11``` diff
22diff --git a/src/v0.8/ccip/pools/LockReleaseTokenPool.sol b/src/v0.8/ccip/pools/GHO/UpgradeableLockReleaseTokenPool.sol
3- index ecc28a14dd..bd46601d55 100644
3+ index ecc28a14dd..21bd2df50d 100644
44--- a/src/v0.8/ccip/pools/LockReleaseTokenPool.sol
55+++ b/src/v0.8/ccip/pools/GHO/UpgradeableLockReleaseTokenPool.sol
6- @@ -1,25 +1,41 @@
6+ @@ -1,25 +1,44 @@
77 // SPDX-License-Identifier: BUSL-1.1
88- pragma solidity 0.8.24;
99+ pragma solidity ^0.8.0;
@@ -35,6 +35,9 @@ index ecc28a14dd..bd46601d55 100644
3535+ /// - Implementation of Initializable to allow upgrades
3636+ /// - Move of allowlist and router definition to initialization stage
3737+ /// - Addition of a bridge limit to regulate the maximum amount of tokens that can be transferred out (burned/locked)
38+ + /// - Increment bridged amount on transferLiquidity, reverts if amount + current bridged > bridge limit
39+ + /// - Increment bridged amount on provideLiquidity, reverts if amount + current bridged > bridge limit
40+ + /// - Decrement bridged amount on withdrawLiquidity, reverts if amount > gho.balanceOf(this)
3841
3942 /// @notice Token pool used for tokens on their native chain. This uses a lock and release mechanism.
4043 /// Because of lock/unlock requiring liquidity, this pool contract also has function to add and remove
@@ -54,7 +57,7 @@ index ecc28a14dd..bd46601d55 100644
5457
5558 event LiquidityTransferred(address indexed from, uint256 amount);
5659
57- @@ -33,30 +49 ,69 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion
60+ @@ -33,30 +52 ,69 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion
5861 /// @notice The address of the rebalancer.
5962 address internal s_rebalancer;
6063
@@ -133,7 +136,7 @@ index ecc28a14dd..bd46601d55 100644
133136 }
134137
135138 /// @notice Release tokens from the pool to the recipient
136- @@ -64,11 +119 ,18 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion
139+ @@ -64,11 +122 ,18 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion
137140 function releaseOrMint(
138141 Pool.ReleaseOrMintInV1 calldata releaseOrMintIn
139142 ) external virtual override returns (Pool.ReleaseOrMintOutV1 memory) {
@@ -154,7 +157,7 @@ index ecc28a14dd..bd46601d55 100644
154157
155158 // Release to the recipient
156159 getToken().safeTransfer(releaseOrMintIn.receiver, localAmount);
157- @@ -79,9 +141 ,7 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion
160+ @@ -79,9 +144 ,7 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion
158161 }
159162
160163 /// @inheritdoc IERC165
@@ -165,7 +168,7 @@ index ecc28a14dd..bd46601d55 100644
165168 return interfaceId == type(ILiquidityContainer).interfaceId || super.supportsInterface(interfaceId);
166169 }
167170
168- @@ -93,12 +153 ,47 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion
171+ @@ -93,12 +156 ,47 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion
169172
170173 /// @notice Sets the LiquidityManager address.
171174 /// @dev Only callable by the owner.
@@ -216,18 +219,23 @@ index ecc28a14dd..bd46601d55 100644
216219 /// @notice Checks if the pool can accept liquidity.
217220 /// @return true if the pool can accept liquidity, false otherwise.
218221 function canAcceptLiquidity() external view returns (bool) {
219- @@ -107,9 +202,7 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion
222+ @@ -107,23 +205,24 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion
220223
221224 /// @notice Adds liquidity to the pool. The tokens should be approved first.
222225 /// @param amount The amount of liquidity to provide.
223226- function provideLiquidity(
224227- uint256 amount
225228- ) external {
229+ + /// @dev amount being added + currentBridged needs to be within the bridge limit, otherwise increase bridge limit first
226230+ function provideLiquidity(uint256 amount) external {
227231 if (!i_acceptLiquidity) revert LiquidityNotAccepted();
228232 if (s_rebalancer != msg.sender) revert Unauthorized(msg.sender);
229233
230- @@ -119,9 +212,7 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion
234+ + if ((s_currentBridged += amount) > s_bridgeLimit) revert BridgeLimitExceeded(s_bridgeLimit);
235+ +
236+ i_token.safeTransferFrom(msg.sender, address(this), amount);
237+ emit LiquidityAdded(msg.sender, amount);
238+ }
231239
232240 /// @notice Removed liquidity to the pool. The tokens will be sent to msg.sender.
233241 /// @param amount The amount of liquidity to remove.
@@ -237,13 +245,23 @@ index ecc28a14dd..bd46601d55 100644
237245+ function withdrawLiquidity(uint256 amount) external {
238246 if (s_rebalancer != msg.sender) revert Unauthorized(msg.sender);
239247
248+ + s_currentBridged -= amount;
249+ +
240250 if (i_token.balanceOf(address(this)) < amount) revert InsufficientLiquidity();
241- @@ -141,7 +232,7 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion
251+ i_token.safeTransfer(msg.sender, amount);
252+ emit LiquidityRemoved(msg.sender, amount);
253+ @@ -138,10 +237,13 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion
254+ /// changing which pool CCIP uses, to ensure both pools can operate. Then the pool should be changed in the
255+ /// TokenAdminRegistry, which will activate the new pool. All new transactions will use the new pool and its
256+ /// liquidity. Finally, the remaining liquidity can be transferred to the new pool using this function one more time.
257+ + /// @dev amount being added + currentBridged needs to be within the bridge limit, otherwise increase bridge limit first
242258 /// @param from The address of the old pool.
243259 /// @param amount The amount of liquidity to transfer.
244260 function transferLiquidity(address from, uint256 amount) external onlyOwner {
245261- LockReleaseTokenPool(from).withdrawLiquidity(amount);
246262+ UpgradeableLockReleaseTokenPool(from).withdrawLiquidity(amount);
263+ +
264+ + if ((s_currentBridged += amount) > s_bridgeLimit) revert BridgeLimitExceeded(s_bridgeLimit);
247265
248266 emit LiquidityTransferred(from, amount);
249267 }
0 commit comments