Skip to content

Commit d052628

Browse files
authored
Lockbox per pool (#1485)
local lockbox
1 parent e243de8 commit d052628

File tree

43 files changed

+1550
-1366
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1550
-1366
lines changed

ccv/chains/evm/gobindings/generated/latest/erc20_lock_box/erc20_lock_box.go

Lines changed: 535 additions & 85 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ccv/chains/evm/gobindings/generated/latest/lock_release_token_pool/lock_release_token_pool.go

Lines changed: 2 additions & 210 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ccv/chains/evm/gobindings/generated/latest/siloed_lock_release_token_pool/siloed_lock_release_token_pool.go

Lines changed: 21 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ccv/chains/evm/gobindings/generated/latest/siloed_usdc_token_pool/siloed_usdc_token_pool.go

Lines changed: 21 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ccv/chains/evm/gobindings/generated/latest/token_pool_factory/token_pool_factory.go

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chains/evm/.gas-snapshot

Lines changed: 55 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -86,25 +86,15 @@ CommitteeVerifier_verifyMessage:test_verifyMessage_ForwardCompatibilityWithExtra
8686
CommitteeVerifier_withdrawFeeTokens:test_withdrawFeeTokens() (gas: 215582)
8787
CommitteeVerifier_withdrawFeeTokens:test_withdrawFeeTokens_MultipleTokens() (gas: 1493095)
8888
DefensiveExampleTest:test_HappyPath() (gas: 203303)
89-
DefensiveExampleTest:test_Recovery() (gas: 428649)
89+
DefensiveExampleTest:test_Recovery() (gas: 428623)
9090
ERC165CheckerReverting_supportsInterfaceReverting:test__supportsInterfaceReverting() (gas: 10673)
91-
ERC20LockBox_configureAllowedCallers:test_ConfigureAllowedCallers_AddAlreadyAllowedCaller() (gas: 32992)
92-
ERC20LockBox_configureAllowedCallers:test_ConfigureAllowedCallers_AddAndRemoveInSameCall() (gas: 71065)
93-
ERC20LockBox_configureAllowedCallers:test_ConfigureAllowedCallers_AddMultipleCallers() (gas: 128026)
94-
ERC20LockBox_configureAllowedCallers:test_ConfigureAllowedCallers_AddSingleCaller() (gas: 57264)
95-
ERC20LockBox_configureAllowedCallers:test_ConfigureAllowedCallers_ReAddRemovedCaller() (gas: 78277)
96-
ERC20LockBox_configureAllowedCallers:test_ConfigureAllowedCallers_RemoveAllCallers() (gas: 94645)
97-
ERC20LockBox_configureAllowedCallers:test_ConfigureAllowedCallers_RemoveNonExistentCaller() (gas: 32707)
98-
ERC20LockBox_configureAllowedCallers:test_ConfigureAllowedCallers_RemoveSingleCaller() (gas: 49924)
99-
ERC20LockBox_configureAllowedCallers:test_ConfigureAllowedCallers_ZeroAddress() (gas: 53199)
100-
ERC20LockBox_configureAllowedCallers:test_ConfigureAllowedCallers_ZeroTokenAddress() (gas: 11266)
101-
ERC20LockBox_constructor:test_Constructor_Success() (gas: 575716)
102-
ERC20LockBox_deposit:test_Deposit_FromDifferentCallers() (gas: 486012)
103-
ERC20LockBox_deposit:test_Deposit_MultipleDeposits() (gas: 88456)
104-
ERC20LockBox_withdraw:test_Withdraw_EventEmission() (gas: 97975)
105-
ERC20LockBox_withdraw:test_Withdraw_MultipleWithdrawals() (gas: 142149)
106-
ERC20LockBox_withdraw:test_Withdraw_PartialAmount() (gas: 113230)
107-
ERC20LockBox_withdraw:test_Withdraw_ToDifferentRecipients() (gas: 130182)
91+
ERC20LockBox_constructor:test_constructor() (gas: 731898)
92+
ERC20LockBox_deposit:test_deposit_FromDifferentCallers() (gas: 511291)
93+
ERC20LockBox_deposit:test_deposit_MultipleDeposits() (gas: 76246)
94+
ERC20LockBox_withdraw:test_withdraw_EventEmission() (gas: 87982)
95+
ERC20LockBox_withdraw:test_withdraw_MultipleWithdrawals() (gas: 128924)
96+
ERC20LockBox_withdraw:test_withdraw_PartialAmount() (gas: 100978)
97+
ERC20LockBox_withdraw:test_withdraw_ToDifferentRecipients() (gas: 118284)
10898
EtherSenderReceiverTest_ccipReceive:test_ccipReceive_fallbackToWethTransfer() (gas: 98080)
10999
EtherSenderReceiverTest_ccipReceive:test_ccipReceive_happyPath() (gas: 48430)
110100
EtherSenderReceiverTest_ccipReceive:test_ccipReceive_wrongToken() (gas: 18138)
@@ -178,7 +168,7 @@ FeeQuoter_applyDestChainConfigUpdates:test_applyDestChainConfigUpdates() (gas: 1
178168
FeeQuoter_applyDestChainConfigUpdates:test_applyDestChainConfigUpdates_ZeroInputDoesNotEmitLog() (gas: 13182)
179169
FeeQuoter_applyFeeTokensUpdates:test_applyFeeTokensUpdates() (gas: 68608)
180170
FeeQuoter_applyTokenTransferFeeConfigUpdates:test_applyTokenTransferFeeConfigUpdates() (gas: 82019)
181-
FeeQuoter_constructor:test_constructor() (gas: 4382361)
171+
FeeQuoter_constructor:test_constructor() (gas: 4382328)
182172
FeeQuoter_convertTokenAmount:test_convertTokenAmount() (gas: 68235)
183173
FeeQuoter_getTokenAndGasPrices:test_getTokenAndGasPrices() (gas: 71199)
184174
FeeQuoter_getTokenAndGasPrices:test_getTokenAndGasPrices_ZeroGasPrice() (gas: 82259)
@@ -265,13 +255,12 @@ Internal_validateEVMAddress:test_validateEVMAddress_ValidAddress() (gas: 586)
265255
Internal_validateTVMAddress:test_validateTVMAddress_BasechainAddress() (gas: 287)
266256
Internal_validateTVMAddress:test_validateTVMAddress_MasterchainAddress() (gas: 595)
267257
Internal_validateTVMAddress:test_validateTVMAddress_MinimalNonZeroAccountId() (gas: 857)
268-
LockReleaseTokenPool_lockOrBurn:test_lockOrBurnV2_WithFee() (gas: 278395)
269-
LockReleaseTokenPool_lockOrBurn:test_lockOrBurn_LockOrBurnWithAllowList() (gas: 283739)
270-
LockReleaseTokenPool_releaseOrMint:test_releaseOrMint() (gas: 234516)
271-
LockReleaseTokenPool_releaseOrMint:test_releaseOrMintV2() (gas: 247028)
272-
LockReleaseTokenPool_setRebalancer:test_SetRebalancer() (gas: 21953)
258+
LockReleaseTokenPool_constructor:test_constructor() (gas: 5908382)
259+
LockReleaseTokenPool_lockOrBurn:test_lockOrBurnV2_WithFee() (gas: 277867)
260+
LockReleaseTokenPool_lockOrBurn:test_lockOrBurn_LockOrBurnWithAllowList() (gas: 281110)
261+
LockReleaseTokenPool_releaseOrMint:test_releaseOrMint() (gas: 234112)
262+
LockReleaseTokenPool_releaseOrMint:test_releaseOrMintV2() (gas: 246587)
273263
LockReleaseTokenPool_supportsInterface:test_SupportsInterface() (gas: 10100)
274-
LockReleaseTokenPool_transferLiquidity:test_transferLiquidity() (gas: 96529)
275264
LombardTokenPool_constructor:test_constructor() (gas: 4492381)
276265
LombardTokenPool_constructor:test_constructor_RevertsWhen_InvalidMessageVersion() (gas: 101872)
277266
LombardTokenPool_constructor:test_constructor_RevertsWhen_ZeroBridge() (gas: 97521)
@@ -460,9 +449,9 @@ Router_ccipSend:test_NonLinkFeeToken() (gas: 245932)
460449
Router_ccipSend:test_WrappedNativeFeeToken() (gas: 276460)
461450
Router_ccipSend:test_ccipSend_nativeFeeNoTokenSuccess_gas() (gas: 191329)
462451
Router_ccipSend:test_ccipSend_nativeFeeOneTokenSuccess_gas() (gas: 340764)
463-
Router_constructor:test_Constructor() (gas: 13312)
452+
Router_constructor:test_Constructor() (gas: 13279)
464453
Router_getArmProxy:test_getArmProxy() (gas: 10647)
465-
Router_getFee:test_GetFeeSupportedChain() (gas: 82316)
454+
Router_getFee:test_GetFeeSupportedChain() (gas: 82283)
466455
Router_recoverTokens:test_RecoverTokens() (gas: 51647)
467456
Router_routeMessage:test_routeMessage_AutoExec() (gas: 41935)
468457
Router_routeMessage:test_routeMessage_ExecutionEvent() (gas: 157877)
@@ -491,55 +480,60 @@ SignatureQuorumValidator_getSignatureConfig:test_getSignatureConfig_MultipleUpda
491480
SignatureQuorumValidator_getSignatureConfig:test_getSignatureConfig_SingleSigner() (gas: 68231)
492481
SignatureQuorumValidator_validateSignatures:test_validateSignatures_ExtraSignatures() (gas: 103451)
493482
SignatureQuorumValidator_validateSignatures:test_validateSignatures_MultipleSignatures() (gas: 107585)
494-
SiloedLockReleaseTokenPool_getAvailableTokens:test_getAvailableTokens_SiloedChain() (gas: 92935)
495-
SiloedLockReleaseTokenPool_getAvailableTokens:test_getAvailableTokens_UnsiloedChain() (gas: 96901)
496-
SiloedLockReleaseTokenPool_lockOrBurn:test_lockOrBurn_SiloedFunds() (gas: 269660)
497-
SiloedLockReleaseTokenPool_lockOrBurn:test_lockOrBurn_UnsiloedFunds() (gas: 268735)
498-
SiloedLockReleaseTokenPool_provideLiquidity:test_provideLiquidity() (gas: 261216)
499-
SiloedLockReleaseTokenPool_provideSiloedLiquidity:test_provideSiloedLiquidity() (gas: 252312)
500-
SiloedLockReleaseTokenPool_releaseOrMint:test_ReleaseOrMint_RevertsWhen_InsufficientLiquidity_SiloedChain() (gas: 110687)
501-
SiloedLockReleaseTokenPool_releaseOrMint:test_ReleaseOrMint_RevertsWhen_InsufficientLiquidity_UnsiloedChain() (gas: 114891)
502-
SiloedLockReleaseTokenPool_releaseOrMint:test_ReleaseOrMint_SiloedChain() (gas: 292101)
503-
SiloedLockReleaseTokenPool_releaseOrMint:test_ReleaseOrMint_UnsiloedChain() (gas: 293748)
504-
SiloedLockReleaseTokenPool_setRebalancer:test_setRebalancer_UnsiloedChains() (gas: 24971)
505-
SiloedLockReleaseTokenPool_setRebalancer:test_setSiloRebalancer() (gas: 28998)
506-
SiloedLockReleaseTokenPool_updateSiloDesignations:test_updateSiloDesignations() (gas: 181096)
507-
SiloedLockReleaseTokenPool_withdrawLiqudity:test_withdrawLiquidity_SiloedFunds() (gas: 108237)
508-
SiloedLockReleaseTokenPool_withdrawLiqudity:test_withdrawLiquidity_UnsiloedFunds_LegacyFunctionSelector() (gas: 109932)
509-
SiloedUSDCTokenPool_burnLockedUSDC:test_burnLockedUSDC() (gas: 413352)
483+
SiloedLockReleaseTokenPool_configureChainLockBoxes:test_configureChainLockBoxes() (gas: 976525)
484+
SiloedLockReleaseTokenPool_constructor:test_constructor() (gas: 6815165)
485+
SiloedLockReleaseTokenPool_getAvailableTokens:test_getAvailableTokens_SiloedChain() (gas: 73508)
486+
SiloedLockReleaseTokenPool_getAvailableTokens:test_getAvailableTokens_UnsiloedChain() (gas: 77606)
487+
SiloedLockReleaseTokenPool_lockOrBurn:test_lockOrBurn_SiloedFunds() (gas: 253875)
488+
SiloedLockReleaseTokenPool_lockOrBurn:test_lockOrBurn_UnsiloedFunds() (gas: 253412)
489+
SiloedLockReleaseTokenPool_provideLiquidity:test_provideLiquidity() (gas: 249761)
490+
SiloedLockReleaseTokenPool_provideSiloedLiquidity:test_provideSiloedLiquidity() (gas: 181908)
491+
SiloedLockReleaseTokenPool_releaseOrMint:test_ReleaseOrMint_RevertsWhen_InsufficientLiquidity_SiloedChain() (gas: 108391)
492+
SiloedLockReleaseTokenPool_releaseOrMint:test_ReleaseOrMint_RevertsWhen_InsufficientLiquidity_UnsiloedChain() (gas: 112636)
493+
SiloedLockReleaseTokenPool_releaseOrMint:test_ReleaseOrMint_SiloedChain() (gas: 291520)
494+
SiloedLockReleaseTokenPool_releaseOrMint:test_ReleaseOrMint_UnsiloedChain() (gas: 298136)
495+
SiloedLockReleaseTokenPool_setRebalancer:test_setRebalancer_UnsiloedChains() (gas: 24932)
496+
SiloedLockReleaseTokenPool_setRebalancer:test_setSiloRebalancer() (gas: 28896)
497+
SiloedLockReleaseTokenPool_updateSiloDesignations:test_updateSiloDesignations() (gas: 210904)
498+
SiloedLockReleaseTokenPool_withdrawLiqudity:test_withdrawLiquidity_SiloedFunds() (gas: 99599)
499+
SiloedLockReleaseTokenPool_withdrawLiqudity:test_withdrawLiquidity_UnsiloedFunds_LegacyFunctionSelector() (gas: 99570)
500+
SiloedUSDCTokenPool_burnLockedUSDC:test_burnLockedUSDC() (gas: 391466)
510501
SiloedUSDCTokenPool_cancelExistingCCTPMigrationProposal:test_cancelExistingCCTPMigrationProposal() (gas: 30708)
511502
SiloedUSDCTokenPool_cancelExistingCCTPMigrationProposal:test_cancelExistingCCTPMigrationProposal_EmitsEvent() (gas: 30011)
512-
SiloedUSDCTokenPool_cancelExistingCCTPMigrationProposal:test_cancelExistingCCTPMigrationProposal_ResetsExcludedTokens() (gas: 184689)
513-
SiloedUSDCTokenPool_excludeTokensFromBurn:test_excludeTokensFromBurn() (gas: 190690)
514-
SiloedUSDCTokenPool_excludeTokensFromBurn:test_excludeTokensFromBurn_EmitsEvent() (gas: 190494)
515-
SiloedUSDCTokenPool_lockOrBurn:test_lockOrBurn_MultipleLocks() (gas: 159383)
516-
SiloedUSDCTokenPool_lockOrBurn:test_lockOrBurn_Success() (gas: 134691)
517-
SiloedUSDCTokenPool_lockOrBurn:test_lockOrBurn_UpdatesLockedTokensAccounting() (gas: 131781)
518-
SiloedUSDCTokenPool_lockOrBurn:test_lockOrBurn_UpdatesSiloedTokensAccounting() (gas: 133767)
503+
SiloedUSDCTokenPool_cancelExistingCCTPMigrationProposal:test_cancelExistingCCTPMigrationProposal_ResetsExcludedTokens() (gas: 167372)
504+
SiloedUSDCTokenPool_excludeTokensFromBurn:test_excludeTokensFromBurn() (gas: 169021)
505+
SiloedUSDCTokenPool_excludeTokensFromBurn:test_excludeTokensFromBurn_EmitsEvent() (gas: 168803)
506+
SiloedUSDCTokenPool_lockOrBurn:test_lockOrBurn_MultipleLocks() (gas: 130418)
507+
SiloedUSDCTokenPool_lockOrBurn:test_lockOrBurn_Success() (gas: 107677)
508+
SiloedUSDCTokenPool_lockOrBurn:test_lockOrBurn_UpdatesLockedTokensAccounting() (gas: 104767)
509+
SiloedUSDCTokenPool_lockOrBurn:test_lockOrBurn_UpdatesSiloedTokensAccounting() (gas: 106747)
519510
SiloedUSDCTokenPool_proposeCCTPMigration:test_proposeCCTPMigration() (gas: 38080)
520511
SiloedUSDCTokenPool_proposeCCTPMigration:test_proposeCCTPMigration_AfterCancellation() (gas: 50832)
521-
SiloedUSDCTokenPool_releaseOrMint:test_releaseOrMint_SubtractsFromExcludedTokens() (gas: 379874)
522-
SiloedUSDCTokenPool_releaseOrMint:test_releaseOrMint_Success() (gas: 175372)
512+
SiloedUSDCTokenPool_releaseOrMint:test_releaseOrMint_SubtractsFromExcludedTokens() (gas: 373474)
513+
SiloedUSDCTokenPool_releaseOrMint:test_releaseOrMint_Success() (gas: 157583)
514+
SiloedUSDCTokenPool_typeAndVersion:test_typeAndVersion() (gas: 9927)
523515
TokenAdminRegistry_acceptAdminRole:test_acceptAdminRole() (gas: 45424)
524516
TokenAdminRegistry_addRegistryModule:test_addRegistryModule() (gas: 67792)
525517
TokenAdminRegistry_getAllConfiguredTokens:test_getAllConfiguredTokens_outOfBounds() (gas: 11754)
526518
TokenAdminRegistry_getPool:test_getPool() (gas: 17951)
527519
TokenAdminRegistry_getPools:test_getPools() (gas: 40701)
528-
TokenAdminRegistry_isAdministrator:test_isAdministrator() (gas: 107880)
520+
TokenAdminRegistry_isAdministrator:test_isAdministrator() (gas: 107814)
529521
TokenAdminRegistry_proposeAdministrator:test_proposeAdministrator_module() (gas: 114714)
530522
TokenAdminRegistry_proposeAdministrator:test_proposeAdministrator_owner() (gas: 109226)
531523
TokenAdminRegistry_proposeAdministrator:test_proposeAdministrator_reRegisterWhileUnclaimed() (gas: 117826)
532524
TokenAdminRegistry_removeRegistryModule:test_removeRegistryModule() (gas: 55228)
533525
TokenAdminRegistry_setPool:test_setPool() (gas: 36792)
534526
TokenAdminRegistry_setPool:test_setPool_ZeroAddressRemovesPool() (gas: 31885)
535527
TokenAdminRegistry_transferAdminRole:test_transferAdminRole() (gas: 50684)
536-
TokenPoolFactory_createTokenPool:test_createTokenPoolLockRelease_ExistingToken_predict() (gas: 14209167)
537-
TokenPoolFactory_createTokenPool:test_createTokenPool_BurnFromMintTokenPool() (gas: 7667130)
538-
TokenPoolFactory_createTokenPool:test_createTokenPool_ExistingRemoteToken_AndPredictPool() (gas: 15447280)
539-
TokenPoolFactory_createTokenPool:test_createTokenPool_RemoteTokenHasDifferentDecimals() (gas: 15455018)
540-
TokenPoolFactory_createTokenPool:test_createTokenPool_WithNoExistingRemoteContracts_predict() (gas: 15820648)
541-
TokenPoolFactory_createTokenPool:test_createTokenPool_WithNoExistingTokenOnRemoteChain() (gas: 7469936)
542-
TokenPoolFactory_createTokenPool:test_createTokenPool_WithRemoteTokenAndRemotePool() (gas: 7666874)
528+
TokenPoolFactory_deployTokenAndTokenPool:test_deployTokenAndTokenPool_BurnFromMintTokenPool() (gas: 7667829)
529+
TokenPoolFactory_deployTokenAndTokenPool:test_deployTokenAndTokenPool_LockRelease_AuthorizesPoolForLockBox() (gas: 6828977)
530+
TokenPoolFactory_deployTokenAndTokenPool:test_deployTokenAndTokenPool_RemoteTokenHasDifferentDecimals() (gas: 16668770)
531+
TokenPoolFactory_deployTokenAndTokenPool:test_deployTokenAndTokenPool_WithNoExistingRemoteContracts_Predict() (gas: 17034658)
532+
TokenPoolFactory_deployTokenAndTokenPool:test_deployTokenAndTokenPool_WithNoExistingTokenOnRemoteChain() (gas: 7469717)
533+
TokenPoolFactory_deployTokenAndTokenPool:test_deployTokenAndTokenPool_WithRemoteTokenAndRemotePool() (gas: 7667178)
534+
TokenPoolFactory_deployTokenAndTokenPool:test_deployTokenPoolWithExistingToken_ExistingRemoteToken_AndPredictPool() (gas: 16661186)
535+
TokenPoolFactory_deployTokenAndTokenPool:test_deployTokenPoolWithExistingToken_LockRelease_ExistingToken_Predict() (gas: 16630008)
536+
TokenPoolFactory_deployTokenAndTokenPool:test_deployTokenPoolWithExistingToken_LockRelease_UserLockBoxOwnershipPreserved() (gas: 6062387)
543537
TokenPoolV2_applyFee:test_applyFee_CustomFinality() (gas: 62367)
544538
TokenPoolV2_applyFee:test_applyFee_DefaultFinality() (gas: 55476)
545539
TokenPoolV2_applyTokenTransferFeeConfigUpdates:test_applyTokenTransferFeeConfigUpdates() (gas: 46172)
@@ -622,5 +616,5 @@ USDCTokenPool_supportsInterface:test_SupportsInterface() (gas: 10100)
622616
VersionedVerifierResolver_applyInboundImplementationUpdates:test_applyInboundImplementationUpdates() (gas: 109230)
623617
VersionedVerifierResolver_applyOutboundImplementationUpdates:test_applyOutboundImplementationUpdates() (gas: 108154)
624618
cctp_e2e:test_cctp_e2e() (gas: 662407)
625-
e2e:test_e2e() (gas: 553021)
619+
e2e:test_e2e() (gas: 548513)
626620
e2e_lombard:test_e2e_Lombard() (gas: 731267)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.4;
3+
4+
interface ILockBox {
5+
/// @notice Deposits the token into the lockbox.
6+
/// @param token The address of the token to deposit.
7+
/// @param remoteChainSelector The chain selector of the remote chain.
8+
/// @param amount The amount of tokens to deposit.
9+
function deposit(
10+
address token,
11+
uint64 remoteChainSelector,
12+
uint256 amount
13+
) external;
14+
15+
/// @notice Withdraws tokens to a specific recipient.
16+
/// @param token The address of the token to withdraw.
17+
/// @param remoteChainSelector The chain selector of the remote chain.
18+
/// @param amount The amount of tokens to withdraw.
19+
/// @param recipient The address of the recipient to receive the withdrawn tokens.
20+
function withdraw(
21+
address token,
22+
uint64 remoteChainSelector,
23+
uint256 amount,
24+
address recipient
25+
) external;
26+
27+
/// @notice Returns whether the lockbox supports a token.
28+
/// @param token The address of the token.
29+
/// @return supported True if the token is supported.
30+
function isTokenSupported(
31+
address token
32+
) external view returns (bool);
33+
}

0 commit comments

Comments
 (0)