Skip to content

Commit

Permalink
Add 1.5.1 pools (#1551)
Browse files Browse the repository at this point in the history
Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
  • Loading branch information
1 parent ca9a0f7 commit bca2fe0
Show file tree
Hide file tree
Showing 117 changed files with 7,555 additions and 5,139 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/solidity-foundry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
{ "name": "functions", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": true, "run-forge-fmt": false }},
{ "name": "keystone", "setup": { "run-coverage": true, "min-coverage": 72.8, "run-gas-snapshot": false, "run-forge-fmt": false }},
{ "name": "l2ep", "setup": { "run-coverage": true, "min-coverage": 61.0, "run-gas-snapshot": true, "run-forge-fmt": false }},
{ "name": "liquiditymanager", "setup": { "run-coverage": true, "min-coverage": 46.3, "run-gas-snapshot": true, "run-forge-fmt": false }},
{ "name": "liquiditymanager", "setup": { "run-coverage": true, "min-coverage": 44.3, "run-gas-snapshot": true, "run-forge-fmt": false }},
{ "name": "llo-feeds", "setup": { "run-coverage": true, "min-coverage": 49.3, "run-gas-snapshot": true, "run-forge-fmt": false }},
{ "name": "operatorforwarder", "setup": { "run-coverage": true, "min-coverage": 55.7, "run-gas-snapshot": true, "run-forge-fmt": false }},
{ "name": "shared", "setup": { "run-coverage": true, "extra-coverage-params": "--no-match-path='*CallWithExactGas*'", "min-coverage": 32.6, "run-gas-snapshot": true, "run-forge-fmt": false }},
Expand Down
620 changes: 317 additions & 303 deletions contracts/gas-snapshots/ccip.gas-snapshot

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions contracts/gas-snapshots/liquiditymanager.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ LiquidityManager_addLiquidity:test_addLiquiditySuccess() (gas: 279154)
LiquidityManager_rebalanceLiquidity:test_InsufficientLiquidityReverts() (gas: 206745)
LiquidityManager_rebalanceLiquidity:test_InvalidRemoteChainReverts() (gas: 192319)
LiquidityManager_rebalanceLiquidity:test_rebalanceBetweenPoolsSuccess() (gas: 9141768)
LiquidityManager_rebalanceLiquidity:test_rebalanceBetweenPoolsSuccess_AlreadyFinalized() (gas: 8960797)
LiquidityManager_rebalanceLiquidity:test_rebalanceBetweenPools_MultiStageFinalization() (gas: 8956003)
LiquidityManager_rebalanceLiquidity:test_rebalanceBetweenPools_NativeRewrap() (gas: 8883801)
LiquidityManager_rebalanceLiquidity:test_rebalanceLiquiditySuccess() (gas: 382897)
LiquidityManager_rebalanceLiquidity:test_rebalanceBetweenPoolsSuccess_AlreadyFinalized() (gas: 9306597)
LiquidityManager_rebalanceLiquidity:test_rebalanceBetweenPools_MultiStageFinalization() (gas: 9301803)
LiquidityManager_rebalanceLiquidity:test_rebalanceBetweenPools_NativeRewrap() (gas: 9231693)
LiquidityManager_rebalanceLiquidity:test_rebalanceLiquiditySuccess() (gas: 382880)
LiquidityManager_receive:test_receive_success() (gas: 21182)
LiquidityManager_removeLiquidity:test_InsufficientLiquidityReverts() (gas: 184869)
LiquidityManager_removeLiquidity:test_OnlyFinanceRoleReverts() (gas: 10872)
LiquidityManager_removeLiquidity:test_removeLiquiditySuccess() (gas: 236342)
LiquidityManager_removeLiquidity:test_removeLiquiditySuccess() (gas: 236324)
LiquidityManager_setCrossChainRebalancer:test_OnlyOwnerReverts() (gas: 17005)
LiquidityManager_setCrossChainRebalancer:test_ZeroAddressReverts() (gas: 21624)
LiquidityManager_setCrossChainRebalancer:test_ZeroChainSelectorReverts() (gas: 13099)
Expand All @@ -19,7 +19,7 @@ LiquidityManager_setFinanceRole:test_OnlyOwnerReverts() (gas: 10987)
LiquidityManager_setFinanceRole:test_setFinanceRoleSuccess() (gas: 21836)
LiquidityManager_setLocalLiquidityContainer:test_OnlyOwnerReverts() (gas: 11052)
LiquidityManager_setLocalLiquidityContainer:test_ReverstWhen_CalledWithTheZeroAddress() (gas: 10643)
LiquidityManager_setLocalLiquidityContainer:test_setLocalLiquidityContainerSuccess() (gas: 3498806)
LiquidityManager_setLocalLiquidityContainer:test_setLocalLiquidityContainerSuccess() (gas: 3847225)
LiquidityManager_setMinimumLiquidity:test_OnlyOwnerReverts() (gas: 10925)
LiquidityManager_setMinimumLiquidity:test_setMinimumLiquiditySuccess() (gas: 36389)
LiquidityManager_withdrawERC20:test_withdrawERC20Reverts() (gas: 180359)
Expand Down
25 changes: 25 additions & 0 deletions contracts/gas-snapshots/shared.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,31 @@ AuthorizedCallers_applyAuthorizedCallerUpdates:test_SkipRemove_Success() (gas: 3
AuthorizedCallers_applyAuthorizedCallerUpdates:test_ZeroAddressNotAllowed_Revert() (gas: 64661)
AuthorizedCallers_constructor:test_ZeroAddressNotAllowed_Revert() (gas: 64661)
AuthorizedCallers_constructor:test_constructor_Success() (gas: 693193)
BurnMintERC20_approve:test_approve() (gas: 57609)
BurnMintERC20_approve:test_approve_RevertWhen_InvalidAddress() (gas: 11289)
BurnMintERC20_burn:test_BasicBurn() (gas: 153528)
BurnMintERC20_burn:test_burn_RevertWhen_BurnFromZeroAddress() (gas: 43800)
BurnMintERC20_burn:test_burn_RevertWhen_ExceedsBalance() (gas: 21868)
BurnMintERC20_burn:test_burn_RevertWhen_SenderNotBurner() (gas: 67663)
BurnMintERC20_burnFrom:test_BurnFrom() (gas: 57929)
BurnMintERC20_burnFrom:test_burnFrom_RevertWhen_ExceedsBalance() (gas: 35838)
BurnMintERC20_burnFrom:test_burnFrom_RevertWhen_InsufficientAllowance() (gas: 21834)
BurnMintERC20_burnFrom:test_burnFrom_RevertWhen_SenderNotBurner() (gas: 67662)
BurnMintERC20_burnFromAlias:test_burn() (gas: 57973)
BurnMintERC20_burnFromAlias:test_burn_RevertWhen_ExceedsBalance() (gas: 35880)
BurnMintERC20_burnFromAlias:test_burn_RevertWhen_InsufficientAllowance() (gas: 21897)
BurnMintERC20_burnFromAlias:test_burn_RevertWhen_SenderNotBurner() (gas: 67650)
BurnMintERC20_constructor:test_Constructor() (gas: 1680059)
BurnMintERC20_getCCIPAdmin:test_getCCIPAdmin() (gas: 10544)
BurnMintERC20_getCCIPAdmin:test_setCCIPAdmin() (gas: 21562)
BurnMintERC20_grantMintAndBurnRoles:test_GrantMintAndBurnRoles() (gas: 79089)
BurnMintERC20_mint:test_mint() (gas: 101815)
BurnMintERC20_mint:test_mint_RevertWhen_InvalidRecipient() (gas: 66372)
BurnMintERC20_mint:test_mint_RevertWhen_MaxSupplyExceeded() (gas: 50365)
BurnMintERC20_mint:test_mint_RevertWhen_SenderNotMinter() (gas: 65827)
BurnMintERC20_supportsInterface:test_SupportsInterface() (gas: 11202)
BurnMintERC20_transfer:test_transfer() (gas: 42318)
BurnMintERC20_transfer:test_transfer_RevertWhen_InvalidAddress() (gas: 11287)
BurnMintERC677_approve:testApproveSuccess() (gas: 55477)
BurnMintERC677_approve:testInvalidAddressReverts() (gas: 10653)
BurnMintERC677_burn:testBasicBurnSuccess() (gas: 172022)
Expand Down
4 changes: 0 additions & 4 deletions contracts/scripts/native_solc_compile_all_ccip
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ compileContract ccip/pools/LockReleaseTokenPool.sol
compileContract ccip/pools/BurnMintTokenPool.sol
compileContract ccip/pools/BurnFromMintTokenPool.sol
compileContract ccip/pools/BurnWithFromMintTokenPool.sol
compileContract ccip/pools/LockReleaseTokenPoolAndProxy.sol
compileContract ccip/pools/BurnMintTokenPoolAndProxy.sol
compileContract ccip/pools/BurnWithFromMintTokenPoolAndProxy.sol
compileContract ccip/pools/BurnWithFromMintRebasingTokenPool.sol
compileContract ccip/pools/TokenPool.sol


Expand Down
5 changes: 3 additions & 2 deletions contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/tok
contract BurnFromMintTokenPool is BurnMintTokenPoolAbstract, ITypeAndVersion {
using SafeERC20 for IBurnMintERC20;

string public constant override typeAndVersion = "BurnFromMintTokenPool 1.5.0";
string public constant override typeAndVersion = "BurnFromMintTokenPool 1.5.1";

constructor(
IBurnMintERC20 token,
uint8 localTokenDecimals,
address[] memory allowlist,
address rmnProxy,
address router
) TokenPool(token, allowlist, rmnProxy, router) {
) TokenPool(token, localTokenDecimals, allowlist, rmnProxy, router) {
// Some tokens allow burning from the sender without approval, but not all do.
// To be safe, we approve the pool to burn from the pool.
token.safeIncreaseAllowance(address(this), type(uint256).max);
Expand Down
5 changes: 3 additions & 2 deletions contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ import {TokenPool} from "./TokenPool.sol";
/// If that is expected, please make sure the token's burner/minter roles are adjustable.
/// @dev This contract is a variant of BurnMintTokenPool that uses `burn(amount)`.
contract BurnMintTokenPool is BurnMintTokenPoolAbstract, ITypeAndVersion {
string public constant override typeAndVersion = "BurnMintTokenPool 1.5.0";
string public constant override typeAndVersion = "BurnMintTokenPool 1.5.1";

constructor(
IBurnMintERC20 token,
uint8 localTokenDecimals,
address[] memory allowlist,
address rmnProxy,
address router
) TokenPool(token, allowlist, rmnProxy, router) {}
) TokenPool(token, localTokenDecimals, allowlist, rmnProxy, router) {}

/// @inheritdoc BurnMintTokenPoolAbstract
function _burn(
Expand Down
15 changes: 11 additions & 4 deletions contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAbstract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ abstract contract BurnMintTokenPoolAbstract is TokenPool {

emit Burned(msg.sender, lockOrBurnIn.amount);

return Pool.LockOrBurnOutV1({destTokenAddress: getRemoteToken(lockOrBurnIn.remoteChainSelector), destPoolData: ""});
return Pool.LockOrBurnOutV1({
destTokenAddress: getRemoteToken(lockOrBurnIn.remoteChainSelector),
destPoolData: _encodeLocalDecimals()
});
}

/// @notice Mint tokens from the pool to the recipient
Expand All @@ -35,11 +38,15 @@ abstract contract BurnMintTokenPoolAbstract is TokenPool {
) external virtual override returns (Pool.ReleaseOrMintOutV1 memory) {
_validateReleaseOrMint(releaseOrMintIn);

// Calculate the local amount
uint256 localAmount =
_calculateLocalAmount(releaseOrMintIn.amount, _parseRemoteDecimals(releaseOrMintIn.sourcePoolData));

// Mint to the receiver
IBurnMintERC20(address(i_token)).mint(releaseOrMintIn.receiver, releaseOrMintIn.amount);
IBurnMintERC20(address(i_token)).mint(releaseOrMintIn.receiver, localAmount);

emit Minted(msg.sender, releaseOrMintIn.receiver, releaseOrMintIn.amount);
emit Minted(msg.sender, releaseOrMintIn.receiver, localAmount);

return Pool.ReleaseOrMintOutV1({destinationAmount: releaseOrMintIn.amount});
return Pool.ReleaseOrMintOutV1({destinationAmount: localAmount});
}
}
55 changes: 0 additions & 55 deletions contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAndProxy.sol

This file was deleted.

This file was deleted.

5 changes: 3 additions & 2 deletions contracts/src/v0.8/ccip/pools/BurnWithFromMintTokenPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ contract BurnWithFromMintTokenPool is BurnMintTokenPoolAbstract, ITypeAndVersion

constructor(
IBurnMintERC20 token,
uint8 localTokenDecimals,
address[] memory allowlist,
address rmnProxy,
address router
) TokenPool(token, allowlist, rmnProxy, router) {
) TokenPool(token, localTokenDecimals, allowlist, rmnProxy, router) {
// Some tokens allow burning from the sender without approval, but not all do.
// To be safe, we approve the pool to burn from the pool.
token.safeIncreaseAllowance(address(this), type(uint256).max);
Expand All @@ -37,6 +38,6 @@ contract BurnWithFromMintTokenPool is BurnMintTokenPoolAbstract, ITypeAndVersion
}

function typeAndVersion() external pure virtual override returns (string memory) {
return "BurnWithFromMintTokenPool 1.5.0";
return "BurnWithFromMintTokenPool 1.5.1";
}
}

This file was deleted.

Loading

0 comments on commit bca2fe0

Please sign in to comment.