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

DirectBurn on RemotePool #21

Merged
merged 10 commits into from
Jan 2, 2025
12 changes: 12 additions & 0 deletions contracts/src/v0.8/ccip/pools/GHO/UpgradeableBurnMintTokenPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ contract UpgradeableBurnMintTokenPool is Initializable, UpgradeableBurnMintToken
_setRateLimitConfig(remoteChainSelector, outboundConfig, inboundConfig);
}

/// @notice This function allows the owner to burn `amount` of the pool's token. This is
/// expected to be called while migrating facilitators by offboarding this facilitator in
/// favor of a new token pool.
/// @dev New token pool should mint and transfer liquidity to this pool (since this pool
/// does not hold tokens at any point in time) which can be burnt and hence will reduce
/// the facilitator bucket level on GHO. The naming convention mimics that in LockRelease
/// type token pools for the sake of consistency.
/// @param amount The amount of tokens to burn.
function withdrawLiquidity(uint256 amount) external onlyOwner {
DhairyaSethi marked this conversation as resolved.
Show resolved Hide resolved
IBurnMintERC20(address(i_token)).burn(amount);
}

/// @inheritdoc UpgradeableBurnMintTokenPoolAbstract
function _burn(uint256 amount) internal virtual override {
IBurnMintERC20(address(i_token)).burn(amount);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
```diff
diff --git a/src/v0.8/ccip/pools/BurnMintTokenPool.sol b/src/v0.8/ccip/pools/GHO/UpgradeableBurnMintTokenPool.sol
index 9af0f22f4c..a5cecc0430 100644
index 9af0f22f4c..3ce2c5a9ab 100644
--- a/src/v0.8/ccip/pools/BurnMintTokenPool.sol
+++ b/src/v0.8/ccip/pools/GHO/UpgradeableBurnMintTokenPool.sol
@@ -1,28 +1,90 @@
@@ -1,28 +1,102 @@
// SPDX-License-Identifier: BUSL-1.1
-pragma solidity 0.8.19;
+pragma solidity ^0.8.0;
Expand Down Expand Up @@ -106,6 +106,18 @@ index 9af0f22f4c..a5cecc0430 100644
+ _setRateLimitConfig(remoteChainSelector, outboundConfig, inboundConfig);
+ }
+
+ /// @notice This function allows the owner to burn `amount` of the pool's token. This is
+ /// expected to be called while migrating facilitators by offboarding this facilitator in
+ /// favor of a new token pool.
+ /// @dev New token pool should mint and transfer liquidity to this pool (since this pool
+ /// does not hold tokens at any point in time) which can be burnt and hence will reduce
+ /// the facilitator bucket level on GHO. The naming convention mimics that in LockRelease
+ /// type token pools for the sake of consistency.
+ /// @param amount The amount of tokens to burn.
+ function withdrawLiquidity(uint256 amount) external onlyOwner {
+ IBurnMintERC20(address(i_token)).burn(amount);
+ }
+
+ /// @inheritdoc UpgradeableBurnMintTokenPoolAbstract
function _burn(uint256 amount) internal virtual override {
IBurnMintERC20(address(i_token)).burn(amount);
Expand Down
21 changes: 21 additions & 0 deletions contracts/src/v0.8/ccip/test/pools/GHO/GhoTokenPoolRemote.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,24 @@ contract GhoTokenPoolRemote_proxyPool is GhoTokenPoolRemoteSetup {
assertEq(s_pool.getProxyPool(), proxyPool);
}
}

contract GhoTokenPoolRemote_withdrawLiquidity is GhoTokenPoolRemoteSetup {
function testWithdrawLiquidityOnlyOwner() public {
vm.startPrank(STRANGER);
vm.expectRevert("Only callable by owner");
s_pool.withdrawLiquidity(13e7);
}

function testFuzzWithdrawLiquiditySuccess(uint256 amount) public {
amount = bound(amount, 1, type(uint128).max); // bound to bucket capacity
// prank previously bridged supply
vm.startPrank(address(s_pool));
s_burnMintERC677.mint(address(s_pool), amount);

vm.startPrank(AAVE_DAO);
s_pool.withdrawLiquidity(amount);

assertEq(s_burnMintERC677.balanceOf(address(s_pool)), 0);
assertEq(GhoToken(address(s_burnMintERC677)).getFacilitator(address(s_pool)).bucketLevel, 0);
}
}
Loading