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

Self Serve Token Pool Factory Contract #1410

Closed
wants to merge 65 commits into from
Closed
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
e35a529
proof of concept v0 for token pool factory. Untested
jhweintraub Sep 4, 2024
264c483
Merge branch 'ccip-develop' into feature/selfServeFactory
jhweintraub Sep 4, 2024
45c205e
cleanup and solhint fixes
jhweintraub Sep 5, 2024
6b06dc7
Checkpoint a successful deployment workflow
jhweintraub Sep 10, 2024
034990c
Check in. Prediction mechanism working tentatively
jhweintraub Sep 11, 2024
986aeed
tests passing. Cleanup, Comments, and better formatting still needed
jhweintraub Sep 11, 2024
47cae4b
Cleanup and additional comments/natspec
jhweintraub Sep 13, 2024
10c5c66
cleanup shared token files
jhweintraub Sep 13, 2024
4b5719c
Merge branch 'ccip-develop' into feature/selfServeFactory
jhweintraub Sep 13, 2024
b263cd8
Merge branch 'ccip-develop' into feature/selfServeFactory
jhweintraub Sep 13, 2024
f4847a4
snapshot and compilation fix
jhweintraub Sep 13, 2024
05df3b3
update shared snapshot file for burnMintERC20 file
jhweintraub Sep 13, 2024
9e0b93c
linter
jhweintraub Sep 17, 2024
bdccab9
stack cleanup, add Create2, OZ library, comment fixes, etc.
jhweintraub Sep 17, 2024
30eef85
ccip-precommit
jhweintraub Sep 17, 2024
2faa130
add missing vendor files
jhweintraub Sep 17, 2024
9f76e1b
burn mint formatting
jhweintraub Sep 17, 2024
65395df
gas optimizations and formatting cleanup
jhweintraub Sep 18, 2024
58bdf08
Merge branch 'ccip-develop' into feature/selfServeFactory
jhweintraub Sep 18, 2024
1e8cbe2
Merge branch 'ccip-develop' into feature/selfServeFactory
jhweintraub Sep 20, 2024
8308646
snapshot update
jhweintraub Sep 20, 2024
3301bae
Merge branch 'ccip-develop' into feature/selfServeFactory
jhweintraub Sep 23, 2024
ddef2db
quality cleanup
jhweintraub Sep 23, 2024
6dd38d9
linter fix
jhweintraub Sep 23, 2024
f2984cb
Merge branch 'ccip-develop' into feature/selfServeFactory
jhweintraub Sep 23, 2024
edc5c27
revert empty parameter flag to the empty byte string
jhweintraub Sep 24, 2024
9c0d776
Merge branch 'ccip-develop' into feature/selfServeFactory
jhweintraub Sep 24, 2024
2ee8c29
gas snapshot fix
jhweintraub Sep 24, 2024
0f22eb0
refactor BurnMintERC677 to inherit from BurnMintERC20
jhweintraub Sep 25, 2024
706eb0b
linting
jhweintraub Sep 25, 2024
8c5285e
Merge branch 'ccip-develop' into feature/selfServeFactory
jhweintraub Sep 25, 2024
559bfee
fix a weird snapshot issue idek how this happened
jhweintraub Sep 25, 2024
a0982c2
Merge 559bfee2c9a82e1e38437e84de33b0e3820ef8fa into 390ee2334126e313c…
jhweintraub Sep 25, 2024
a997387
Update gethwrappers
app-token-issuer-infra-releng[bot] Sep 25, 2024
729dbb9
snapshotting
jhweintraub Sep 25, 2024
0688f98
formatting
jhweintraub Sep 25, 2024
90ee01d
Revert Changes to shared folders, will be in Chainlink repo
jhweintraub Sep 26, 2024
374b334
Merge 90ee01d2d42b23bc992fc5cd1b861d280761bbdc into 390ee2334126e313c…
jhweintraub Sep 26, 2024
34ac7c6
Update gethwrappers
app-token-issuer-infra-releng[bot] Sep 26, 2024
5c05b9d
remove stateful functions from tokenPoolFactory
jhweintraub Sep 26, 2024
ba1c74c
add support for lock-release pools
jhweintraub Sep 26, 2024
b3dc9c1
add comments and reomve unnec. initArgs parameter
jhweintraub Sep 27, 2024
d69fd9a
Merge branch 'ccip-develop' into feature/selfServeFactory
jhweintraub Sep 30, 2024
e78543b
comment cleanup
jhweintraub Sep 30, 2024
bbabb8d
forge fmt
jhweintraub Sep 30, 2024
bf6d75d
CI cleanup
jhweintraub Oct 4, 2024
ae8a3c0
formatting CI is the bane of my existence
jhweintraub Oct 4, 2024
5fda354
fill in end-to-end coverage gaps
jhweintraub Oct 4, 2024
240b70f
Merge branch 'ccip-develop' into feature/selfServeFactory
jhweintraub Oct 7, 2024
f03c94d
Merge 240b70f3357127d505ef29b25e2edff7afede58c into f77ff217862989836…
jhweintraub Oct 7, 2024
9f28740
Update gethwrappers
app-token-issuer-infra-releng[bot] Oct 7, 2024
e9da1df
rework lock-release pool deployment to be more stringent
jhweintraub Oct 10, 2024
752c290
when you forget to run the formatter before committing
jhweintraub Oct 10, 2024
a929fed
Merge branch 'ccip-develop' into feature/selfServeFactory
jhweintraub Oct 10, 2024
ea77929
gas snapshotting
jhweintraub Oct 10, 2024
7dc40df
remove console log and silence compiler warning
jhweintraub Oct 10, 2024
b1c8c67
another attempt at snapshot fixing
jhweintraub Oct 10, 2024
005861f
Merge branch 'ccip-develop' into feature/selfServeFactory
jhweintraub Oct 15, 2024
9355849
snapshot fix after a merge
jhweintraub Oct 15, 2024
7ce7ea7
fix wrapper changes previously
jhweintraub Oct 15, 2024
a8e6726
pragma fix, formatting, and remove unused files
jhweintraub Oct 15, 2024
0bd89b5
more formatting
jhweintraub Oct 15, 2024
ba9c004
formatting and naming fixes
jhweintraub Oct 22, 2024
b198018
Merge branch 'ccip-develop' into feature/selfServeFactory
jhweintraub Oct 22, 2024
d3ab628
*sighs in snapshotting*
jhweintraub Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions contracts/gas-snapshots/ccip.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,33 @@ 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: 26370)
FactoryBurnMintERC20approve:testApproveSuccess() (gas: 55767)
FactoryBurnMintERC20approve:testInvalidAddressReverts() (gas: 10709)
FactoryBurnMintERC20burn:testBasicBurnSuccess() (gas: 172380)
FactoryBurnMintERC20burn:testBurnFromZeroAddressReverts() (gas: 47384)
FactoryBurnMintERC20burn:testExceedsBalanceReverts() (gas: 21962)
FactoryBurnMintERC20burn:testSenderNotBurnerReverts() (gas: 13491)
FactoryBurnMintERC20burnFrom:testBurnFromSuccess() (gas: 58212)
FactoryBurnMintERC20burnFrom:testExceedsBalanceReverts() (gas: 36130)
FactoryBurnMintERC20burnFrom:testInsufficientAllowanceReverts() (gas: 22054)
FactoryBurnMintERC20burnFrom:testSenderNotBurnerReverts() (gas: 13491)
FactoryBurnMintERC20burnFromAlias:testBurnFromSuccess() (gas: 58187)
FactoryBurnMintERC20burnFromAlias:testExceedsBalanceReverts() (gas: 36094)
FactoryBurnMintERC20burnFromAlias:testInsufficientAllowanceReverts() (gas: 22009)
FactoryBurnMintERC20burnFromAlias:testSenderNotBurnerReverts() (gas: 13446)
FactoryBurnMintERC20constructor:testConstructorSuccess() (gas: 1501073)
FactoryBurnMintERC20decreaseApproval:testDecreaseApprovalSuccess() (gas: 31323)
FactoryBurnMintERC20grantMintAndBurnRoles:testGrantMintAndBurnRolesSuccess() (gas: 121439)
FactoryBurnMintERC20grantRole:testGrantBurnAccessSuccess() (gas: 53612)
FactoryBurnMintERC20grantRole:testGrantManySuccess() (gas: 963184)
FactoryBurnMintERC20grantRole:testGrantMintAccessSuccess() (gas: 94434)
FactoryBurnMintERC20increaseApproval:testIncreaseApprovalSuccess() (gas: 44368)
FactoryBurnMintERC20mint:testBasicMintSuccess() (gas: 149987)
FactoryBurnMintERC20mint:testMaxSupplyExceededReverts() (gas: 50703)
FactoryBurnMintERC20mint:testSenderNotMinterReverts() (gas: 11328)
FactoryBurnMintERC20supportsInterface:testConstructorSuccess() (gas: 11396)
FactoryBurnMintERC20transfer:testInvalidAddressReverts() (gas: 10707)
FactoryBurnMintERC20transfer:testTransferSuccess() (gas: 42427)
FeeQuoter_applyDestChainConfigUpdates:test_InvalidChainFamilySelector_Revert() (gas: 16878)
FeeQuoter_applyDestChainConfigUpdates:test_InvalidDestChainConfigDestChainSelectorEqZero_Revert() (gas: 16780)
FeeQuoter_applyDestChainConfigUpdates:test_applyDestChainConfigUpdatesDefaultTxGasLimitEqZero_Revert() (gas: 16822)
Expand Down Expand Up @@ -988,6 +1015,12 @@ TokenPoolAndProxy:test_lockOrBurn_lockRelease_Success() (gas: 5793246)
TokenPoolAndProxy:test_setPreviousPool_Success() (gas: 3070731)
TokenPoolAndProxyMigration:test_tokenPoolMigration_Success_1_2() (gas: 6440241)
TokenPoolAndProxyMigration:test_tokenPoolMigration_Success_1_4() (gas: 6640374)
TokenPoolFactoryTests:test_TokenPoolFactory_Constructor_Revert() (gas: 1048467)
TokenPoolFactoryTests:test_createTokenPoolLockRelease_ExistingToken_predict_Success() (gas: 11782116)
TokenPoolFactoryTests:test_createTokenPool_ExistingRemoteToken_AndPredictPool_Success() (gas: 12424135)
TokenPoolFactoryTests:test_createTokenPool_WithNoExistingRemoteContracts_predict_Success() (gas: 12765436)
TokenPoolFactoryTests:test_createTokenPool_WithNoExistingTokenOnRemoteChain_Success() (gas: 5841482)
TokenPoolFactoryTests:test_createTokenPool_WithRemoteTokenAndRemotePool_Success() (gas: 5981654)
TokenPoolWithAllowList_applyAllowListUpdates:test_AllowListNotEnabled_Revert() (gas: 1979943)
TokenPoolWithAllowList_applyAllowListUpdates:test_OnlyOwner_Revert() (gas: 12113)
TokenPoolWithAllowList_applyAllowListUpdates:test_SetAllowListSkipsZero_Success() (gas: 23476)
Expand Down
8 changes: 4 additions & 4 deletions contracts/gas-snapshots/operatorforwarder.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ FactoryTest:test_DeployNewForwarderAndTransferOwnership_Success() (gas: 1059722)
FactoryTest:test_DeployNewForwarder_Success() (gas: 1048209)
FactoryTest:test_DeployNewOperatorAndForwarder_Success() (gas: 4069305)
FactoryTest:test_DeployNewOperator_Success() (gas: 3020464)
ForwarderTest:test_Forward_Success(uint256) (runs: 257, μ: 226979, ~: 227289)
ForwarderTest:test_MultiForward_Success(uint256,uint256) (runs: 257, μ: 258577, ~: 259120)
ForwarderTest:test_Forward_Success(uint256) (runs: 256, μ: 226978, ~: 227289)
ForwarderTest:test_MultiForward_Success(uint256,uint256) (runs: 256, μ: 258575, ~: 259120)
ForwarderTest:test_OwnerForward_Success() (gas: 30118)
ForwarderTest:test_SetAuthorizedSenders_Success() (gas: 160524)
ForwarderTest:test_TransferOwnershipWithMessage_Success() (gas: 35123)
OperatorTest:test_CancelOracleRequest_Success() (gas: 274436)
OperatorTest:test_FulfillOracleRequest_Success() (gas: 330603)
OperatorTest:test_NotAuthorizedSender_Revert() (gas: 246716)
OperatorTest:test_OracleRequest_Success() (gas: 250019)
OperatorTest:test_SendRequestAndCancelRequest_Success(uint96) (runs: 257, μ: 387121, ~: 387124)
OperatorTest:test_SendRequest_Success(uint96) (runs: 257, μ: 303612, ~: 303615)
OperatorTest:test_SendRequestAndCancelRequest_Success(uint96) (runs: 256, μ: 387121, ~: 387124)
OperatorTest:test_SendRequest_Success(uint96) (runs: 256, μ: 303612, ~: 303615)
5 changes: 3 additions & 2 deletions contracts/src/v0.8/ccip/FeeQuoter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,8 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver,
uint64 destChainSelector = destChainConfigArgs[i].destChainSelector;
DestChainConfig memory destChainConfig = destChainConfigArg.destChainConfig;

// NOTE: when supporting non-EVM chains, update chainFamilySelector validations
// Do not allow chain selector of zero or an invalid default gas limit.
// Note: Only EVM chains are supported at the moment, and more validation may be needed for other chain types.
if (
destChainSelector == 0 || destChainConfig.defaultTxGasLimit == 0
|| destChainConfig.chainFamilySelector != Internal.CHAIN_FAMILY_SELECTOR_EVM
Expand All @@ -993,7 +994,7 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver,
revert InvalidDestChainConfig(destChainSelector);
}

// The chain family selector cannot be zero - indicates that it is a new chain
// Chain family selector of zero indicates that the chain has not been added yet, so emit different event
if (s_destChainConfigs[destChainSelector].chainFamilySelector == 0) {
emit DestChainAdded(destChainSelector, destChainConfig);
} else {
Expand Down
18 changes: 18 additions & 0 deletions contracts/src/v0.8/ccip/interfaces/ITokenAdminRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,22 @@ 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