Skip to content

Commit 03fae55

Browse files
committed
remove localAmount call
1 parent 2d55e25 commit 03fae55

File tree

6 files changed

+28
-27
lines changed

6 files changed

+28
-27
lines changed

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

Lines changed: 1 addition & 1 deletion
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: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chains/evm/.gas-snapshot

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ BurnMintTokenPool_releaseOrMint:test_releaseOrMint_WithFinalityParam() (gas: 107
3737
BurnMintTokenPool_typeAndVersion:test_typeAndVersion() (gas: 3888688)
3838
BurnMintWithLockReleaseFlagTokenPool_lockOrBurn:test_LockOrBurn_CorrectReturnData() (gas: 246205)
3939
BurnMintWithLockReleaseFlagTokenPool_lockOrBurn:test_lockOrBurnV2_ReturnsLockReleaseFlag() (gas: 239608)
40-
BurnMintWithLockReleaseFlagTokenPool_releaseOrMint:test_releaseOrMintV2_LockReleaseFlagInSourcePoolData() (gas: 105933)
41-
BurnMintWithLockReleaseFlagTokenPool_releaseOrMint:test_releaseOrMint_EmptySourcePoolData() (gas: 107334)
42-
BurnMintWithLockReleaseFlagTokenPool_releaseOrMint:test_releaseOrMint_LockReleaseFlagInSourcePoolData() (gas: 107350)
40+
BurnMintWithLockReleaseFlagTokenPool_releaseOrMint:test_releaseOrMintV2_LockReleaseFlagInSourcePoolData() (gas: 105858)
41+
BurnMintWithLockReleaseFlagTokenPool_releaseOrMint:test_releaseOrMint_EmptySourcePoolData() (gas: 107259)
42+
BurnMintWithLockReleaseFlagTokenPool_releaseOrMint:test_releaseOrMint_LockReleaseFlagInSourcePoolData() (gas: 107275)
4343
BurnMintWithLockReleaseFlagTokenPool_typeAndVersion:test_typeAndVersion() (gas: 10254)
4444
BurnToAddressMintTokenPool_lockOrBurn:test_LockOrBurn() (gas: 242315)
4545
BurnWithFromMintTokenPool_lockOrBurn:test_constructor() (gas: 21718)
@@ -516,9 +516,9 @@ SiloedUSDCTokenPool_lockOrBurn:test_lockOrBurn_UpdatesLockedTokensAccounting() (
516516
SiloedUSDCTokenPool_lockOrBurn:test_lockOrBurn_UpdatesSiloedTokensAccounting() (gas: 103700)
517517
SiloedUSDCTokenPool_proposeCCTPMigration:test_proposeCCTPMigration() (gas: 38080)
518518
SiloedUSDCTokenPool_proposeCCTPMigration:test_proposeCCTPMigration_AfterCancellation() (gas: 50832)
519-
SiloedUSDCTokenPool_releaseOrMint:test_releaseOrMintV2_Success() (gas: 154798)
520-
SiloedUSDCTokenPool_releaseOrMint:test_releaseOrMint_SubtractsFromExcludedTokens() (gas: 372888)
521-
SiloedUSDCTokenPool_releaseOrMint:test_releaseOrMint_Success() (gas: 157468)
519+
SiloedUSDCTokenPool_releaseOrMint:test_releaseOrMintV2_Success() (gas: 154723)
520+
SiloedUSDCTokenPool_releaseOrMint:test_releaseOrMint_SubtractsFromExcludedTokens() (gas: 372774)
521+
SiloedUSDCTokenPool_releaseOrMint:test_releaseOrMint_Success() (gas: 157393)
522522
SiloedUSDCTokenPool_typeAndVersion:test_typeAndVersion() (gas: 9927)
523523
TokenAdminRegistry_acceptAdminRole:test_acceptAdminRole() (gas: 45424)
524524
TokenAdminRegistry_addRegistryModule:test_addRegistryModule() (gas: 67792)

chains/evm/contracts/pools/USDC/BurnMintWithLockReleaseFlagTokenPool.sol

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,21 @@ contract BurnMintWithLockReleaseFlagTokenPool is BurnMintTokenPool {
5858
Pool.ReleaseOrMintInV1 calldata releaseOrMintIn,
5959
uint16 blockConfirmationRequested
6060
) public virtual override returns (Pool.ReleaseOrMintOutV1 memory) {
61-
// Since the remote token is always canonical USDC, the decimals should always be 6 for remote tokens,
62-
// which enables potentially local non-canonical USDC with different decimals to be minted.
63-
uint256 localAmount = _calculateLocalAmount(releaseOrMintIn.sourceDenominatedAmount, 6);
61+
// Since USDC is 6 decimals on all chains, we don't need to convert to a different denomination.
62+
_validateReleaseOrMint(releaseOrMintIn, releaseOrMintIn.sourceDenominatedAmount, blockConfirmationRequested);
6463

65-
_validateReleaseOrMint(releaseOrMintIn, localAmount, blockConfirmationRequested);
66-
67-
_releaseOrMint(releaseOrMintIn.receiver, localAmount, releaseOrMintIn.remoteChainSelector);
64+
_releaseOrMint(
65+
releaseOrMintIn.receiver, releaseOrMintIn.sourceDenominatedAmount, releaseOrMintIn.remoteChainSelector
66+
);
6867

6968
emit ReleasedOrMinted({
7069
remoteChainSelector: releaseOrMintIn.remoteChainSelector,
7170
token: address(i_token),
7271
sender: msg.sender,
7372
recipient: releaseOrMintIn.receiver,
74-
amount: localAmount
73+
amount: releaseOrMintIn.sourceDenominatedAmount
7574
});
7675

77-
return Pool.ReleaseOrMintOutV1({destinationAmount: localAmount});
76+
return Pool.ReleaseOrMintOutV1({destinationAmount: releaseOrMintIn.sourceDenominatedAmount});
7877
}
7978
}

chains/evm/contracts/pools/USDC/SiloedUSDCTokenPool.sol

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,35 +80,37 @@ contract SiloedUSDCTokenPool is SiloedLockReleaseTokenPool, AuthorizedCallers {
8080
Pool.ReleaseOrMintInV1 calldata releaseOrMintIn,
8181
uint16 blockConfirmationRequested
8282
) public virtual override returns (Pool.ReleaseOrMintOutV1 memory) {
83-
// Calculate the local amount. Since USDC is always 6 decimals, we can hard code the decimals to 6.
84-
uint256 localAmount = _calculateLocalAmount(releaseOrMintIn.sourceDenominatedAmount, 6);
85-
86-
_validateReleaseOrMint(releaseOrMintIn, localAmount, blockConfirmationRequested);
83+
// Since USDC is 6 decimals on all chains, we don't need to convert to a different denomination.
84+
_validateReleaseOrMint(releaseOrMintIn, releaseOrMintIn.sourceDenominatedAmount, blockConfirmationRequested);
8785

8886
uint256 excludedTokens = s_tokensExcludedFromBurn[releaseOrMintIn.remoteChainSelector];
8987
if (excludedTokens != 0) {
9088
// The existence of excluded tokens indicates a migration has occurred on the chain, and that any tokens
9189
// being released should come from those excluded tokens reserved for processing inflight messages.
92-
if (localAmount > excludedTokens) revert InsufficientLiquidity(excludedTokens, localAmount);
93-
s_tokensExcludedFromBurn[releaseOrMintIn.remoteChainSelector] -= localAmount;
90+
if (releaseOrMintIn.sourceDenominatedAmount > excludedTokens) {
91+
revert InsufficientLiquidity(excludedTokens, releaseOrMintIn.sourceDenominatedAmount);
92+
}
93+
s_tokensExcludedFromBurn[releaseOrMintIn.remoteChainSelector] -= releaseOrMintIn.sourceDenominatedAmount;
9494
// During a proposed migration, the lockbox balance is the source of truth. Any release here reduces the
9595
// lockbox balance, so burnLockedUSDC will not over-burn even without separate per-chain accounting.
9696
}
9797
// No excluded tokens is the common path, as it means no migration has occurred yet, and any released
9898
// tokens should come from the stored token balance of previously deposited tokens.
9999

100100
// Release to the recipient using the lockbox tied to the remote chain selector.
101-
_releaseOrMint(releaseOrMintIn.receiver, localAmount, releaseOrMintIn.remoteChainSelector);
101+
_releaseOrMint(
102+
releaseOrMintIn.receiver, releaseOrMintIn.sourceDenominatedAmount, releaseOrMintIn.remoteChainSelector
103+
);
102104

103105
emit ReleasedOrMinted({
104106
remoteChainSelector: releaseOrMintIn.remoteChainSelector,
105107
token: address(i_token),
106108
sender: msg.sender,
107109
recipient: releaseOrMintIn.receiver,
108-
amount: localAmount
110+
amount: releaseOrMintIn.sourceDenominatedAmount
109111
});
110112

111-
return Pool.ReleaseOrMintOutV1({destinationAmount: localAmount});
113+
return Pool.ReleaseOrMintOutV1({destinationAmount: releaseOrMintIn.sourceDenominatedAmount});
112114
}
113115

114116
/// @dev This function is overridden to prevent providing liquidity to a chain that has already been migrated, and thus should use CCTP-proper instead of a Lock/Release mechanism.

chains/evm/gobindings/generation/generated-wrapper-dependency-versions-do-not-edit.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ GETH_VERSION: 1.15.3
22
advanced_pool_hooks: ../solc/ccip/AdvancedPoolHooks/AdvancedPoolHooks.sol/AdvancedPoolHooks.abi.json ../solc/ccip/AdvancedPoolHooks/AdvancedPoolHooks.sol/AdvancedPoolHooks.bin ed1186bfe57828c397acdc6c4179e057a814e4bf1bccf5cf2cc98575cb393949
33
burn_from_mint_token_pool: ../solc/ccip/BurnFromMintTokenPool/BurnFromMintTokenPool.sol/BurnFromMintTokenPool.abi.json ../solc/ccip/BurnFromMintTokenPool/BurnFromMintTokenPool.sol/BurnFromMintTokenPool.bin dfd8fa72e17dd182c3ea41301203480b4dd4efc9c346feb40448975029adef76
44
burn_mint_token_pool: ../solc/ccip/BurnMintTokenPool/BurnMintTokenPool.sol/BurnMintTokenPool.abi.json ../solc/ccip/BurnMintTokenPool/BurnMintTokenPool.sol/BurnMintTokenPool.bin e1e3bbb104eb1a0096549cbdf039485e6037358800874e82f66c2fa12022149a
5-
burn_mint_with_lock_release_flag_token_pool: ../solc/ccip/BurnMintWithLockReleaseFlagTokenPool/BurnMintWithLockReleaseFlagTokenPool.sol/BurnMintWithLockReleaseFlagTokenPool.abi.json ../solc/ccip/BurnMintWithLockReleaseFlagTokenPool/BurnMintWithLockReleaseFlagTokenPool.sol/BurnMintWithLockReleaseFlagTokenPool.bin 76646ddd5e990559101edf514ec144e36670d83c42a7cc774997d9f176fa1234
5+
burn_mint_with_lock_release_flag_token_pool: ../solc/ccip/BurnMintWithLockReleaseFlagTokenPool/BurnMintWithLockReleaseFlagTokenPool.sol/BurnMintWithLockReleaseFlagTokenPool.abi.json ../solc/ccip/BurnMintWithLockReleaseFlagTokenPool/BurnMintWithLockReleaseFlagTokenPool.sol/BurnMintWithLockReleaseFlagTokenPool.bin 723b2929026ca82c891e93274cec41b0c0cce0636d532f130f1b4650140c040f
66
burn_to_address_mint_token_pool: ../solc/ccip/BurnToAddressMintTokenPool/BurnToAddressMintTokenPool.sol/BurnToAddressMintTokenPool.abi.json ../solc/ccip/BurnToAddressMintTokenPool/BurnToAddressMintTokenPool.sol/BurnToAddressMintTokenPool.bin b58c7254925493b43eb512ebec15a57f6b6cc140f732e6b5c1e4de29f343c1ce
77
burn_with_from_mint_token_pool: ../solc/ccip/BurnWithFromMintTokenPool/BurnWithFromMintTokenPool.sol/BurnWithFromMintTokenPool.abi.json ../solc/ccip/BurnWithFromMintTokenPool/BurnWithFromMintTokenPool.sol/BurnWithFromMintTokenPool.bin 277c055a0112dc14e1631a61baa647424344271a4ed207b557cb207b832c9570
88
ccip_reader_tester: ../solc/ccip/CCIPReaderTester/CCIPReaderTester.sol/CCIPReaderTester.abi.json ../solc/ccip/CCIPReaderTester/CCIPReaderTester.sol/CCIPReaderTester.bin fcc137fc5a0f322abc37a370eee6b75fda2e26bd7e8859b0c79d0da320a75fa8
@@ -42,7 +42,7 @@ rmn_proxy_contract: ../solc/ccip/RMNProxy/RMNProxy.sol/RMNProxy.abi.json ../solc
4242
rmn_remote: ../solc/ccip/RMNRemote/RMNRemote.sol/RMNRemote.abi.json ../solc/ccip/RMNRemote/RMNRemote.sol/RMNRemote.bin e345511af2c05588a6875c9c5cc728732e8728e76217caa3de3966b0051b0ad2
4343
router: ../solc/ccip/Router/Router.sol/Router.abi.json ../solc/ccip/Router/Router.sol/Router.bin 4048d8be7531670b5e054b7dc18aa8394f2b6dd44fd7fff83aa0cb4aeb38e926
4444
siloed_lock_release_token_pool: ../solc/ccip/SiloedLockReleaseTokenPool/SiloedLockReleaseTokenPool.sol/SiloedLockReleaseTokenPool.abi.json ../solc/ccip/SiloedLockReleaseTokenPool/SiloedLockReleaseTokenPool.sol/SiloedLockReleaseTokenPool.bin caeb6312ea1b78f51e11873faa7bf95db0b966148e9416871ee896d8b25db213
45-
siloed_usdc_token_pool: ../solc/ccip/SiloedUSDCTokenPool/SiloedUSDCTokenPool.sol/SiloedUSDCTokenPool.abi.json ../solc/ccip/SiloedUSDCTokenPool/SiloedUSDCTokenPool.sol/SiloedUSDCTokenPool.bin 67fceba00fd91f20f5bac1c127dbb7543b1253989b1d2325ff3d59de7becd314
45+
siloed_usdc_token_pool: ../solc/ccip/SiloedUSDCTokenPool/SiloedUSDCTokenPool.sol/SiloedUSDCTokenPool.abi.json ../solc/ccip/SiloedUSDCTokenPool/SiloedUSDCTokenPool.sol/SiloedUSDCTokenPool.bin 4149800a69c2beba6d3278ee6a2ff7f8c88e1385581334c2f28e260d5963404d
4646
token_admin_registry: ../solc/ccip/TokenAdminRegistry/TokenAdminRegistry.sol/TokenAdminRegistry.abi.json ../solc/ccip/TokenAdminRegistry/TokenAdminRegistry.sol/TokenAdminRegistry.bin 086268b9df56e089a69a96ce3e4fd03a07a00a1c8812ba9504e31930a5c3ff1d
4747
token_pool: ../solc/ccip/TokenPool/TokenPool.sol/TokenPool.abi.json ../solc/ccip/TokenPool/TokenPool.sol/TokenPool.bin 11ccfca8caeff8fc446fab8ffb72a91853a114dd3c8f6a52fa7a46324ef2db2b
4848
token_pool_factory: ../solc/ccip/TokenPoolFactory/TokenPoolFactory.sol/TokenPoolFactory.abi.json ../solc/ccip/TokenPoolFactory/TokenPoolFactory.sol/TokenPoolFactory.bin 0264e3b1d37b4d22028774f2516e37542684c6d1de17cb36096a17afbbc44b29

0 commit comments

Comments
 (0)