Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCIP-3171 SelfServeTokenPoolFactory #14924

Merged
merged 10 commits into from
Oct 25, 2024
11 changes: 11 additions & 0 deletions contracts/.changeset/dry-seas-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@chainlink/contracts': minor
---

New contract for deploying, CCIP-compatible token pools and configuring with the tokenAdminRegistry, and a new ERC20 with constructor compatible with the factory's deployment pattern. #internal



PR issue: CCIP-3171

Solidity Review issue: CCIP-3966
36 changes: 36 additions & 0 deletions contracts/gas-snapshots/ccip.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,35 @@ EtherSenderReceiverTest_validatedMessage:test_validatedMessage_emptyDataOverwrit
EtherSenderReceiverTest_validatedMessage:test_validatedMessage_invalidTokenAmounts() (gas: 17925)
EtherSenderReceiverTest_validatedMessage:test_validatedMessage_tokenOverwrittenToWeth() (gas: 25329)
EtherSenderReceiverTest_validatedMessage:test_validatedMessage_validMessage_extraArgs() (gas: 26348)
FactoryBurnMintERC20approve:test_Approve_Success() (gas: 55766)
FactoryBurnMintERC20approve:test_InvalidAddress_Reverts() (gas: 10703)
FactoryBurnMintERC20burn:test_BasicBurn_Success() (gas: 172367)
FactoryBurnMintERC20burn:test_BurnFromZeroAddress_Reverts() (gas: 47272)
FactoryBurnMintERC20burn:test_ExceedsBalance_Reverts() (gas: 21939)
FactoryBurnMintERC20burn:test_SenderNotBurner_Reverts() (gas: 13487)
FactoryBurnMintERC20burnFrom:test_BurnFrom_Success() (gas: 58221)
FactoryBurnMintERC20burnFrom:test_ExceedsBalance_Reverts() (gas: 36138)
FactoryBurnMintERC20burnFrom:test_InsufficientAllowance_Reverts() (gas: 22025)
FactoryBurnMintERC20burnFrom:test_SenderNotBurner_Reverts() (gas: 13454)
FactoryBurnMintERC20burnFromAlias:test_BurnFrom_Success() (gas: 58196)
FactoryBurnMintERC20burnFromAlias:test_ExceedsBalance_Reverts() (gas: 36102)
FactoryBurnMintERC20burnFromAlias:test_InsufficientAllowance_Reverts() (gas: 21980)
FactoryBurnMintERC20burnFromAlias:test_SenderNotBurner_Reverts() (gas: 13409)
FactoryBurnMintERC20constructor:test_Constructor_Success() (gas: 1503941)
FactoryBurnMintERC20decreaseApproval:test_DecreaseApproval_Success() (gas: 31331)
FactoryBurnMintERC20getCCIPAdmin:test_getCCIPAdmin_Success() (gas: 12684)
FactoryBurnMintERC20getCCIPAdmin:test_setCCIPAdmin_Success() (gas: 23757)
FactoryBurnMintERC20grantMintAndBurnRoles:test_GrantMintAndBurnRoles_Success() (gas: 121062)
FactoryBurnMintERC20grantRole:test_GrantBurnAccess_Success() (gas: 53324)
FactoryBurnMintERC20grantRole:test_GrantMany_Success() (gas: 961398)
FactoryBurnMintERC20grantRole:test_GrantMintAccess_Success() (gas: 94068)
FactoryBurnMintERC20increaseApproval:test_IncreaseApproval_Success() (gas: 44311)
FactoryBurnMintERC20mint:test_BasicMint_Success() (gas: 149771)
FactoryBurnMintERC20mint:test_MaxSupplyExceeded_Reverts() (gas: 50659)
FactoryBurnMintERC20mint:test_SenderNotMinter_Reverts() (gas: 11372)
FactoryBurnMintERC20supportsInterface:test_SupportsInterface_Success() (gas: 11439)
FactoryBurnMintERC20transfer:test_InvalidAddress_Reverts() (gas: 10701)
FactoryBurnMintERC20transfer:test_Transfer_Success() (gas: 42449)
FeeQuoter_applyDestChainConfigUpdates:test_InvalidChainFamilySelector_Revert() (gas: 16856)
FeeQuoter_applyDestChainConfigUpdates:test_InvalidDestChainConfigDestChainSelectorEqZero_Revert() (gas: 16736)
FeeQuoter_applyDestChainConfigUpdates:test_applyDestChainConfigUpdatesDefaultTxGasLimitEqZero_Revert() (gas: 16778)
Expand Down Expand Up @@ -659,6 +688,13 @@ TokenAdminRegistry_setPool:test_setPool_Success() (gas: 36135)
TokenAdminRegistry_setPool:test_setPool_ZeroAddressRemovesPool_Success() (gas: 30842)
TokenAdminRegistry_transferAdminRole:test_transferAdminRole_OnlyAdministrator_Revert() (gas: 18103)
TokenAdminRegistry_transferAdminRole:test_transferAdminRole_Success() (gas: 49460)
TokenPoolFactoryTests:test_TokenPoolFactory_Constructor_Revert() (gas: 1048490)
TokenPoolFactoryTests:test_createTokenPoolLockRelease_ExistingToken_predict_Success() (gas: 11789992)
TokenPoolFactoryTests:test_createTokenPool_BurnFromMintTokenPool_Success() (gas: 5990027)
TokenPoolFactoryTests:test_createTokenPool_ExistingRemoteToken_AndPredictPool_Success() (gas: 12432090)
TokenPoolFactoryTests:test_createTokenPool_WithNoExistingRemoteContracts_predict_Success() (gas: 12773572)
TokenPoolFactoryTests:test_createTokenPool_WithNoExistingTokenOnRemoteChain_Success() (gas: 5846507)
TokenPoolFactoryTests:test_createTokenPool_WithRemoteTokenAndRemotePool_Success() (gas: 5986543)
TokenPoolWithAllowList_applyAllowListUpdates:test_AllowListNotEnabled_Revert() (gas: 1979946)
TokenPoolWithAllowList_applyAllowListUpdates:test_OnlyOwner_Revert() (gas: 12107)
TokenPoolWithAllowList_applyAllowListUpdates:test_SetAllowListSkipsZero_Success() (gas: 23476)
Expand Down
20 changes: 20 additions & 0 deletions contracts/src/v0.8/ccip/interfaces/ITokenAdminRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,24 @@ interface ITokenAdminRegistry {
/// @param localToken The token to register the administrator for.
/// @param administrator The administrator to register.
function proposeAdministrator(address localToken, address administrator) external;

/// @notice Accepts the administrator role for a token.
/// @param localToken The token to accept the administrator role for.
/// @dev This function can only be called by the pending administrator.
function acceptAdminRole(
address localToken
) external;

/// @notice Sets the pool for a token. Setting the pool to address(0) effectively delists the token
/// from CCIP. Setting the pool to any other address enables the token on CCIP.
/// @param localToken The token to set the pool for.
/// @param pool The pool to set for the token.
function setPool(address localToken, address pool) external;

/// @notice Transfers the administrator role for a token to a new address with a 2-step process.
/// @param localToken The token to transfer the administrator role for.
/// @param newAdmin The address to transfer the administrator role to. Can be address(0) to cancel
/// a pending transfer.
/// @dev The new admin must call `acceptAdminRole` to accept the role.
function transferAdminRole(address localToken, address newAdmin) external;
}
Loading
Loading