Skip to content

Commit

Permalink
add: final upgrade script for celo reserve
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpy committed Dec 12, 2024
1 parent bfa2113 commit e869dcb
Show file tree
Hide file tree
Showing 2 changed files with 310 additions and 133 deletions.
20 changes: 16 additions & 4 deletions contracts/utils/ProtoclUpgradeV4Mento.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ contract ProtocolUpgradeV4Mento {
IBancorExchangeProvider.PoolExchange memory _exchange,
address _mentoExchange,
address _mentoController,
address _distHelper
address _distHelper,
uint256 totalGlobalSupply
) external {
require(msg.sender == address(avatar), "only avatar can call this");

uint32 expansionFrequency = 1 days;
uint64 expansionRate = 288617289021952; //10% a year = ((1e18 - expansionRate)/1e18)^365=0.9
// uint32 expansionFrequency = 1 days;
// uint64 expansionRate = 288617289021952; //10% a year = ((1e18 - expansionRate)/1e18)^365=0.9
uint256 cUSDBalance = ERC20(_exchange.reserveAsset).balanceOf(
MentoExchange(_mentoExchange).reserve()
);
Expand Down Expand Up @@ -62,7 +63,7 @@ contract ProtocolUpgradeV4Mento {
address(_mentoController),
abi.encodeCall(
IGoodDollarExpansionController.setExpansionConfig,
(exchangeId, expansionRate, expansionFrequency)
(exchangeId, 288617289021952, 1 days) //10% a year = ((1e18 - expansionRate)/1e18)^365=0.9 frequency 1 day
),
address(avatar),
0
Expand All @@ -80,6 +81,17 @@ contract ProtocolUpgradeV4Mento {
);
require(ok, "setDistribuitionHelper failed");

// mint exit liquidity to bridge
uint256 toMint = totalGlobalSupply - gdSupply;
require(
_controller.mintTokens(
toMint,
0xa3247276DbCC76Dd7705273f766eB3E8a5ecF4a5,
address(avatar)
),
"bridge minting failed"
);

// prevent executing again
require(_controller.unregisterSelf(avatar), "unregistering failed");
avatar = address(0);
Expand Down
Loading

0 comments on commit e869dcb

Please sign in to comment.