Skip to content
Merged
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
8 changes: 7 additions & 1 deletion script/config/Config.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {ILiquityConfig} from "./ILiquityConfig.sol";

import "./mento/MentoConfig_celo.sol";
import "./mento/MentoConfig_celo_sepolia.sol";
import "./mento/MentoConfig_monad.sol";
import "./mento/MentoConfig_monad_testnet.sol";
import "./liquity/LiquityConfig_GBPm_celo.sol";
import "./liquity/LiquityConfig_GBPm_celo_sepolia.sol";
Expand Down Expand Up @@ -58,7 +59,12 @@ library Config {

console.log(string.concat("Deployed ", artifactName, " at:"), configContract);
return configContract;
} catch {
} catch (bytes memory data) {
if (data.length > 0) {
assembly {
revert(add(data, 32), mload(data))
}
}
revert(
string.concat(
"Config: failed to deploy '",
Expand Down
4 changes: 2 additions & 2 deletions script/config/IMentoConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ interface IMentoConfig {

struct ExchangeConfig {
IBiPoolManager.PoolExchange pool;
ExchangeTrandingLimitsConfig tradingLimits;
ExchangeTradingLimitsConfig tradingLimits;
bool createVirtual;
}

struct ExchangeTrandingLimitsConfig {
struct ExchangeTradingLimitsConfig {
ITradingLimits.Config asset0;
ITradingLimits.Config asset1;
}
Expand Down
2 changes: 1 addition & 1 deletion script/config/mento/MentoConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ abstract contract MentoConfig is TrebScript, ProxyHelper, IMentoConfig {
string memory rateFeed,
uint256 resetFrequency,
uint256 stablePoolResetSize,
ExchangeTrandingLimitsConfig memory tradingLimits,
ExchangeTradingLimitsConfig memory tradingLimits,
bool createVirtual
) internal {
require(_isStableToken[asset0], string.concat("MentoConfig: ", asset0, " is not a registered stableToken"));
Expand Down
182 changes: 112 additions & 70 deletions script/config/mento/MentoConfig_celo.sol

Large diffs are not rendered by default.

205 changes: 205 additions & 0 deletions script/config/mento/MentoConfig_celo_sepolia.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {MentoConfig, ITradingLimits, BreakerType, CoreAggregators, FxAggregators} from "./MentoConfig.sol";
import {MentoConfig_celo} from "./MentoConfig_celo.sol";
import {CoreAggregators, FxAggregators} from "./MentoConfig.sol";
import {bytes32s, uints} from "lib/mento-std/src/Array.sol";
Expand Down Expand Up @@ -36,6 +37,12 @@ contract MentoConfig_celo_sepolia is MentoConfig_celo {

// Oracle infrastructure
_oracleConfig = OracleConfig({reportExpirySeconds: 5 minutes});
_eurocEurBreakerThreshold = 0.001 * 1e24;
_celoEthRelayerMaxTimestampSpread = 10 minutes;
_celoEthRelayerDescription = "CELOETH";
_includeCollateralRelayers = true;
_useLongCrossPairDesc = false;
_includeCeloUsdRelayer = true;
mockAggregatorReporter = 0xabcdE369CDdD1665E4EbD9214b8e9a595271272C;
_setMockAggregatorSource("celo");

Expand Down Expand Up @@ -83,6 +90,192 @@ contract MentoConfig_celo_sepolia is MentoConfig_celo {
});
}

function _initSwap() internal override {
_addExchange({
asset0: "USDm",
asset1: "USDC",
pricingModule: "ConstantSumPricingModule:v2.6.5",
spread: 0.0005 * 1e24,
rateFeed: "USDCUSD",
resetFrequency: 6 minutes,
stablePoolResetSize: 12_000_000 * 1e18,
tradingLimits: ExchangeTradingLimitsConfig({
asset0: ITradingLimits.Config({
timestep0: 5 minutes,
limit0: 2_500_000,
timestep1: 1 days,
limit1: 5_000_000,
limitGlobal: 0,
flags: 1 | 2
}),
asset1: emptyTradingLimits()
}),
createVirtual: false
});

_addExchange({
asset0: "USDm",
asset1: "axlUSDC",
pricingModule: "ConstantSumPricingModule:v2.6.5",
spread: 0.0005 * 1e24,
rateFeed: "USDCUSD",
resetFrequency: 6 minutes,
stablePoolResetSize: 12_000_000 * 1e18,
tradingLimits: ExchangeTradingLimitsConfig({
asset0: ITradingLimits.Config({
timestep0: 5 minutes,
limit0: 2_500_000,
timestep1: 1 days,
limit1: 5_000_000,
limitGlobal: 0,
flags: 1 | 2
}),
asset1: emptyTradingLimits()
}),
createVirtual: false
});

_addExchange({
asset0: "USDm",
asset1: "USDT",
pricingModule: "ConstantSumPricingModule:v2.6.5",
spread: 0.0005 * 1e24,
rateFeed: "USDTUSD",
resetFrequency: 6 minutes,
stablePoolResetSize: 12_000_000 * 1e18,
tradingLimits: ExchangeTradingLimitsConfig({
asset0: ITradingLimits.Config({
timestep0: 5 minutes,
limit0: 2_500_000,
timestep1: 1 days,
limit1: 5_000_000,
limitGlobal: 0,
flags: 1 | 2
}),
asset1: emptyTradingLimits()
}),
createVirtual: false
});

_addExchange({
asset0: "USDm",
asset1: "CELO",
pricingModule: "ConstantProductPricingModule:v2.6.5",
spread: 0.0025 * 1e24,
rateFeed: "CELOUSD",
resetFrequency: 6 minutes,
stablePoolResetSize: 3_000_000 * 1e18,
tradingLimits: ExchangeTradingLimitsConfig({
asset0: ITradingLimits.Config({
timestep0: 5 minutes,
limit0: 100_000,
timestep1: 1 days,
limit1: 500_000,
limitGlobal: 0,
flags: 1 | 2
}),
asset1: emptyTradingLimits()
}),
createVirtual: false
});

_addExchange({
asset0: "EURm",
asset1: "axlEUROC",
pricingModule: "ConstantSumPricingModule:v2.6.5",
spread: 0.005 * 1e24,
rateFeed: "EUROCEUR",
resetFrequency: 6 minutes,
stablePoolResetSize: 12_000_000 * 1e18,
tradingLimits: ExchangeTradingLimitsConfig({
asset0: ITradingLimits.Config({
timestep0: 5 minutes,
limit0: 100_000,
timestep1: 1 days,
limit1: 500_000,
limitGlobal: 0,
flags: 1 | 2
}),
asset1: ITradingLimits.Config({
timestep0: 5 minutes,
limit0: 100_000,
timestep1: 1 days,
limit1: 500_000,
limitGlobal: 0,
flags: 1 | 2
})
}),
createVirtual: false
});

_addFxExchange({
currency: "EUR",
spread: 0.005 * 1e24,
tradingLimits: _tier1FxTradingLimits(0.86 * 1e3),
createVirtual: false
});
_addFxExchange({
currency: "AUD",
spread: 0.0015 * 1e24,
tradingLimits: _tier1FxTradingLimits(1.54 * 1e3),
createVirtual: true
});
_addFxExchange({
currency: "CAD",
spread: 0.0015 * 1e24,
tradingLimits: _tier1FxTradingLimits(1.38 * 1e3),
createVirtual: true
});
_addFxExchange({
currency: "ZAR",
spread: 0.003 * 1e24,
tradingLimits: _fxTradingLimits(100_000, 500_000, 2_500_000, 17.72 * 1e3),
createVirtual: true
});
_addFxExchange({
currency: "CHF", spread: 0.003 * 1e24, tradingLimits: _tier1FxTradingLimits(0.8 * 1e3), createVirtual: true
});
_addFxExchange({
currency: "JPY",
spread: 0.003 * 1e24,
tradingLimits: _tier1FxTradingLimits(149.0 * 1e3),
createVirtual: true
});
_addFxExchange({
currency: "COP",
spread: 0.003 * 1e24,
tradingLimits: _tier2FxTradingLimits(4015.0 * 1e3),
createVirtual: true
});
_addFxExchange({
currency: "BRL", spread: 0.003 * 1e24, tradingLimits: _tier1FxTradingLimits(5.45 * 1e3), createVirtual: true
});
_addFxExchange({
currency: "PHP", spread: 0.003 * 1e24, tradingLimits: _tier2FxTradingLimits(57.4 * 1e3), createVirtual: true
});
_addFxExchange({
currency: "GHS", spread: 0.01 * 1e24, tradingLimits: _tier2FxTradingLimits(11.92 * 1e3), createVirtual: true
});
_addFxExchange({
currency: "NGN",
spread: 0.01 * 1e24,
tradingLimits: _tier2FxTradingLimits(1531.98 * 1e3),
createVirtual: true
});
_addFxExchange({
currency: "KES",
spread: 0.01 * 1e24,
tradingLimits: _tier1FxTradingLimits(129.21 * 1e3),
createVirtual: true
});
_addFxExchange({
currency: "XOF",
spread: 0.02 * 1e24,
tradingLimits: _fxTradingLimits(50_000, 250_000, 1_250_000, 560.46 * 1e3),
createVirtual: true
});
}

function _initCollateral() internal override {
_addCollateral("USDC", 0x01C5C0122039549AD1493B8220cABEdD739BC44E);
_addCollateral("axlUSDC", _registerMockCollateral("axlUSDC", 18));
Expand All @@ -105,4 +298,16 @@ contract MentoConfig_celo_sepolia is MentoConfig_celo {
// _addReserveV2Collateral("axlEUROC");
// _addReserveV2Collateral("CELO");
}

function _initGovernance() internal override {
_lockingConfig = LockingConfig({minCliffPeriod: 0, minSlopePeriod: 1});
_governanceConfig = GovernanceConfig({
timelockDelay: 5 minutes,
votingDelay: 0,
votingPeriod: 10 minutes,
proposalThreshold: 10000e18,
quorum: 2,
watchdog: 0x56fD3F2bEE130e9867942D0F463a16fBE49B8d81
});
}
}
25 changes: 8 additions & 17 deletions test/integration/CDPMigrationVerification.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ contract CDPMigrationVerification is V3IntegrationBase {

assertEq(
IFXPriceFeed(priceFeedAddr).watchdogAddress(),
fxPriceFeedManager,
lookupOrFail("FxPriceFeedManager"),
string.concat("FXPriceFeed.watchdogAddress() is zero for CDP pool at index ", vm.toString(i))
);
}
Expand Down Expand Up @@ -477,15 +477,6 @@ contract CDPMigrationVerification is V3IntegrationBase {
reserveSafe,
string.concat("Reserve trove NFT not owned by ReserveSafe for CDP pool at index ", idx)
);

// Interest rate matches config
IMentoConfig.CDPMigrationConfig memory expected = _getCDPMigrationConfig(cdpPools[i]);
uint256 annualInterestRate = ITroveManager(troveManagerAddr).getTroveAnnualInterestRate(troveId);
assertEq(
annualInterestRate,
expected.interestRate,
string.concat("Reserve trove interest rate mismatch for CDP pool at index ", idx)
);
}
}

Expand Down Expand Up @@ -566,7 +557,7 @@ contract CDPMigrationVerification is V3IntegrationBase {
ICDPLiquidityStrategy(cdpLiquidityStrategy).getCDPConfig(cdpPools[i]);

uint256 burnAmount = 1e18;
deal(debtToken, cdpConfig.collateralRegistry, burnAmount);
_dealTokens(debtToken, cdpConfig.collateralRegistry, burnAmount);

vm.prank(cdpConfig.collateralRegistry);
IStableTokenV3(debtToken).burn(burnAmount);
Expand All @@ -580,7 +571,7 @@ contract CDPMigrationVerification is V3IntegrationBase {
(address borrowerOps,,,) = _getLiquityContracts(cdpPools[i]);

uint256 burnAmount = 1e18;
deal(debtToken, borrowerOps, burnAmount);
_dealTokens(debtToken, borrowerOps, burnAmount);

vm.prank(borrowerOps);
IStableTokenV3(debtToken).burn(burnAmount);
Expand All @@ -594,7 +585,7 @@ contract CDPMigrationVerification is V3IntegrationBase {
(,, address troveManagerAddr,) = _getLiquityContracts(cdpPools[i]);

uint256 burnAmount = 1e18;
deal(debtToken, troveManagerAddr, burnAmount);
_dealTokens(debtToken, troveManagerAddr, burnAmount);

vm.prank(troveManagerAddr);
IStableTokenV3(debtToken).burn(burnAmount);
Expand All @@ -608,7 +599,7 @@ contract CDPMigrationVerification is V3IntegrationBase {
(,,, address stabilityPoolAddr) = _getLiquityContracts(cdpPools[i]);

uint256 burnAmount = 1e18;
deal(debtToken, stabilityPoolAddr, burnAmount);
_dealTokens(debtToken, stabilityPoolAddr, burnAmount);

vm.prank(stabilityPoolAddr);
IStableTokenV3(debtToken).burn(burnAmount);
Expand All @@ -633,7 +624,7 @@ contract CDPMigrationVerification is V3IntegrationBase {
for (uint256 i = 0; i < cdpPools.length; i++) {
address debtToken = _getDebtToken(cdpPools[i]);

deal(debtToken, broker, 1e18);
_dealTokens(debtToken, broker, 1e18);

vm.prank(broker);
vm.expectRevert();
Expand All @@ -651,7 +642,7 @@ contract CDPMigrationVerification is V3IntegrationBase {

address sender = makeAddr("tokenHolder");
uint256 amount = 1e18;
deal(debtToken, sender, amount);
_dealTokens(debtToken, sender, amount);

uint256 senderBalBefore = IStableTokenV3(debtToken).balanceOf(sender);
uint256 poolBalBefore = IStableTokenV3(debtToken).balanceOf(stabilityPoolAddr);
Expand Down Expand Up @@ -680,7 +671,7 @@ contract CDPMigrationVerification is V3IntegrationBase {

address receiver = makeAddr("tokenReceiver");
uint256 amount = 1e18;
deal(debtToken, stabilityPoolAddr, amount);
_dealTokens(debtToken, stabilityPoolAddr, amount);

uint256 poolBalBefore = IStableTokenV3(debtToken).balanceOf(stabilityPoolAddr);
uint256 receiverBalBefore = IStableTokenV3(debtToken).balanceOf(receiver);
Expand Down
8 changes: 4 additions & 4 deletions test/integration/CDPOperations.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ contract CDPOperations is V3IntegrationBase {
debtAmount = p.debtAmount;
collAmount = p.collAmount;

deal(c.collToken, user, p.collAmount);
deal(c.gasToken, user, p.ethGasComp);
_dealTokens(c.collToken, user, p.collAmount);
_dealTokens(c.gasToken, user, p.ethGasComp);

vm.startPrank(user);
IERC20(c.collToken).approve(c.borrowerOps, p.collAmount);
Expand Down Expand Up @@ -313,8 +313,8 @@ contract CDPOperations is V3IntegrationBase {
debtAmount = p.debtAmount;
collAmount = p.collAmount;

deal(c.collToken, user, p.collAmount);
deal(c.gasToken, user, p.ethGasComp);
_dealTokens(c.collToken, user, p.collAmount);
_dealTokens(c.gasToken, user, p.ethGasComp);

vm.startPrank(user);
IERC20(c.collToken).approve(c.borrowerOps, p.collAmount);
Expand Down
Loading
Loading