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

Open
wants to merge 45 commits into
base: ccip-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
45 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
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
258 changes: 132 additions & 126 deletions contracts/gas-snapshots/ccip.gas-snapshot

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions contracts/gas-snapshots/operatorforwarder.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ 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_OwnerForward_Success() (gas: 30118)
ForwarderTest:test_OwnerForward_Success() (gas: 30096)
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_CancelOracleRequest_Success() (gas: 274295)
OperatorTest:test_FulfillOracleRequest_Success() (gas: 330480)
OperatorTest:test_NotAuthorizedSender_Revert() (gas: 246628)
OperatorTest:test_OracleRequest_Success() (gas: 249843)
OperatorTest:test_SendRequestAndCancelRequest_Success(uint96) (runs: 257, μ: 386787, ~: 386790)
OperatorTest:test_SendRequest_Success(uint96) (runs: 257, μ: 303436, ~: 303439)
81 changes: 54 additions & 27 deletions contracts/gas-snapshots/shared.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,69 @@ AuthorizedCallers_applyAuthorizedCallerUpdates:test_SkipRemove_Success() (gas: 3
AuthorizedCallers_applyAuthorizedCallerUpdates:test_ZeroAddressNotAllowed_Revert() (gas: 64473)
AuthorizedCallers_constructor:test_ZeroAddressNotAllowed_Revert() (gas: 64473)
AuthorizedCallers_constructor:test_constructor_Success() (gas: 720513)
BurnMintERC677_approve:testApproveSuccess() (gas: 55512)
BurnMintERC20_approve:testApproveSuccess() (gas: 55477)
jhweintraub marked this conversation as resolved.
Show resolved Hide resolved
BurnMintERC20_approve:testInvalidAddressReverts() (gas: 10663)
BurnMintERC20_burn:testBasicBurnSuccess() (gas: 173886)
BurnMintERC20_burn:testBurnFromZeroAddressReverts() (gas: 47201)
BurnMintERC20_burn:testExceedsBalanceReverts() (gas: 21819)
BurnMintERC20_burn:testSenderNotBurnerReverts() (gas: 16739)
BurnMintERC20_burnFrom:testBurnFromSuccess() (gas: 57957)
BurnMintERC20_burnFrom:testExceedsBalanceReverts() (gas: 35916)
BurnMintERC20_burnFrom:testInsufficientAllowanceReverts() (gas: 21914)
BurnMintERC20_burnFrom:testSenderNotBurnerReverts() (gas: 16739)
BurnMintERC20_burnFromAlias:testBurnFromSuccess() (gas: 57932)
BurnMintERC20_burnFromAlias:testExceedsBalanceReverts() (gas: 35880)
BurnMintERC20_burnFromAlias:testInsufficientAllowanceReverts() (gas: 21869)
BurnMintERC20_burnFromAlias:testSenderNotBurnerReverts() (gas: 16694)
BurnMintERC20_constructor:testConstructorSuccess() (gas: 1600593)
BurnMintERC20_decreaseApproval:testDecreaseApprovalSuccess() (gas: 31123)
BurnMintERC20_grantMintAndBurnRoles:testGrantMintAndBurnRolesSuccess() (gas: 121170)
BurnMintERC20_grantRole:testGrantBurnAccessSuccess() (gas: 53407)
BurnMintERC20_grantRole:testGrantManySuccess() (gas: 944594)
BurnMintERC20_grantRole:testGrantMintAccessSuccess() (gas: 94200)
BurnMintERC20_increaseApproval:testIncreaseApprovalSuccess() (gas: 44121)
BurnMintERC20_mint:testBasicMintSuccess() (gas: 149743)
BurnMintERC20_mint:testMaxSupplyExceededReverts() (gas: 50429)
BurnMintERC20_mint:testSenderNotMinterReverts() (gas: 14596)
BurnMintERC20_supportsInterface:testConstructorSuccess() (gas: 11123)
BurnMintERC20_transfer:testInvalidAddressReverts() (gas: 10661)
BurnMintERC20_transfer:testTransferSuccess() (gas: 42277)
BurnMintERC677_approve:testApproveSuccess() (gas: 55477)
BurnMintERC677_approve:testInvalidAddressReverts() (gas: 10663)
BurnMintERC677_burn:testBasicBurnSuccess() (gas: 173939)
BurnMintERC677_burn:testBurnFromZeroAddressReverts() (gas: 47201)
BurnMintERC677_burn:testBasicBurnSuccess() (gas: 173904)
BurnMintERC677_burn:testBurnFromZeroAddressReverts() (gas: 47223)
BurnMintERC677_burn:testExceedsBalanceReverts() (gas: 21841)
BurnMintERC677_burn:testSenderNotBurnerReverts() (gas: 13359)
BurnMintERC677_burnFrom:testBurnFromSuccess() (gas: 57923)
BurnMintERC677_burnFrom:testExceedsBalanceReverts() (gas: 35864)
BurnMintERC677_burnFrom:testInsufficientAllowanceReverts() (gas: 21849)
BurnMintERC677_burnFrom:testSenderNotBurnerReverts() (gas: 13359)
BurnMintERC677_burnFromAlias:testBurnFromSuccess() (gas: 57949)
BurnMintERC677_burn:testSenderNotBurnerReverts() (gas: 13424)
BurnMintERC677_burnFrom:testBurnFromSuccess() (gas: 57957)
BurnMintERC677_burnFrom:testExceedsBalanceReverts() (gas: 35916)
BurnMintERC677_burnFrom:testInsufficientAllowanceReverts() (gas: 21914)
BurnMintERC677_burnFrom:testSenderNotBurnerReverts() (gas: 13424)
BurnMintERC677_burnFromAlias:testBurnFromSuccess() (gas: 57932)
BurnMintERC677_burnFromAlias:testExceedsBalanceReverts() (gas: 35880)
BurnMintERC677_burnFromAlias:testInsufficientAllowanceReverts() (gas: 21869)
BurnMintERC677_burnFromAlias:testSenderNotBurnerReverts() (gas: 13379)
BurnMintERC677_constructor:testConstructorSuccess() (gas: 1672809)
BurnMintERC677_decreaseApproval:testDecreaseApprovalSuccess() (gas: 31069)
BurnMintERC677_grantMintAndBurnRoles:testGrantMintAndBurnRolesSuccess() (gas: 121324)
BurnMintERC677_grantRole:testGrantBurnAccessSuccess() (gas: 53460)
BurnMintERC677_grantRole:testGrantManySuccess() (gas: 937759)
BurnMintERC677_grantRole:testGrantMintAccessSuccess() (gas: 94340)
BurnMintERC677_increaseApproval:testIncreaseApprovalSuccess() (gas: 44076)
BurnMintERC677_mint:testBasicMintSuccess() (gas: 149699)
BurnMintERC677_mint:testMaxSupplyExceededReverts() (gas: 50385)
BurnMintERC677_constructor:testConstructorSuccess() (gas: 1763863)
BurnMintERC677_decreaseApproval:testDecreaseApprovalSuccess() (gas: 31088)
BurnMintERC677_grantMintAndBurnRoles:testGrantMintAndBurnRolesSuccess() (gas: 121214)
BurnMintERC677_grantRole:testGrantBurnAccessSuccess() (gas: 53477)
BurnMintERC677_grantRole:testGrantManySuccess() (gas: 937980)
BurnMintERC677_grantRole:testGrantMintAccessSuccess() (gas: 94200)
BurnMintERC677_increaseApproval:testIncreaseApprovalSuccess() (gas: 44121)
BurnMintERC677_mint:testBasicMintSuccess() (gas: 149677)
BurnMintERC677_mint:testMaxSupplyExceededReverts() (gas: 50297)
BurnMintERC677_mint:testSenderNotMinterReverts() (gas: 11195)
BurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12476)
BurnMintERC677_transfer:testInvalidAddressReverts() (gas: 10639)
BurnMintERC677_transfer:testTransferSuccess() (gas: 42299)
BurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12610)
BurnMintERC677_transfer:testInvalidAddressReverts() (gas: 10661)
BurnMintERC677_transfer:testTransferSuccess() (gas: 42277)
CallWithExactGas__callWithExactGas:test_CallWithExactGasReceiverErrorSuccess() (gas: 67209)
CallWithExactGas__callWithExactGas:test_CallWithExactGasSafeReturnDataExactGas() (gas: 18324)
CallWithExactGas__callWithExactGas:test_NoContractReverts() (gas: 11559)
CallWithExactGas__callWithExactGas:test_NoGasForCallExactCheckReverts() (gas: 15788)
CallWithExactGas__callWithExactGas:test_NotEnoughGasForCallReverts() (gas: 16241)
CallWithExactGas__callWithExactGas:test_callWithExactGasSuccess(bytes,bytes4) (runs: 257, μ: 15767, ~: 15719)
CallWithExactGas__callWithExactGas:test_callWithExactGasSuccess(bytes,bytes4) (runs: 257, μ: 15766, ~: 15719)
CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractExactGasSuccess() (gas: 20116)
CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractReceiverErrorSuccess() (gas: 67721)
CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractSuccess(bytes,bytes4) (runs: 257, μ: 16277, ~: 16229)
CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_CallWithExactGasEvenIfTargetIsNoContractSuccess(bytes,bytes4) (runs: 257, μ: 16276, ~: 16229)
CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_NoContractSuccess() (gas: 12962)
CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_NoGasForCallExactCheckReturnFalseSuccess() (gas: 13005)
CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract:test_NotEnoughGasForCallReturnsFalseSuccess() (gas: 13317)
Expand Down Expand Up @@ -74,11 +101,11 @@ EnumerableMapAddresses_set:testSetSuccess() (gas: 94685)
EnumerableMapAddresses_tryGet:testBytes32TryGetSuccess() (gas: 94622)
EnumerableMapAddresses_tryGet:testBytesTryGetSuccess() (gas: 96279)
EnumerableMapAddresses_tryGet:testTryGetSuccess() (gas: 94893)
OpStackBurnMintERC677_constructor:testConstructorSuccess() (gas: 1743649)
OpStackBurnMintERC677_interfaceCompatibility:testBurnCompatibility() (gas: 298649)
OpStackBurnMintERC677_interfaceCompatibility:testMintCompatibility() (gas: 137957)
OpStackBurnMintERC677_constructor:testConstructorSuccess() (gas: 1829158)
OpStackBurnMintERC677_interfaceCompatibility:testBurnCompatibility() (gas: 298741)
OpStackBurnMintERC677_interfaceCompatibility:testMintCompatibility() (gas: 138155)
OpStackBurnMintERC677_interfaceCompatibility:testStaticFunctionsCompatibility() (gas: 13781)
OpStackBurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12752)
OpStackBurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12814)
SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_EmptySubset_Reverts() (gas: 5460)
SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_EmptySuperset_Reverts() (gas: 4661)
SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_HasDuplicates_Reverts() (gas: 8265)
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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ pragma solidity 0.8.24;
import {BurnMintERC677} from "../../../shared/token/ERC677/BurnMintERC677.sol";
import {IGetCCIPAdmin} from "../../interfaces/IGetCCIPAdmin.sol";

contract BurnMintERC677Helper is BurnMintERC677, IGetCCIPAdmin {
contract BurnMintERC677Helper is BurnMintERC677 {
constructor(string memory name, string memory symbol) BurnMintERC677(name, symbol, 18, 0) {}

// Gives one full token to any given address.
function drip(address to) external {
_mint(to, 1e18);
}

function getCCIPAdmin() external view override returns (address) {
return owner();
}
}
9 changes: 5 additions & 4 deletions contracts/src/v0.8/ccip/test/legacy/TokenPoolAndProxy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.0;
import {IPoolV1} from "../../interfaces/IPool.sol";
import {IPoolPriorTo1_5} from "../../interfaces/IPoolPriorTo1_5.sol";

import {BurnMintERC20} from "../../../shared/token/ERC20/BurnMintERC20.sol";
import {BurnMintERC677} from "../../../shared/token/ERC677/BurnMintERC677.sol";
import {Router} from "../../Router.sol";
import {Client} from "../../libraries/Client.sol";
Expand Down Expand Up @@ -112,9 +113,9 @@ contract TokenPoolAndProxyMigration is EVM2EVMOnRampSetup {
s_newPool.setPreviousPool(IPoolPriorTo1_5(address(0)));

// The new pool is now active, but is has not been given permissions to burn/mint yet
vm.expectRevert(abi.encodeWithSelector(BurnMintERC677.SenderNotBurner.selector, address(s_newPool)));
vm.expectRevert(abi.encodeWithSelector(BurnMintERC20.SenderNotBurner.selector, address(s_newPool)));
_ccipSend1_5();
vm.expectRevert(abi.encodeWithSelector(BurnMintERC677.SenderNotMinter.selector, address(s_newPool)));
vm.expectRevert(abi.encodeWithSelector(BurnMintERC20.SenderNotMinter.selector, address(s_newPool)));
_fakeReleaseOrMintFromOffRamp1_5();

// When we do give burn/mint, the new pool is fully active
Expand Down Expand Up @@ -176,9 +177,9 @@ contract TokenPoolAndProxyMigration is EVM2EVMOnRampSetup {
s_newPool.setPreviousPool(IPoolPriorTo1_5(address(0)));

// The new pool is now active, but is has not been given permissions to burn/mint yet
vm.expectRevert(abi.encodeWithSelector(BurnMintERC677.SenderNotBurner.selector, address(s_newPool)));
vm.expectRevert(abi.encodeWithSelector(BurnMintERC20.SenderNotBurner.selector, address(s_newPool)));
_ccipSend1_5();
vm.expectRevert(abi.encodeWithSelector(BurnMintERC677.SenderNotMinter.selector, address(s_newPool)));
vm.expectRevert(abi.encodeWithSelector(BurnMintERC20.SenderNotMinter.selector, address(s_newPool)));
_fakeReleaseOrMintFromOffRamp1_5();

// When we do give burn/mint, the new pool is fully active
Expand Down
Loading
Loading