Skip to content

Commit

Permalink
Support Mantle deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinNagpal committed Jan 2, 2025
1 parent ab57066 commit f2c299e
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 7 deletions.
11 changes: 10 additions & 1 deletion forge/script/marketupdates/helpers/BridgeHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ library BridgeHelper {
uint256 proposalId = arbitrumBridgeReceiver.proposalCount();
arbitrumBridgeReceiver.executeProposal(proposalId);

} else if (chain == ChainAddresses.Chain.OPTIMISM || chain == ChainAddresses.Chain.BASE) {
} else if (chain == ChainAddresses.Chain.OPTIMISM || chain == ChainAddresses.Chain.BASE || chain == ChainAddresses.Chain.MANTLE) {
// Common setup for Optimism and Base
address crossDomainMessenger = 0x4200000000000000000000000000000000000007;
vm.prank(crossDomainMessenger);
Expand All @@ -66,6 +66,15 @@ library BridgeHelper {
uint256 proposalId = optimismBridgeReceiver.proposalCount();
optimismBridgeReceiver.executeProposal(proposalId);

} if (chain == ChainAddresses.Chain.MANTLE) {
OptimismBridgeReceiver optimismBridgeReceiver = OptimismBridgeReceiver(payable(ChainAddresses.MANTLE_BRIDGE_RECEIVER));

address(optimismBridgeReceiver).call(l2Payload);

uint256 delay = ITimelock(ChainAddresses.MANTLE_LOCAL_TIMELOCK).delay();
vm.warp(block.timestamp + delay + 10);
uint256 proposalId = optimismBridgeReceiver.proposalCount();
optimismBridgeReceiver.executeProposal(proposalId);
} else {
// For Base chain
BaseBridgeReceiver baseBridgeReceiver = BaseBridgeReceiver(payable(ChainAddresses.BASE_BRIDGE_RECEIVER));
Expand Down
28 changes: 22 additions & 6 deletions forge/script/marketupdates/helpers/ChainAddresses.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ library ChainAddresses {
SCROLL,
OPTIMISM,
MAINNET_SEPOLIA,
OP_SEPOLIA
OP_SEPOLIA,
MANTLE
}


Expand Down Expand Up @@ -84,6 +85,17 @@ library ChainAddresses {
address constant public OPTIMISM_MARKET_UPDATE_PAUSE_GUARDIAN = 0x3fFd6c073a4ba24a113B18C8F373569640916A45; // See - https://optimistic.etherscan.io/address/0xE36A30D249f7761327fd973001A32010b521b6Fd#readProxyContract
address constant public OPTIMISM_MARKET_UPDATE_PROPOSAL_GUARDIAN = 0x3fFd6c073a4ba24a113B18C8F373569640916A45; // See - https://optimistic.etherscan.io/address/0xE36A30D249f7761327fd973001A32010b521b6Fd#readProxyContract

address constant public MANTLE_MARKET_ADMIN = 0x7e14050080306cd36b47DE61ce604b3a1EC70c4e;
address constant public MANTLE_MARKET_UPDATE_PAUSE_GUARDIAN = 0x2127338F0ff71Ecc779dce407D95C7D32f7C5F45;
address constant public MANTLE_MARKET_UPDATE_PROPOSAL_GUARDIAN = 0x2127338F0ff71Ecc779dce407D95C7D32f7C5F45;

address constant public MANTLE_LOCAL_TIMELOCK = 0x16C7B5C1b10489F4B111af11de2Bd607c9728107; // See - https://mantlescan.xyz/address/0x6d903f6003cca6255D85CcA4D3B5E5146dC33925
address constant public MANTLE_CONFIGURATOR_PROXY = 0xb77Cd4cD000957283D8BAf53cD782ECf029cF7DB; // See - https://mantlescan.xyz/address/0xb77Cd4cD000957283D8BAf53cD782ECf029cF7DB
address constant public MANTLE_COMET_PROXY_ADMIN = 0xe268B436E75648aa0639e2088fa803feA517a0c7; // See - https://mantlescan.xyz/address/0xe268B436E75648aa0639e2088fa803feA517a0c7
address constant public MANTLE_BRIDGE_RECEIVER = 0xc91EcA15747E73d6dd7f616C49dAFF37b9F1B604; // See - https://mantlescan.xyz/address/0xc91EcA15747E73d6dd7f616C49dAFF37b9F1B604



function getChainAddresses(Chain chain) internal pure returns (ChainAddressesStruct memory) {
if (chain == Chain.ETHEREUM) {
return ChainAddressesStruct({
Expand Down Expand Up @@ -139,7 +151,7 @@ library ChainAddresses {
marketUpdateProposalGuardian: OPTIMISM_MARKET_UPDATE_PROPOSAL_GUARDIAN,
marketAdmin: OPTIMISM_MARKET_ADMIN
});
} else if (chain == Chain.OP_SEPOLIA) {
} else if (chain == Chain.OP_SEPOLIA) {
return ChainAddressesStruct({
governorTimelockAddress: OPTIMISM_LOCAL_TIMELOCK,
configuratorProxyAddress: OPTIMISM_CONFIGURATOR_PROXY,
Expand All @@ -148,11 +160,11 @@ library ChainAddresses {
marketUpdateProposalGuardian: OPTIMISM_MARKET_UPDATE_PROPOSAL_GUARDIAN,
marketAdmin: OPTIMISM_MARKET_ADMIN
});
} else if (chain == Chain.MAINNET_SEPOLIA) {
} else if (chain == Chain.MANTLE) {
return ChainAddressesStruct({
governorTimelockAddress: MAINNET_GOVERNOR_TIMELOCK,
configuratorProxyAddress: MAINNET_CONFIGURATOR_PROXY,
cometProxyAdminAddress: MAINNET_COMET_PROXY_ADMIN,
governorTimelockAddress: MANTLE_LOCAL_TIMELOCK,
configuratorProxyAddress: MANTLE_CONFIGURATOR_PROXY,
cometProxyAdminAddress: MANTLE_COMET_PROXY_ADMIN,
marketUpdatePauseGuardian: address(0),
marketUpdateProposalGuardian: address(0),
marketAdmin: address(0)
Expand All @@ -175,6 +187,8 @@ library ChainAddresses {
return SCROLL_LOCAL_TIMELOCK;
} else if (chain == Chain.OPTIMISM) {
return OPTIMISM_LOCAL_TIMELOCK;
} else if (chain == Chain.MANTLE) {
return MANTLE_LOCAL_TIMELOCK;
} else {
revert("MarketUpdateAddresses: Chain not supported");
}
Expand All @@ -197,6 +211,8 @@ library ChainAddresses {
return Chain.OP_SEPOLIA;
} else if(chainId == 11155111) {
return Chain.MAINNET_SEPOLIA;
} else if(chainId == 5000) {
return Chain.MANTLE;
} else {
revert("MarketUpdateAddresses: Chain not supported");
}
Expand Down
9 changes: 9 additions & 0 deletions forge/script/marketupdates/helpers/MarketAddresses.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ library MarketAddresses {
address constant public OPTIMISM_USDT_MARKET = 0x995E394b8B2437aC8Ce61Ee0bC610D617962B214; // See - https://optimistic.etherscan.io/address/0x995E394b8B2437aC8Ce61Ee0bC610D617962B214
address constant public OPTIMISM_ETH_MARKET = 0xE36A30D249f7761327fd973001A32010b521b6Fd; // See - https://optimistic.etherscan.io/address/0xE36A30D249f7761327fd973001A32010b521b6Fd

address constant public MANTLE_USDe_MARKET = 0x606174f62cd968d8e684c645080fa694c1D7786E; // See - https://mantlescan.xyz/address/0x606174f62cd968d8e684c645080fa694c1D7786E

function getMarketsForChain(ChainAddresses.Chain chain) internal pure returns (MarketInfo[] memory) {
if (chain == ChainAddresses.Chain.ETHEREUM) {
MarketInfo[] memory markets = new MarketInfo[](4);
Expand Down Expand Up @@ -106,6 +108,13 @@ library MarketAddresses {
cometProxyAddress: SCROLL_USDC_MARKET
});
return markets;
} else if (chain == ChainAddresses.Chain.MANTLE) {
MarketInfo[] memory markets = new MarketInfo[](1);
markets[0] = MarketInfo({
baseTokenSymbol: "USDe",
cometProxyAddress: MANTLE_USDe_MARKET
});
return markets;
} else if (chain == ChainAddresses.Chain.OPTIMISM) {
MarketInfo[] memory markets = new MarketInfo[](3);
markets[0] = MarketInfo({
Expand Down
35 changes: 35 additions & 0 deletions forge/test/MarketUpdateMantleDeploymentTest.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
pragma solidity 0.8.15;

import {Test} from "forge-std/Test.sol";
import "@comet-contracts/Comet.sol";
import "@comet-contracts/marketupdates/MarketUpdateProposer.sol";

import "../script/marketupdates/helpers/GovernanceHelper.sol";
import "../script/marketupdates/helpers/MarketUpdateAddresses.sol";
import "../script/marketupdates/helpers/MarketUpdateContractsDeployer.sol";
import "../script/marketupdates/helpers/ChainAddresses.sol";
import "../script/marketupdates/helpers/MarketAddresses.sol";
import "../script/marketupdates/helpers/GovernanceHelper.sol";
import "./MarketUpdateDeploymentBaseTest.sol";

contract MarketUpdateMantleDeploymentTest is Test, MarketUpdateDeploymentBaseTest {

MarketUpdateContractsDeployer.DeployedContracts deployedContracts;

function setUp() public {
vm.createSelectFork("mantle");
deployedContracts = createMarketUpdateDeploymentForL2(vm, ChainAddresses.Chain.MANTLE);
}

function test_MantleUSDeDeployment() public {
console.log("Create Supply Kink Proposal for USDCe Market and verify after execution");

updateAndVerifySupplyKinkInL2(
vm,
"cUSDev3",
ChainAddresses.Chain.MANTLE,
MarketAddresses.MANTLE_USDe_MARKET,
deployedContracts
);
}
}
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ optimism = "${OPTIMISM_RPC_URL}"
scroll = "${SCROLL_RPC_URL}"
base = "${BASE_RPC_URL}"
sepolia = "${SEPOLIA_RPC_URL}"
mantle = "${MANTLE_RPC_URL}"

0 comments on commit f2c299e

Please sign in to comment.