Skip to content

Commit 13d9c47

Browse files
committed
feat: mantle capo
1 parent e7ad7cc commit 13d9c47

File tree

5 files changed

+91
-0
lines changed

5 files changed

+91
-0
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ deploy-eurc-base :; forge script scripts/DeployBase.s.sol:DeployEURCBase --rpc-u
6161

6262
deploy-rlusd-mainnet :; forge script scripts/DeployEthereum.s.sol:DeployRLUSDEthereum --rpc-url mainnet $(common-flags)
6363

64+
deploy-usdc-mantle :; FOUNDRY_PROFILE=mantle forge script scripts/DeployMantle.s.sol:DeployUSDCMantle --rpc-url mantle $(common-flags)
65+
deploy-usdt-mantle :; FOUNDRY_PROFILE=mantle forge script scripts/DeployMantle.s.sol:DeployUSDTMantle --rpc-url mantle $(common-flags)
66+
6467
# Utilities
6568
download :; cast etherscan-source --chain ${chain} -d src/etherscan/${chain}_${address} ${address}
6669
git-diff :

foundry.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ scroll="${RPC_SCROLL}"
5151
zksync = "${RPC_ZKSYNC}"
5252
linea = "${RPC_LINEA}"
5353
sonic = "${RPC_SONIC}"
54+
mantle = "${RPC_MANTLE}"
5455

5556
[etherscan]
5657
mainnet = { key="${ETHERSCAN_API_KEY_MAINNET}", chainId=1 }
@@ -68,5 +69,6 @@ scroll = { key="${ETHERSCAN_API_KEY_SCROLL}", chainId=534352 }
6869
zksync = { key="${ETHERSCAN_API_KEY_ZKSYNC}", chain = 324 }
6970
linea = { key="${ETHERSCAN_API_KEY_LINEA}", chain = 59144 }
7071
sonic = { key="${ETHERSCAN_API_KEY_SONIC}", chain = 146 }
72+
mantle = { key = "${ETHERSCAN_API_KEY_MANTLE}", chainId = 5000 }
7173

7274
# See more config options https://github.com/gakonst/foundry/tree/master/config

scripts/DeployMantle.s.sol

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity ^0.8.0;
3+
4+
import {GovV3Helpers} from 'aave-helpers/GovV3Helpers.sol';
5+
import {MantleScript} from 'solidity-utils/contracts/utils/ScriptUtils.sol';
6+
import {AaveV3Mantle} from 'aave-address-book/AaveV3Mantle.sol';
7+
import {PriceCapAdapterStable, IPriceCapAdapterStable} from '../src/contracts/PriceCapAdapterStable.sol';
8+
import {IPriceCapAdapter, IChainlinkAggregator} from '../src/interfaces/IPriceCapAdapter.sol';
9+
10+
library CapAdaptersCodeMantle {
11+
address public constant USDC_PRICE_FEED = 0x22b422CECb0D4Bd5afF3EA999b048FA17F5263bD;
12+
address public constant USDT_PRICE_FEED = 0xd86048D5e4fe96157CE03Ae519A9045bEDaa6551;
13+
14+
function USDCAdapterCode() internal pure returns (bytes memory) {
15+
return
16+
abi.encodePacked(
17+
type(PriceCapAdapterStable).creationCode,
18+
abi.encode(
19+
IPriceCapAdapterStable.CapAdapterStableParams({
20+
aclManager: AaveV3Mantle.ACL_MANAGER,
21+
assetToUsdAggregator: IChainlinkAggregator(USDC_PRICE_FEED),
22+
adapterDescription: 'Capped USDC/USD',
23+
priceCap: int256(1.04 * 1e8)
24+
})
25+
)
26+
);
27+
}
28+
29+
function USDTAdapterCode() internal pure returns (bytes memory) {
30+
return
31+
abi.encodePacked(
32+
type(PriceCapAdapterStable).creationCode,
33+
abi.encode(
34+
IPriceCapAdapterStable.CapAdapterStableParams({
35+
aclManager: AaveV3Mantle.ACL_MANAGER,
36+
assetToUsdAggregator: IChainlinkAggregator(USDT_PRICE_FEED),
37+
adapterDescription: 'Capped USDT/USD',
38+
priceCap: int256(1.04 * 1e8)
39+
})
40+
)
41+
);
42+
}
43+
}
44+
45+
contract DeployUSDCMantle is MantleScript {
46+
function run() external broadcast {
47+
GovV3Helpers.deployDeterministic(CapAdaptersCodeMantle.USDCAdapterCode());
48+
}
49+
}
50+
51+
contract DeployUSDTMantle is MantleScript {
52+
function run() external broadcast {
53+
GovV3Helpers.deployDeterministic(CapAdaptersCodeMantle.USDTAdapterCode());
54+
}
55+
}
56+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity ^0.8.0;
3+
4+
import '../BaseStableTest.sol';
5+
import {CapAdaptersCodeMantle} from '../../scripts/DeployMantle.s.sol';
6+
7+
contract USDCMantlePriceCapAdapterTest is BaseStableTest {
8+
constructor()
9+
BaseStableTest(
10+
CapAdaptersCodeMantle.USDCAdapterCode(),
11+
10,
12+
ForkParams({network: 'mantle', blockNumber: 78380776})
13+
)
14+
{}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity ^0.8.0;
3+
4+
import '../BaseStableTest.sol';
5+
import {CapAdaptersCodeMantle} from '../../scripts/DeployMantle.s.sol';
6+
7+
contract USDTMantlePriceCapAdapterTest is BaseStableTest {
8+
constructor()
9+
BaseStableTest(
10+
CapAdaptersCodeMantle.USDTAdapterCode(),
11+
10,
12+
ForkParams({network: 'mantle', blockNumber: 78380776})
13+
)
14+
{}
15+
}

0 commit comments

Comments
 (0)