Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ deploy-eurc-base :; forge script scripts/DeployBase.s.sol:DeployEURCBase --rpc-u

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

deploy-usdc-mantle :; FOUNDRY_PROFILE=mantle forge script scripts/DeployMantle.s.sol:DeployUSDCMantle --rpc-url mantle $(common-flags)
deploy-usdt-mantle :; FOUNDRY_PROFILE=mantle forge script scripts/DeployMantle.s.sol:DeployUSDTMantle --rpc-url mantle $(common-flags)

# Utilities
download :; cast etherscan-source --chain ${chain} -d src/etherscan/${chain}_${address} ${address}
git-diff :
Expand Down
2 changes: 2 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ scroll="${RPC_SCROLL}"
zksync = "${RPC_ZKSYNC}"
linea = "${RPC_LINEA}"
sonic = "${RPC_SONIC}"
mantle = "${RPC_MANTLE}"

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

# See more config options https://github.com/gakonst/foundry/tree/master/config
56 changes: 56 additions & 0 deletions scripts/DeployMantle.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import {GovV3Helpers} from 'aave-helpers/GovV3Helpers.sol';
import {MantleScript} from 'solidity-utils/contracts/utils/ScriptUtils.sol';
import {AaveV3Mantle} from 'aave-address-book/AaveV3Mantle.sol';
import {PriceCapAdapterStable, IPriceCapAdapterStable} from '../src/contracts/PriceCapAdapterStable.sol';
import {IPriceCapAdapter, IChainlinkAggregator} from '../src/interfaces/IPriceCapAdapter.sol';

library CapAdaptersCodeMantle {
address public constant USDC_PRICE_FEED = 0x22b422CECb0D4Bd5afF3EA999b048FA17F5263bD;
address public constant USDT_PRICE_FEED = 0xd86048D5e4fe96157CE03Ae519A9045bEDaa6551;

function USDCAdapterCode() internal pure returns (bytes memory) {
return
abi.encodePacked(
type(PriceCapAdapterStable).creationCode,
abi.encode(
IPriceCapAdapterStable.CapAdapterStableParams({
aclManager: AaveV3Mantle.ACL_MANAGER,
assetToUsdAggregator: IChainlinkAggregator(USDC_PRICE_FEED),
adapterDescription: 'Capped USDC/USD',
priceCap: int256(1.04 * 1e8)
})
)
);
}

function USDTAdapterCode() internal pure returns (bytes memory) {
return
abi.encodePacked(
type(PriceCapAdapterStable).creationCode,
abi.encode(
IPriceCapAdapterStable.CapAdapterStableParams({
aclManager: AaveV3Mantle.ACL_MANAGER,
assetToUsdAggregator: IChainlinkAggregator(USDT_PRICE_FEED),
adapterDescription: 'Capped USDT/USD',
priceCap: int256(1.04 * 1e8)
})
)
);
}
}

contract DeployUSDCMantle is MantleScript {
function run() external broadcast {
GovV3Helpers.deployDeterministic(CapAdaptersCodeMantle.USDCAdapterCode());
}
}

contract DeployUSDTMantle is MantleScript {
function run() external broadcast {
GovV3Helpers.deployDeterministic(CapAdaptersCodeMantle.USDTAdapterCode());
}
}

15 changes: 15 additions & 0 deletions tests/mantle/USDCPriceCapAdapterTest.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import '../BaseStableTest.sol';
import {CapAdaptersCodeMantle} from '../../scripts/DeployMantle.s.sol';

contract USDCMantlePriceCapAdapterTest is BaseStableTest {
constructor()
BaseStableTest(
CapAdaptersCodeMantle.USDCAdapterCode(),
10,
ForkParams({network: 'mantle', blockNumber: 78380776})
)
{}
}
15 changes: 15 additions & 0 deletions tests/mantle/USDTPriceCapAdapterTest.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import '../BaseStableTest.sol';
import {CapAdaptersCodeMantle} from '../../scripts/DeployMantle.s.sol';

contract USDTMantlePriceCapAdapterTest is BaseStableTest {
constructor()
BaseStableTest(
CapAdaptersCodeMantle.USDTAdapterCode(),
10,
ForkParams({network: 'mantle', blockNumber: 78380776})
)
{}
}
Loading