diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml new file mode 100644 index 000000000..083b1ee73 --- /dev/null +++ b/.github/workflows/canary.yml @@ -0,0 +1,61 @@ +name: Canary Release + +on: [push] + +jobs: + export: + name: Generate Interfaces And Contracts + + runs-on: ubuntu-latest + strategy: + matrix: + export_type: ['all'] + + env: + PROJECT_NAME: '@allo-protocol/allo-v2.1' + EXPORT_NAME: ${{ matrix.export_type == 'interfaces' && '-interfaces' || '' }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: "recursive" + fetch-depth: 1 + + - name: Setup bun env + uses: oven-sh/setup-bun@v2 + + - name: Install dependencies + run: bun install + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Run Smock + run: bun smock + id: smock + + - name: Build project and generate out directory + run: forge build + + - name: Export Solidity - Export Type ${{ matrix.export_type }} + uses: defi-wonderland/solidity-exporter-action@c39954b18f1105333bcd232ff527fe1b114f4d1d + with: + package_name: ${{ env.PROJECT_NAME }} + out: 'out' + contracts: 'contracts' + export_type: '${{ matrix.export_type }}' + + - name: Update version + run: cd export/${{ env.PROJECT_NAME }}${{ env.EXPORT_NAME }} && yarn version --new-version "0.0.0-${GITHUB_SHA::8}" --no-git-tag-version + + - name: Configure npm for Publishing + run: | + echo "registry=https://registry.npmjs.org/" > ~/.npmrc + echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc + - name: Publish to NPM - Export Type ${{ matrix.export_type }} + run: cd export/${{ env.PROJECT_NAME }}${{ env.EXPORT_NAME }} && npm publish --access public --tag canary + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/contracts/strategies/examples/direct-allocation/DirectAllocation.sol b/contracts/strategies/examples/direct-allocation/DirectAllocation.sol index 924bbb5a5..3ac016f65 100644 --- a/contracts/strategies/examples/direct-allocation/DirectAllocation.sol +++ b/contracts/strategies/examples/direct-allocation/DirectAllocation.sol @@ -8,10 +8,10 @@ import {BaseStrategy} from "strategies/BaseStrategy.sol"; import {Errors} from "contracts/core/libraries/Errors.sol"; import {Transfer} from "contracts/core/libraries/Transfer.sol"; -/// @title DirectAllocationStrategy +/// @title DirectAllocation /// @dev The strategy only implements the allocate logic /// @notice A strategy that directly allocates funds to a recipient -contract DirectAllocationStrategy is BaseStrategy, Errors { +contract DirectAllocation is BaseStrategy, Errors { using Transfer for address; /// =============================== diff --git a/script/strategies/DeployDirectAllocation.sol b/script/strategies/DeployDirectAllocation.sol index bce0c41a2..9a5ba1938 100644 --- a/script/strategies/DeployDirectAllocation.sol +++ b/script/strategies/DeployDirectAllocation.sol @@ -2,13 +2,13 @@ pragma solidity ^0.8.19; import {DeployBase} from "script/DeployBase.sol"; -import {DirectAllocationStrategy} from "contracts/strategies/examples/direct-allocation/DirectAllocation.sol"; +import {DirectAllocation} from "contracts/strategies/examples/direct-allocation/DirectAllocation.sol"; contract DeployDirectAllocation is DeployBase { function _deploy() internal override returns (address _contract, string memory _contractName) { address _allo = vm.envAddress("ALLO_ADDRESS"); - _contract = address(new DirectAllocationStrategy(_allo)); - _contractName = "DirectAllocationStrategy"; + _contract = address(new DirectAllocation(_allo)); + _contractName = "DirectAllocation"; } } diff --git a/test/integration/DirectAllocation.t.sol b/test/integration/DirectAllocation.t.sol index 7f0c676f1..e30d4ae6d 100644 --- a/test/integration/DirectAllocation.t.sol +++ b/test/integration/DirectAllocation.t.sol @@ -4,13 +4,13 @@ pragma solidity ^0.8.19; import {IAllo} from "contracts/core/interfaces/IAllo.sol"; import {Metadata} from "contracts/core/Registry.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import {DirectAllocationStrategy} from "strategies/examples/direct-allocation/DirectAllocation.sol"; +import {DirectAllocation} from "strategies/examples/direct-allocation/DirectAllocation.sol"; import {IntegrationBase} from "./IntegrationBase.sol"; import {Errors} from "contracts/core/libraries/Errors.sol"; contract IntegrationDirectAllocationStrategy is IntegrationBase { IAllo public allo; - DirectAllocationStrategy public strategy; + DirectAllocation public strategy; uint256 public poolId; @@ -19,7 +19,7 @@ contract IntegrationDirectAllocationStrategy is IntegrationBase { allo = IAllo(ALLO_PROXY); - strategy = new DirectAllocationStrategy(address(allo)); + strategy = new DirectAllocation(address(allo)); // Deal deal(DAI, userAddr, 100000 ether); diff --git a/test/invariant/fuzz/Setup.t.sol b/test/invariant/fuzz/Setup.t.sol index 8f042b142..cb6c96217 100644 --- a/test/invariant/fuzz/Setup.t.sol +++ b/test/invariant/fuzz/Setup.t.sol @@ -7,7 +7,7 @@ import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transpa import {Allo, IAllo, Metadata} from "contracts/core/Allo.sol"; import {Registry, Anchor} from "contracts/core/Anchor.sol"; import {IRegistry} from "contracts/core/interfaces/IRegistry.sol"; -import {DirectAllocationStrategy} from "contracts/strategies/examples/direct-allocation/DirectAllocation.sol"; +import {DirectAllocation} from "contracts/strategies/examples/direct-allocation/DirectAllocation.sol"; import {Actors} from "./helpers/Actors.t.sol"; import {Utils} from "./helpers/Utils.t.sol"; @@ -27,7 +27,7 @@ contract Setup is Actors { Allo allo; Registry registry; - DirectAllocationStrategy strategy_directAllocation; + DirectAllocation strategy_directAllocation; ERC20 token; @@ -66,7 +66,7 @@ contract Setup is Actors { ); // Deploy base strategy - strategy_directAllocation = new DirectAllocationStrategy(address(allo)); + strategy_directAllocation = new DirectAllocation(address(allo)); // Deploy token token = ERC20(address(new FuzzERC20())); diff --git a/test/unit/core/RegistryUnit.t.sol b/test/unit/core/RegistryUnit.t.sol index 5756d8c10..d7b7fcee9 100644 --- a/test/unit/core/RegistryUnit.t.sol +++ b/test/unit/core/RegistryUnit.t.sol @@ -14,6 +14,7 @@ contract RegistryUnit is Test { using stdStorage for StdStorage; MockMockRegistry public registry; + address public constant NATIVE = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; event ProfileCreated( bytes32 indexed profileId, uint256 nonce, string name, Metadata metadata, address owner, address anchor @@ -402,6 +403,8 @@ contract RegistryUnit is Test { { vm.assume(_recipient != address(0)); vm.assume(_token != address(vm)); + vm.assume(_token != NATIVE); + assumeNotPrecompile(_token); vm.mockCall(_token, abi.encodeWithSignature("balanceOf(address)", address(registry)), abi.encode(_amount)); vm.mockCall(_token, abi.encodeWithSignature("transfer(address,uint256)", _recipient, _amount), abi.encode(true)); diff --git a/test/unit/strategies/DirectAllocation.t.sol b/test/unit/strategies/DirectAllocation.t.sol index 6a6d7fbdb..732df7155 100644 --- a/test/unit/strategies/DirectAllocation.t.sol +++ b/test/unit/strategies/DirectAllocation.t.sol @@ -2,14 +2,14 @@ pragma solidity ^0.8.19; import {Test} from "forge-std/Test.sol"; -import {DirectAllocationStrategy} from "strategies/examples/direct-allocation/DirectAllocation.sol"; +import {DirectAllocation} from "strategies/examples/direct-allocation/DirectAllocation.sol"; import {Errors} from "contracts/core/libraries/Errors.sol"; contract DirectAllocationTest is Test { event Initialized(uint256 poolId, bytes data); event DirectAllocated(address indexed recipient, uint256 amount, address token, address sender); - DirectAllocationStrategy directAllocationStrategy; + DirectAllocation directAllocationStrategy; address mockAlloAddress; @@ -17,7 +17,7 @@ contract DirectAllocationTest is Test { /// create a mock allo address mockAlloAddress = makeAddr("allo"); /// create the direct allocation strategy - directAllocationStrategy = new DirectAllocationStrategy(mockAlloAddress); + directAllocationStrategy = new DirectAllocation(mockAlloAddress); } function test_InitializeWhenCalled(uint256 _poolId) external {