Skip to content

Commit 310e250

Browse files
committed
rename token pool block confs & impl pool ftf
1 parent c80ea01 commit 310e250

24 files changed

Lines changed: 305 additions & 337 deletions

chains/evm/contracts/interfaces/IPoolV2.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ interface IPoolV2 is IERC165 {
1111
struct TokenTransferFeeConfig {
1212
uint32 destGasOverhead; // ───────────────────────╮ Gas charged to execute the token transfer on the destination chain.
1313
uint32 destBytesOverhead; // │ Data availability bytes.
14-
uint32 defaultBlockConfirmationsFeeUSDCents; // │ Fee to charge for token transfer with default block confirmations, multiples of 0.01 USD.
15-
uint32 customBlockConfirmationsFeeUSDCents; // │ Fee to charge for token transfer with custom block confirmations, multiples of 0.01 USD.
14+
uint32 finalityFeeUSDCents; // │ Fee to charge for token transfer with default block confirmations, multiples of 0.01 USD.
15+
uint32 fastFinalityFeeUSDCents; // │ Fee to charge for token transfer with custom block confirmations, multiples of 0.01 USD.
1616
// │ The following two fee is deducted from the transferred asset, not added on top.
17-
uint16 defaultBlockConfirmationsTransferFeeBps; //│ Fee in basis points for default finality transfers [0-10_000].
18-
uint16 customBlockConfirmationsTransferFeeBps; // │ Fee in basis points for custom finality transfers [0-10_000].
17+
uint16 finalityTransferFeeBps; //│ Fee in basis points for default finality transfers [0-10_000].
18+
uint16 fastFinalityTransferFeeBps; // │ Fee in basis points for custom finality transfers [0-10_000].
1919
bool isEnabled; // ───────────────────────────────╯ Whether this config is enabled.
2020
}
2121

chains/evm/contracts/pools/TokenPool.sol

Lines changed: 78 additions & 93 deletions
Large diffs are not rendered by default.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ contract CCTPThroughCCVTokenPool is TokenPool, ITypeAndVersion, AuthorizedCaller
125125
}
126126

127127
CCTPVerifier.DynamicConfig memory dynamicConfig = CCTPVerifier(verifierImpl).getDynamicConfig();
128-
transferFeeConfig.customBlockConfirmationsTransferFeeBps = dynamicConfig.fastFinalityBps;
128+
transferFeeConfig.fastFinalityTransferFeeBps = dynamicConfig.fastFinalityBps;
129129

130130
return transferFeeConfig;
131131
}

chains/evm/contracts/test/helpers/TokenPoolHelper.sol

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,15 @@ contract TokenPoolHelper is TokenPool {
8383
_onlyOffRamp(remoteChainSelector);
8484
}
8585

86-
function getCustomMinBlockConfirmations() external view returns (uint16 minBlockConfirmations) {
87-
return s_minBlockConfirmations;
88-
}
89-
9086
function getFastOutboundBucket(
9187
uint64 remoteChainSelector
9288
) external view returns (RateLimiter.TokenBucket memory bucket) {
93-
return s_customBlockConfirmationsOutboundRateLimiterConfig[remoteChainSelector];
89+
return s_fastFinalityOutboundRateLimiterConfig[remoteChainSelector];
9490
}
9591

9692
function getFastInboundBucket(
9793
uint64 remoteChainSelector
9894
) external view returns (RateLimiter.TokenBucket memory bucket) {
99-
return s_customBlockConfirmationsInboundRateLimiterConfig[remoteChainSelector];
95+
return s_fastFinalityInboundRateLimiterConfig[remoteChainSelector];
10096
}
10197
}

chains/evm/contracts/test/pools/BurnMintTokenPool/BurnMintTokenPool.lockOrBurn.t.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ contract BurnMintTokenPool_lockOrBurn is BurnMintTokenPoolSetup {
120120
}
121121

122122
function test_lockOrBurn_FeeNotApplied_LegacyLockOrBurn() public {
123-
uint16 defaultBlockConfirmationsTransferFeeBps = 100;
124-
uint16 customBlockConfirmationsTransferFeeBps = 500;
123+
uint16 finalityTransferFeeBps = 100;
124+
uint16 fastFinalityTransferFeeBps = 500;
125125
uint256 amount = 1000e18;
126126

127127
// Mint tokens to the pool so they can be burned
@@ -133,10 +133,10 @@ contract BurnMintTokenPool_lockOrBurn is BurnMintTokenPoolSetup {
133133
tokenTransferFeeConfig: IPoolV2.TokenTransferFeeConfig({
134134
destGasOverhead: 50_000,
135135
destBytesOverhead: Pool.CCIP_LOCK_OR_BURN_V1_RET_BYTES,
136-
defaultBlockConfirmationsFeeUSDCents: 0,
137-
customBlockConfirmationsFeeUSDCents: 0,
138-
defaultBlockConfirmationsTransferFeeBps: defaultBlockConfirmationsTransferFeeBps,
139-
customBlockConfirmationsTransferFeeBps: customBlockConfirmationsTransferFeeBps,
136+
finalityFeeUSDCents: 0,
137+
fastFinalityFeeUSDCents: 0,
138+
finalityTransferFeeBps: finalityTransferFeeBps,
139+
fastFinalityTransferFeeBps: fastFinalityTransferFeeBps,
140140
isEnabled: true
141141
})
142142
});

chains/evm/contracts/test/pools/LockReleaseTokenPool/LockReleaseTokenPool.lockOrBurn.t.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ contract LockReleaseTokenPool_lockOrBurn is LockReleaseTokenPoolSetup {
138138
IPoolV2.TokenTransferFeeConfig memory feeConfig = IPoolV2.TokenTransferFeeConfig({
139139
destGasOverhead: 50_000,
140140
destBytesOverhead: 32,
141-
defaultBlockConfirmationsFeeUSDCents: 0,
142-
customBlockConfirmationsFeeUSDCents: 0,
143-
defaultBlockConfirmationsTransferFeeBps: defaultFeeBps,
144-
customBlockConfirmationsTransferFeeBps: 0,
141+
finalityFeeUSDCents: 0,
142+
fastFinalityFeeUSDCents: 0,
143+
finalityTransferFeeBps: defaultFeeBps,
144+
fastFinalityTransferFeeBps: 0,
145145
isEnabled: true
146146
});
147147

chains/evm/contracts/test/pools/SiloedLockReleaseTokenPool/SiloedLockReleaseTokenPool.lockOrBurn.t.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ contract SiloedLockReleaseTokenPool_lockOrBurn is SiloedLockReleaseTokenPoolSetu
118118
IPoolV2.TokenTransferFeeConfig memory feeConfig = IPoolV2.TokenTransferFeeConfig({
119119
destGasOverhead: 50_000,
120120
destBytesOverhead: 32,
121-
defaultBlockConfirmationsFeeUSDCents: 0,
122-
customBlockConfirmationsFeeUSDCents: 0,
123-
defaultBlockConfirmationsTransferFeeBps: defaultFeeBps,
124-
customBlockConfirmationsTransferFeeBps: 0,
121+
finalityFeeUSDCents: 0,
122+
fastFinalityFeeUSDCents: 0,
123+
finalityTransferFeeBps: defaultFeeBps,
124+
fastFinalityTransferFeeBps: 0,
125125
isEnabled: true
126126
});
127127

chains/evm/contracts/test/pools/TokenPool/TokenPool.applyChainUpdates.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ contract TokenPool_applyChainUpdates is BaseTest {
119119
TokenPool.RateLimitConfigArgs[] memory customRLArgs = new TokenPool.RateLimitConfigArgs[](1);
120120
customRLArgs[0] = TokenPool.RateLimitConfigArgs({
121121
remoteChainSelector: evmChainSelector,
122-
customBlockConfirmations: true,
122+
fastFinality: true,
123123
outboundRateLimiterConfig: RateLimiter.Config({isEnabled: true, capacity: 5e20, rate: 1e18}),
124124
inboundRateLimiterConfig: RateLimiter.Config({isEnabled: true, capacity: 5e20, rate: 1e18})
125125
});

chains/evm/contracts/test/pools/TokenPool/TokenPool.applyFee.t.sol

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ import {AdvancedPoolHooksSetup} from "../AdvancedPoolHooks/AdvancedPoolHooksSetu
99

1010
contract TokenPool_applyFee is AdvancedPoolHooksSetup {
1111
function test_applyFee_CustomFinality() public {
12-
uint16 minBlockConfirmations = 5;
13-
uint16 defaultBlockConfirmationsTransferFeeBps = 100;
14-
uint16 customBlockConfirmationsTransferFeeBps = 500;
12+
bytes2 minFinality = bytes2(uint16(5));
13+
uint16 finalityTransferFeeBps = 100;
14+
uint16 fastFinalityTransferFeeBps = 500;
1515
uint256 amount = 1_000e18;
16-
s_tokenPool.setMinBlockConfirmations(minBlockConfirmations);
16+
s_tokenPool.setFinalityConfig(minFinality);
1717
TokenPool.TokenTransferFeeConfigArgs[] memory feeConfigArgs = new TokenPool.TokenTransferFeeConfigArgs[](1);
1818
feeConfigArgs[0] = TokenPool.TokenTransferFeeConfigArgs({
1919
destChainSelector: DEST_CHAIN_SELECTOR,
2020
tokenTransferFeeConfig: IPoolV2.TokenTransferFeeConfig({
2121
destGasOverhead: 50_000,
2222
destBytesOverhead: Pool.CCIP_LOCK_OR_BURN_V1_RET_BYTES,
23-
defaultBlockConfirmationsFeeUSDCents: 0,
24-
customBlockConfirmationsFeeUSDCents: 0,
25-
defaultBlockConfirmationsTransferFeeBps: defaultBlockConfirmationsTransferFeeBps,
26-
customBlockConfirmationsTransferFeeBps: customBlockConfirmationsTransferFeeBps,
23+
finalityFeeUSDCents: 0,
24+
fastFinalityFeeUSDCents: 0,
25+
finalityTransferFeeBps: finalityTransferFeeBps,
26+
fastFinalityTransferFeeBps: fastFinalityTransferFeeBps,
2727
isEnabled: true
2828
})
2929
});
@@ -37,12 +37,12 @@ contract TokenPool_applyFee is AdvancedPoolHooksSetup {
3737
localToken: address(s_token)
3838
});
3939

40-
uint256 amountAfterFee = s_tokenPool.applyFee(lockOrBurnIn, bytes2(uint16(minBlockConfirmations)));
41-
assertEq(amountAfterFee, amount - ((amount * customBlockConfirmationsTransferFeeBps) / BPS_DIVIDER));
40+
uint256 amountAfterFee = s_tokenPool.applyFee(lockOrBurnIn, minFinality);
41+
assertEq(amountAfterFee, amount - ((amount * fastFinalityTransferFeeBps) / BPS_DIVIDER));
4242
}
4343

4444
function test_applyFee_DefaultFinality() public {
45-
uint16 defaultBlockConfirmationsTransferFeeBps = 250; // 2.5%
45+
uint16 finalityTransferFeeBps = 250; // 2.5%
4646
uint256 amount = 1_000e18;
4747

4848
vm.startPrank(OWNER);
@@ -52,10 +52,10 @@ contract TokenPool_applyFee is AdvancedPoolHooksSetup {
5252
tokenTransferFeeConfig: IPoolV2.TokenTransferFeeConfig({
5353
destGasOverhead: 50_000,
5454
destBytesOverhead: Pool.CCIP_LOCK_OR_BURN_V1_RET_BYTES,
55-
defaultBlockConfirmationsFeeUSDCents: 0,
56-
customBlockConfirmationsFeeUSDCents: 0,
57-
defaultBlockConfirmationsTransferFeeBps: defaultBlockConfirmationsTransferFeeBps,
58-
customBlockConfirmationsTransferFeeBps: 0,
55+
finalityFeeUSDCents: 0,
56+
fastFinalityFeeUSDCents: 0,
57+
finalityTransferFeeBps: finalityTransferFeeBps,
58+
fastFinalityTransferFeeBps: 0,
5959
isEnabled: true
6060
})
6161
});
@@ -70,6 +70,6 @@ contract TokenPool_applyFee is AdvancedPoolHooksSetup {
7070
});
7171

7272
uint256 amountAfterFee = s_tokenPool.applyFee(lockOrBurnIn, bytes2(0));
73-
assertEq(amountAfterFee, amount - ((amount * defaultBlockConfirmationsTransferFeeBps) / BPS_DIVIDER));
73+
assertEq(amountAfterFee, amount - ((amount * finalityTransferFeeBps) / BPS_DIVIDER));
7474
}
7575
}

chains/evm/contracts/test/pools/TokenPool/TokenPool.applyTokenTransferFeeConfigUpdates.t.sol

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ contract TokenPool_applyTokenTransferFeeConfigUpdates is AdvancedPoolHooksSetup
1313
IPoolV2.TokenTransferFeeConfig memory feeConfig = IPoolV2.TokenTransferFeeConfig({
1414
destGasOverhead: 50_000,
1515
destBytesOverhead: Pool.CCIP_LOCK_OR_BURN_V1_RET_BYTES,
16-
defaultBlockConfirmationsFeeUSDCents: 100, // $1.00
17-
customBlockConfirmationsFeeUSDCents: 150, // $1.50
18-
defaultBlockConfirmationsTransferFeeBps: 100, // 1%
19-
customBlockConfirmationsTransferFeeBps: 200, // 2%
16+
finalityFeeUSDCents: 100, // $1.00
17+
fastFinalityFeeUSDCents: 150, // $1.50
18+
finalityTransferFeeBps: 100, // 1%
19+
fastFinalityTransferFeeBps: 200, // 2%
2020
isEnabled: true
2121
});
2222

@@ -36,10 +36,10 @@ contract TokenPool_applyTokenTransferFeeConfigUpdates is AdvancedPoolHooksSetup
3636
IPoolV2.TokenTransferFeeConfig memory feeConfig = IPoolV2.TokenTransferFeeConfig({
3737
destGasOverhead: 50_000,
3838
destBytesOverhead: Pool.CCIP_LOCK_OR_BURN_V1_RET_BYTES,
39-
defaultBlockConfirmationsFeeUSDCents: 100,
40-
customBlockConfirmationsFeeUSDCents: 150,
41-
defaultBlockConfirmationsTransferFeeBps: 100,
42-
customBlockConfirmationsTransferFeeBps: 200,
39+
finalityFeeUSDCents: 100,
40+
fastFinalityFeeUSDCents: 150,
41+
finalityTransferFeeBps: 100,
42+
fastFinalityTransferFeeBps: 200,
4343
isEnabled: true
4444
});
4545

@@ -90,10 +90,10 @@ contract TokenPool_applyTokenTransferFeeConfigUpdates is AdvancedPoolHooksSetup
9090
IPoolV2.TokenTransferFeeConfig memory feeConfig = IPoolV2.TokenTransferFeeConfig({
9191
destGasOverhead: 50_000,
9292
destBytesOverhead: Pool.CCIP_LOCK_OR_BURN_V1_RET_BYTES,
93-
defaultBlockConfirmationsFeeUSDCents: 0,
94-
customBlockConfirmationsFeeUSDCents: 0,
95-
defaultBlockConfirmationsTransferFeeBps: uint16(BPS_DIVIDER),
96-
customBlockConfirmationsTransferFeeBps: 0,
93+
finalityFeeUSDCents: 0,
94+
fastFinalityFeeUSDCents: 0,
95+
finalityTransferFeeBps: uint16(BPS_DIVIDER),
96+
fastFinalityTransferFeeBps: 0,
9797
isEnabled: true
9898
});
9999

@@ -109,10 +109,10 @@ contract TokenPool_applyTokenTransferFeeConfigUpdates is AdvancedPoolHooksSetup
109109
IPoolV2.TokenTransferFeeConfig memory feeConfig = IPoolV2.TokenTransferFeeConfig({
110110
destGasOverhead: 50_000,
111111
destBytesOverhead: Pool.CCIP_LOCK_OR_BURN_V1_RET_BYTES,
112-
defaultBlockConfirmationsFeeUSDCents: 0,
113-
customBlockConfirmationsFeeUSDCents: 0,
114-
defaultBlockConfirmationsTransferFeeBps: 0,
115-
customBlockConfirmationsTransferFeeBps: uint16(BPS_DIVIDER),
112+
finalityFeeUSDCents: 0,
113+
fastFinalityFeeUSDCents: 0,
114+
finalityTransferFeeBps: 0,
115+
fastFinalityTransferFeeBps: uint16(BPS_DIVIDER),
116116
isEnabled: true
117117
});
118118

@@ -130,10 +130,10 @@ contract TokenPool_applyTokenTransferFeeConfigUpdates is AdvancedPoolHooksSetup
130130
IPoolV2.TokenTransferFeeConfig memory feeConfig = IPoolV2.TokenTransferFeeConfig({
131131
destGasOverhead: 0, // Zero gas overhead
132132
destBytesOverhead: Pool.CCIP_LOCK_OR_BURN_V1_RET_BYTES,
133-
defaultBlockConfirmationsFeeUSDCents: 100,
134-
customBlockConfirmationsFeeUSDCents: 150,
135-
defaultBlockConfirmationsTransferFeeBps: 100,
136-
customBlockConfirmationsTransferFeeBps: 200,
133+
finalityFeeUSDCents: 100,
134+
fastFinalityFeeUSDCents: 150,
135+
finalityTransferFeeBps: 100,
136+
fastFinalityTransferFeeBps: 200,
137137
isEnabled: true // Enabled with zero gas
138138
});
139139

@@ -149,10 +149,10 @@ contract TokenPool_applyTokenTransferFeeConfigUpdates is AdvancedPoolHooksSetup
149149
IPoolV2.TokenTransferFeeConfig memory feeConfig = IPoolV2.TokenTransferFeeConfig({
150150
destGasOverhead: 50_000,
151151
destBytesOverhead: Pool.CCIP_LOCK_OR_BURN_V1_RET_BYTES,
152-
defaultBlockConfirmationsFeeUSDCents: 100,
153-
customBlockConfirmationsFeeUSDCents: 150,
154-
defaultBlockConfirmationsTransferFeeBps: 100,
155-
customBlockConfirmationsTransferFeeBps: 200,
152+
finalityFeeUSDCents: 100,
153+
fastFinalityFeeUSDCents: 150,
154+
finalityTransferFeeBps: 100,
155+
fastFinalityTransferFeeBps: 200,
156156
isEnabled: false // Cannot set isEnabled: false directly
157157
});
158158

0 commit comments

Comments
 (0)