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
11 changes: 11 additions & 0 deletions contracts/src/v0.8/ccip/pools/GHO/UpgradeableBurnMintTokenPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {IRouter} from "../../interfaces/IRouter.sol";
/// - Implementation of Initializable to allow upgrades
/// - Move of allowlist and router definition to initialization stage
/// - Inclusion of rate limit admin who may configure rate limits in addition to owner
/// - Addition of authorized function to to directly burn liquidity, thereby reducing the facilitator's bucket level.
/// - Modifications from inherited contract (see contract for more details):
/// - UpgradeableTokenPool: Modify `onlyOnRamp` & `onlyOffRamp` modifier to accept transactions from ProxyPool
contract UpgradeableBurnMintTokenPool is Initializable, UpgradeableBurnMintTokenPoolAbstract, ITypeAndVersion {
Expand Down Expand Up @@ -84,6 +85,16 @@ contract UpgradeableBurnMintTokenPool is Initializable, UpgradeableBurnMintToken
_setRateLimitConfig(remoteChainSelector, outboundConfig, inboundConfig);
}

/// @notice Burn an amount of tokens with no additional logic.
/// @dev This GHO-specific functionality is designed for migrating bucket levels between
/// facilitators. The new pool is expected to mint amount of tokens, while the old pool
/// burns an equivalent amount. This ensures the facilitator can be offboarded, as all
/// liquidity minted by it must be fully burned
/// @param amount The amount of tokens to burn.
function directBurn(uint256 amount) external onlyOwner {
_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..f19106fd4d 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,101 @@
// SPDX-License-Identifier: BUSL-1.1
-pragma solidity 0.8.19;
+pragma solidity ^0.8.0;
Expand All @@ -28,6 +28,7 @@ index 9af0f22f4c..a5cecc0430 100644
+/// - Implementation of Initializable to allow upgrades
+/// - Move of allowlist and router definition to initialization stage
+/// - Inclusion of rate limit admin who may configure rate limits in addition to owner
+/// - Addition of authorized function to to directly burn liquidity, thereby reducing the facilitator's bucket level.
+/// - Modifications from inherited contract (see contract for more details):
+/// - UpgradeableTokenPool: Modify `onlyOnRamp` & `onlyOffRamp` modifier to accept transactions from ProxyPool
+contract UpgradeableBurnMintTokenPool is Initializable, UpgradeableBurnMintTokenPoolAbstract, ITypeAndVersion {
Expand Down Expand Up @@ -106,6 +107,16 @@ index 9af0f22f4c..a5cecc0430 100644
+ _setRateLimitConfig(remoteChainSelector, outboundConfig, inboundConfig);
+ }
+
+ /// @notice Burn an amount of tokens with no additional logic.
+ /// @dev This GHO-specific functionality is designed for migrating bucket levels between
+ /// facilitators. The new pool is expected to mint amount of tokens, while the old pool
+ /// burns an equivalent amount. This ensures the facilitator can be offboarded, as all
+ /// liquidity minted by it must be fully burned
+ /// @param amount The amount of tokens to burn.
+ function directBurn(uint256 amount) external onlyOwner {
+ _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_directBurn is GhoTokenPoolRemoteSetup {
function testDirectBurnOnlyOwner() public {
vm.startPrank(STRANGER);
vm.expectRevert("Only callable by owner");
s_pool.directBurn(13e7);
}

function testFuzzDirectBurnSuccess(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.directBurn(amount);

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