Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
MainnetController
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.21;
import { IAToken } from "aave-v3-origin/src/core/contracts/interfaces/IAToken.sol";
import { IPool as IAavePool } from "aave-v3-origin/src/core/contracts/interfaces/IPool.sol";
import { IERC20 } from "forge-std/interfaces/IERC20.sol";
import { IERC4626 } from "forge-std/interfaces/IERC4626.sol";
import { IERC7540 } from "forge-std/interfaces/IERC7540.sol";
import { IMetaMorpho, Id, MarketAllocation } from "metamorpho/interfaces/IMetaMorpho.sol";
import { AccessControl } from "openzeppelin-contracts/contracts/access/AccessControl.sol";
import { Ethereum } from "spark-address-registry/Ethereum.sol";
import { IALMProxy } from "./interfaces/IALMProxy.sol";
import { ICCTPLike } from "./interfaces/CCTPInterfaces.sol";
import { IRateLimits } from "./interfaces/IRateLimits.sol";
import { RateLimitHelpers } from "./RateLimitHelpers.sol";
interface IATokenWithPool is IAToken {
function POOL() external view returns(address);
}
interface IBuidlRedeemLike {
function asset() external view returns(address);
function redeem(uint256 usdcAmount) external;
}
interface IDaiUsdsLike {
function dai() external view returns(address);
function daiToUsds(address usr, uint256 wad) external;
function usdsToDai(address usr, uint256 wad) external;
}
interface IEthenaMinterLike {
function setDelegatedSigner(address delegateSigner) external;
function removeDelegatedSigner(address delegateSigner) external;
}
interface ICentrifugeToken is IERC7540 {
function cancelDepositRequest(uint256 requestId, address controller) external;
function cancelRedeemRequest(uint256 requestId, address controller) external;
function claimCancelDepositRequest(uint256 requestId, address receiver, address controller)
external returns (uint256 assets);
function claimCancelRedeemRequest(uint256 requestId, address receiver, address controller)
external returns (uint256 shares);
}
interface IMapleTokenLike is IERC4626 {
function requestRedeem(uint256 shares, address receiver) external;
function removeShares(uint256 shares, address receiver) external;
}
interface IPSMLike {
function buyGemNoFee(address usr, uint256 usdcAmount) external returns (uint256 usdsAmount);
function fill() external returns (uint256 wad);
function gem() external view returns(address);
function sellGemNoFee(address usr, uint256 usdcAmount) external returns (uint256 usdsAmount);
function to18ConversionFactor() external view returns (uint256);
}
interface ISSRedemptionLike is IERC20 {
function calculateUsdcOut(uint256 ustbAmount)
external view returns (uint256 usdcOutAmount, uint256 usdPerUstbChainlinkRaw);
function redeem(uint256 ustbAmout) external;
}
interface ISUSDELike is IERC4626 {
function cooldownAssets(uint256 usdeAmount) external;
function cooldownShares(uint256 susdeAmount) external;
function unstake(address receiver) external;
}
interface IUSTBLike is IERC20 {
function subscribe(uint256 inAmount, address stablecoin) external;
}
interface IVaultLike {
function buffer() external view returns(address);
function draw(uint256 usdsAmount) external;
function wipe(uint256 usdsAmount) external;
}
contract MainnetController is AccessControl {
/**********************************************************************************************/
/*** Events ***/
/**********************************************************************************************/
// NOTE: This is used to track individual transfers for offchain processing of CCTP transactions
event CCTPTransferInitiated(
uint64 indexed nonce,
uint32 indexed destinationDomain,
bytes32 indexed mintRecipient,
uint256 usdcAmount
);
event MintRecipientSet(uint32 indexed destinationDomain, bytes32 mintRecipient);
event RelayerRemoved(address indexed relayer);
/**********************************************************************************************/
/*** State variables ***/
/**********************************************************************************************/
bytes32 public constant FREEZER = keccak256("FREEZER");
bytes32 public constant RELAYER = keccak256("RELAYER");
bytes32 public constant LIMIT_4626_DEPOSIT = keccak256("LIMIT_4626_DEPOSIT");
bytes32 public constant LIMIT_4626_WITHDRAW = keccak256("LIMIT_4626_WITHDRAW");
bytes32 public constant LIMIT_7540_DEPOSIT = keccak256("LIMIT_7540_DEPOSIT");
bytes32 public constant LIMIT_7540_REDEEM = keccak256("LIMIT_7540_REDEEM");
bytes32 public constant LIMIT_AAVE_DEPOSIT = keccak256("LIMIT_AAVE_DEPOSIT");
bytes32 public constant LIMIT_AAVE_WITHDRAW = keccak256("LIMIT_AAVE_WITHDRAW");
bytes32 public constant LIMIT_ASSET_TRANSFER = keccak256("LIMIT_ASSET_TRANSFER");
bytes32 public constant LIMIT_BUIDL_REDEEM_CIRCLE = keccak256("LIMIT_BUIDL_REDEEM_CIRCLE");
bytes32 public constant LIMIT_MAPLE_REDEEM = keccak256("LIMIT_MAPLE_REDEEM");
bytes32 public constant LIMIT_SUPERSTATE_REDEEM = keccak256("LIMIT_SUPERSTATE_REDEEM");
bytes32 public constant LIMIT_SUPERSTATE_SUBSCRIBE = keccak256("LIMIT_SUPERSTATE_SUBSCRIBE");
bytes32 public constant LIMIT_SUSDE_COOLDOWN = keccak256("LIMIT_SUSDE_COOLDOWN");
bytes32 public constant LIMIT_USDC_TO_CCTP = keccak256("LIMIT_USDC_TO_CCTP");
bytes32 public constant LIMIT_USDC_TO_DOMAIN = keccak256("LIMIT_USDC_TO_DOMAIN");
bytes32 public constant LIMIT_USDE_BURN = keccak256("LIMIT_USDE_BURN");
bytes32 public constant LIMIT_USDE_MINT = keccak256("LIMIT_USDE_MINT");
bytes32 public constant LIMIT_USDS_MINT = keccak256("LIMIT_USDS_MINT");
bytes32 public constant LIMIT_USDS_TO_USDC = keccak256("LIMIT_USDS_TO_USDC");
address public immutable buffer;
IALMProxy public immutable proxy;
IBuidlRedeemLike public immutable buidlRedeem;
ICCTPLike public immutable cctp;
IDaiUsdsLike public immutable daiUsds;
IEthenaMinterLike public immutable ethenaMinter;
IPSMLike public immutable psm;
IRateLimits public immutable rateLimits;
ISSRedemptionLike public immutable superstateRedemption;
IVaultLike public immutable vault;
IERC20 public immutable dai;
IERC20 public immutable usds;
IERC20 public immutable usde;
IERC20 public immutable usdc;
IUSTBLike public immutable ustb;
ISUSDELike public immutable susde;
uint256 public immutable psmTo18ConversionFactor;
mapping(uint32 destinationDomain => bytes32 mintRecipient) public mintRecipients;
/**********************************************************************************************/
/*** Initialization ***/
/**********************************************************************************************/
constructor(
address admin_,
address proxy_,
address rateLimits_,
address vault_,
address psm_,
address daiUsds_,
address cctp_
) {
_grantRole(DEFAULT_ADMIN_ROLE, admin_);
proxy = IALMProxy(proxy_);
rateLimits = IRateLimits(rateLimits_);
vault = IVaultLike(vault_);
buffer = IVaultLike(vault_).buffer();
psm = IPSMLike(psm_);
daiUsds = IDaiUsdsLike(daiUsds_);
cctp = ICCTPLike(cctp_);
buidlRedeem = IBuidlRedeemLike(Ethereum.BUIDL_REDEEM);
ethenaMinter = IEthenaMinterLike(Ethereum.ETHENA_MINTER);
superstateRedemption = ISSRedemptionLike(Ethereum.SUPERSTATE_REDEMPTION);
susde = ISUSDELike(Ethereum.SUSDE);
ustb = IUSTBLike(Ethereum.USTB);
dai = IERC20(daiUsds.dai());
usdc = IERC20(psm.gem());
usds = IERC20(Ethereum.USDS);
usde = IERC20(Ethereum.USDE);
psmTo18ConversionFactor = psm.to18ConversionFactor();
}
/**********************************************************************************************/
/*** Modifiers ***/
/**********************************************************************************************/
modifier rateLimited(bytes32 key, uint256 amount) {
rateLimits.triggerRateLimitDecrease(key, amount);
_;
}
modifier rateLimitedAsset(bytes32 key, address asset, uint256 amount) {
rateLimits.triggerRateLimitDecrease(RateLimitHelpers.makeAssetKey(key, asset), amount);
_;
}
modifier cancelRateLimit(bytes32 key, uint256 amount) {
rateLimits.triggerRateLimitIncrease(key, amount);
_;
}
modifier rateLimitExists(bytes32 key) {
require(
rateLimits.getRateLimitData(key).maxAmount > 0,
"MainnetController/invalid-action"
);
_;
}
/**********************************************************************************************/
/*** Admin functions ***/
/**********************************************************************************************/
function setMintRecipient(uint32 destinationDomain, bytes32 mintRecipient)
external
onlyRole(DEFAULT_ADMIN_ROLE)
{
mintRecipients[destinationDomain] = mintRecipient;
emit MintRecipientSet(destinationDomain, mintRecipient);
}
/**********************************************************************************************/
/*** Freezer functions ***/
/**********************************************************************************************/
function removeRelayer(address relayer) external onlyRole(FREEZER) {
_revokeRole(RELAYER, relayer);
emit RelayerRemoved(relayer);
}
/**********************************************************************************************/
/*** Relayer vault functions ***/
/**********************************************************************************************/
function mintUSDS(uint256 usdsAmount)
external
onlyRole(RELAYER)
rateLimited(LIMIT_USDS_MINT, usdsAmount)
{
// Mint USDS into the buffer
proxy.doCall(
address(vault),
abi.encodeCall(vault.draw, (usdsAmount))
);
// Transfer USDS from the buffer to the proxy
proxy.doCall(
address(usds),
abi.encodeCall(usds.transferFrom, (buffer, address(proxy), usdsAmount))
);
}
function burnUSDS(uint256 usdsAmount)
external
onlyRole(RELAYER)
cancelRateLimit(LIMIT_USDS_MINT, usdsAmount)
{
// Transfer USDS from the proxy to the buffer
proxy.doCall(
address(usds),
abi.encodeCall(usds.transfer, (buffer, usdsAmount))
);
// Burn USDS from the buffer
proxy.doCall(
address(vault),
abi.encodeCall(vault.wipe, (usdsAmount))
);
}
/**********************************************************************************************/
/*** Relayer ERC20 functions ***/
/**********************************************************************************************/
function transferAsset(address asset, address destination, uint256 amount)
external
onlyRole(RELAYER)
rateLimited(
RateLimitHelpers.makeAssetDestinationKey(LIMIT_ASSET_TRANSFER, asset, destination),
amount
)
{
proxy.doCall(
asset,
abi.encodeCall(IERC20(asset).transfer, (destination, amount))
);
}
/**********************************************************************************************/
/*** Relayer ERC4626 functions ***/
/**********************************************************************************************/
function depositERC4626(address token, uint256 amount)
external
onlyRole(RELAYER)
rateLimitedAsset(LIMIT_4626_DEPOSIT, token, amount)
returns (uint256 shares)
{
// Note that whitelist is done by rate limits
IERC20 asset = IERC20(IERC4626(token).asset());
// Approve asset to token from the proxy (assumes the proxy has enough of the asset).
_approve(address(asset), token, amount);
// Deposit asset into the token, proxy receives token shares, decode the resulting shares
shares = abi.decode(
proxy.doCall(
token,
abi.encodeCall(IERC4626(token).deposit, (amount, address(proxy)))
),
(uint256)
);
}
function withdrawERC4626(address token, uint256 amount)
external
onlyRole(RELAYER)
rateLimitedAsset(LIMIT_4626_WITHDRAW, token, amount)
returns (uint256 shares)
{
// Withdraw asset from a token, decode resulting shares.
// Assumes proxy has adequate token shares.
shares = abi.decode(
proxy.doCall(
token,
abi.encodeCall(IERC4626(token).withdraw, (amount, address(proxy), address(proxy)))
),
(uint256)
);
}
// NOTE: !!! Rate limited at end of function !!!
function redeemERC4626(address token, uint256 shares)
external
onlyRole(RELAYER)
returns (uint256 assets)
{
// Redeem shares for assets from the token, decode the resulting assets.
// Assumes proxy has adequate token shares.
assets = abi.decode(
proxy.doCall(
token,
abi.encodeCall(IERC4626(token).redeem, (shares, address(proxy), address(proxy)))
),
(uint256)
);
rateLimits.triggerRateLimitDecrease(
RateLimitHelpers.makeAssetKey(LIMIT_4626_WITHDRAW, token),
assets
);
}
/**********************************************************************************************/
/*** Relayer ERC7540 functions ***/
/**********************************************************************************************/
function requestDepositERC7540(address token, uint256 amount)
external
onlyRole(RELAYER)
rateLimitedAsset(LIMIT_7540_DEPOSIT, token, amount)
{
// Note that whitelist is done by rate limits
IERC20 asset = IERC20(IERC7540(token).asset());
// Approve asset to vault from the proxy (assumes the proxy has enough of the asset).
_approve(address(asset), token, amount);
// Submit deposit request by transferring assets
proxy.doCall(
token,
abi.encodeCall(IERC7540(token).requestDeposit, (amount, address(proxy), address(proxy)))
);
}
function claimDepositERC7540(address token)
external
onlyRole(RELAYER)
rateLimitExists(RateLimitHelpers.makeAssetKey(LIMIT_7540_DEPOSIT, token))
{
uint256 shares = IERC7540(token).maxMint(address(proxy));
// Claim shares from the vault to the proxy
proxy.doCall(
token,
abi.encodeCall(IERC4626(token).mint, (shares, address(proxy)))
);
}
function requestRedeemERC7540(address token, uint256 shares)
external
onlyRole(RELAYER)
rateLimitedAsset(
LIMIT_7540_REDEEM,
token,
IERC7540(token).convertToAssets(shares)
)
{
// Submit redeem request by transferring shares
proxy.doCall(
token,
abi.encodeCall(IERC7540(token).requestRedeem, (shares, address(proxy), address(proxy)))
);
}
function claimRedeemERC7540(address token)
external
onlyRole(RELAYER)
rateLimitExists(RateLimitHelpers.makeAssetKey(LIMIT_7540_REDEEM, token))
{
uint256 assets = IERC7540(token).maxWithdraw(address(proxy));
// Claim assets from the vault to the proxy
proxy.doCall(
token,
abi.encodeCall(IERC7540(token).withdraw, (assets, address(proxy), address(proxy)))
);
}
/**********************************************************************************************/
/*** Relayer Centrifuge functions ***/
/**********************************************************************************************/
// NOTE: These cancelation methods are compatible with ERC-7887
uint256 CENTRIFUGE_REQUEST_ID = 0;
function cancelCentrifugeDepositRequest(address token)
external
onlyRole(RELAYER)
rateLimitExists(RateLimitHelpers.makeAssetKey(LIMIT_7540_DEPOSIT, token))
{
// NOTE: While the cancelation is pending, no new deposit request can be submitted
proxy.doCall(
token,
abi.encodeCall(
ICentrifugeToken(token).cancelDepositRequest,
(CENTRIFUGE_REQUEST_ID, address(proxy))
)
);
}
function claimCentrifugeCancelDepositRequest(address token)
external
onlyRole(RELAYER)
rateLimitExists(RateLimitHelpers.makeAssetKey(LIMIT_7540_DEPOSIT, token))
{
proxy.doCall(
token,
abi.encodeCall(
ICentrifugeToken(token).claimCancelDepositRequest,
(CENTRIFUGE_REQUEST_ID, address(proxy), address(proxy))
)
);
}
function cancelCentrifugeRedeemRequest(address token)
external
onlyRole(RELAYER)
rateLimitExists(RateLimitHelpers.makeAssetKey(LIMIT_7540_REDEEM, token))
{
// NOTE: While the cancelation is pending, no new redeem request can be submitted
proxy.doCall(
token,
abi.encodeCall(
ICentrifugeToken(token).cancelRedeemRequest,
(CENTRIFUGE_REQUEST_ID, address(proxy))
)
);
}
function claimCentrifugeCancelRedeemRequest(address token)
external
onlyRole(RELAYER)
rateLimitExists(RateLimitHelpers.makeAssetKey(LIMIT_7540_REDEEM, token))
{
proxy.doCall(
token,
abi.encodeCall(
ICentrifugeToken(token).claimCancelRedeemRequest,
(CENTRIFUGE_REQUEST_ID, address(proxy), address(proxy))
)
);
}
/**********************************************************************************************/
/*** Relayer Aave functions ***/
/**********************************************************************************************/
function depositAave(address aToken, uint256 amount)
external
onlyRole(RELAYER)
rateLimitedAsset(LIMIT_AAVE_DEPOSIT, aToken, amount)
{
IERC20 underlying = IERC20(IATokenWithPool(aToken).UNDERLYING_ASSET_ADDRESS());
IAavePool pool = IAavePool(IATokenWithPool(aToken).POOL());
// Approve underlying to Aave pool from the proxy (assumes the proxy has enough underlying).
_approve(address(underlying), address(pool), amount);
// Deposit underlying into Aave pool, proxy receives aTokens
proxy.doCall(
address(pool),
abi.encodeCall(pool.supply, (address(underlying), amount, address(proxy), 0))
);
}
// NOTE: !!! Rate limited at end of function !!!
function withdrawAave(address aToken, uint256 amount)
external
onlyRole(RELAYER)
returns (uint256 amountWithdrawn)
{
IAavePool pool = IAavePool(IATokenWithPool(aToken).POOL());
// Withdraw underlying from Aave pool, decode resulting amount withdrawn.
// Assumes proxy has adequate aTokens.
amountWithdrawn = abi.decode(
proxy.doCall(
address(pool),
abi.encodeCall(
pool.withdraw,
(IATokenWithPool(aToken).UNDERLYING_ASSET_ADDRESS(), amount, address(proxy))
)
),
(uint256)
);
rateLimits.triggerRateLimitDecrease(
RateLimitHelpers.makeAssetKey(LIMIT_AAVE_WITHDRAW, aToken),
amountWithdrawn
);
}
/**********************************************************************************************/
/*** Relayer BlackRock BUIDL functions ***/
/**********************************************************************************************/
function redeemBUIDLCircleFacility(uint256 usdcAmount)
external
onlyRole(RELAYER)
rateLimited(LIMIT_BUIDL_REDEEM_CIRCLE, usdcAmount)
{
_approve(address(buidlRedeem.asset()), address(buidlRedeem), usdcAmount);
proxy.doCall(
address(buidlRedeem),
abi.encodeCall(buidlRedeem.redeem, (usdcAmount))
);
}
/**********************************************************************************************/
/*** Relayer Ethena functions ***/
/**********************************************************************************************/
function setDelegatedSigner(address delegatedSigner) external onlyRole(RELAYER) {
proxy.doCall(
address(ethenaMinter),
abi.encodeCall(ethenaMinter.setDelegatedSigner, (address(delegatedSigner)))
);
}
function removeDelegatedSigner(address delegatedSigner) external onlyRole(RELAYER) {
proxy.doCall(
address(ethenaMinter),
abi.encodeCall(ethenaMinter.removeDelegatedSigner, (address(delegatedSigner)))
);
}
// Note that Ethena's mint/redeem per-block limits include other users
function prepareUSDeMint(uint256 usdcAmount)
external
onlyRole(RELAYER)
rateLimited(LIMIT_USDE_MINT, usdcAmount)
{
_approve(address(usdc), address(ethenaMinter), usdcAmount);
}
function prepareUSDeBurn(uint256 usdeAmount)
external
onlyRole(RELAYER)
rateLimited(LIMIT_USDE_BURN, usdeAmount)
{
_approve(address(usde), address(ethenaMinter), usdeAmount);
}
function cooldownAssetsSUSDe(uint256 usdeAmount)
external
onlyRole(RELAYER)
rateLimited(LIMIT_SUSDE_COOLDOWN, usdeAmount)
{
proxy.doCall(
address(susde),
abi.encodeCall(susde.cooldownAssets, (usdeAmount))
);
}
// NOTE: !!! Rate limited at end of function !!!
function cooldownSharesSUSDe(uint256 susdeAmount)
external
onlyRole(RELAYER)
returns (uint256 cooldownAmount)
{
cooldownAmount = abi.decode(
proxy.doCall(
address(susde),
abi.encodeCall(susde.cooldownShares, (susdeAmount))
),
(uint256)
);
rateLimits.triggerRateLimitDecrease(LIMIT_SUSDE_COOLDOWN, cooldownAmount);
}
function unstakeSUSDe() external onlyRole(RELAYER) {
proxy.doCall(
address(susde),
abi.encodeCall(susde.unstake, (address(proxy)))
);
}
/**********************************************************************************************/
/*** Relayer Maple functions ***/
/**********************************************************************************************/
function requestMapleRedemption(address mapleToken, uint256 shares)
external
onlyRole(RELAYER)
rateLimitedAsset(
LIMIT_MAPLE_REDEEM,
mapleToken,
IMapleTokenLike(mapleToken).convertToAssets(shares)
)
{
proxy.doCall(
mapleToken,
abi.encodeCall(IMapleTokenLike(mapleToken).requestRedeem, (shares, address(proxy)))
);
}
function cancelMapleRedemption(address mapleToken, uint256 shares)
external
onlyRole(RELAYER)
rateLimitExists(RateLimitHelpers.makeAssetKey(LIMIT_MAPLE_REDEEM, mapleToken))
{
proxy.doCall(
mapleToken,
abi.encodeCall(IMapleTokenLike(mapleToken).removeShares, (shares, address(proxy)))
);
}
/**********************************************************************************************/
/*** Relayer Morpho functions ***/
/**********************************************************************************************/
function setSupplyQueueMorpho(address morphoVault, Id[] memory newSupplyQueue)
external
onlyRole(RELAYER)
rateLimitExists(RateLimitHelpers.makeAssetKey(LIMIT_4626_DEPOSIT, morphoVault))
{
proxy.doCall(
morphoVault,
abi.encodeCall(IMetaMorpho(morphoVault).setSupplyQueue, (newSupplyQueue))
);
}
function updateWithdrawQueueMorpho(address morphoVault, uint256[] calldata indexes)
external
onlyRole(RELAYER)
rateLimitExists(RateLimitHelpers.makeAssetKey(LIMIT_4626_DEPOSIT, morphoVault))
{
proxy.doCall(
morphoVault,
abi.encodeCall(IMetaMorpho(morphoVault).updateWithdrawQueue, (indexes))
);
}
function reallocateMorpho(address morphoVault, MarketAllocation[] calldata allocations)
external
onlyRole(RELAYER)
rateLimitExists(RateLimitHelpers.makeAssetKey(LIMIT_4626_DEPOSIT, morphoVault))
{
proxy.doCall(
morphoVault,
abi.encodeCall(IMetaMorpho(morphoVault).reallocate, (allocations))
);
}
/**********************************************************************************************/
/*** Relayer Superstate functions ***/
/**********************************************************************************************/
function subscribeSuperstate(uint256 usdcAmount)
external
onlyRole(RELAYER)
rateLimited(LIMIT_SUPERSTATE_SUBSCRIBE, usdcAmount)
{
_approve(address(usdc), address(ustb), usdcAmount);
proxy.doCall(
address(ustb),
abi.encodeCall(ustb.subscribe, (usdcAmount, address(usdc)))
);
}
// NOTE: Rate limited outside of modifier because of tuple return
function redeemSuperstate(uint256 ustbAmount) external onlyRole(RELAYER) {
( uint256 usdcAmount, ) = superstateRedemption.calculateUsdcOut(ustbAmount);
rateLimits.triggerRateLimitDecrease(LIMIT_SUPERSTATE_REDEEM, usdcAmount);
_approve(address(ustb), address(superstateRedemption), ustbAmount);
proxy.doCall(
address(superstateRedemption),
abi.encodeCall(superstateRedemption.redeem, (ustbAmount))
);
}
/**********************************************************************************************/
/*** Relayer PSM functions ***/
/**********************************************************************************************/
// NOTE: The param `usdcAmount` is denominated in 1e6 precision to match how PSM uses
// USDC precision for both `buyGemNoFee` and `sellGemNoFee`
function swapUSDSToUSDC(uint256 usdcAmount)
external
onlyRole(RELAYER)
rateLimited(LIMIT_USDS_TO_USDC, usdcAmount)
{
uint256 usdsAmount = usdcAmount * psmTo18ConversionFactor;
// Approve USDS to DaiUsds migrator from the proxy (assumes the proxy has enough USDS)
_approve(address(usds), address(daiUsds), usdsAmount);
// Swap USDS to DAI 1:1
proxy.doCall(
address(daiUsds),
abi.encodeCall(daiUsds.usdsToDai, (address(proxy), usdsAmount))
);
// Approve DAI to PSM from the proxy because conversion from USDS to DAI was 1:1
_approve(address(dai), address(psm), usdsAmount);
// Swap DAI to USDC through the PSM
proxy.doCall(
address(psm),
abi.encodeCall(psm.buyGemNoFee, (address(proxy), usdcAmount))
);
}
function swapUSDCToUSDS(uint256 usdcAmount)
external
onlyRole(RELAYER)
cancelRateLimit(LIMIT_USDS_TO_USDC, usdcAmount)
{
// Approve USDC to PSM from the proxy (assumes the proxy has enough USDC)
_approve(address(usdc), address(psm), usdcAmount);
// Max USDC that can be swapped to DAI in one call
uint256 limit = dai.balanceOf(address(psm)) / psmTo18ConversionFactor;
if (usdcAmount <= limit) {
_swapUSDCToDAI(usdcAmount);
} else {
uint256 remainingUsdcToSwap = usdcAmount;
// Refill the PSM with DAI as many times as needed to get to the full `usdcAmount`.
// If the PSM cannot be filled with the full amount, psm.fill() will revert
// with `DssLitePsm/nothing-to-fill` since rush() will return 0.
// This is desired behavior because this function should only succeed if the full
// `usdcAmount` can be swapped.
while (remainingUsdcToSwap > 0) {
psm.fill();
limit = dai.balanceOf(address(psm)) / psmTo18ConversionFactor;
uint256 swapAmount = remainingUsdcToSwap < limit ? remainingUsdcToSwap : limit;
_swapUSDCToDAI(swapAmount);
remainingUsdcToSwap -= swapAmount;
}
}
uint256 daiAmount = usdcAmount * psmTo18ConversionFactor;
// Approve DAI to DaiUsds migrator from the proxy (assumes the proxy has enough DAI)
_approve(address(dai), address(daiUsds), daiAmount);
// Swap DAI to USDS 1:1
proxy.doCall(
address(daiUsds),
abi.encodeCall(daiUsds.daiToUsds, (address(proxy), daiAmount))
);
}
/**********************************************************************************************/
/*** Relayer bridging functions ***/
/**********************************************************************************************/
function transferUSDCToCCTP(uint256 usdcAmount, uint32 destinationDomain)
external
onlyRole(RELAYER)
rateLimited(LIMIT_USDC_TO_CCTP, usdcAmount)
rateLimited(
RateLimitHelpers.makeDomainKey(LIMIT_USDC_TO_DOMAIN, destinationDomain),
usdcAmount
)
{
bytes32 mintRecipient = mintRecipients[destinationDomain];
require(mintRecipient != 0, "MainnetController/domain-not-configured");
// Approve USDC to CCTP from the proxy (assumes the proxy has enough USDC)
_approve(address(usdc), address(cctp), usdcAmount);
// If amount is larger than limit it must be split into multiple calls
uint256 burnLimit = cctp.localMinter().burnLimitsPerMessage(address(usdc));
while (usdcAmount > burnLimit) {
_initiateCCTPTransfer(burnLimit, destinationDomain, mintRecipient);
usdcAmount -= burnLimit;
}
// Send remaining amount (if any)
if (usdcAmount > 0) {
_initiateCCTPTransfer(usdcAmount, destinationDomain, mintRecipient);
}
}
/**********************************************************************************************/
/*** Internal helper functions ***/
/**********************************************************************************************/
function _approve(address token, address spender, uint256 amount) internal {
proxy.doCall(token, abi.encodeCall(IERC20.approve, (spender, amount)));
}
function _initiateCCTPTransfer(
uint256 usdcAmount,
uint32 destinationDomain,
bytes32 mintRecipient
)
internal
{
uint64 nonce = abi.decode(
proxy.doCall(
address(cctp),
abi.encodeCall(
cctp.depositForBurn,
(
usdcAmount,
destinationDomain,
mintRecipient,
address(usdc)
)
)
),
(uint64)
);
emit CCTPTransferInitiated(nonce, destinationDomain, mintRecipient, usdcAmount);
}
function _swapUSDCToDAI(uint256 usdcAmount) internal {
// Swap USDC to DAI through the PSM (1:1 since sellGemNoFee is used)
proxy.doCall(
address(psm),
abi.encodeCall(psm.sellGemNoFee, (address(proxy), usdcAmount))
);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
import {IScaledBalanceToken} from './IScaledBalanceToken.sol';
import {IInitializableAToken} from './IInitializableAToken.sol';
/**
* @title IAToken
* @author Aave
* @notice Defines the basic interface for an AToken.
*/
interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
/**
* @dev Emitted during the transfer action
* @param from The user whose tokens are being transferred
* @param to The recipient
* @param value The scaled amount being transferred
* @param index The next liquidity index of the reserve
*/
event BalanceTransfer(address indexed from, address indexed to, uint256 value, uint256 index);
/**
* @notice Mints `amount` aTokens to `user`
* @param caller The address performing the mint
* @param onBehalfOf The address of the user that will receive the minted aTokens
* @param amount The amount of tokens getting minted
* @param index The next liquidity index of the reserve
* @return `true` if the the previous balance of the user was 0
*/
function mint(
address caller,
address onBehalfOf,
uint256 amount,
uint256 index
) external returns (bool);
/**
* @notice Burns aTokens from `user` and sends the equivalent amount of underlying to `receiverOfUnderlying`
* @dev In some instances, the mint event could be emitted from a burn transaction
* if the amount to burn is less than the interest that the user accrued
* @param from The address from which the aTokens will be burned
* @param receiverOfUnderlying The address that will receive the underlying
* @param amount The amount being burned
* @param index The next liquidity index of the reserve
*/
function burn(address from, address receiverOfUnderlying, uint256 amount, uint256 index) external;
/**
* @notice Mints aTokens to the reserve treasury
* @param amount The amount of tokens getting minted
* @param index The next liquidity index of the reserve
*/
function mintToTreasury(uint256 amount, uint256 index) external;
/**
* @notice Transfers aTokens in the event of a borrow being liquidated, in case the liquidators reclaims the aToken
* @param from The address getting liquidated, current owner of the aTokens
* @param to The recipient
* @param value The amount of tokens getting transferred
*/
function transferOnLiquidation(address from, address to, uint256 value) external;
/**
* @notice Transfers the underlying asset to `target`.
* @dev Used by the Pool to transfer assets in borrow(), withdraw() and flashLoan()
* @param target The recipient of the underlying
* @param amount The amount getting transferred
*/
function transferUnderlyingTo(address target, uint256 amount) external;
/**
* @notice Handles the underlying received by the aToken after the transfer has been completed.
* @dev The default implementation is empty as with standard ERC20 tokens, nothing needs to be done after the
* transfer is concluded. However in the future there may be aTokens that allow for example to stake the underlying
* to receive LM rewards. In that case, `handleRepayment()` would perform the staking of the underlying asset.
* @param user The user executing the repayment
* @param onBehalfOf The address of the user who will get his debt reduced/removed
* @param amount The amount getting repaid
*/
function handleRepayment(address user, address onBehalfOf, uint256 amount) external;
/**
* @notice Allow passing a signed message to approve spending
* @dev implements the permit function as for
* https://github.com/ethereum/EIPs/blob/8a34d644aacf0f9f8f00815307fd7dd5da07655f/EIPS/eip-2612.md
* @param owner The owner of the funds
* @param spender The spender
* @param value The amount
* @param deadline The deadline timestamp, type(uint256).max for max deadline
* @param v Signature param
* @param s Signature param
* @param r Signature param
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @notice Returns the address of the underlying asset of this aToken (E.g. WETH for aWETH)
* @return The address of the underlying asset
*/
function UNDERLYING_ASSET_ADDRESS() external view returns (address);
/**
* @notice Returns the address of the Aave treasury, receiving the fees on this aToken.
* @return Address of the Aave treasury
*/
function RESERVE_TREASURY_ADDRESS() external view returns (address);
/**
* @notice Get the domain separator for the token
* @dev Return cached value if chainId matches cache, otherwise recomputes separator
* @return The domain separator of the token at current chain
*/
function DOMAIN_SEPARATOR() external view returns (bytes32);
/**
* @notice Returns the nonce for owner.
* @param owner The address of the owner
* @return The nonce of the owner
*/
function nonces(address owner) external view returns (uint256);
/**
* @notice Rescue and transfer tokens locked in this contract
* @param token The address of the token
* @param to The address of the recipient
* @param amount The amount of token to transfer
*/
function rescueTokens(address token, address to, uint256 amount) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IPoolAddressesProvider} from './IPoolAddressesProvider.sol';
import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
/**
* @title IPool
* @author Aave
* @notice Defines the basic interface for an Aave Pool.
*/
interface IPool {
/**
* @dev Emitted on mintUnbacked()
* @param reserve The address of the underlying asset of the reserve
* @param user The address initiating the supply
* @param onBehalfOf The beneficiary of the supplied assets, receiving the aTokens
* @param amount The amount of supplied assets
* @param referralCode The referral code used
*/
event MintUnbacked(
address indexed reserve,
address user,
address indexed onBehalfOf,
uint256 amount,
uint16 indexed referralCode
);
/**
* @dev Emitted on backUnbacked()
* @param reserve The address of the underlying asset of the reserve
* @param backer The address paying for the backing
* @param amount The amount added as backing
* @param fee The amount paid in fees
*/
event BackUnbacked(address indexed reserve, address indexed backer, uint256 amount, uint256 fee);
/**
* @dev Emitted on supply()
* @param reserve The address of the underlying asset of the reserve
* @param user The address initiating the supply
* @param onBehalfOf The beneficiary of the supply, receiving the aTokens
* @param amount The amount supplied
* @param referralCode The referral code used
*/
event Supply(
address indexed reserve,
address user,
address indexed onBehalfOf,
uint256 amount,
uint16 indexed referralCode
);
/**
* @dev Emitted on withdraw()
* @param reserve The address of the underlying asset being withdrawn
* @param user The address initiating the withdrawal, owner of aTokens
* @param to The address that will receive the underlying
* @param amount The amount to be withdrawn
*/
event Withdraw(address indexed reserve, address indexed user, address indexed to, uint256 amount);
/**
* @dev Emitted on borrow() and flashLoan() when debt needs to be opened
* @param reserve The address of the underlying asset being borrowed
* @param user The address of the user initiating the borrow(), receiving the funds on borrow() or just
* initiator of the transaction on flashLoan()
* @param onBehalfOf The address that will be getting the debt
* @param amount The amount borrowed out
* @param interestRateMode The rate mode: 1 for Stable, 2 for Variable
* @param borrowRate The numeric rate at which the user has borrowed, expressed in ray
* @param referralCode The referral code used
*/
event Borrow(
address indexed reserve,
address user,
address indexed onBehalfOf,
uint256 amount,
DataTypes.InterestRateMode interestRateMode,
uint256 borrowRate,
uint16 indexed referralCode
);
/**
* @dev Emitted on repay()
* @param reserve The address of the underlying asset of the reserve
* @param user The beneficiary of the repayment, getting his debt reduced
* @param repayer The address of the user initiating the repay(), providing the funds
* @param amount The amount repaid
* @param useATokens True if the repayment is done using aTokens, `false` if done with underlying asset directly
*/
event Repay(
address indexed reserve,
address indexed user,
address indexed repayer,
uint256 amount,
bool useATokens
);
/**
* @dev Emitted on swapBorrowRateMode()
* @param reserve The address of the underlying asset of the reserve
* @param user The address of the user swapping his rate mode
* @param interestRateMode The current interest rate mode of the position being swapped: 1 for Stable, 2 for Variable
*/
event SwapBorrowRateMode(
address indexed reserve,
address indexed user,
DataTypes.InterestRateMode interestRateMode
);
/**
* @dev Emitted on borrow(), repay() and liquidationCall() when using isolated assets
* @param asset The address of the underlying asset of the reserve
* @param totalDebt The total isolation mode debt for the reserve
*/
event IsolationModeTotalDebtUpdated(address indexed asset, uint256 totalDebt);
/**
* @dev Emitted when the user selects a certain asset category for eMode
* @param user The address of the user
* @param categoryId The category id
*/
event UserEModeSet(address indexed user, uint8 categoryId);
/**
* @dev Emitted on setUserUseReserveAsCollateral()
* @param reserve The address of the underlying asset of the reserve
* @param user The address of the user enabling the usage as collateral
*/
event ReserveUsedAsCollateralEnabled(address indexed reserve, address indexed user);
/**
* @dev Emitted on setUserUseReserveAsCollateral()
* @param reserve The address of the underlying asset of the reserve
* @param user The address of the user enabling the usage as collateral
*/
event ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user);
/**
* @dev Emitted on rebalanceStableBorrowRate()
* @param reserve The address of the underlying asset of the reserve
* @param user The address of the user for which the rebalance has been executed
*/
event RebalanceStableBorrowRate(address indexed reserve, address indexed user);
/**
* @dev Emitted on flashLoan()
* @param target The address of the flash loan receiver contract
* @param initiator The address initiating the flash loan
* @param asset The address of the asset being flash borrowed
* @param amount The amount flash borrowed
* @param interestRateMode The flashloan mode: 0 for regular flashloan, 1 for Stable debt, 2 for Variable debt
* @param premium The fee flash borrowed
* @param referralCode The referral code used
*/
event FlashLoan(
address indexed target,
address initiator,
address indexed asset,
uint256 amount,
DataTypes.InterestRateMode interestRateMode,
uint256 premium,
uint16 indexed referralCode
);
/**
* @dev Emitted when a borrower is liquidated.
* @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
* @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
* @param user The address of the borrower getting liquidated
* @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
* @param liquidatedCollateralAmount The amount of collateral received by the liquidator
* @param liquidator The address of the liquidator
* @param receiveAToken True if the liquidators wants to receive the collateral aTokens, `false` if he wants
* to receive the underlying collateral asset directly
*/
event LiquidationCall(
address indexed collateralAsset,
address indexed debtAsset,
address indexed user,
uint256 debtToCover,
uint256 liquidatedCollateralAmount,
address liquidator,
bool receiveAToken
);
/**
* @dev Emitted when the state of a reserve is updated.
* @param reserve The address of the underlying asset of the reserve
* @param liquidityRate The next liquidity rate
* @param stableBorrowRate The next stable borrow rate
* @param variableBorrowRate The next variable borrow rate
* @param liquidityIndex The next liquidity index
* @param variableBorrowIndex The next variable borrow index
*/
event ReserveDataUpdated(
address indexed reserve,
uint256 liquidityRate,
uint256 stableBorrowRate,
uint256 variableBorrowRate,
uint256 liquidityIndex,
uint256 variableBorrowIndex
);
/**
* @dev Emitted when the protocol treasury receives minted aTokens from the accrued interest.
* @param reserve The address of the reserve
* @param amountMinted The amount minted to the treasury
*/
event MintedToTreasury(address indexed reserve, uint256 amountMinted);
/**
* @notice Mints an `amount` of aTokens to the `onBehalfOf`
* @param asset The address of the underlying asset to mint
* @param amount The amount to mint
* @param onBehalfOf The address that will receive the aTokens
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function mintUnbacked(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode
) external;
/**
* @notice Back the current unbacked underlying with `amount` and pay `fee`.
* @param asset The address of the underlying asset to back
* @param amount The amount to back
* @param fee The amount paid in fees
* @return The backed amount
*/
function backUnbacked(address asset, uint256 amount, uint256 fee) external returns (uint256);
/**
* @notice Supplies an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
* - E.g. User supplies 100 USDC and gets in return 100 aUSDC
* @param asset The address of the underlying asset to supply
* @param amount The amount to be supplied
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
* is a different wallet
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function supply(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;
/**
* @notice Supply with transfer approval of asset to be supplied done via permit function
* see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
* @param asset The address of the underlying asset to supply
* @param amount The amount to be supplied
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
* is a different wallet
* @param deadline The deadline timestamp that the permit is valid
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
* @param permitV The V parameter of ERC712 permit sig
* @param permitR The R parameter of ERC712 permit sig
* @param permitS The S parameter of ERC712 permit sig
*/
function supplyWithPermit(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode,
uint256 deadline,
uint8 permitV,
bytes32 permitR,
bytes32 permitS
) external;
/**
* @notice Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned
* E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC
* @param asset The address of the underlying asset to withdraw
* @param amount The underlying amount to be withdrawn
* - Send the value type(uint256).max in order to withdraw the whole aToken balance
* @param to The address that will receive the underlying, same as msg.sender if the user
* wants to receive it on his own wallet, or a different address if the beneficiary is a
* different wallet
* @return The final amount withdrawn
*/
function withdraw(address asset, uint256 amount, address to) external returns (uint256);
/**
* @notice Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower
* already supplied enough collateral, or he was given enough allowance by a credit delegator on the
* corresponding debt token (StableDebtToken or VariableDebtToken)
* - E.g. User borrows 100 USDC passing as `onBehalfOf` his own address, receiving the 100 USDC in his wallet
* and 100 stable/variable debt tokens, depending on the `interestRateMode`
* @param asset The address of the underlying asset to borrow
* @param amount The amount to be borrowed
* @param interestRateMode The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable
* @param referralCode The code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
* @param onBehalfOf The address of the user who will receive the debt. Should be the address of the borrower itself
* calling the function if he wants to borrow against his own collateral, or the address of the credit delegator
* if he has been given credit delegation allowance
*/
function borrow(
address asset,
uint256 amount,
uint256 interestRateMode,
uint16 referralCode,
address onBehalfOf
) external;
/**
* @notice Repays a borrowed `amount` on a specific reserve, burning the equivalent debt tokens owned
* - E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the `onBehalfOf` address
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
* @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
* @param onBehalfOf The address of the user who will get his debt reduced/removed. Should be the address of the
* user calling the function if he wants to reduce/remove his own debt, or the address of any other
* other borrower whose debt should be removed
* @return The final amount repaid
*/
function repay(
address asset,
uint256 amount,
uint256 interestRateMode,
address onBehalfOf
) external returns (uint256);
/**
* @notice Repay with transfer approval of asset to be repaid done via permit function
* see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
* @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
* @param onBehalfOf Address of the user who will get his debt reduced/removed. Should be the address of the
* user calling the function if he wants to reduce/remove his own debt, or the address of any other
* other borrower whose debt should be removed
* @param deadline The deadline timestamp that the permit is valid
* @param permitV The V parameter of ERC712 permit sig
* @param permitR The R parameter of ERC712 permit sig
* @param permitS The S parameter of ERC712 permit sig
* @return The final amount repaid
*/
function repayWithPermit(
address asset,
uint256 amount,
uint256 interestRateMode,
address onBehalfOf,
uint256 deadline,
uint8 permitV,
bytes32 permitR,
bytes32 permitS
) external returns (uint256);
/**
* @notice Repays a borrowed `amount` on a specific reserve using the reserve aTokens, burning the
* equivalent debt tokens
* - E.g. User repays 100 USDC using 100 aUSDC, burning 100 variable/stable debt tokens
* @dev Passing uint256.max as amount will clean up any residual aToken dust balance, if the user aToken
* balance is not enough to cover the whole debt
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
* @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
* @return The final amount repaid
*/
function repayWithATokens(
address asset,
uint256 amount,
uint256 interestRateMode
) external returns (uint256);
/**
* @notice Allows a borrower to swap his debt between stable and variable mode, or vice versa
* @param asset The address of the underlying asset borrowed
* @param interestRateMode The current interest rate mode of the position being swapped: 1 for Stable, 2 for Variable
*/
function swapBorrowRateMode(address asset, uint256 interestRateMode) external;
/**
* @notice Permissionless method which allows anyone to swap a users stable debt to variable debt
* @dev Introduced in favor of stable rate deprecation
* @param asset The address of the underlying asset borrowed
* @param user The address of the user whose debt will be swapped from stable to variable
*/
function swapToVariable(address asset, address user) external;
/**
* @notice Rebalances the stable interest rate of a user to the current stable rate defined on the reserve.
* - Users can be rebalanced if the following conditions are satisfied:
* 1. Usage ratio is above 95%
* 2. the current supply APY is below REBALANCE_UP_THRESHOLD * maxVariableBorrowRate, which means that too
* much has been borrowed at a stable rate and suppliers are not earning enough
* @param asset The address of the underlying asset borrowed
* @param user The address of the user to be rebalanced
*/
function rebalanceStableBorrowRate(address asset, address user) external;
/**
* @notice Allows suppliers to enable/disable a specific supplied asset as collateral
* @param asset The address of the underlying asset supplied
* @param useAsCollateral True if the user wants to use the supply as collateral, false otherwise
*/
function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external;
/**
* @notice Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1
* - The caller (liquidator) covers `debtToCover` amount of debt of the user getting liquidated, and receives
* a proportionally amount of the `collateralAsset` plus a bonus to cover market risk
* @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
* @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
* @param user The address of the borrower getting liquidated
* @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
* @param receiveAToken True if the liquidators wants to receive the collateral aTokens, `false` if he wants
* to receive the underlying collateral asset directly
*/
function liquidationCall(
address collateralAsset,
address debtAsset,
address user,
uint256 debtToCover,
bool receiveAToken
) external;
/**
* @notice Allows smartcontracts to access the liquidity of the pool within one transaction,
* as long as the amount taken plus a fee is returned.
* @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept
* into consideration. For further details please visit https://docs.aave.com/developers/
* @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanReceiver interface
* @param assets The addresses of the assets being flash-borrowed
* @param amounts The amounts of the assets being flash-borrowed
* @param interestRateModes Types of the debt to open if the flash loan is not returned:
* 0 -> Don't open any debt, just revert if funds can't be transferred from the receiver
* 1 -> Open debt at stable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
* 2 -> Open debt at variable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
* @param onBehalfOf The address that will receive the debt in the case of using on `modes` 1 or 2
* @param params Variadic packed params to pass to the receiver as extra information
* @param referralCode The code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function flashLoan(
address receiverAddress,
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata interestRateModes,
address onBehalfOf,
bytes calldata params,
uint16 referralCode
) external;
/**
* @notice Allows smartcontracts to access the liquidity of the pool within one transaction,
* as long as the amount taken plus a fee is returned.
* @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept
* into consideration. For further details please visit https://docs.aave.com/developers/
* @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanSimpleReceiver interface
* @param asset The address of the asset being flash-borrowed
* @param amount The amount of the asset being flash-borrowed
* @param params Variadic packed params to pass to the receiver as extra information
* @param referralCode The code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function flashLoanSimple(
address receiverAddress,
address asset,
uint256 amount,
bytes calldata params,
uint16 referralCode
) external;
/**
* @notice Returns the user account data across all the reserves
* @param user The address of the user
* @return totalCollateralBase The total collateral of the user in the base currency used by the price feed
* @return totalDebtBase The total debt of the user in the base currency used by the price feed
* @return availableBorrowsBase The borrowing power left of the user in the base currency used by the price feed
* @return currentLiquidationThreshold The liquidation threshold of the user
* @return ltv The loan to value of The user
* @return healthFactor The current health factor of the user
*/
function getUserAccountData(
address user
)
external
view
returns (
uint256 totalCollateralBase,
uint256 totalDebtBase,
uint256 availableBorrowsBase,
uint256 currentLiquidationThreshold,
uint256 ltv,
uint256 healthFactor
);
/**
* @notice Initializes a reserve, activating it, assigning an aToken and debt tokens and an
* interest rate strategy
* @dev Only callable by the PoolConfigurator contract
* @param asset The address of the underlying asset of the reserve
* @param aTokenAddress The address of the aToken that will be assigned to the reserve
* @param stableDebtAddress The address of the StableDebtToken that will be assigned to the reserve
* @param variableDebtAddress The address of the VariableDebtToken that will be assigned to the reserve
* @param interestRateStrategyAddress The address of the interest rate strategy contract
*/
function initReserve(
address asset,
address aTokenAddress,
address stableDebtAddress,
address variableDebtAddress,
address interestRateStrategyAddress
) external;
/**
* @notice Drop a reserve
* @dev Only callable by the PoolConfigurator contract
* @param asset The address of the underlying asset of the reserve
*/
function dropReserve(address asset) external;
/**
* @notice Updates the address of the interest rate strategy contract
* @dev Only callable by the PoolConfigurator contract
* @param asset The address of the underlying asset of the reserve
* @param rateStrategyAddress The address of the interest rate strategy contract
*/
function setReserveInterestRateStrategyAddress(
address asset,
address rateStrategyAddress
) external;
/**
* @notice Accumulates interest to all indexes of the reserve
* @dev Only callable by the PoolConfigurator contract
* @dev To be used when required by the configurator, for example when updating interest rates strategy data
* @param asset The address of the underlying asset of the reserve
*/
function syncIndexesState(address asset) external;
/**
* @notice Updates interest rates on the reserve data
* @dev Only callable by the PoolConfigurator contract
* @dev To be used when required by the configurator, for example when updating interest rates strategy data
* @param asset The address of the underlying asset of the reserve
*/
function syncRatesState(address asset) external;
/**
* @notice Sets the configuration bitmap of the reserve as a whole
* @dev Only callable by the PoolConfigurator contract
* @param asset The address of the underlying asset of the reserve
* @param configuration The new configuration bitmap
*/
function setConfiguration(
address asset,
DataTypes.ReserveConfigurationMap calldata configuration
) external;
/**
* @notice Returns the configuration of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The configuration of the reserve
*/
function getConfiguration(
address asset
) external view returns (DataTypes.ReserveConfigurationMap memory);
/**
* @notice Returns the configuration of the user across all the reserves
* @param user The user address
* @return The configuration of the user
*/
function getUserConfiguration(
address user
) external view returns (DataTypes.UserConfigurationMap memory);
/**
* @notice Returns the normalized income of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The reserve's normalized income
*/
function getReserveNormalizedIncome(address asset) external view returns (uint256);
/**
* @notice Returns the normalized variable debt per unit of asset
* @dev WARNING: This function is intended to be used primarily by the protocol itself to get a
* "dynamic" variable index based on time, current stored index and virtual rate at the current
* moment (approx. a borrower would get if opening a position). This means that is always used in
* combination with variable debt supply/balances.
* If using this function externally, consider that is possible to have an increasing normalized
* variable debt that is not equivalent to how the variable debt index would be updated in storage
* (e.g. only updates with non-zero variable debt supply)
* @param asset The address of the underlying asset of the reserve
* @return The reserve normalized variable debt
*/
function getReserveNormalizedVariableDebt(address asset) external view returns (uint256);
/**
* @notice Returns the state and configuration of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The state and configuration data of the reserve
*/
function getReserveData(address asset) external view returns (DataTypes.ReserveDataLegacy memory);
/**
* @notice Returns the state and configuration of the reserve, including extra data included with Aave v3.1
* @param asset The address of the underlying asset of the reserve
* @return The state and configuration data of the reserve with virtual accounting
*/
function getReserveDataExtended(
address asset
) external view returns (DataTypes.ReserveData memory);
/**
* @notice Returns the virtual underlying balance of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The reserve virtual underlying balance
*/
function getVirtualUnderlyingBalance(address asset) external view returns (uint128);
/**
* @notice Validates and finalizes an aToken transfer
* @dev Only callable by the overlying aToken of the `asset`
* @param asset The address of the underlying asset of the aToken
* @param from The user from which the aTokens are transferred
* @param to The user receiving the aTokens
* @param amount The amount being transferred/withdrawn
* @param balanceFromBefore The aToken balance of the `from` user before the transfer
* @param balanceToBefore The aToken balance of the `to` user before the transfer
*/
function finalizeTransfer(
address asset,
address from,
address to,
uint256 amount,
uint256 balanceFromBefore,
uint256 balanceToBefore
) external;
/**
* @notice Returns the list of the underlying assets of all the initialized reserves
* @dev It does not include dropped reserves
* @return The addresses of the underlying assets of the initialized reserves
*/
function getReservesList() external view returns (address[] memory);
/**
* @notice Returns the number of initialized reserves
* @dev It includes dropped reserves
* @return The count
*/
function getReservesCount() external view returns (uint256);
/**
* @notice Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct
* @param id The id of the reserve as stored in the DataTypes.ReserveData struct
* @return The address of the reserve associated with id
*/
function getReserveAddressById(uint16 id) external view returns (address);
/**
* @notice Returns the PoolAddressesProvider connected to this contract
* @return The address of the PoolAddressesProvider
*/
function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider);
/**
* @notice Updates the protocol fee on the bridging
* @param bridgeProtocolFee The part of the premium sent to the protocol treasury
*/
function updateBridgeProtocolFee(uint256 bridgeProtocolFee) external;
/**
* @notice Updates flash loan premiums. Flash loan premium consists of two parts:
* - A part is sent to aToken holders as extra, one time accumulated interest
* - A part is collected by the protocol treasury
* @dev The total premium is calculated on the total borrowed amount
* @dev The premium to protocol is calculated on the total premium, being a percentage of `flashLoanPremiumTotal`
* @dev Only callable by the PoolConfigurator contract
* @param flashLoanPremiumTotal The total premium, expressed in bps
* @param flashLoanPremiumToProtocol The part of the premium sent to the protocol treasury, expressed in bps
*/
function updateFlashloanPremiums(
uint128 flashLoanPremiumTotal,
uint128 flashLoanPremiumToProtocol
) external;
/**
* @notice Configures a new category for the eMode.
* @dev In eMode, the protocol allows very high borrowing power to borrow assets of the same category.
* The category 0 is reserved as it's the default for volatile assets
* @param id The id of the category
* @param config The configuration of the category
*/
function configureEModeCategory(uint8 id, DataTypes.EModeCategory memory config) external;
/**
* @notice Returns the data of an eMode category
* @param id The id of the category
* @return The configuration data of the category
*/
function getEModeCategoryData(uint8 id) external view returns (DataTypes.EModeCategory memory);
/**
* @notice Allows a user to use the protocol in eMode
* @param categoryId The id of the category
*/
function setUserEMode(uint8 categoryId) external;
/**
* @notice Returns the eMode the user is using
* @param user The address of the user
* @return The eMode id
*/
function getUserEMode(address user) external view returns (uint256);
/**
* @notice Resets the isolation mode total debt of the given asset to zero
* @dev It requires the given asset has zero debt ceiling
* @param asset The address of the underlying asset to reset the isolationModeTotalDebt
*/
function resetIsolationModeTotalDebt(address asset) external;
/**
* @notice Sets the liquidation grace period of the given asset
* @dev To enable a liquidation grace period, a timestamp in the future should be set,
* To disable a liquidation grace period, any timestamp in the past works, like 0
* @param asset The address of the underlying asset to set the liquidationGracePeriod
* @param until Timestamp when the liquidation grace period will end
**/
function setLiquidationGracePeriod(address asset, uint40 until) external;
/**
* @notice Returns the liquidation grace period of the given asset
* @param asset The address of the underlying asset
* @return Timestamp when the liquidation grace period will end
**/
function getLiquidationGracePeriod(address asset) external returns (uint40);
/**
* @notice Returns the percentage of available liquidity that can be borrowed at once at stable rate
* @return The percentage of available liquidity to borrow, expressed in bps
*/
function MAX_STABLE_RATE_BORROW_SIZE_PERCENT() external view returns (uint256);
/**
* @notice Returns the total fee on flash loans
* @return The total fee on flashloans
*/
function FLASHLOAN_PREMIUM_TOTAL() external view returns (uint128);
/**
* @notice Returns the part of the bridge fees sent to protocol
* @return The bridge fee sent to the protocol treasury
*/
function BRIDGE_PROTOCOL_FEE() external view returns (uint256);
/**
* @notice Returns the part of the flashloan fees sent to protocol
* @return The flashloan fee sent to the protocol treasury
*/
function FLASHLOAN_PREMIUM_TO_PROTOCOL() external view returns (uint128);
/**
* @notice Returns the maximum number of reserves supported to be listed in this Pool
* @return The maximum number of reserves supported
*/
function MAX_NUMBER_RESERVES() external view returns (uint16);
/**
* @notice Mints the assets accrued through the reserve factor to the treasury in the form of aTokens
* @param assets The list of reserves for which the minting needs to be executed
*/
function mintToTreasury(address[] calldata assets) external;
/**
* @notice Rescue and transfer tokens locked in this contract
* @param token The address of the token
* @param to The address of the recipient
* @param amount The amount of token to transfer
*/
function rescueTokens(address token, address to, uint256 amount) external;
/**
* @notice Supplies an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
* - E.g. User supplies 100 USDC and gets in return 100 aUSDC
* @dev Deprecated: Use the `supply` function instead
* @param asset The address of the underlying asset to supply
* @param amount The amount to be supplied
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
* is a different wallet
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;
/**
* @notice Gets the address of the external FlashLoanLogic
*/
function getFlashLoanLogic() external returns (address);
/**
* @notice Gets the address of the external BorrowLogic
*/
function getBorrowLogic() external returns (address);
/**
* @notice Gets the address of the external BridgeLogic
*/
function getBridgeLogic() external returns (address);
/**
* @notice Gets the address of the external EModeLogic
*/
function getEModeLogic() external returns (address);
/**
* @notice Gets the address of the external LiquidationLogic
*/
function getLiquidationLogic() external returns (address);
/**
* @notice Gets the address of the external PoolLogic
*/
function getPoolLogic() external returns (address);
/**
* @notice Gets the address of the external SupplyLogic
*/
function getSupplyLogic() external returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2;
/// @dev Interface of the ERC20 standard as defined in the EIP.
/// @dev This includes the optional name, symbol, and decimals metadata.
interface IERC20 {
/// @dev Emitted when `value` tokens are moved from one account (`from`) to another (`to`).
event Transfer(address indexed from, address indexed to, uint256 value);
/// @dev Emitted when the allowance of a `spender` for an `owner` is set, where `value`
/// is the new allowance.
event Approval(address indexed owner, address indexed spender, uint256 value);
/// @notice Returns the amount of tokens in existence.
function totalSupply() external view returns (uint256);
/// @notice Returns the amount of tokens owned by `account`.
function balanceOf(address account) external view returns (uint256);
/// @notice Moves `amount` tokens from the caller's account to `to`.
function transfer(address to, uint256 amount) external returns (bool);
/// @notice Returns the remaining number of tokens that `spender` is allowed
/// to spend on behalf of `owner`
function allowance(address owner, address spender) external view returns (uint256);
/// @notice Sets `amount` as the allowance of `spender` over the caller's tokens.
/// @dev Be aware of front-running risks: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
function approve(address spender, uint256 amount) external returns (bool);
/// @notice Moves `amount` tokens from `from` to `to` using the allowance mechanism.
/// `amount` is then deducted from the caller's allowance.
function transferFrom(address from, address to, uint256 amount) external returns (bool);
/// @notice Returns the name of the token.
function name() external view returns (string memory);
/// @notice Returns the symbol of the token.
function symbol() external view returns (string memory);
/// @notice Returns the decimals places of the token.
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2;
import "./IERC20.sol";
/// @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in
/// https://eips.ethereum.org/EIPS/eip-4626
interface IERC4626 is IERC20 {
event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);
event Withdraw(
address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares
);
/// @notice Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
/// @dev
/// - MUST be an ERC-20 token contract.
/// - MUST NOT revert.
function asset() external view returns (address assetTokenAddress);
/// @notice Returns the total amount of the underlying asset that is “managed” by Vault.
/// @dev
/// - SHOULD include any compounding that occurs from yield.
/// - MUST be inclusive of any fees that are charged against assets in the Vault.
/// - MUST NOT revert.
function totalAssets() external view returns (uint256 totalManagedAssets);
/// @notice Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
/// scenario where all the conditions are met.
/// @dev
/// - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
/// - MUST NOT show any variations depending on the caller.
/// - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
/// - MUST NOT revert.
///
/// NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
/// “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
/// from.
function convertToShares(uint256 assets) external view returns (uint256 shares);
/// @notice Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
/// scenario where all the conditions are met.
/// @dev
/// - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
/// - MUST NOT show any variations depending on the caller.
/// - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
/// - MUST NOT revert.
///
/// NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
/// “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
/// from.
function convertToAssets(uint256 shares) external view returns (uint256 assets);
/// @notice Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
/// through a deposit call.
/// @dev
/// - MUST return a limited value if receiver is subject to some deposit limit.
/// - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
/// - MUST NOT revert.
function maxDeposit(address receiver) external view returns (uint256 maxAssets);
/// @notice Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
/// current on-chain conditions.
/// @dev
/// - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
/// call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
/// in the same transaction.
/// - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
/// deposit would be accepted, regardless if the user has enough tokens approved, etc.
/// - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
/// - MUST NOT revert.
///
/// NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
/// share price or some other type of condition, meaning the depositor will lose assets by depositing.
function previewDeposit(uint256 assets) external view returns (uint256 shares);
/// @notice Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
/// @dev
/// - MUST emit the Deposit event.
/// - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
/// deposit execution, and are accounted for during deposit.
/// - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
/// approving enough underlying tokens to the Vault contract, etc).
///
/// NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
function deposit(uint256 assets, address receiver) external returns (uint256 shares);
/// @notice Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
/// @dev
/// - MUST return a limited value if receiver is subject to some mint limit.
/// - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
/// - MUST NOT revert.
function maxMint(address receiver) external view returns (uint256 maxShares);
/// @notice Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
/// current on-chain conditions.
/// @dev
/// - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
/// in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
/// same transaction.
/// - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
/// would be accepted, regardless if the user has enough tokens approved, etc.
/// - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
/// - MUST NOT revert.
///
/// NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
/// share price or some other type of condition, meaning the depositor will lose assets by minting.
function previewMint(uint256 shares) external view returns (uint256 assets);
/// @notice Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
/// @dev
/// - MUST emit the Deposit event.
/// - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
/// execution, and are accounted for during mint.
/// - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
/// approving enough underlying tokens to the Vault contract, etc).
///
/// NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
function mint(uint256 shares, address receiver) external returns (uint256 assets);
/// @notice Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
/// Vault, through a withdrawal call.
/// @dev
/// - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
/// - MUST NOT revert.
function maxWithdraw(address owner) external view returns (uint256 maxAssets);
/// @notice Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
/// given current on-chain conditions.
/// @dev
/// - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
/// call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
/// called
/// in the same transaction.
/// - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
/// the withdrawal would be accepted, regardless if the user has enough shares, etc.
/// - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
/// - MUST NOT revert.
///
/// NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
/// share price or some other type of condition, meaning the depositor will lose assets by depositing.
function previewWithdraw(uint256 assets) external view returns (uint256 shares);
/// @notice Burns shares from owner and sends exactly assets of underlying tokens to receiver.
/// @dev
/// - MUST emit the Withdraw event.
/// - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
/// withdraw execution, and are accounted for during withdrawal.
/// - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
/// not having enough shares, etc).
///
/// Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
/// Those methods should be performed separately.
function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);
/// @notice Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
/// through a redeem call.
/// @dev
/// - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
/// - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
/// - MUST NOT revert.
function maxRedeem(address owner) external view returns (uint256 maxShares);
/// @notice Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
/// given current on-chain conditions.
/// @dev
/// - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
/// in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
/// same transaction.
/// - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
/// redemption would be accepted, regardless if the user has enough shares, etc.
/// - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
/// - MUST NOT revert.
///
/// NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
/// share price or some other type of condition, meaning the depositor will lose assets by redeeming.
function previewRedeem(uint256 shares) external view returns (uint256 assets);
/// @notice Burns exactly shares from owner and sends assets of underlying tokens to receiver.
/// @dev
/// - MUST emit the Withdraw event.
/// - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
/// redeem execution, and are accounted for during redeem.
/// - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
/// not having enough shares, etc).
///
/// NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
/// Those methods should be performed separately.
function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2;
import "./IERC7575.sol";
/// @dev Interface of the base operator logic of ERC7540, as defined in
/// https://eips.ethereum.org/EIPS/eip-7540
interface IERC7540Operator {
/**
* @dev The event emitted when an operator is set.
*
* @param controller The address of the controller.
* @param operator The address of the operator.
* @param approved The approval status.
*/
event OperatorSet(address indexed controller, address indexed operator, bool approved);
/**
* @dev Sets or removes an operator for the caller.
*
* @param operator The address of the operator.
* @param approved The approval status.
* @return Whether the call was executed successfully or not
*/
function setOperator(address operator, bool approved) external returns (bool);
/**
* @dev Returns `true` if the `operator` is approved as an operator for an `controller`.
*
* @param controller The address of the controller.
* @param operator The address of the operator.
* @return status The approval status
*/
function isOperator(address controller, address operator) external view returns (bool status);
}
/// @dev Interface of the asynchronous deposit Vault interface of ERC7540, as defined in
/// https://eips.ethereum.org/EIPS/eip-7540
interface IERC7540Deposit is IERC7540Operator {
event DepositRequest(
address indexed controller, address indexed owner, uint256 indexed requestId, address sender, uint256 assets
);
/**
* @dev Transfers assets from sender into the Vault and submits a Request for asynchronous deposit.
*
* - MUST support ERC-20 approve / transferFrom on asset as a deposit Request flow.
* - MUST revert if all of assets cannot be requested for deposit.
* - owner MUST be msg.sender unless some unspecified explicit approval is given by the caller,
* approval of ERC-20 tokens from owner to sender is NOT enough.
*
* @param assets the amount of deposit assets to transfer from owner
* @param controller the controller of the request who will be able to operate the request
* @param owner the source of the deposit assets
*
* NOTE: most implementations will require pre-approval of the Vault with the Vault's underlying asset token.
*/
function requestDeposit(uint256 assets, address controller, address owner) external returns (uint256 requestId);
/**
* @dev Returns the amount of requested assets in Pending state.
*
* - MUST NOT include any assets in Claimable state for deposit or mint.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT revert unless due to integer overflow caused by an unreasonably large input.
*/
function pendingDepositRequest(uint256 requestId, address controller)
external
view
returns (uint256 pendingAssets);
/**
* @dev Returns the amount of requested assets in Claimable state for the controller to deposit or mint.
*
* - MUST NOT include any assets in Pending state.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT revert unless due to integer overflow caused by an unreasonably large input.
*/
function claimableDepositRequest(uint256 requestId, address controller)
external
view
returns (uint256 claimableAssets);
/**
* @dev Mints shares Vault shares to receiver by claiming the Request of the controller.
*
* - MUST emit the Deposit event.
* - controller MUST equal msg.sender unless the controller has approved the msg.sender as an operator.
*/
function deposit(uint256 assets, address receiver, address controller) external returns (uint256 shares);
/**
* @dev Mints exactly shares Vault shares to receiver by claiming the Request of the controller.
*
* - MUST emit the Deposit event.
* - controller MUST equal msg.sender unless the controller has approved the msg.sender as an operator.
*/
function mint(uint256 shares, address receiver, address controller) external returns (uint256 assets);
}
/// @dev Interface of the asynchronous deposit Vault interface of ERC7540, as defined in
/// https://eips.ethereum.org/EIPS/eip-7540
interface IERC7540Redeem is IERC7540Operator {
event RedeemRequest(
address indexed controller, address indexed owner, uint256 indexed requestId, address sender, uint256 assets
);
/**
* @dev Assumes control of shares from sender into the Vault and submits a Request for asynchronous redeem.
*
* - MUST support a redeem Request flow where the control of shares is taken from sender directly
* where msg.sender has ERC-20 approval over the shares of owner.
* - MUST revert if all of shares cannot be requested for redeem.
*
* @param shares the amount of shares to be redeemed to transfer from owner
* @param controller the controller of the request who will be able to operate the request
* @param owner the source of the shares to be redeemed
*
* NOTE: most implementations will require pre-approval of the Vault with the Vault's share token.
*/
function requestRedeem(uint256 shares, address controller, address owner) external returns (uint256 requestId);
/**
* @dev Returns the amount of requested shares in Pending state.
*
* - MUST NOT include any shares in Claimable state for redeem or withdraw.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT revert unless due to integer overflow caused by an unreasonably large input.
*/
function pendingRedeemRequest(uint256 requestId, address controller)
external
view
returns (uint256 pendingShares);
/**
* @dev Returns the amount of requested shares in Claimable state for the controller to redeem or withdraw.
*
* - MUST NOT include any shares in Pending state for redeem or withdraw.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT revert unless due to integer overflow caused by an unreasonably large input.
*/
function claimableRedeemRequest(uint256 requestId, address controller)
external
view
returns (uint256 claimableShares);
}
/// @dev Interface of the fully asynchronous Vault interface of ERC7540, as defined in
/// https://eips.ethereum.org/EIPS/eip-7540
interface IERC7540 is IERC7540Deposit, IERC7540Redeem, IERC7575 {}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
import {IMorpho, Id, MarketParams} from "../../lib/morpho-blue/src/interfaces/IMorpho.sol";
import {IERC4626} from "../../lib/openzeppelin-contracts/contracts/interfaces/IERC4626.sol";
import {IERC20Permit} from "../../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol";
import {MarketConfig, PendingUint192, PendingAddress} from "../libraries/PendingLib.sol";
struct MarketAllocation {
/// @notice The market to allocate.
MarketParams marketParams;
/// @notice The amount of assets to allocate.
uint256 assets;
}
interface IMulticall {
function multicall(bytes[] calldata) external returns (bytes[] memory);
}
interface IOwnable {
function owner() external view returns (address);
function transferOwnership(address) external;
function renounceOwnership() external;
function acceptOwnership() external;
function pendingOwner() external view returns (address);
}
/// @dev This interface is used for factorizing IMetaMorphoStaticTyping and IMetaMorpho.
/// @dev Consider using the IMetaMorpho interface instead of this one.
interface IMetaMorphoBase {
/// @notice The address of the Morpho contract.
function MORPHO() external view returns (IMorpho);
function DECIMALS_OFFSET() external view returns (uint8);
/// @notice The address of the curator.
function curator() external view returns (address);
/// @notice Stores whether an address is an allocator or not.
function isAllocator(address target) external view returns (bool);
/// @notice The current guardian. Can be set even without the timelock set.
function guardian() external view returns (address);
/// @notice The current fee.
function fee() external view returns (uint96);
/// @notice The fee recipient.
function feeRecipient() external view returns (address);
/// @notice The skim recipient.
function skimRecipient() external view returns (address);
/// @notice The current timelock.
function timelock() external view returns (uint256);
/// @dev Stores the order of markets on which liquidity is supplied upon deposit.
/// @dev Can contain any market. A market is skipped as soon as its supply cap is reached.
function supplyQueue(uint256) external view returns (Id);
/// @notice Returns the length of the supply queue.
function supplyQueueLength() external view returns (uint256);
/// @dev Stores the order of markets from which liquidity is withdrawn upon withdrawal.
/// @dev Always contain all non-zero cap markets as well as all markets on which the vault supplies liquidity,
/// without duplicate.
function withdrawQueue(uint256) external view returns (Id);
/// @notice Returns the length of the withdraw queue.
function withdrawQueueLength() external view returns (uint256);
/// @notice Stores the total assets managed by this vault when the fee was last accrued.
/// @dev May be greater than `totalAssets()` due to removal of markets with non-zero supply or socialized bad debt.
/// This difference will decrease the fee accrued until one of the functions updating `lastTotalAssets` is
/// triggered (deposit/mint/withdraw/redeem/setFee/setFeeRecipient).
function lastTotalAssets() external view returns (uint256);
/// @notice Submits a `newTimelock`.
/// @dev Warning: Reverts if a timelock is already pending. Revoke the pending timelock to overwrite it.
/// @dev In case the new timelock is higher than the current one, the timelock is set immediately.
function submitTimelock(uint256 newTimelock) external;
/// @notice Accepts the pending timelock.
function acceptTimelock() external;
/// @notice Revokes the pending timelock.
/// @dev Does not revert if there is no pending timelock.
function revokePendingTimelock() external;
/// @notice Submits a `newSupplyCap` for the market defined by `marketParams`.
/// @dev Warning: Reverts if a cap is already pending. Revoke the pending cap to overwrite it.
/// @dev Warning: Reverts if a market removal is pending.
/// @dev In case the new cap is lower than the current one, the cap is set immediately.
function submitCap(MarketParams memory marketParams, uint256 newSupplyCap) external;
/// @notice Accepts the pending cap of the market defined by `marketParams`.
function acceptCap(MarketParams memory marketParams) external;
/// @notice Revokes the pending cap of the market defined by `id`.
/// @dev Does not revert if there is no pending cap.
function revokePendingCap(Id id) external;
/// @notice Submits a forced market removal from the vault, eventually losing all funds supplied to the market.
/// @notice Funds can be recovered by enabling this market again and withdrawing from it (using `reallocate`),
/// but funds will be distributed pro-rata to the shares at the time of withdrawal, not at the time of removal.
/// @notice This forced removal is expected to be used as an emergency process in case a market constantly reverts.
/// To softly remove a sane market, the curator role is expected to bundle a reallocation that empties the market
/// first (using `reallocate`), followed by the removal of the market (using `updateWithdrawQueue`).
/// @dev Warning: Removing a market with non-zero supply will instantly impact the vault's price per share.
/// @dev Warning: Reverts for non-zero cap or if there is a pending cap. Successfully submitting a zero cap will
/// prevent such reverts.
function submitMarketRemoval(MarketParams memory marketParams) external;
/// @notice Revokes the pending removal of the market defined by `id`.
/// @dev Does not revert if there is no pending market removal.
function revokePendingMarketRemoval(Id id) external;
/// @notice Submits a `newGuardian`.
/// @notice Warning: a malicious guardian could disrupt the vault's operation, and would have the power to revoke
/// any pending guardian.
/// @dev In case there is no guardian, the gardian is set immediately.
/// @dev Warning: Submitting a gardian will overwrite the current pending gardian.
function submitGuardian(address newGuardian) external;
/// @notice Accepts the pending guardian.
function acceptGuardian() external;
/// @notice Revokes the pending guardian.
function revokePendingGuardian() external;
/// @notice Skims the vault `token` balance to `skimRecipient`.
function skim(address) external;
/// @notice Sets `newAllocator` as an allocator or not (`newIsAllocator`).
function setIsAllocator(address newAllocator, bool newIsAllocator) external;
/// @notice Sets `curator` to `newCurator`.
function setCurator(address newCurator) external;
/// @notice Sets the `fee` to `newFee`.
function setFee(uint256 newFee) external;
/// @notice Sets `feeRecipient` to `newFeeRecipient`.
function setFeeRecipient(address newFeeRecipient) external;
/// @notice Sets `skimRecipient` to `newSkimRecipient`.
function setSkimRecipient(address newSkimRecipient) external;
/// @notice Sets `supplyQueue` to `newSupplyQueue`.
/// @param newSupplyQueue is an array of enabled markets, and can contain duplicate markets, but it would only
/// increase the cost of depositing to the vault.
function setSupplyQueue(Id[] calldata newSupplyQueue) external;
/// @notice Updates the withdraw queue. Some markets can be removed, but no market can be added.
/// @notice Removing a market requires the vault to have 0 supply on it, or to have previously submitted a removal
/// for this market (with the function `submitMarketRemoval`).
/// @notice Warning: Anyone can supply on behalf of the vault so the call to `updateWithdrawQueue` that expects a
/// market to be empty can be griefed by a front-run. To circumvent this, the allocator can simply bundle a
/// reallocation that withdraws max from this market with a call to `updateWithdrawQueue`.
/// @dev Warning: Removing a market with supply will decrease the fee accrued until one of the functions updating
/// `lastTotalAssets` is triggered (deposit/mint/withdraw/redeem/setFee/setFeeRecipient).
/// @dev Warning: `updateWithdrawQueue` is not idempotent. Submitting twice the same tx will change the queue twice.
/// @param indexes The indexes of each market in the previous withdraw queue, in the new withdraw queue's order.
function updateWithdrawQueue(uint256[] calldata indexes) external;
/// @notice Reallocates the vault's liquidity so as to reach a given allocation of assets on each given market.
/// @notice The allocator can withdraw from any market, even if it's not in the withdraw queue, as long as the loan
/// token of the market is the same as the vault's asset.
/// @dev The behavior of the reallocation can be altered by state changes, including:
/// - Deposits on the vault that supplies to markets that are expected to be supplied to during reallocation.
/// - Withdrawals from the vault that withdraws from markets that are expected to be withdrawn from during
/// reallocation.
/// - Donations to the vault on markets that are expected to be supplied to during reallocation.
/// - Withdrawals from markets that are expected to be withdrawn from during reallocation.
/// @dev Sender is expected to pass `assets = type(uint256).max` with the last MarketAllocation of `allocations` to
/// supply all the remaining withdrawn liquidity, which would ensure that `totalWithdrawn` = `totalSupplied`.
function reallocate(MarketAllocation[] calldata allocations) external;
}
/// @dev This interface is inherited by MetaMorpho so that function signatures are checked by the compiler.
/// @dev Consider using the IMetaMorpho interface instead of this one.
interface IMetaMorphoStaticTyping is IMetaMorphoBase {
/// @notice Returns the current configuration of each market.
function config(Id) external view returns (uint184 cap, bool enabled, uint64 removableAt);
/// @notice Returns the pending guardian.
function pendingGuardian() external view returns (address guardian, uint64 validAt);
/// @notice Returns the pending cap for each market.
function pendingCap(Id) external view returns (uint192 value, uint64 validAt);
/// @notice Returns the pending timelock.
function pendingTimelock() external view returns (uint192 value, uint64 validAt);
}
/// @title IMetaMorpho
/// @author Morpho Labs
/// @custom:contact [email protected]
/// @dev Use this interface for MetaMorpho to have access to all the functions with the appropriate function signatures.
interface IMetaMorpho is IMetaMorphoBase, IERC4626, IERC20Permit, IOwnable, IMulticall {
/// @notice Returns the current configuration of each market.
function config(Id) external view returns (MarketConfig memory);
/// @notice Returns the pending guardian.
function pendingGuardian() external view returns (PendingAddress memory);
/// @notice Returns the pending cap for each market.
function pendingCap(Id) external view returns (PendingUint192 memory);
/// @notice Returns the pending timelock.
function pendingTimelock() external view returns (PendingUint192 memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
mapping(bytes32 role => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
return _roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
if (!hasRole(role, account)) {
_roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
if (hasRole(role, account)) {
_roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity >=0.8.0;
library Ethereum {
/******************************************************************************************************************/
/*** Token Addresses ***/
/******************************************************************************************************************/
address internal constant CBBTC = 0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf;
address internal constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
address internal constant GNO = 0x6810e776880C02933D47DB1b9fc05908e5386b96;
address internal constant MKR = 0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2;
address internal constant RETH = 0xae78736Cd615f374D3085123A210448E74Fc6393;
address internal constant SDAI = 0x83F20F44975D03b1b09e64809B757c47f942BEeA;
address internal constant SUSDE = 0x9D39A5DE30e57443BfF2A8307A4256c8797A3497;
address internal constant SUSDS = 0xa3931d71877C0E7a3148CB7Eb4463524FEc27fbD;
address internal constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
address internal constant USDE = 0x4c9EDD5852cd905f086C759E8383e09bff1E68B3;
address internal constant USDS = 0xdC035D45d973E3EC169d2276DDab16f1e407384F;
address internal constant USCC = 0x14d60E7FDC0D71d8611742720E4C50E7a974020c;
address internal constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
address internal constant USTB = 0x43415eB6ff9DB7E26A15b704e7A3eDCe97d31C4e;
address internal constant WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;
address internal constant WEETH = 0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee;
address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address internal constant WSTETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;
/******************************************************************************************************************/
/*** MakerDAO Addresses ***/
/******************************************************************************************************************/
address internal constant CHIEF = 0x0a3f6849f78076aefaDf113F5BED87720274dDC0;
address internal constant DAI_USDS = 0x3225737a9Bbb6473CB4a45b7244ACa2BeFdB276A;
address internal constant PAUSE_PROXY = 0xBE8E3e3618f7474F8cB1d074A26afFef007E98FB;
address internal constant POT = 0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7;
address internal constant PSM = 0xf6e72Db5454dd049d0788e411b06CfAF16853042; // Lite PSM
address internal constant VAT = 0x35D1b3F3D7966A1DFe207aa4514C12a259A0492B;
/******************************************************************************************************************/
/*** SparkDAO Addresses ***/
/******************************************************************************************************************/
address internal constant SPARK_PROXY = 0x3300f198988e4C9C63F75dF86De36421f06af8c4;
/******************************************************************************************************************/
/*** Allocation System Addresses ***/
/******************************************************************************************************************/
address internal constant ALLOCATOR_BUFFER = 0xc395D150e71378B47A1b8E9de0c1a83b75a08324;
address internal constant ALLOCATOR_ORACLE = 0xc7B91C401C02B73CBdF424dFaaa60950d5040dB7;
address internal constant ALLOCATOR_REGISTRY = 0xCdCFA95343DA7821fdD01dc4d0AeDA958051bB3B;
address internal constant ALLOCATOR_ROLES = 0x9A865A710399cea85dbD9144b7a09C889e94E803;
address internal constant ALLOCATOR_VAULT = 0x691a6c29e9e96dd897718305427Ad5D534db16BA;
/******************************************************************************************************************/
/*** Spark Liquidity Layer Addresses ***/
/******************************************************************************************************************/
address internal constant ALM_CONTROLLER = 0x5cf73FDb7057E436A6eEaDFAd27E45E7ab6E431e;
address internal constant ALM_PROXY = 0x1601843c5E9bC251A3272907010AFa41Fa18347E;
address internal constant ALM_RATE_LIMITS = 0x7A5FD5cf045e010e62147F065cEAe59e5344b188;
address internal constant ALM_FREEZER = 0x90D8c80C028B4C09C0d8dcAab9bbB057F0513431;
address internal constant ALM_RELAYER = 0x8a25A24EDE9482C4Fc0738F99611BE58F1c839AB;
/******************************************************************************************************************/
/*** Ethena Addresses ***/
/******************************************************************************************************************/
address internal constant ETHENA_MINTER = 0xe3490297a08d6fC8Da46Edb7B6142E4F461b62D3;
/******************************************************************************************************************/
/*** Aave Addresses ***/
/******************************************************************************************************************/
address internal constant ATOKEN_CORE_USDS = 0x32a6268f9Ba3642Dda7892aDd74f1D34469A4259;
address internal constant ATOKEN_CORE_USDC = 0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c;
/******************************************************************************************************************/
/*** Blackrock BUIDL Addresses ***/
/******************************************************************************************************************/
address internal constant BUIDL_REDEEM = 0x31D3F59Ad4aAC0eeE2247c65EBE8Bf6E9E470a53;
/******************************************************************************************************************/
/*** Morpho Addresses ***/
/******************************************************************************************************************/
address internal constant MORPHO = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;
address internal constant MORPHO_DEFAULT_IRM = 0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC;
address internal constant MORPHO_SUSDE_ORACLE = 0x5D916980D5Ae1737a8330Bf24dF812b2911Aae25;
address internal constant MORPHO_USDE_ORACLE = 0xaE4750d0813B5E37A51f7629beedd72AF1f9cA35;
address internal constant MORPHO_VAULT_DAI_1 = 0x73e65DBD630f90604062f6E02fAb9138e713edD9;
/******************************************************************************************************************/
/*** Superstate Addresses ***/
/******************************************************************************************************************/
address internal constant SUPERSTATE_REDEMPTION = 0x4c21B7577C8FE8b0B0669165ee7C8f67fa1454Cf;
/******************************************************************************************************************/
/*** SparkLend - Core Protocol Addresses ***/
/******************************************************************************************************************/
address internal constant AAVE_ORACLE = 0x8105f69D9C41644c6A0803fDA7D03Aa70996cFD9;
address internal constant ACL_MANAGER = 0xdA135Cd78A086025BcdC87B038a1C462032b510C;
address internal constant DAI_TREASURY = 0x856900aa78e856a5df1a2665eE3a66b2487cD68f;
address internal constant EMISSION_MANAGER = 0xf09e48dd4CA8e76F63a57ADd428bB06fee7932a4;
address internal constant INCENTIVES = 0x4370D3b6C9588E02ce9D22e684387859c7Ff5b34;
address internal constant POOL = 0xC13e21B648A5Ee794902342038FF3aDAB66BE987;
address internal constant POOL_ADDRESSES_PROVIDER = 0x02C3eA4e34C0cBd694D2adFa2c690EECbC1793eE;
address internal constant POOL_ADDRESSES_PROVIDER_REGISTRY = 0x03cFa0C4622FF84E50E75062683F44c9587e6Cc1;
address internal constant POOL_CONFIGURATOR = 0x542DBa469bdE58FAeE189ffB60C6b49CE60E0738;
address internal constant TREASURY = 0xb137E7d16564c81ae2b0C8ee6B55De81dd46ECe5;
address internal constant TREASURY_CONTROLLER = 0x92eF091C5a1E01b3CE1ba0D0150C84412d818F7a;
address internal constant WETH_GATEWAY = 0xBD7D6a9ad7865463DE44B05F04559f65e3B11704;
/******************************************************************************************************************/
/*** SparkLend - Reserve Token Addresses ***/
/******************************************************************************************************************/
address internal constant CBBTC_ATOKEN = 0xb3973D459df38ae57797811F2A1fd061DA1BC123;
address internal constant CBBTC_STABLE_DEBT_TOKEN = 0x26a76E2fa1EaDbe7C30f0c333059Bcc3642c28d2;
address internal constant CBBTC_DEBT_TOKEN = 0x661fE667D2103eb52d3632a3eB2cAbd123F27938;
address internal constant DAI_ATOKEN = 0x4DEDf26112B3Ec8eC46e7E31EA5e123490B05B8B;
address internal constant DAI_STABLE_DEBT_TOKEN = 0xfe2B7a7F4cC0Fb76f7Fc1C6518D586F1e4559176;
address internal constant DAI_DEBT_TOKEN = 0xf705d2B7e92B3F38e6ae7afaDAA2fEE110fE5914;
address internal constant GNO_ATOKEN = 0x7b481aCC9fDADDc9af2cBEA1Ff2342CB1733E50F;
address internal constant GNO_STABLE_DEBT_TOKEN = 0xbf13910620722D4D4F8A03962894EB3335Bf4FaE;
address internal constant GNO_DEBT_TOKEN = 0x57a2957651DA467fCD4104D749f2F3684784c25a;
address internal constant RETH_ATOKEN = 0x9985dF20D7e9103ECBCeb16a84956434B6f06ae8;
address internal constant RETH_STABLE_DEBT_TOKEN = 0xa9a4037295Ea3a168DC3F65fE69FdA524d52b3e1;
address internal constant RETH_DEBT_TOKEN = 0xBa2C8F2eA5B56690bFb8b709438F049e5Dd76B96;
address internal constant SDAI_ATOKEN = 0x78f897F0fE2d3B5690EbAe7f19862DEacedF10a7;
address internal constant SDAI_STABLE_DEBT_TOKEN = 0xEc6C6aBEd4DC03299EFf82Ac8A0A83643d3cB335;
address internal constant SDAI_DEBT_TOKEN = 0xaBc57081C04D921388240393ec4088Aa47c6832B;
address internal constant USDC_ATOKEN = 0x377C3bd93f2a2984E1E7bE6A5C22c525eD4A4815;
address internal constant USDC_STABLE_DEBT_TOKEN = 0x887Ac022983Ff083AEb623923789052A955C6798;
address internal constant USDC_DEBT_TOKEN = 0x7B70D04099CB9cfb1Db7B6820baDAfB4C5C70A67;
address internal constant USDT_ATOKEN = 0xe7dF13b8e3d6740fe17CBE928C7334243d86c92f;
address internal constant USDT_STABLE_DEBT_TOKEN = 0x0Dae62F953Ceb2E969fB4dE85f3F9074fa920776;
address internal constant USDT_DEBT_TOKEN = 0x529b6158d1D2992E3129F7C69E81a7c677dc3B12;
address internal constant WBTC_ATOKEN = 0x4197ba364AE6698015AE5c1468f54087602715b2;
address internal constant WBTC_STABLE_DEBT_TOKEN = 0x4b29e6cBeE62935CfC92efcB3839eD2c2F35C1d9;
address internal constant WBTC_DEBT_TOKEN = 0xf6fEe3A8aC8040C3d6d81d9A4a168516Ec9B51D2;
address internal constant WEETH_ATOKEN = 0x3CFd5C0D4acAA8Faee335842e4f31159fc76B008;
address internal constant WEETH_STABLE_DEBT_TOKEN = 0x5B1F8aF3E6C0BF4d20e8e5220a4e4A3A8fA6Dc0A;
address internal constant WEETH_DEBT_TOKEN = 0xc2bD6d2fEe70A0A73a33795BdbeE0368AeF5c766;
address internal constant WETH_ATOKEN = 0x59cD1C87501baa753d0B5B5Ab5D8416A45cD71DB;
address internal constant WETH_STABLE_DEBT_TOKEN = 0x3c6b93D38ffA15ea995D1BC950d5D0Fa6b22bD05;
address internal constant WETH_DEBT_TOKEN = 0x2e7576042566f8D6990e07A1B61Ad1efd86Ae70d;
address internal constant WSTETH_ATOKEN = 0x12B54025C112Aa61fAce2CDB7118740875A566E9;
address internal constant WSTETH_STABLE_DEBT_TOKEN = 0x9832D969a0c8662D98fFf334A4ba7FeE62b109C2;
address internal constant WSTETH_DEBT_TOKEN = 0xd5c3E3B566a42A6110513Ac7670C1a86D76E13E6;
/******************************************************************************************************************/
/*** SparkLend - Auxiliary Protocol Addresses ***/
/******************************************************************************************************************/
address internal constant CAP_AUTOMATOR = 0x2276f52afba7Cf2525fd0a050DF464AC8532d0ef;
address internal constant FREEZER_MOM = 0x237e3985dD7E373F2ec878EC1Ac48A228Cf2e7a3;
address internal constant KILL_SWITCH_ORACLE = 0x909A86f78e1cdEd68F9c2Fe2c9CD922c401abe82;
/******************************************************************************************************************/
/*** SparkLend - Emergency Spells ***/
/******************************************************************************************************************/
address internal constant SPELL_FREEZE_ALL = 0x9e2890BF7f8D5568Cc9e5092E67Ba00C8dA3E97f;
address internal constant SPELL_FREEZE_DAI = 0xa2039bef2c5803d66E4e68F9E23a942E350b938c;
address internal constant SPELL_PAUSE_ALL = 0x425b0de240b4c2DC45979DB782A355D090Dc4d37;
address internal constant SPELL_PAUSE_DAI = 0xCacB88e39112B56278db25b423441248cfF94241;
address internal constant SPELL_REMOVE_MULTISIG = 0xE47AB4919F6F5459Dcbbfbe4264BD4630c0169A9;
/******************************************************************************************************************/
/*** SparkLend - Implementation Addresses ***/
/******************************************************************************************************************/
address internal constant A_TOKEN_IMPL = 0x6175ddEc3B9b38c88157C10A01ed4A3fa8639cC6;
address internal constant DAI_TREASURY_IMPL = 0xF1E57711Eb5F897b415de1aEFCB64d9BAe58D312;
address internal constant INCENTIVES_IMPL = 0x0ee554F6A1f7a4Cb4f82D4C124DdC2AD3E37fde1;
address internal constant POOL_CONFIGURATOR_IMPL = 0xF7b656C95420194b79687fc86D965FB51DA4799F;
address internal constant POOL_IMPL = 0x5aE329203E00f76891094DcfedD5Aca082a50e1b;
address internal constant STABLE_DEBT_TOKEN_IMPL = 0x026a5B6114431d8F3eF2fA0E1B2EDdDccA9c540E;
address internal constant TREASURY_IMPL = 0xF1E57711Eb5F897b415de1aEFCB64d9BAe58D312;
address internal constant VARIABLE_DEBT_TOKEN_IMPL = 0x86C71796CcDB31c3997F8Ec5C2E3dB3e9e40b985;
/******************************************************************************************************************/
/*** SparkLend - Config Engine Addresses ***/
/******************************************************************************************************************/
address internal constant CONFIG_ENGINE = 0x3254F7cd0565aA67eEdC86c2fB608BE48d5cCd78;
address internal constant PROXY_ADMIN = 0x883A82BDd3d07ae6ACfD151020faD350df25087e;
address internal constant RATES_FACTORY = 0xfE57e187EF6285e90d7049e6a21571aa47cF11a2;
address internal constant TRANSPARENT_PROXY_FACTORY = 0x777803CbDD89D5D5Bc1DdD2151B51b0B07F6bf37;
/******************************************************************************************************************/
/*** SparkLend - Data Provider Addresses ***/
/******************************************************************************************************************/
address internal constant PROTOCOL_DATA_PROVIDER = 0xFc21d6d146E6086B8359705C8b28512a983db0cb;
address internal constant UI_INCENTIVE_DATA_PROVIDER = 0xA7F8A757C4f7696c015B595F51B2901AC0121B18;
address internal constant UI_POOL_DATA_PROVIDER = 0xF028c2F4b19898718fD0F77b9b881CbfdAa5e8Bb;
address internal constant WALLET_BALANCE_PROVIDER = 0xd2AeF86F51F92E8e49F42454c287AE4879D1BeDc;
/******************************************************************************************************************/
/*** SparkLend - Library Addresses ***/
/******************************************************************************************************************/
address internal constant BORROW_LOGIC = 0x4662C88C542F0954F8CccCDE4542eEc32d7E7e9a;
address internal constant BRIDGE_LOGIC = 0x2C54924711E479E639032704146b865E12f0C6D1;
address internal constant EMODE_LOGIC = 0x2Ad00613A66D71Ff2B0607fB3C4632C47a50DADe;
address internal constant FLASH_LOAN_LOGIC = 0x7f44e1c1dE70059D7cc483378BEFeE2a030CE247;
address internal constant LIQUIDATION_LOGIC = 0x6aEa92693C527bC2c7B3171C6f2598d67d619088;
address internal constant POOL_LOGIC = 0x1761a0f74032963B6Ad0774C5EBF4586c0bD7604;
address internal constant SUPPLY_LOGIC = 0x46256841e36b7557BB8e4c706beD38b17A9EB2c1;
/******************************************************************************************************************/
/*** Cross-Domain Addresses ***/
/******************************************************************************************************************/
address internal constant CCTP_TOKEN_MESSENGER = 0xBd3fa81B58Ba92a82136038B25aDec7066af3155;
address internal constant ARBITRUM_DSR_FORWARDER = 0x7F36E7F562Ee3f320644F6031e03E12a02B85799;
address internal constant OPTIMISM_DSR_FORWARDER = 0x4042127DecC0cF7cc0966791abebf7F76294DeF3;
address internal constant WORLD_CHAIN_DSR_FORWARDER = 0xA34437dAAE56A7CC6DC757048933D7777b3e547B;
/******************************************************************************************************************/
/*** Base Addresses ***/
/******************************************************************************************************************/
address internal constant BASE_DSR_FORWARDER = 0x8Ed551D485701fe489c215E13E42F6fc59563e0e;
address internal constant BASE_SSR_FORWARDER = 0xB2833392527f41262eB0E3C7b47AFbe030ef188E;
address internal constant BASE_ESCROW = 0x7F311a4D48377030bD810395f4CCfC03bdbe9Ef3;
address internal constant BASE_SKY_GOV_RELAY = 0x1Ee0AE8A993F2f5abDB51EAF4AC2876202b65c3b;
address internal constant BASE_TOKEN_BRIDGE = 0xA5874756416Fa632257eEA380CAbd2E87cED352A;
/******************************************************************************************************************/
/*** Multisigs ***/
/******************************************************************************************************************/
address internal constant MULTISIG_FREEZER = 0x44efFc473e81632B12486866AA1678edbb7BEeC3;
address internal constant MULTISIG_REWARDS = 0x8076807464DaC94Ac8Aa1f7aF31b58F73bD88A27;
/******************************************************************************************************************/
/*** User Action Addresses ***/
/******************************************************************************************************************/
address internal constant USER_ACTIONS_PSM_VARIANT1 = 0x52d298Ff9e77E71C2EB1992260520E7b15257d99;
}// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity >=0.8.0;
import { IAccessControl } from "openzeppelin-contracts/contracts/access/IAccessControl.sol";
interface IALMProxy is IAccessControl {
/**
* @dev This function retrieves a constant `bytes32` value that represents the controller.
* @return The `bytes32` identifier of the controller.
*/
function CONTROLLER() external view returns (bytes32);
/**
* @dev Performs a standard call to the specified `target` with the given `data`.
* Reverts if the call fails.
* @param target The address of the target contract to call.
* @param data The calldata that will be sent to the target contract.
* @return result The returned data from the call.
*/
function doCall(address target, bytes calldata data)
external returns (bytes memory result);
/**
* @dev This function allows for transferring `value` (ether) along with the call to the target contract.
* Reverts if the call fails.
* @param target The address of the target contract to call.
* @param data The calldata that will be sent to the target contract.
* @param value The amount of Ether (in wei) to send with the call.
* @return result The returned data from the call.
*/
function doCallWithValue(address target, bytes memory data, uint256 value)
external payable returns (bytes memory result);
/**
* @dev This function performs a delegate call to the specified `target`
* with the given `data`. Reverts if the call fails.
* @param target The address of the target contract to delegate call.
* @param data The calldata that will be sent to the target contract.
* @return result The returned data from the delegate call.
*/
function doDelegateCall(address target, bytes calldata data)
external returns (bytes memory result);
}// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity >=0.8.0;
interface ICCTPLike {
function depositForBurn(
uint256 amount,
uint32 destinationDomain,
bytes32 mintRecipient,
address burnToken
) external returns (uint64 nonce);
function localMinter() external view returns (ICCTPTokenMinterLike);
}
interface ICCTPTokenMinterLike {
function burnLimitsPerMessage(address) external view returns (uint256);
}// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity >=0.8.0;
import { IAccessControl } from "openzeppelin-contracts/contracts/access/IAccessControl.sol";
interface IRateLimits is IAccessControl {
/**********************************************************************************************/
/*** Structs ***/
/**********************************************************************************************/
/**
* @dev Struct representing a rate limit.
* The current rate limit is calculated using the formula:
* `currentRateLimit = min(slope * (block.timestamp - lastUpdated) + lastAmount, maxAmount)`.
* @param maxAmount Maximum allowed amount at any time.
* @param slope The slope of the rate limit, used to calculate the new
* limit based on time passed. [tokens / second]
* @param lastAmount The amount left available at the last update.
* @param lastUpdated The timestamp when the rate limit was last updated.
*/
struct RateLimitData {
uint256 maxAmount;
uint256 slope;
uint256 lastAmount;
uint256 lastUpdated;
}
/**********************************************************************************************/
/*** Events ***/
/**********************************************************************************************/
/**
* @dev Emitted when the rate limit data is set.
* @param key The identifier for the rate limit.
* @param maxAmount The maximum allowed amount for the rate limit.
* @param slope The slope value used in the rate limit calculation.
* @param lastAmount The amount left available at the last update.
* @param lastUpdated The timestamp when the rate limit was last updated.
*/
event RateLimitDataSet(
bytes32 indexed key,
uint256 maxAmount,
uint256 slope,
uint256 lastAmount,
uint256 lastUpdated
);
/**
* @dev Emitted when a rate limit decrease is triggered.
* @param key The identifier for the rate limit.
* @param amountToDecrease The amount to decrease from the current rate limit.
* @param oldRateLimit The previous rate limit value before triggering.
* @param newRateLimit The new rate limit value after triggering.
*/
event RateLimitDecreaseTriggered(
bytes32 indexed key,
uint256 amountToDecrease,
uint256 oldRateLimit,
uint256 newRateLimit
);
/**
* @dev Emitted when a rate limit increase is triggered.
* @param key The identifier for the rate limit.
* @param amountToIncrease The amount to increase from the current rate limit.
* @param oldRateLimit The previous rate limit value before triggering.
* @param newRateLimit The new rate limit value after triggering.
*/
event RateLimitIncreaseTriggered(
bytes32 indexed key,
uint256 amountToIncrease,
uint256 oldRateLimit,
uint256 newRateLimit
);
/**********************************************************************************************/
/*** State variables ***/
/**********************************************************************************************/
/**
* @dev Returns the controller identifier as a bytes32 value.
* @return The controller identifier.
*/
function CONTROLLER() external view returns (bytes32);
/**********************************************************************************************/
/*** Admin functions ***/
/**********************************************************************************************/
/**
* @dev Sets rate limit data for a specific key.
* @param key The identifier for the rate limit.
* @param maxAmount The maximum allowed amount for the rate limit.
* @param slope The slope value used in the rate limit calculation.
* @param lastAmount The amount left available at the last update.
* @param lastUpdated The timestamp when the rate limit was last updated.
*/
function setRateLimitData(
bytes32 key,
uint256 maxAmount,
uint256 slope,
uint256 lastAmount,
uint256 lastUpdated
) external;
/**
* @dev Sets rate limit data for a specific key with
* `lastAmount == maxAmount` and `lastUpdated == block.timestamp`.
* @param key The identifier for the rate limit.
* @param maxAmount The maximum allowed amount for the rate limit.
* @param slope The slope value used in the rate limit calculation.
*/
function setRateLimitData(bytes32 key, uint256 maxAmount, uint256 slope) external;
/**
* @dev Sets an unlimited rate limit.
* @param key The identifier for the rate limit.
*/
function setUnlimitedRateLimitData(bytes32 key) external;
/**********************************************************************************************/
/*** Getter Functions ***/
/**********************************************************************************************/
/**
* @dev Retrieves the RateLimitData struct associated with a specific key.
* @param key The identifier for the rate limit.
* @return The data associated with the rate limit.
*/
function getRateLimitData(bytes32 key) external view returns (RateLimitData memory);
/**
* @dev Retrieves the current rate limit for a specific key.
* @param key The identifier for the rate limit.
* @return The current rate limit value for the given key.
*/
function getCurrentRateLimit(bytes32 key) external view returns (uint256);
/**********************************************************************************************/
/*** Controller functions ***/
/**********************************************************************************************/
/**
* @dev Triggers the rate limit for a specific key and reduces the available
* amount by the provided value.
* @param key The identifier for the rate limit.
* @param amountToDecrease The amount to decrease from the current rate limit.
* @return newLimit The updated rate limit after the deduction.
*/
function triggerRateLimitDecrease(bytes32 key, uint256 amountToDecrease)
external returns (uint256 newLimit);
/**
* @dev Increases the rate limit for a given key up to the maxAmount. Does not revert if
* the new rate limit exceeds the maxAmount.
* @param key The identifier for the rate limit.
* @param amountToIncrease The amount to increase from the current rate limit.
* @return newLimit The updated rate limit after the addition.
*/
function triggerRateLimitIncrease(bytes32 key, uint256 amountToIncrease)
external returns (uint256 newLimit);
}// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.21;
import { IRateLimits } from "../src/interfaces/IRateLimits.sol";
struct RateLimitData {
uint256 maxAmount;
uint256 slope;
}
library RateLimitHelpers {
error InvalidUnlimitedRateLimitSlope(string name);
error InvalidMaxAmountPrecision(string name);
error InvalidSlopePrecision(string name);
function makeAssetKey(bytes32 key, address asset) internal pure returns (bytes32) {
return keccak256(abi.encode(key, asset));
}
function makeAssetDestinationKey(bytes32 key, address asset, address destination) internal pure returns (bytes32) {
return keccak256(abi.encode(key, asset, destination));
}
function makeDomainKey(bytes32 key, uint32 domain) internal pure returns (bytes32) {
return keccak256(abi.encode(key, domain));
}
function unlimitedRateLimit() internal pure returns (RateLimitData memory) {
return RateLimitData({
maxAmount : type(uint256).max,
slope : 0
});
}
function setRateLimitData(
bytes32 key,
address rateLimits,
RateLimitData memory data,
string memory name,
uint256 decimals
)
internal
{
// Handle setting an unlimited rate limit
if (data.maxAmount == type(uint256).max) {
if (data.slope != 0) {
revert InvalidUnlimitedRateLimitSlope(name);
}
} else {
uint256 upperBound = 1e12 * (10 ** decimals);
uint256 lowerBound = 10 ** decimals;
if (data.maxAmount > upperBound || data.maxAmount < lowerBound) {
revert InvalidMaxAmountPrecision(name);
}
if (
data.slope != 0 &&
(data.slope > upperBound / 1 hours || data.slope < lowerBound / 1 hours)
) {
revert InvalidSlopePrecision(name);
}
}
IRateLimits(rateLimits).setRateLimitData(key, data.maxAmount, data.slope);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title IScaledBalanceToken
* @author Aave
* @notice Defines the basic interface for a scaled-balance token.
*/
interface IScaledBalanceToken {
/**
* @dev Emitted after the mint action
* @param caller The address performing the mint
* @param onBehalfOf The address of the user that will receive the minted tokens
* @param value The scaled-up amount being minted (based on user entered amount and balance increase from interest)
* @param balanceIncrease The increase in scaled-up balance since the last action of 'onBehalfOf'
* @param index The next liquidity index of the reserve
*/
event Mint(
address indexed caller,
address indexed onBehalfOf,
uint256 value,
uint256 balanceIncrease,
uint256 index
);
/**
* @dev Emitted after the burn action
* @dev If the burn function does not involve a transfer of the underlying asset, the target defaults to zero address
* @param from The address from which the tokens will be burned
* @param target The address that will receive the underlying, if any
* @param value The scaled-up amount being burned (user entered amount - balance increase from interest)
* @param balanceIncrease The increase in scaled-up balance since the last action of 'from'
* @param index The next liquidity index of the reserve
*/
event Burn(
address indexed from,
address indexed target,
uint256 value,
uint256 balanceIncrease,
uint256 index
);
/**
* @notice Returns the scaled balance of the user.
* @dev The scaled balance is the sum of all the updated stored balance divided by the reserve's liquidity index
* at the moment of the update
* @param user The user whose balance is calculated
* @return The scaled balance of the user
*/
function scaledBalanceOf(address user) external view returns (uint256);
/**
* @notice Returns the scaled balance of the user and the scaled total supply.
* @param user The address of the user
* @return The scaled balance of the user
* @return The scaled total supply
*/
function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256);
/**
* @notice Returns the scaled total supply of the scaled balance token. Represents sum(debt/index)
* @return The scaled total supply
*/
function scaledTotalSupply() external view returns (uint256);
/**
* @notice Returns last index interest was accrued to the user's balance
* @param user The address of the user
* @return The last index interest was accrued to the user's balance, expressed in ray
*/
function getPreviousIndex(address user) external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IAaveIncentivesController} from './IAaveIncentivesController.sol';
import {IPool} from './IPool.sol';
/**
* @title IInitializableAToken
* @author Aave
* @notice Interface for the initialize function on AToken
*/
interface IInitializableAToken {
/**
* @dev Emitted when an aToken is initialized
* @param underlyingAsset The address of the underlying asset
* @param pool The address of the associated pool
* @param treasury The address of the treasury
* @param incentivesController The address of the incentives controller for this aToken
* @param aTokenDecimals The decimals of the underlying
* @param aTokenName The name of the aToken
* @param aTokenSymbol The symbol of the aToken
* @param params A set of encoded parameters for additional initialization
*/
event Initialized(
address indexed underlyingAsset,
address indexed pool,
address treasury,
address incentivesController,
uint8 aTokenDecimals,
string aTokenName,
string aTokenSymbol,
bytes params
);
/**
* @notice Initializes the aToken
* @param pool The pool contract that is initializing this contract
* @param treasury The address of the Aave treasury, receiving the fees on this aToken
* @param underlyingAsset The address of the underlying asset of this aToken (E.g. WETH for aWETH)
* @param incentivesController The smart contract managing potential incentives distribution
* @param aTokenDecimals The decimals of the aToken, same as the underlying asset's
* @param aTokenName The name of the aToken
* @param aTokenSymbol The symbol of the aToken
* @param params A set of encoded parameters for additional initialization
*/
function initialize(
IPool pool,
address treasury,
address underlyingAsset,
IAaveIncentivesController incentivesController,
uint8 aTokenDecimals,
string calldata aTokenName,
string calldata aTokenSymbol,
bytes calldata params
) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title IPoolAddressesProvider
* @author Aave
* @notice Defines the basic interface for a Pool Addresses Provider.
*/
interface IPoolAddressesProvider {
/**
* @dev Emitted when the market identifier is updated.
* @param oldMarketId The old id of the market
* @param newMarketId The new id of the market
*/
event MarketIdSet(string indexed oldMarketId, string indexed newMarketId);
/**
* @dev Emitted when the pool is updated.
* @param oldAddress The old address of the Pool
* @param newAddress The new address of the Pool
*/
event PoolUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the pool configurator is updated.
* @param oldAddress The old address of the PoolConfigurator
* @param newAddress The new address of the PoolConfigurator
*/
event PoolConfiguratorUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the price oracle is updated.
* @param oldAddress The old address of the PriceOracle
* @param newAddress The new address of the PriceOracle
*/
event PriceOracleUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the ACL manager is updated.
* @param oldAddress The old address of the ACLManager
* @param newAddress The new address of the ACLManager
*/
event ACLManagerUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the ACL admin is updated.
* @param oldAddress The old address of the ACLAdmin
* @param newAddress The new address of the ACLAdmin
*/
event ACLAdminUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the price oracle sentinel is updated.
* @param oldAddress The old address of the PriceOracleSentinel
* @param newAddress The new address of the PriceOracleSentinel
*/
event PriceOracleSentinelUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the pool data provider is updated.
* @param oldAddress The old address of the PoolDataProvider
* @param newAddress The new address of the PoolDataProvider
*/
event PoolDataProviderUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when a new proxy is created.
* @param id The identifier of the proxy
* @param proxyAddress The address of the created proxy contract
* @param implementationAddress The address of the implementation contract
*/
event ProxyCreated(
bytes32 indexed id,
address indexed proxyAddress,
address indexed implementationAddress
);
/**
* @dev Emitted when a new non-proxied contract address is registered.
* @param id The identifier of the contract
* @param oldAddress The address of the old contract
* @param newAddress The address of the new contract
*/
event AddressSet(bytes32 indexed id, address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the implementation of the proxy registered with id is updated
* @param id The identifier of the contract
* @param proxyAddress The address of the proxy contract
* @param oldImplementationAddress The address of the old implementation contract
* @param newImplementationAddress The address of the new implementation contract
*/
event AddressSetAsProxy(
bytes32 indexed id,
address indexed proxyAddress,
address oldImplementationAddress,
address indexed newImplementationAddress
);
/**
* @notice Returns the id of the Aave market to which this contract points to.
* @return The market id
*/
function getMarketId() external view returns (string memory);
/**
* @notice Associates an id with a specific PoolAddressesProvider.
* @dev This can be used to create an onchain registry of PoolAddressesProviders to
* identify and validate multiple Aave markets.
* @param newMarketId The market id
*/
function setMarketId(string calldata newMarketId) external;
/**
* @notice Returns an address by its identifier.
* @dev The returned address might be an EOA or a contract, potentially proxied
* @dev It returns ZERO if there is no registered address with the given id
* @param id The id
* @return The address of the registered for the specified id
*/
function getAddress(bytes32 id) external view returns (address);
/**
* @notice General function to update the implementation of a proxy registered with
* certain `id`. If there is no proxy registered, it will instantiate one and
* set as implementation the `newImplementationAddress`.
* @dev IMPORTANT Use this function carefully, only for ids that don't have an explicit
* setter function, in order to avoid unexpected consequences
* @param id The id
* @param newImplementationAddress The address of the new implementation
*/
function setAddressAsProxy(bytes32 id, address newImplementationAddress) external;
/**
* @notice Sets an address for an id replacing the address saved in the addresses map.
* @dev IMPORTANT Use this function carefully, as it will do a hard replacement
* @param id The id
* @param newAddress The address to set
*/
function setAddress(bytes32 id, address newAddress) external;
/**
* @notice Returns the address of the Pool proxy.
* @return The Pool proxy address
*/
function getPool() external view returns (address);
/**
* @notice Updates the implementation of the Pool, or creates a proxy
* setting the new `pool` implementation when the function is called for the first time.
* @param newPoolImpl The new Pool implementation
*/
function setPoolImpl(address newPoolImpl) external;
/**
* @notice Returns the address of the PoolConfigurator proxy.
* @return The PoolConfigurator proxy address
*/
function getPoolConfigurator() external view returns (address);
/**
* @notice Updates the implementation of the PoolConfigurator, or creates a proxy
* setting the new `PoolConfigurator` implementation when the function is called for the first time.
* @param newPoolConfiguratorImpl The new PoolConfigurator implementation
*/
function setPoolConfiguratorImpl(address newPoolConfiguratorImpl) external;
/**
* @notice Returns the address of the price oracle.
* @return The address of the PriceOracle
*/
function getPriceOracle() external view returns (address);
/**
* @notice Updates the address of the price oracle.
* @param newPriceOracle The address of the new PriceOracle
*/
function setPriceOracle(address newPriceOracle) external;
/**
* @notice Returns the address of the ACL manager.
* @return The address of the ACLManager
*/
function getACLManager() external view returns (address);
/**
* @notice Updates the address of the ACL manager.
* @param newAclManager The address of the new ACLManager
*/
function setACLManager(address newAclManager) external;
/**
* @notice Returns the address of the ACL admin.
* @return The address of the ACL admin
*/
function getACLAdmin() external view returns (address);
/**
* @notice Updates the address of the ACL admin.
* @param newAclAdmin The address of the new ACL admin
*/
function setACLAdmin(address newAclAdmin) external;
/**
* @notice Returns the address of the price oracle sentinel.
* @return The address of the PriceOracleSentinel
*/
function getPriceOracleSentinel() external view returns (address);
/**
* @notice Updates the address of the price oracle sentinel.
* @param newPriceOracleSentinel The address of the new PriceOracleSentinel
*/
function setPriceOracleSentinel(address newPriceOracleSentinel) external;
/**
* @notice Returns the address of the data provider.
* @return The address of the DataProvider
*/
function getPoolDataProvider() external view returns (address);
/**
* @notice Updates the address of the data provider.
* @param newDataProvider The address of the new DataProvider
*/
function setPoolDataProvider(address newDataProvider) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library DataTypes {
/**
* This exists specifically to maintain the `getReserveData()` interface, since the new, internal
* `ReserveData` struct includes the reserve's `virtualUnderlyingBalance`.
*/
struct ReserveDataLegacy {
//stores the reserve configuration
ReserveConfigurationMap configuration;
//the liquidity index. Expressed in ray
uint128 liquidityIndex;
//the current supply rate. Expressed in ray
uint128 currentLiquidityRate;
//variable borrow index. Expressed in ray
uint128 variableBorrowIndex;
//the current variable borrow rate. Expressed in ray
uint128 currentVariableBorrowRate;
//the current stable borrow rate. Expressed in ray
uint128 currentStableBorrowRate;
//timestamp of last update
uint40 lastUpdateTimestamp;
//the id of the reserve. Represents the position in the list of the active reserves
uint16 id;
//aToken address
address aTokenAddress;
//stableDebtToken address
address stableDebtTokenAddress;
//variableDebtToken address
address variableDebtTokenAddress;
//address of the interest rate strategy
address interestRateStrategyAddress;
//the current treasury balance, scaled
uint128 accruedToTreasury;
//the outstanding unbacked aTokens minted through the bridging feature
uint128 unbacked;
//the outstanding debt borrowed against this asset in isolation mode
uint128 isolationModeTotalDebt;
}
struct ReserveData {
//stores the reserve configuration
ReserveConfigurationMap configuration;
//the liquidity index. Expressed in ray
uint128 liquidityIndex;
//the current supply rate. Expressed in ray
uint128 currentLiquidityRate;
//variable borrow index. Expressed in ray
uint128 variableBorrowIndex;
//the current variable borrow rate. Expressed in ray
uint128 currentVariableBorrowRate;
//the current stable borrow rate. Expressed in ray
uint128 currentStableBorrowRate;
//timestamp of last update
uint40 lastUpdateTimestamp;
//the id of the reserve. Represents the position in the list of the active reserves
uint16 id;
//timestamp until when liquidations are not allowed on the reserve, if set to past liquidations will be allowed
uint40 liquidationGracePeriodUntil;
//aToken address
address aTokenAddress;
//stableDebtToken address
address stableDebtTokenAddress;
//variableDebtToken address
address variableDebtTokenAddress;
//address of the interest rate strategy
address interestRateStrategyAddress;
//the current treasury balance, scaled
uint128 accruedToTreasury;
//the outstanding unbacked aTokens minted through the bridging feature
uint128 unbacked;
//the outstanding debt borrowed against this asset in isolation mode
uint128 isolationModeTotalDebt;
//the amount of underlying accounted for by the protocol
uint128 virtualUnderlyingBalance;
}
struct ReserveConfigurationMap {
//bit 0-15: LTV
//bit 16-31: Liq. threshold
//bit 32-47: Liq. bonus
//bit 48-55: Decimals
//bit 56: reserve is active
//bit 57: reserve is frozen
//bit 58: borrowing is enabled
//bit 59: stable rate borrowing enabled
//bit 60: asset is paused
//bit 61: borrowing in isolation mode is enabled
//bit 62: siloed borrowing enabled
//bit 63: flashloaning enabled
//bit 64-79: reserve factor
//bit 80-115: borrow cap in whole tokens, borrowCap == 0 => no cap
//bit 116-151: supply cap in whole tokens, supplyCap == 0 => no cap
//bit 152-167: liquidation protocol fee
//bit 168-175: eMode category
//bit 176-211: unbacked mint cap in whole tokens, unbackedMintCap == 0 => minting disabled
//bit 212-251: debt ceiling for isolation mode with (ReserveConfiguration::DEBT_CEILING_DECIMALS) decimals
//bit 252: virtual accounting is enabled for the reserve
//bit 253-255 unused
uint256 data;
}
struct UserConfigurationMap {
/**
* @dev Bitmap of the users collaterals and borrows. It is divided in pairs of bits, one pair per asset.
* The first bit indicates if an asset is used as collateral by the user, the second whether an
* asset is borrowed by the user.
*/
uint256 data;
}
struct EModeCategory {
// each eMode category has a custom ltv and liquidation threshold
uint16 ltv;
uint16 liquidationThreshold;
uint16 liquidationBonus;
// each eMode category may or may not have a custom oracle to override the individual assets price oracles
address priceSource;
string label;
}
enum InterestRateMode {
NONE,
STABLE,
VARIABLE
}
struct ReserveCache {
uint256 currScaledVariableDebt;
uint256 nextScaledVariableDebt;
uint256 currPrincipalStableDebt;
uint256 currAvgStableBorrowRate;
uint256 currTotalStableDebt;
uint256 nextAvgStableBorrowRate;
uint256 nextTotalStableDebt;
uint256 currLiquidityIndex;
uint256 nextLiquidityIndex;
uint256 currVariableBorrowIndex;
uint256 nextVariableBorrowIndex;
uint256 currLiquidityRate;
uint256 currVariableBorrowRate;
uint256 reserveFactor;
ReserveConfigurationMap reserveConfiguration;
address aTokenAddress;
address stableDebtTokenAddress;
address variableDebtTokenAddress;
uint40 reserveLastUpdateTimestamp;
uint40 stableDebtLastUpdateTimestamp;
}
struct ExecuteLiquidationCallParams {
uint256 reservesCount;
uint256 debtToCover;
address collateralAsset;
address debtAsset;
address user;
bool receiveAToken;
address priceOracle;
uint8 userEModeCategory;
address priceOracleSentinel;
}
struct ExecuteSupplyParams {
address asset;
uint256 amount;
address onBehalfOf;
uint16 referralCode;
}
struct ExecuteBorrowParams {
address asset;
address user;
address onBehalfOf;
uint256 amount;
InterestRateMode interestRateMode;
uint16 referralCode;
bool releaseUnderlying;
uint256 maxStableRateBorrowSizePercent;
uint256 reservesCount;
address oracle;
uint8 userEModeCategory;
address priceOracleSentinel;
}
struct ExecuteRepayParams {
address asset;
uint256 amount;
InterestRateMode interestRateMode;
address onBehalfOf;
bool useATokens;
}
struct ExecuteWithdrawParams {
address asset;
uint256 amount;
address to;
uint256 reservesCount;
address oracle;
uint8 userEModeCategory;
}
struct ExecuteSetUserEModeParams {
uint256 reservesCount;
address oracle;
uint8 categoryId;
}
struct FinalizeTransferParams {
address asset;
address from;
address to;
uint256 amount;
uint256 balanceFromBefore;
uint256 balanceToBefore;
uint256 reservesCount;
address oracle;
uint8 fromEModeCategory;
}
struct FlashloanParams {
address receiverAddress;
address[] assets;
uint256[] amounts;
uint256[] interestRateModes;
address onBehalfOf;
bytes params;
uint16 referralCode;
uint256 flashLoanPremiumToProtocol;
uint256 flashLoanPremiumTotal;
uint256 maxStableRateBorrowSizePercent;
uint256 reservesCount;
address addressesProvider;
address pool;
uint8 userEModeCategory;
bool isAuthorizedFlashBorrower;
}
struct FlashloanSimpleParams {
address receiverAddress;
address asset;
uint256 amount;
bytes params;
uint16 referralCode;
uint256 flashLoanPremiumToProtocol;
uint256 flashLoanPremiumTotal;
}
struct FlashLoanRepaymentParams {
uint256 amount;
uint256 totalPremium;
uint256 flashLoanPremiumToProtocol;
address asset;
address receiverAddress;
uint16 referralCode;
}
struct CalculateUserAccountDataParams {
UserConfigurationMap userConfig;
uint256 reservesCount;
address user;
address oracle;
uint8 userEModeCategory;
}
struct ValidateBorrowParams {
ReserveCache reserveCache;
UserConfigurationMap userConfig;
address asset;
address userAddress;
uint256 amount;
InterestRateMode interestRateMode;
uint256 maxStableLoanPercent;
uint256 reservesCount;
address oracle;
uint8 userEModeCategory;
address priceOracleSentinel;
bool isolationModeActive;
address isolationModeCollateralAddress;
uint256 isolationModeDebtCeiling;
}
struct ValidateLiquidationCallParams {
ReserveCache debtReserveCache;
uint256 totalDebt;
uint256 healthFactor;
address priceOracleSentinel;
}
struct CalculateInterestRatesParams {
uint256 unbacked;
uint256 liquidityAdded;
uint256 liquidityTaken;
uint256 totalStableDebt;
uint256 totalVariableDebt;
uint256 averageStableBorrowRate;
uint256 reserveFactor;
address reserve;
bool usingVirtualBalance;
uint256 virtualUnderlyingBalance;
}
struct InitReserveParams {
address asset;
address aTokenAddress;
address stableDebtAddress;
address variableDebtAddress;
address interestRateStrategyAddress;
uint16 reservesCount;
uint16 maxNumberReserves;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2;
import "./IERC165.sol";
/// @dev Interface of the ERC7575 "Multi-Asset ERC-4626 Vaults", as defined in
/// https://eips.ethereum.org/EIPS/eip-7575
interface IERC7575 is IERC165 {
event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);
event Withdraw(
address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares
);
/**
* @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
*
* - MUST be an ERC-20 token contract.
* - MUST NOT revert.
*/
function asset() external view returns (address assetTokenAddress);
/**
* @dev Returns the address of the share token
*
* - MUST be an ERC-20 token contract.
* - MUST NOT revert.
*/
function share() external view returns (address shareTokenAddress);
/**
* @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
* scenario where all the conditions are met.
*
* - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
* - MUST NOT revert.
*
* NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
* “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
* from.
*/
function convertToShares(uint256 assets) external view returns (uint256 shares);
/**
* @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
* scenario where all the conditions are met.
*
* - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
* - MUST NOT revert.
*
* NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
* “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
* from.
*/
function convertToAssets(uint256 shares) external view returns (uint256 assets);
/**
* @dev Returns the total amount of the underlying asset that is “managed” by Vault.
*
* - SHOULD include any compounding that occurs from yield.
* - MUST be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT revert.
*/
function totalAssets() external view returns (uint256 totalManagedAssets);
/**
* @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
* through a deposit call.
*
* - MUST return a limited value if receiver is subject to some deposit limit.
* - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
* - MUST NOT revert.
*/
function maxDeposit(address receiver) external view returns (uint256 maxAssets);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
* current on-chain conditions.
*
* - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
* call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
* in the same transaction.
* - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
* deposit would be accepted, regardless if the user has enough tokens approved, etc.
* - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by depositing.
*/
function previewDeposit(uint256 assets) external view returns (uint256 shares);
/**
* @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
*
* - MUST emit the Deposit event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* deposit execution, and are accounted for during deposit.
* - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
* approving enough underlying tokens to the Vault contract, etc).
*
* NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
*/
function deposit(uint256 assets, address receiver) external returns (uint256 shares);
/**
* @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
* - MUST return a limited value if receiver is subject to some mint limit.
* - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
* - MUST NOT revert.
*/
function maxMint(address receiver) external view returns (uint256 maxShares);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
* current on-chain conditions.
*
* - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
* in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
* same transaction.
* - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
* would be accepted, regardless if the user has enough tokens approved, etc.
* - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by minting.
*/
function previewMint(uint256 shares) external view returns (uint256 assets);
/**
* @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
*
* - MUST emit the Deposit event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
* execution, and are accounted for during mint.
* - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
* approving enough underlying tokens to the Vault contract, etc).
*
* NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
*/
function mint(uint256 shares, address receiver) external returns (uint256 assets);
/**
* @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
* Vault, through a withdraw call.
*
* - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
* - MUST NOT revert.
*/
function maxWithdraw(address owner) external view returns (uint256 maxAssets);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
* given current on-chain conditions.
*
* - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
* call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
* called
* in the same transaction.
* - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
* the withdrawal would be accepted, regardless if the user has enough shares, etc.
* - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by depositing.
*/
function previewWithdraw(uint256 assets) external view returns (uint256 shares);
/**
* @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.
*
* - MUST emit the Withdraw event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* withdraw execution, and are accounted for during withdraw.
* - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
* not having enough shares, etc).
*
* Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
* Those methods should be performed separately.
*/
function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);
/**
* @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
* through a redeem call.
*
* - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
* - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
* - MUST NOT revert.
*/
function maxRedeem(address owner) external view returns (uint256 maxShares);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
* given current on-chain conditions.
*
* - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
* in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
* same transaction.
* - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
* redemption would be accepted, regardless if the user has enough shares, etc.
* - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by redeeming.
*/
function previewRedeem(uint256 shares) external view returns (uint256 assets);
/**
* @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.
*
* - MUST emit the Withdraw event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* redeem execution, and are accounted for during redeem.
* - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
* not having enough shares, etc).
*
* NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
* Those methods should be performed separately.
*/
function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);
}
/// @dev Interface of the ERC20 share token, as defined in
/// https://eips.ethereum.org/EIPS/eip-7575
interface IERC7575Share is IERC165 {
event VaultUpdate(address indexed asset, address vault);
/**
* @dev Returns the address of the Vault for the given asset.
*
* @param asset the ERC-20 token to deposit with into the Vault
*/
function vault(address asset) external view returns (address);
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
type Id is bytes32;
struct MarketParams {
address loanToken;
address collateralToken;
address oracle;
address irm;
uint256 lltv;
}
/// @dev Warning: For `feeRecipient`, `supplyShares` does not contain the accrued shares since the last interest
/// accrual.
struct Position {
uint256 supplyShares;
uint128 borrowShares;
uint128 collateral;
}
/// @dev Warning: `totalSupplyAssets` does not contain the accrued interest since the last interest accrual.
/// @dev Warning: `totalBorrowAssets` does not contain the accrued interest since the last interest accrual.
/// @dev Warning: `totalSupplyShares` does not contain the additional shares accrued by `feeRecipient` since the last
/// interest accrual.
struct Market {
uint128 totalSupplyAssets;
uint128 totalSupplyShares;
uint128 totalBorrowAssets;
uint128 totalBorrowShares;
uint128 lastUpdate;
uint128 fee;
}
struct Authorization {
address authorizer;
address authorized;
bool isAuthorized;
uint256 nonce;
uint256 deadline;
}
struct Signature {
uint8 v;
bytes32 r;
bytes32 s;
}
/// @dev This interface is used for factorizing IMorphoStaticTyping and IMorpho.
/// @dev Consider using the IMorpho interface instead of this one.
interface IMorphoBase {
/// @notice The EIP-712 domain separator.
/// @dev Warning: Every EIP-712 signed message based on this domain separator can be reused on another chain sharing
/// the same chain id because the domain separator would be the same.
function DOMAIN_SEPARATOR() external view returns (bytes32);
/// @notice The owner of the contract.
/// @dev It has the power to change the owner.
/// @dev It has the power to set fees on markets and set the fee recipient.
/// @dev It has the power to enable but not disable IRMs and LLTVs.
function owner() external view returns (address);
/// @notice The fee recipient of all markets.
/// @dev The recipient receives the fees of a given market through a supply position on that market.
function feeRecipient() external view returns (address);
/// @notice Whether the `irm` is enabled.
function isIrmEnabled(address irm) external view returns (bool);
/// @notice Whether the `lltv` is enabled.
function isLltvEnabled(uint256 lltv) external view returns (bool);
/// @notice Whether `authorized` is authorized to modify `authorizer`'s position on all markets.
/// @dev Anyone is authorized to modify their own positions, regardless of this variable.
function isAuthorized(address authorizer, address authorized) external view returns (bool);
/// @notice The `authorizer`'s current nonce. Used to prevent replay attacks with EIP-712 signatures.
function nonce(address authorizer) external view returns (uint256);
/// @notice Sets `newOwner` as `owner` of the contract.
/// @dev Warning: No two-step transfer ownership.
/// @dev Warning: The owner can be set to the zero address.
function setOwner(address newOwner) external;
/// @notice Enables `irm` as a possible IRM for market creation.
/// @dev Warning: It is not possible to disable an IRM.
function enableIrm(address irm) external;
/// @notice Enables `lltv` as a possible LLTV for market creation.
/// @dev Warning: It is not possible to disable a LLTV.
function enableLltv(uint256 lltv) external;
/// @notice Sets the `newFee` for the given market `marketParams`.
/// @param newFee The new fee, scaled by WAD.
/// @dev Warning: The recipient can be the zero address.
function setFee(MarketParams memory marketParams, uint256 newFee) external;
/// @notice Sets `newFeeRecipient` as `feeRecipient` of the fee.
/// @dev Warning: If the fee recipient is set to the zero address, fees will accrue there and will be lost.
/// @dev Modifying the fee recipient will allow the new recipient to claim any pending fees not yet accrued. To
/// ensure that the current recipient receives all due fees, accrue interest manually prior to making any changes.
function setFeeRecipient(address newFeeRecipient) external;
/// @notice Creates the market `marketParams`.
/// @dev Here is the list of assumptions on the market's dependencies (tokens, IRM and oracle) that guarantees
/// Morpho behaves as expected:
/// - The token should be ERC-20 compliant, except that it can omit return values on `transfer` and `transferFrom`.
/// - The token balance of Morpho should only decrease on `transfer` and `transferFrom`. In particular, tokens with
/// burn functions are not supported.
/// - The token should not re-enter Morpho on `transfer` nor `transferFrom`.
/// - The token balance of the sender (resp. receiver) should decrease (resp. increase) by exactly the given amount
/// on `transfer` and `transferFrom`. In particular, tokens with fees on transfer are not supported.
/// - The IRM should not re-enter Morpho.
/// - The oracle should return a price with the correct scaling.
/// @dev Here is a list of properties on the market's dependencies that could break Morpho's liveness properties
/// (funds could get stuck):
/// - The token can revert on `transfer` and `transferFrom` for a reason other than an approval or balance issue.
/// - A very high amount of assets (~1e35) supplied or borrowed can make the computation of `toSharesUp` and
/// `toSharesDown` overflow.
/// - The IRM can revert on `borrowRate`.
/// - A very high borrow rate returned by the IRM can make the computation of `interest` in `_accrueInterest`
/// overflow.
/// - The oracle can revert on `price`. Note that this can be used to prevent `borrow`, `withdrawCollateral` and
/// `liquidate` from being used under certain market conditions.
/// - A very high price returned by the oracle can make the computation of `maxBorrow` in `_isHealthy` overflow, or
/// the computation of `assetsRepaid` in `liquidate` overflow.
/// @dev The borrow share price of a market with less than 1e4 assets borrowed can be decreased by manipulations, to
/// the point where `totalBorrowShares` is very large and borrowing overflows.
function createMarket(MarketParams memory marketParams) external;
/// @notice Supplies `assets` or `shares` on behalf of `onBehalf`, optionally calling back the caller's
/// `onMorphoSupply` function with the given `data`.
/// @dev Either `assets` or `shares` should be zero. Most use cases should rely on `assets` as an input so the
/// caller is guaranteed to have `assets` tokens pulled from their balance, but the possibility to mint a specific
/// amount of shares is given for full compatibility and precision.
/// @dev Supplying a large amount can revert for overflow.
/// @dev Supplying an amount of shares may lead to supply more or fewer assets than expected due to slippage.
/// Consider using the `assets` parameter to avoid this.
/// @param marketParams The market to supply assets to.
/// @param assets The amount of assets to supply.
/// @param shares The amount of shares to mint.
/// @param onBehalf The address that will own the increased supply position.
/// @param data Arbitrary data to pass to the `onMorphoSupply` callback. Pass empty data if not needed.
/// @return assetsSupplied The amount of assets supplied.
/// @return sharesSupplied The amount of shares minted.
function supply(
MarketParams memory marketParams,
uint256 assets,
uint256 shares,
address onBehalf,
bytes memory data
) external returns (uint256 assetsSupplied, uint256 sharesSupplied);
/// @notice Withdraws `assets` or `shares` on behalf of `onBehalf` and sends the assets to `receiver`.
/// @dev Either `assets` or `shares` should be zero. To withdraw max, pass the `shares`'s balance of `onBehalf`.
/// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions.
/// @dev Withdrawing an amount corresponding to more shares than supplied will revert for underflow.
/// @dev It is advised to use the `shares` input when withdrawing the full position to avoid reverts due to
/// conversion roundings between shares and assets.
/// @param marketParams The market to withdraw assets from.
/// @param assets The amount of assets to withdraw.
/// @param shares The amount of shares to burn.
/// @param onBehalf The address of the owner of the supply position.
/// @param receiver The address that will receive the withdrawn assets.
/// @return assetsWithdrawn The amount of assets withdrawn.
/// @return sharesWithdrawn The amount of shares burned.
function withdraw(
MarketParams memory marketParams,
uint256 assets,
uint256 shares,
address onBehalf,
address receiver
) external returns (uint256 assetsWithdrawn, uint256 sharesWithdrawn);
/// @notice Borrows `assets` or `shares` on behalf of `onBehalf` and sends the assets to `receiver`.
/// @dev Either `assets` or `shares` should be zero. Most use cases should rely on `assets` as an input so the
/// caller is guaranteed to borrow `assets` of tokens, but the possibility to mint a specific amount of shares is
/// given for full compatibility and precision.
/// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions.
/// @dev Borrowing a large amount can revert for overflow.
/// @dev Borrowing an amount of shares may lead to borrow fewer assets than expected due to slippage.
/// Consider using the `assets` parameter to avoid this.
/// @param marketParams The market to borrow assets from.
/// @param assets The amount of assets to borrow.
/// @param shares The amount of shares to mint.
/// @param onBehalf The address that will own the increased borrow position.
/// @param receiver The address that will receive the borrowed assets.
/// @return assetsBorrowed The amount of assets borrowed.
/// @return sharesBorrowed The amount of shares minted.
function borrow(
MarketParams memory marketParams,
uint256 assets,
uint256 shares,
address onBehalf,
address receiver
) external returns (uint256 assetsBorrowed, uint256 sharesBorrowed);
/// @notice Repays `assets` or `shares` on behalf of `onBehalf`, optionally calling back the caller's
/// `onMorphoReplay` function with the given `data`.
/// @dev Either `assets` or `shares` should be zero. To repay max, pass the `shares`'s balance of `onBehalf`.
/// @dev Repaying an amount corresponding to more shares than borrowed will revert for underflow.
/// @dev It is advised to use the `shares` input when repaying the full position to avoid reverts due to conversion
/// roundings between shares and assets.
/// @dev An attacker can front-run a repay with a small repay making the transaction revert for underflow.
/// @param marketParams The market to repay assets to.
/// @param assets The amount of assets to repay.
/// @param shares The amount of shares to burn.
/// @param onBehalf The address of the owner of the debt position.
/// @param data Arbitrary data to pass to the `onMorphoRepay` callback. Pass empty data if not needed.
/// @return assetsRepaid The amount of assets repaid.
/// @return sharesRepaid The amount of shares burned.
function repay(
MarketParams memory marketParams,
uint256 assets,
uint256 shares,
address onBehalf,
bytes memory data
) external returns (uint256 assetsRepaid, uint256 sharesRepaid);
/// @notice Supplies `assets` of collateral on behalf of `onBehalf`, optionally calling back the caller's
/// `onMorphoSupplyCollateral` function with the given `data`.
/// @dev Interest are not accrued since it's not required and it saves gas.
/// @dev Supplying a large amount can revert for overflow.
/// @param marketParams The market to supply collateral to.
/// @param assets The amount of collateral to supply.
/// @param onBehalf The address that will own the increased collateral position.
/// @param data Arbitrary data to pass to the `onMorphoSupplyCollateral` callback. Pass empty data if not needed.
function supplyCollateral(MarketParams memory marketParams, uint256 assets, address onBehalf, bytes memory data)
external;
/// @notice Withdraws `assets` of collateral on behalf of `onBehalf` and sends the assets to `receiver`.
/// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions.
/// @dev Withdrawing an amount corresponding to more collateral than supplied will revert for underflow.
/// @param marketParams The market to withdraw collateral from.
/// @param assets The amount of collateral to withdraw.
/// @param onBehalf The address of the owner of the collateral position.
/// @param receiver The address that will receive the collateral assets.
function withdrawCollateral(MarketParams memory marketParams, uint256 assets, address onBehalf, address receiver)
external;
/// @notice Liquidates the given `repaidShares` of debt asset or seize the given `seizedAssets` of collateral on the
/// given market `marketParams` of the given `borrower`'s position, optionally calling back the caller's
/// `onMorphoLiquidate` function with the given `data`.
/// @dev Either `seizedAssets` or `repaidShares` should be zero.
/// @dev Seizing more than the collateral balance will underflow and revert without any error message.
/// @dev Repaying more than the borrow balance will underflow and revert without any error message.
/// @dev An attacker can front-run a liquidation with a small repay making the transaction revert for underflow.
/// @param marketParams The market of the position.
/// @param borrower The owner of the position.
/// @param seizedAssets The amount of collateral to seize.
/// @param repaidShares The amount of shares to repay.
/// @param data Arbitrary data to pass to the `onMorphoLiquidate` callback. Pass empty data if not needed.
/// @return The amount of assets seized.
/// @return The amount of assets repaid.
function liquidate(
MarketParams memory marketParams,
address borrower,
uint256 seizedAssets,
uint256 repaidShares,
bytes memory data
) external returns (uint256, uint256);
/// @notice Executes a flash loan.
/// @dev Flash loans have access to the whole balance of the contract (the liquidity and deposited collateral of all
/// markets combined, plus donations).
/// @dev Warning: Not ERC-3156 compliant but compatibility is easily reached:
/// - `flashFee` is zero.
/// - `maxFlashLoan` is the token's balance of this contract.
/// - The receiver of `assets` is the caller.
/// @param token The token to flash loan.
/// @param assets The amount of assets to flash loan.
/// @param data Arbitrary data to pass to the `onMorphoFlashLoan` callback.
function flashLoan(address token, uint256 assets, bytes calldata data) external;
/// @notice Sets the authorization for `authorized` to manage `msg.sender`'s positions.
/// @param authorized The authorized address.
/// @param newIsAuthorized The new authorization status.
function setAuthorization(address authorized, bool newIsAuthorized) external;
/// @notice Sets the authorization for `authorization.authorized` to manage `authorization.authorizer`'s positions.
/// @dev Warning: Reverts if the signature has already been submitted.
/// @dev The signature is malleable, but it has no impact on the security here.
/// @dev The nonce is passed as argument to be able to revert with a different error message.
/// @param authorization The `Authorization` struct.
/// @param signature The signature.
function setAuthorizationWithSig(Authorization calldata authorization, Signature calldata signature) external;
/// @notice Accrues interest for the given market `marketParams`.
function accrueInterest(MarketParams memory marketParams) external;
/// @notice Returns the data stored on the different `slots`.
function extSloads(bytes32[] memory slots) external view returns (bytes32[] memory);
}
/// @dev This interface is inherited by Morpho so that function signatures are checked by the compiler.
/// @dev Consider using the IMorpho interface instead of this one.
interface IMorphoStaticTyping is IMorphoBase {
/// @notice The state of the position of `user` on the market corresponding to `id`.
/// @dev Warning: For `feeRecipient`, `supplyShares` does not contain the accrued shares since the last interest
/// accrual.
function position(Id id, address user)
external
view
returns (uint256 supplyShares, uint128 borrowShares, uint128 collateral);
/// @notice The state of the market corresponding to `id`.
/// @dev Warning: `totalSupplyAssets` does not contain the accrued interest since the last interest accrual.
/// @dev Warning: `totalBorrowAssets` does not contain the accrued interest since the last interest accrual.
/// @dev Warning: `totalSupplyShares` does not contain the accrued shares by `feeRecipient` since the last interest
/// accrual.
function market(Id id)
external
view
returns (
uint128 totalSupplyAssets,
uint128 totalSupplyShares,
uint128 totalBorrowAssets,
uint128 totalBorrowShares,
uint128 lastUpdate,
uint128 fee
);
/// @notice The market params corresponding to `id`.
/// @dev This mapping is not used in Morpho. It is there to enable reducing the cost associated to calldata on layer
/// 2s by creating a wrapper contract with functions that take `id` as input instead of `marketParams`.
function idToMarketParams(Id id)
external
view
returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv);
}
/// @title IMorpho
/// @author Morpho Labs
/// @custom:contact [email protected]
/// @dev Use this interface for Morpho to have access to all the functions with the appropriate function signatures.
interface IMorpho is IMorphoBase {
/// @notice The state of the position of `user` on the market corresponding to `id`.
/// @dev Warning: For `feeRecipient`, `p.supplyShares` does not contain the accrued shares since the last interest
/// accrual.
function position(Id id, address user) external view returns (Position memory p);
/// @notice The state of the market corresponding to `id`.
/// @dev Warning: `m.totalSupplyAssets` does not contain the accrued interest since the last interest accrual.
/// @dev Warning: `m.totalBorrowAssets` does not contain the accrued interest since the last interest accrual.
/// @dev Warning: `m.totalSupplyShares` does not contain the accrued shares by `feeRecipient` since the last
/// interest accrual.
function market(Id id) external view returns (Market memory m);
/// @notice The market params corresponding to `id`.
/// @dev This mapping is not used in Morpho. It is there to enable reducing the cost associated to calldata on layer
/// 2s by creating a wrapper contract with functions that take `id` as input instead of `marketParams`.
function idToMarketParams(Id id) external view returns (MarketParams memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4626.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";
import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol";
/**
* @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in
* https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
*/
interface IERC4626 is IERC20, IERC20Metadata {
event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);
event Withdraw(
address indexed sender,
address indexed receiver,
address indexed owner,
uint256 assets,
uint256 shares
);
/**
* @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
*
* - MUST be an ERC-20 token contract.
* - MUST NOT revert.
*/
function asset() external view returns (address assetTokenAddress);
/**
* @dev Returns the total amount of the underlying asset that is “managed” by Vault.
*
* - SHOULD include any compounding that occurs from yield.
* - MUST be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT revert.
*/
function totalAssets() external view returns (uint256 totalManagedAssets);
/**
* @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
* scenario where all the conditions are met.
*
* - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
* - MUST NOT revert.
*
* NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
* “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
* from.
*/
function convertToShares(uint256 assets) external view returns (uint256 shares);
/**
* @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
* scenario where all the conditions are met.
*
* - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
* - MUST NOT revert.
*
* NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
* “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
* from.
*/
function convertToAssets(uint256 shares) external view returns (uint256 assets);
/**
* @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
* through a deposit call.
*
* - MUST return a limited value if receiver is subject to some deposit limit.
* - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
* - MUST NOT revert.
*/
function maxDeposit(address receiver) external view returns (uint256 maxAssets);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
* current on-chain conditions.
*
* - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
* call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
* in the same transaction.
* - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
* deposit would be accepted, regardless if the user has enough tokens approved, etc.
* - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by depositing.
*/
function previewDeposit(uint256 assets) external view returns (uint256 shares);
/**
* @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
*
* - MUST emit the Deposit event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* deposit execution, and are accounted for during deposit.
* - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
* approving enough underlying tokens to the Vault contract, etc).
*
* NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
*/
function deposit(uint256 assets, address receiver) external returns (uint256 shares);
/**
* @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
* - MUST return a limited value if receiver is subject to some mint limit.
* - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
* - MUST NOT revert.
*/
function maxMint(address receiver) external view returns (uint256 maxShares);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
* current on-chain conditions.
*
* - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
* in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
* same transaction.
* - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
* would be accepted, regardless if the user has enough tokens approved, etc.
* - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by minting.
*/
function previewMint(uint256 shares) external view returns (uint256 assets);
/**
* @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
*
* - MUST emit the Deposit event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
* execution, and are accounted for during mint.
* - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
* approving enough underlying tokens to the Vault contract, etc).
*
* NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
*/
function mint(uint256 shares, address receiver) external returns (uint256 assets);
/**
* @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
* Vault, through a withdraw call.
*
* - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
* - MUST NOT revert.
*/
function maxWithdraw(address owner) external view returns (uint256 maxAssets);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
* given current on-chain conditions.
*
* - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
* call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
* called
* in the same transaction.
* - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
* the withdrawal would be accepted, regardless if the user has enough shares, etc.
* - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by depositing.
*/
function previewWithdraw(uint256 assets) external view returns (uint256 shares);
/**
* @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.
*
* - MUST emit the Withdraw event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* withdraw execution, and are accounted for during withdraw.
* - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
* not having enough shares, etc).
*
* Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
* Those methods should be performed separately.
*/
function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);
/**
* @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
* through a redeem call.
*
* - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
* - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
* - MUST NOT revert.
*/
function maxRedeem(address owner) external view returns (uint256 maxShares);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
* given current on-chain conditions.
*
* - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
* in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
* same transaction.
* - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
* redemption would be accepted, regardless if the user has enough shares, etc.
* - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by redeeming.
*/
function previewRedeem(uint256 shares) external view returns (uint256 assets);
/**
* @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.
*
* - MUST emit the Withdraw event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* redeem execution, and are accounted for during redeem.
* - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
* not having enough shares, etc).
*
* NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
* Those methods should be performed separately.
*/
function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
struct MarketConfig {
/// @notice The maximum amount of assets that can be allocated to the market.
uint184 cap;
/// @notice Whether the market is in the withdraw queue.
bool enabled;
/// @notice The timestamp at which the market can be instantly removed from the withdraw queue.
uint64 removableAt;
}
struct PendingUint192 {
/// @notice The pending value to set.
uint192 value;
/// @notice The timestamp at which the pending value becomes valid.
uint64 validAt;
}
struct PendingAddress {
/// @notice The pending value to set.
address value;
/// @notice The timestamp at which the pending value becomes valid.
uint64 validAt;
}
/// @title PendingLib
/// @author Morpho Labs
/// @custom:contact [email protected]
/// @notice Library to manage pending values and their validity timestamp.
library PendingLib {
/// @dev Updates `pending`'s value to `newValue` and its corresponding `validAt` timestamp.
/// @dev Assumes `timelock` <= `MAX_TIMELOCK`.
function update(PendingUint192 storage pending, uint184 newValue, uint256 timelock) internal {
pending.value = newValue;
// Safe "unchecked" cast because timelock <= MAX_TIMELOCK.
pending.validAt = uint64(block.timestamp + timelock);
}
/// @dev Updates `pending`'s value to `newValue` and its corresponding `validAt` timestamp.
/// @dev Assumes `timelock` <= `MAX_TIMELOCK`.
function update(PendingAddress storage pending, address newValue, uint256 timelock) internal {
pending.value = newValue;
// Safe "unchecked" cast because timelock <= MAX_TIMELOCK.
pending.validAt = uint64(block.timestamp + timelock);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title IAaveIncentivesController
* @author Aave
* @notice Defines the basic interface for an Aave Incentives Controller.
* @dev It only contains one single function, needed as a hook on aToken and debtToken transfers.
*/
interface IAaveIncentivesController {
/**
* @dev Called by the corresponding asset on transfer hook in order to update the rewards distribution.
* @dev The units of `totalSupply` and `userBalance` should be the same.
* @param user The address of the user whose asset balance has changed
* @param totalSupply The total supply of the asset prior to user balance change
* @param userBalance The previous user balance prior to balance change
*/
function handleAction(address user, uint256 totalSupply, uint256 userBalance) external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2;
interface IERC165 {
/// @notice Query if a contract implements an interface
/// @param interfaceID The interface identifier, as specified in ERC-165
/// @dev Interface identification is specified in ERC-165. This function
/// uses less than 30,000 gas.
/// @return `true` if the contract implements `interfaceID` and
/// `interfaceID` is not 0xffffffff, `false` otherwise
function supportsInterface(bytes4 interfaceID) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}{
"remappings": [
"@openzeppelin/contracts-upgradeable/=lib/sdai/lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"aave-v3-core/=lib/aave-v3-origin/src/core/",
"aave-v3-origin/=lib/aave-v3-origin/",
"aave-v3-periphery/=lib/aave-v3-origin/src/periphery/",
"bloom-address-registry/=lib/bloom-address-registry/src/",
"ds-test/=lib/metamorpho/lib/forge-std/lib/ds-test/src/",
"dss-allocator/=lib/dss-allocator/",
"dss-interfaces/=lib/dss-test/lib/dss-interfaces/src/",
"dss-test/=lib/dss-test/src/",
"erc20-helpers/=lib/erc20-helpers/src/",
"erc4626-tests/=lib/metamorpho/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"metamorpho/=lib/metamorpho/src/",
"morpho-blue/=lib/metamorpho/lib/morpho-blue/",
"murky/=lib/metamorpho/lib/universal-rewards-distributor/lib/murky/src/",
"openzeppelin-contracts-upgradeable/=lib/sdai/lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"openzeppelin-foundry-upgrades/=lib/sdai/lib/openzeppelin-foundry-upgrades/src/",
"openzeppelin/=lib/metamorpho/lib/universal-rewards-distributor/lib/openzeppelin-contracts/contracts/",
"sdai/=lib/sdai/",
"solidity-stringutils/=lib/sdai/lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/",
"solidity-utils/=lib/aave-v3-origin/lib/solidity-utils/",
"spark-address-registry/=lib/spark-address-registry/src/",
"spark-psm/=lib/spark-psm/",
"sparklend-address-registry/=lib/spark-psm/lib/xchain-ssr-oracle/lib/sparklend-address-registry/",
"token-tests/=lib/sdai/lib/token-tests/src/",
"universal-rewards-distributor/=lib/metamorpho/lib/universal-rewards-distributor/src/",
"usds/=lib/usds/",
"xchain-helpers/=lib/xchain-helpers/src/",
"xchain-ssr-oracle/=lib/spark-psm/lib/xchain-ssr-oracle/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"admin_","type":"address"},{"internalType":"address","name":"proxy_","type":"address"},{"internalType":"address","name":"rateLimits_","type":"address"},{"internalType":"address","name":"vault_","type":"address"},{"internalType":"address","name":"psm_","type":"address"},{"internalType":"address","name":"daiUsds_","type":"address"},{"internalType":"address","name":"cctp_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"nonce","type":"uint64"},{"indexed":true,"internalType":"uint32","name":"destinationDomain","type":"uint32"},{"indexed":true,"internalType":"bytes32","name":"mintRecipient","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"usdcAmount","type":"uint256"}],"name":"CCTPTransferInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"destinationDomain","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"mintRecipient","type":"bytes32"}],"name":"MintRecipientSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"relayer","type":"address"}],"name":"RelayerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FREEZER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_4626_DEPOSIT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_4626_WITHDRAW","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_7540_DEPOSIT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_7540_REDEEM","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_AAVE_DEPOSIT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_AAVE_WITHDRAW","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_ASSET_TRANSFER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_BUIDL_REDEEM_CIRCLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_MAPLE_REDEEM","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_SUPERSTATE_REDEEM","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_SUPERSTATE_SUBSCRIBE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_SUSDE_COOLDOWN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_USDC_TO_CCTP","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_USDC_TO_DOMAIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_USDE_BURN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_USDE_MINT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_USDS_MINT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIMIT_USDS_TO_USDC","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buffer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buidlRedeem","outputs":[{"internalType":"contract IBuidlRedeemLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdsAmount","type":"uint256"}],"name":"burnUSDS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"cancelCentrifugeDepositRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"cancelCentrifugeRedeemRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"mapleToken","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"cancelMapleRedemption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cctp","outputs":[{"internalType":"contract ICCTPLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"claimCentrifugeCancelDepositRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"claimCentrifugeCancelRedeemRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"claimDepositERC7540","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"claimRedeemERC7540","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdeAmount","type":"uint256"}],"name":"cooldownAssetsSUSDe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"susdeAmount","type":"uint256"}],"name":"cooldownSharesSUSDe","outputs":[{"internalType":"uint256","name":"cooldownAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dai","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"daiUsds","outputs":[{"internalType":"contract IDaiUsdsLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"aToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositAave","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositERC4626","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ethenaMinter","outputs":[{"internalType":"contract IEthenaMinterLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"destinationDomain","type":"uint32"}],"name":"mintRecipients","outputs":[{"internalType":"bytes32","name":"mintRecipient","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdsAmount","type":"uint256"}],"name":"mintUSDS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdeAmount","type":"uint256"}],"name":"prepareUSDeBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdcAmount","type":"uint256"}],"name":"prepareUSDeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"proxy","outputs":[{"internalType":"contract IALMProxy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"psm","outputs":[{"internalType":"contract IPSMLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"psmTo18ConversionFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rateLimits","outputs":[{"internalType":"contract IRateLimits","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"morphoVault","type":"address"},{"components":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"},{"internalType":"uint256","name":"assets","type":"uint256"}],"internalType":"struct MarketAllocation[]","name":"allocations","type":"tuple[]"}],"name":"reallocateMorpho","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdcAmount","type":"uint256"}],"name":"redeemBUIDLCircleFacility","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"redeemERC4626","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"ustbAmount","type":"uint256"}],"name":"redeemSuperstate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatedSigner","type":"address"}],"name":"removeDelegatedSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"}],"name":"removeRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"requestDepositERC7540","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"mapleToken","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"requestMapleRedemption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"requestRedeemERC7540","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatedSigner","type":"address"}],"name":"setDelegatedSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"destinationDomain","type":"uint32"},{"internalType":"bytes32","name":"mintRecipient","type":"bytes32"}],"name":"setMintRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"morphoVault","type":"address"},{"internalType":"Id[]","name":"newSupplyQueue","type":"bytes32[]"}],"name":"setSupplyQueueMorpho","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdcAmount","type":"uint256"}],"name":"subscribeSuperstate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"superstateRedemption","outputs":[{"internalType":"contract ISSRedemptionLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"susde","outputs":[{"internalType":"contract ISUSDELike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdcAmount","type":"uint256"}],"name":"swapUSDCToUSDS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdcAmount","type":"uint256"}],"name":"swapUSDSToUSDC","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"address","name":"destination","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdcAmount","type":"uint256"},{"internalType":"uint32","name":"destinationDomain","type":"uint32"}],"name":"transferUSDCToCCTP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unstakeSUSDe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"morphoVault","type":"address"},{"internalType":"uint256[]","name":"indexes","type":"uint256[]"}],"name":"updateWithdrawQueueMorpho","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdc","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usde","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usds","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ustb","outputs":[{"internalType":"contract IUSTBLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"contract IVaultLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"aToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawAave","outputs":[{"internalType":"uint256","name":"amountWithdrawn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawERC4626","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
6102a06040525f600255348015610014575f80fd5b50604051616713380380616713833981016040819052610033916103ad565b61003d5f886102e9565b506001600160a01b0380871660a0528581166101605284166101a08190526040805163076d57f160e51b8152905163edaafe20916004808201926020929091908290030181865afa158015610094573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100b8919061042e565b6001600160a01b039081166080528381166101405282811661010081905290821660e0527331d3f59ad4aac0eee2247c65ebe8bf6e9e470a5360c05273e3490297a08d6fc8da46edb7b6142e4f461b62d361012052734c21b7577c8fe8b0b0669165ee7c8f67fa1454cf61018052739d39a5de30e57443bff2a8307a4256c8797a3497610260527343415eb6ff9db7e26a15b704e7a3edce97d31c4e610240526040805163f4b9fa7560e01b8152905163f4b9fa75916004808201926020929091908290030181865afa158015610191573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101b5919061042e565b6001600160a01b03166101c0816001600160a01b031681525050610140516001600160a01b0316637bd2bea76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561020e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610232919061042e565b6001600160a01b039081166102205273dc035d45d973e3ec169d2276ddab16f1e407384f6101e052734c9edd5852cd905f086c759e8383e09bff1e68b3610200526101405160408051634010f77760e01b815290519190921691634010f7779160048083019260209291908290030181865afa1580156102b4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102d8919061044e565b610280525061046595505050505050565b5f828152602081815260408083206001600160a01b038516845290915281205460ff16610389575f838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556103413390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161038c565b505f5b92915050565b80516001600160a01b03811681146103a8575f80fd5b919050565b5f805f805f805f60e0888a0312156103c3575f80fd5b6103cc88610392565b96506103da60208901610392565b95506103e860408901610392565b94506103f660608901610392565b935061040460808901610392565b925061041260a08901610392565b915061042060c08901610392565b905092959891949750929550565b5f6020828403121561043e575f80fd5b61044782610392565b9392505050565b5f6020828403121561045e575f80fd5b5051919050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516101c0516101e0516102005161022051610240516102605161028051615dbc6109575f395f818161091a015281816114090152818161157e0152818161164c015261300c01525f81816104d301528181610fa701528181610fc801528181611e2001528181611e41015261477b01525f81816109b5015281816124a8015281816124fe0152818161251f0152614b7701525f81816106fe01528181611382015281816124870152818161254f015281816140970152818161433e0152818161441c015261547401525f818161055a0152610e2901525f81816107d301528181612c5b0152818161303801528181613a550152613a7601525f8181610d100152818161142b015281816115a001528181611678015261316f01525f8181610d3701528181612b0101528181612b2201528181613ba70152613bc801525f81816107fa01528181614a4f01528181614b9801528181614bee0152614c0f01525f8181610ce901528181610db901528181610f0b015281816110d7015281816113120152818161182501528181611a2801528181611b8001528181611f5e0152818161207b01528181612243015281816124170152818161271b0152818161292c01528181612a6501528181612d8c01528181612f9b0152818161327501528181613605015281816136f6015281816139b901528181613c5101528181613d7901528181613ea3015281816140270152818161419d01528181614251015281816144f0015281816148c901528181614aff01528181614d9d01528181614eac015261509501525f8181610512015281816113a3015281816113df015281816114bf0152818161155601528181613190015281816131fa01526152d201525f818161060901528181610e4a015281816125d9015281816125fa01528181612cd501528181612cf601526140b801525f8181610aa301528181611699015281816117030152818161305901526130fe01525f8181610c3a0152818161435f01528181614387015261550f01525f81816108e001528181611895015281816119150152818161196b015261198c01525f8181610c7401528181610f7801528181611178015281816111b8015281816111d9015281816116cb0152818161193c01528181611ac201528181611b0201528181611d0d01528181611df10152818161211c0152818161215c015281816122d4015281816124cf015281816125aa015281816127c101528181612839015281816128790152818161289a015281816129a101528181612ad201528181612c2301528181612ca601528181612e1d01528181612e5f01528181612e8001528181613084015281816131c201528181613306015281816133480152818161348001528181613539015281816138050152818161384501528181613a2601528181613b7801528181613ce201528181613e0a01528181613f3401528181613f7501528181613f96015281816145ff0152818161463f015281816146600152818161474a0152818161496a015281816149aa015281816149cb01528181614bbf01528181614c6901528181614ca901528181614cca01528181614f5201528181614fca0152818161500a0152818161512601528181615168015281816151d30152818161529a01526154e201525f8181610c9b01528181612bfb0152613aa50152615dbc5ff3fe608060405234801561000f575f80fd5b506004361061047a575f3560e01c8063704d1eaf11610258578063c09cea981161014b578063d9acb348116100ca578063ec5568891161008f578063ec55688914610c6f578063edaafe2014610c96578063ef3d3ddb14610cbd578063f092159414610ce4578063f4b9fa7514610d0b578063fbfa77cf14610d32575f80fd5b8063d9acb34814610be8578063dc836b7a14610bfb578063e08471fc14610c22578063e3329e3214610c35578063e604ddab14610c5c575f80fd5b8063cf6761d711610110578063cf6761d714610b60578063d0a7705414610b87578063d547741f14610b9b578063d72f444814610bae578063d86f2a0614610bc1575f80fd5b8063c09cea9814610aec578063c284f59814610b0b578063c2be370614610b32578063c77d9a5214610b45578063c95c29d914610b4d575f80fd5b80639beaa558116101d7578063b2eae5ad1161019c578063b2eae5ad14610a78578063b5cbf20214610a8b578063b8faa7f614610a9e578063bcd7e46c14610ac5578063c07793ad14610ad8575f80fd5b80639beaa558146109fd578063a0b0c6af14610a10578063a217fddf14610a23578063a46a3cf614610a2a578063ad91c80d14610a51575f80fd5b8063900724691161021d578063900724691461097657806391d148541461099d57806395f4324e146109b057806396122b62146109d75780639ba6c1da146109ea575f80fd5b8063704d1eaf146108db5780637891c0431461090257806381455ca91461091557806385f4881d1461093c5780638986012d1461094f575f80fd5b806336568abe116103705780634cf282fb116102ef5780635a0e4895116102b45780635a0e4895146108555780635acb70531461087b5780635bb1a9741461088e578063603b0ade146108a157806360f0a5ac146108c8575f80fd5b80634cf282fb146107ce57806350f5fc06146107f5578063536f6b7e1461081c578063538636131461082f578063558e0a7714610842575f80fd5b806340e492161161033557806340e49216146107475780634390e9dd1461075a578063439e2e451461076d57806343dc75d314610780578063475d182a146107a7575f80fd5b806336568abe146106c05780633ab63d10146106d35780633df1c8c6146106e65780633e413bee146106f95780633ede937f14610720575f80fd5b80631aa5f08d116103fc578063248b7ef7116103c1578063248b7ef7146106615780632cefff96146106745780632d4dcb89146106875780632e5f26751461069a5780632f2ff15d146106ad575f80fd5b80631aa5f08d146105dd5780631cbda1b1146105f1578063240b7844146106045780632483e7151461062b578063248a9ca31461063f575f80fd5b80630b372e57116104425780630b372e57146105345780630fd761e014610555578063115c48d51461057c57806314886aa71461058f57806319ece4ec146105b6575f80fd5b80630187148f1461047e57806301ffc9a71461049357806302a4ea53146104bb578063032988da146104ce57806304bda2621461050d575b5f80fd5b61049161048c366004615619565b610d59565b005b6104a66104a1366004615630565b610e75565b60405190151581526020015b60405180910390f35b6104916104c9366004615619565b610eab565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016104b2565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b610547610542366004615672565b61109a565b6040519081526020016104b2565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b61049161058a366004615619565b6112b3565b6105477f292071ee2770abc65b11bb80fa8c381ada7ff4428c832813b075a12da648670c81565b6105477f213c645fc0f2b08264743dd819fb1d54d9a3d9d1eab0fa654e1a7bf7b22ee79681565b6105475f80516020615d6783398151915281565b6104916105ff366004615619565b6117c5565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b6105475f80516020615d0783398151915281565b61054761064d366004615619565b5f9081526020819052604090206001015490565b61049161066f366004615672565b6119cc565b610491610682366004615672565b611b44565b610547610695366004615619565b611dd7565b6104916106a8366004615672565b611fd7565b6104916106bb36600461569c565b61219e565b6104916106ce36600461569c565b6121c2565b6104916106e13660046156ca565b6121fa565b6104916106f4366004615619565b6123b7565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b6105477f8e6d782dd232ba18cda332ab87226668a41414f4096db2b33575872cd6fca16a81565b61049161075536600461574b565b612591565b61049161076836600461574b565b6126d2565b61049161077b366004615766565b6128cb565b6105477f971711e0ecfa693edaceb1e022ac9879076ac4289525ade0c331a15ff1f96fc181565b6105477fdbd6b16a066c313d3b984d4f2d682f97665d1912ea24d2b7e0f3ba43aa0493c581565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b61049161082a366004615619565b612a05565b61049161083d36600461574b565b612c8d565b61049161085036600461574b565b612d43565b6105477ed4cb8ac2838f11d95b0136a919a13b994f920024aba35eee16dc433c65851c81565b610491610889366004615619565b612f3c565b61049161089c36600461574b565b61322c565b6105477f519fa96e0bcf84b705fc396cd38f7f5e661413cb0fe321a78e8a29091b5bf26281565b6104916108d636600461574b565b61338a565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b610547610910366004615672565b613403565b6105477f000000000000000000000000000000000000000000000000000000000000000081565b61054761094a366004615672565b6136cc565b6105477fcb0537d5e5dba65a8edbac12555995860e5b8e1b70996011edb1ca8173e56d3c81565b6105477fcbdb6738b19dd3b24f89f36d3582b7d46aa62654d6d68e2f61094c597ada836b81565b6104a66109ab36600461569c565b613931565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b6104916109e5366004615619565b613959565b6104916109f83660046157e9565b613c08565b610491610a0b36600461589f565b613d30565b610491610a1e36600461574b565b613e5a565b6105475f81565b6105477f0ac42a08299cbc4428ec38ad4a8e7d7440779fbbb20ea90bd10c094a406cfa6f81565b6105477f48f98264e3feb9c04c94251c86b84a95f369fb2973906e457f22ec9080cb675581565b610491610a86366004615619565b613fc7565b610491610a99366004615925565b6140dd565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b610491610ad336600461593f565b61413d565b6105475f80516020615d4783398151915281565b610547610afa366004615969565b60016020525f908152604090205481565b6105477f4143f9dd901ae26124c50bb2b876e6a4a06e871f5c7f0e960895880d7b095f8581565b610491610b40366004615672565b6144c7565b610491614726565b610491610b5b366004615672565b614838565b6105477f88fe4304240f9fdabd8d614954877c91faacf3746c24df5803bac9e49977b63b81565b6105475f80516020615d2783398151915281565b610491610ba936600461569c565b6149fc565b610491610bbc366004615619565b614a20565b6105477f5def078412c37c191fd2d189c95907ded1a100c5252bc3d643bb61986695451781565b610547610bf6366004615672565b614c4f565b6105477f0476a9fd902eafdb5bcdabd9f0523dd7aacf7aa0c38c0e6ab912f5fed00f8e1181565b610491610c3036600461574b565b614e63565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b610491610c6a36600461574b565b61504c565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b6105477ffa746459736d4da7e93566b5ec05608174be6bf01c7207464bfb77d034bbdc7f81565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b5f80516020615d07833981519152610d70816151aa565b6040516303bf076b60e41b81527f88fe4304240f9fdabd8d614954877c91faacf3746c24df5803bac9e49977b63b60048201819052602482018490529083906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633bf076b0906044016020604051808303815f875af1158015610dff573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e239190615982565b50610e6f7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000866151b7565b50505050565b5f6001600160e01b03198216637965db0b60e01b1480610ea557506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f80516020615d07833981519152610ec2816151aa565b6040516303bf076b60e41b81527fdbd6b16a066c313d3b984d4f2d682f97665d1912ea24d2b7e0f3ba43aa0493c560048201819052602482018490529083906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633bf076b0906044016020604051808303815f875af1158015610f51573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f759190615982565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d27f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663cdac52ed8860405160240161100891815260200190565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b031916825261105193925090600401615999565b5f604051808303815f875af115801561106c573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261109391908101906159dd565b5050505050565b5f5f80516020615d078339815191526110b2816151aa565b7fcbdb6738b19dd3b24f89f36d3582b7d46aa62654d6d68e2f61094c597ada836b84847f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633bf076b061110e8585615249565b836040518363ffffffff1660e01b8152600401611135929190918252602082015260400190565b6020604051808303815f875af1158015611151573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111759190615982565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d288896001600160a01b031663b460af948a7f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000060405160240161120a93929190615a6c565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b031916825261125393925090600401615999565b5f604051808303815f875af115801561126e573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261129591908101906159dd565b8060200190518101906112a89190615982565b979650505050505050565b5f80516020615d078339815191526112ca816151aa565b6040516317024edd60e21b81527ed4cb8ac2838f11d95b0136a919a13b994f920024aba35eee16dc433c65851c60048201819052602482018490529083906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635c093b74906044016020604051808303815f875af1158015611358573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061137c9190615982565b506113c87f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000866151b7565b6040516370a0823160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301525f917f0000000000000000000000000000000000000000000000000000000000000000917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611470573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114949190615982565b61149e9190615a9f565b90508085116114b5576114b08561528d565b611646565b845b8015611644577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d9c55ce16040518163ffffffff1660e01b81526004016020604051808303815f875af115801561151a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061153e9190615982565b506040516370a0823160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301527f0000000000000000000000000000000000000000000000000000000000000000917f0000000000000000000000000000000000000000000000000000000000000000909116906370a0823190602401602060405180830381865afa1580156115e7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061160b9190615982565b6116159190615a9f565b91505f8282106116255782611627565b815b90506116328161528d565b61163c8183615abe565b9150506114b7565b505b5f6116717f000000000000000000000000000000000000000000000000000000000000000087615ad1565b90506116be7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000836151b7565b6040516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116602483018190526044830184905291633aada4d2917f0000000000000000000000000000000000000000000000000000000000000000919082169063f2c07aae906064015b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b031916825261177a93925090600401615999565b5f604051808303815f875af1158015611795573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526117bc91908101906159dd565b50505050505050565b5f80516020615d078339815191526117dc816151aa565b6040516303bf076b60e41b81527f292071ee2770abc65b11bb80fa8c381ada7ff4428c832813b075a12da648670c60048201819052602482018490529083906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633bf076b0906044016020604051808303815f875af115801561186b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061188f9190615982565b5061193a7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118ef573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119139190615ae8565b7f0000000000000000000000000000000000000000000000000000000000000000866151b7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d27f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663db006a758860405160240161100891815260200190565b5f80516020615d078339815191526119e3816151aa565b611a0d7f971711e0ecfa693edaceb1e022ac9879076ac4289525ade0c331a15ff1f96fc184615249565b60405160016221581760e21b03198152600481018290525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015611a75573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a999190615b03565b5111611ac05760405162461bcd60e51b8152600401611ab790615b67565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d285866001600160a01b0316631b8f1830877f00000000000000000000000000000000000000000000000000000000000000006040516024016110089291909182526001600160a01b0316602082015260400190565b5f80516020615d07833981519152611b5b816151aa565b7f8e6d782dd232ba18cda332ab87226668a41414f4096db2b33575872cd6fca16a83837f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633bf076b0611bb78585615249565b836040518363ffffffff1660e01b8152600401611bde929190918252602082015260400190565b6020604051808303815f875af1158015611bfa573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c1e9190615982565b505f866001600160a01b031663b16a19de6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c5c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c809190615ae8565b90505f876001600160a01b0316637535d2466040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cbf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ce39190615ae8565b9050611cf08282896151b7565b604080516001600160a01b038481166024830152604482018a90527f000000000000000000000000000000000000000000000000000000000000000016606482018190525f6084808401919091528351808403909101815260a490920183526020820180516001600160e01b031663617ba03760e01b1790529151631d56d26960e11b8152633aada4d291611d8a91859190600401615999565b5f604051808303815f875af1158015611da5573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611dcc91908101906159dd565b505050505050505050565b5f5f80516020615d07833981519152611def816151aa565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d27f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639343d9e187604051602401611e8191815260200190565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b0319168252611eca93925090600401615999565b5f604051808303815f875af1158015611ee5573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611f0c91908101906159dd565b806020019051810190611f1f9190615982565b6040516303bf076b60e41b81527fdbd6b16a066c313d3b984d4f2d682f97665d1912ea24d2b7e0f3ba43aa0493c56004820152602481018290529092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690633bf076b0906044016020604051808303815f875af1158015611fac573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fd09190615982565b5050919050565b5f80516020615d07833981519152611fee816151aa565b6040516303d1689d60e11b8152600481018390527f971711e0ecfa693edaceb1e022ac9879076ac4289525ade0c331a15ff1f96fc19084906001600160a01b038216906307a2d13a90602401602060405180830381865afa158015612055573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120799190615982565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633bf076b06120b28585615249565b836040518363ffffffff1660e01b81526004016120d9929190918252602082015260400190565b6020604051808303815f875af11580156120f5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121199190615982565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d287886001600160a01b031663107703ab897f00000000000000000000000000000000000000000000000000000000000000006040516024016117319291909182526001600160a01b0316602082015260400190565b5f828152602081905260409020600101546121b8816151aa565b610e6f8383615304565b6001600160a01b03811633146121eb5760405163334bd91960e11b815260040160405180910390fd5b6121f58282615393565b505050565b5f80516020615d07833981519152612211816151aa565b6122285f80516020615d6783398151915285615249565b60405160016221581760e21b03198152600481018290525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015612290573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122b49190615b03565b51116122d25760405162461bcd60e51b8152600401611ab790615b67565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d286876001600160a01b0316637299aa318888604051602401612324929190615b9c565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b031916825261236d93925090600401615999565b5f604051808303815f875af1158015612388573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526123af91908101906159dd565b505050505050565b5f80516020615d078339815191526123ce816151aa565b6040516303bf076b60e41b81527f213c645fc0f2b08264743dd819fb1d54d9a3d9d1eab0fa654e1a7bf7b22ee79660048201819052602482018490529083906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633bf076b0906044016020604051808303815f875af115801561245d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124819190615982565b506124cd7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000866151b7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d27f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166359e6951d887f00000000000000000000000000000000000000000000000000000000000000006040516024016110089291909182526001600160a01b0316602082015260400190565b5f80516020615d078339815191526125a8816151aa565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d27f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166340e492168660405160240161264791906001600160a01b0391909116815260200190565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b031916825261269093925090600401615999565b5f604051808303815f875af11580156126ab573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526121f591908101906159dd565b5f80516020615d078339815191526126e9816151aa565b6127005f80516020615d2783398151915283615249565b60405160016221581760e21b03198152600481018290525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015612768573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061278c9190615b03565b51116127aa5760405162461bcd60e51b8152600401611ab790615b67565b60405163ce96cb7760e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301525f919085169063ce96cb7790602401602060405180830381865afa158015612811573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906128359190615982565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d285866001600160a01b031663b460af94857f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000060405160240161100893929190615a6c565b5f80516020615d078339815191526128e2816151aa565b61290d7f48f98264e3feb9c04c94251c86b84a95f369fb2973906e457f22ec9080cb675585856153fc565b6040516303bf076b60e41b8152600481018290526024810184905283907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690633bf076b0906044016020604051808303815f875af115801561297a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061299e9190615982565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d287886001600160a01b031663a9059cbb89896040516024016117319291906001600160a01b03929092168252602082015260400190565b5f80516020615d07833981519152612a1c816151aa565b6040516303bf076b60e41b81527fcb0537d5e5dba65a8edbac12555995860e5b8e1b70996011edb1ca8173e56d3c60048201819052602482018490529083906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633bf076b0906044016020604051808303815f875af1158015612aab573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612acf9190615982565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d27f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633b30414788604051602401612b6291815260200190565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b0319168252612bab93925090600401615999565b5f604051808303815f875af1158015612bc6573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612bed91908101906159dd565b506040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660248301527f00000000000000000000000000000000000000000000000000000000000000008116604483018190526064830187905291633aada4d2917f000000000000000000000000000000000000000000000000000000000000000091908216906323b872dd90608401611008565b5f80516020615d07833981519152612ca4816151aa565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d27f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663538636138660405160240161264791906001600160a01b0391909116815260200190565b5f80516020615d07833981519152612d5a816151aa565b612d715f80516020615d4783398151915283615249565b60405160016221581760e21b03198152600481018290525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015612dd9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612dfd9190615b03565b5111612e1b5760405162461bcd60e51b8152600401611ab790615b67565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d284856001600160a01b03166369d77a446002547f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000604051602401612eb193929190615a6c565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b0319168252612efa93925090600401615999565b5f604051808303815f875af1158015612f15573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610e6f91908101906159dd565b5f80516020615d07833981519152612f53816151aa565b6040516303bf076b60e41b81527ed4cb8ac2838f11d95b0136a919a13b994f920024aba35eee16dc433c65851c60048201819052602482018490529083906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633bf076b0906044016020604051808303815f875af1158015612fe1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906130059190615982565b505f6130317f000000000000000000000000000000000000000000000000000000000000000086615ad1565b905061307e7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000836151b7565b604080517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031660248201819052604480830185905283518084039091018152606490920183526020820180516001600160e01b031663068f301560e41b1790529151631d56d26960e11b8152633aada4d291613127917f00000000000000000000000000000000000000000000000000000000000000009190600401615999565b5f604051808303815f875af1158015613142573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261316991908101906159dd565b506131b57f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000836151b7565b6040516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116602483018190526044830188905291633aada4d2917f0000000000000000000000000000000000000000000000000000000000000000919082169063067d927490606401612324565b5f80516020615d07833981519152613243816151aa565b61325a5f80516020615d4783398151915283615249565b60405160016221581760e21b03198152600481018290525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ff7a9fa490602401608060405180830381865afa1580156132c2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906132e69190615b03565b51116133045760405162461bcd60e51b8152600401611ab790615b67565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d284856001600160a01b031663b9cf06346002547f0000000000000000000000000000000000000000000000000000000000000000604051602401612eb19291909182526001600160a01b0316602082015260400190565b7f0ac42a08299cbc4428ec38ad4a8e7d7440779fbbb20ea90bd10c094a406cfa6f6133b4816151aa565b6133cb5f80516020615d0783398151915283615393565b506040516001600160a01b038316907f10e1f7ce9fd7d1b90a66d13a2ab3cb8dd7f29f3f8d520b143b063ccfbab6906b905f90a25050565b5f5f80516020615d0783398151915261341b816151aa565b5f846001600160a01b0316637535d2466040518163ffffffff1660e01b8152600401602060405180830381865afa158015613458573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061347c9190615ae8565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d282836001600160a01b03166369328dec896001600160a01b031663b16a19de6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156134f9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061351d9190615ae8565b6040516001600160a01b039182166024820152604481018b90527f0000000000000000000000000000000000000000000000000000000000000000909116606482015260840160408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b03191682526135ac93925090600401615999565b5f604051808303815f875af11580156135c7573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526135ee91908101906159dd565b8060200190518101906136019190615982565b92507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633bf076b061365c7f519fa96e0bcf84b705fc396cd38f7f5e661413cb0fe321a78e8a29091b5bf26288615249565b856040518363ffffffff1660e01b8152600401613683929190918252602082015260400190565b6020604051808303815f875af115801561369f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906136c39190615982565b50505092915050565b5f5f80516020615d078339815191526136e4816151aa565b5f80516020615d6783398151915284847f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633bf076b061372d8585615249565b836040518363ffffffff1660e01b8152600401613754929190918252602082015260400190565b6020604051808303815f875af1158015613770573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137949190615982565b505f876001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156137d2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137f69190615ae8565b90506138038189896151b7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d2898a6001600160a01b0316636e553f658b7f00000000000000000000000000000000000000000000000000000000000000006040516024016138879291909182526001600160a01b0316602082015260400190565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b03191682526138d093925090600401615999565b5f604051808303815f875af11580156138eb573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261391291908101906159dd565b8060200190518101906139259190615982565b98975050505050505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b5f80516020615d07833981519152613970816151aa565b6040516317024edd60e21b81527fcb0537d5e5dba65a8edbac12555995860e5b8e1b70996011edb1ca8173e56d3c60048201819052602482018490529083906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635c093b74906044016020604051808303815f875af11580156139ff573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613a239190615982565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d27f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb7f000000000000000000000000000000000000000000000000000000000000000089604051602401613aea9291906001600160a01b03929092168252602082015260400190565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b0319168252613b3393925090600401615999565b5f604051808303815f875af1158015613b4e573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052613b7591908101906159dd565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d27f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b38a16208860405160240161100891815260200190565b5f80516020615d07833981519152613c1f816151aa565b613c365f80516020615d6783398151915284615249565b60405160016221581760e21b03198152600481018290525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015613c9e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613cc29190615b03565b5111613ce05760405162461bcd60e51b8152600401611ab790615b67565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d285866001600160a01b0316632acc56f9876040516024016110089190615c43565b5f80516020615d07833981519152613d47816151aa565b613d5e5f80516020615d6783398151915285615249565b60405160016221581760e21b03198152600481018290525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015613dc6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613dea9190615b03565b5111613e085760405162461bcd60e51b8152600401611ab790615b67565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d286876001600160a01b03166341b678338888604051602401612324929190615c86565b5f80516020615d07833981519152613e71816151aa565b613e885f80516020615d2783398151915283615249565b60405160016221581760e21b03198152600481018290525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015613ef0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613f149190615b03565b5111613f325760405162461bcd60e51b8152600401611ab790615b67565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d284856001600160a01b031662a06d196002547f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000604051602401612eb193929190615a6c565b5f80516020615d07833981519152613fde816151aa565b6040516303bf076b60e41b81527f5def078412c37c191fd2d189c95907ded1a100c5252bc3d643bb61986695451760048201819052602482018490529083906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633bf076b0906044016020604051808303815f875af115801561406d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906140919190615982565b50610e6f7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000866151b7565b5f6140e7816151aa565b63ffffffff83165f8181526001602052604090819020849055517f5e7cfea10f05abc55e716d0d5031f3eea4eabbe012e9bf1d56c5034bba4bfa30906141309085815260200190565b60405180910390a2505050565b5f80516020615d07833981519152614154816151aa565b6040516303bf076b60e41b81527f0476a9fd902eafdb5bcdabd9f0523dd7aacf7aa0c38c0e6ab912f5fed00f8e1160048201819052602482018590529084906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633bf076b0906044016020604051808303815f875af11580156141e3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906142079190615982565b506142327ffa746459736d4da7e93566b5ec05608174be6bf01c7207464bfb77d034bbdc7f85615431565b6040516303bf076b60e41b8152600481018290526024810187905286907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690633bf076b0906044016020604051808303815f875af115801561429f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906142c39190615982565b5063ffffffff86165f90815260016020526040812054908190036143395760405162461bcd60e51b815260206004820152602760248201527f4d61696e6e6574436f6e74726f6c6c65722f646f6d61696e2d6e6f742d636f6e604482015266199a59dd5c995960ca1b6064820152608401611ab7565b6143847f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008a6151b7565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663cb75c11c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156143e1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906144059190615ae8565b6040516352b7631960e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152919091169063a56ec63290602401602060405180830381865afa15801561446b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061448f9190615982565b90505b808911156144b6576144a5818984615454565b6144af818a615abe565b9850614492565b8815611dcc57611dcc898984615454565b5f80516020615d078339815191526144de816151aa565b5f80516020615d4783398151915283837f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633bf076b06145278585615249565b836040518363ffffffff1660e01b815260040161454e929190918252602082015260400190565b6020604051808303815f875af115801561456a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061458e9190615982565b505f866001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156145cc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145f09190615ae8565b90506145fd8188886151b7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d288896001600160a01b03166385b77f458a7f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000060405160240161469193929190615a6c565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b03191682526146da93925090600401615999565b5f604051808303815f875af11580156146f5573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261471c91908101906159dd565b5050505050505050565b5f80516020615d0783398151915261473d816151aa565b6040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166024830181905291633aada4d2917f0000000000000000000000000000000000000000000000000000000000000000919082169063f2888dbb906044015b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b03191682526147f293925090600401615999565b5f604051808303815f875af115801561480d573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261483491908101906159dd565b5050565b5f80516020615d0783398151915261484f816151aa565b6040516303d1689d60e11b8152600481018390525f80516020615d278339815191529084906001600160a01b038216906307a2d13a90602401602060405180830381865afa1580156148a3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906148c79190615982565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633bf076b06149008585615249565b836040518363ffffffff1660e01b8152600401614927929190918252602082015260400190565b6020604051808303815f875af1158015614943573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906149679190615982565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d287886001600160a01b0316637d41c86e897f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000060405160240161173193929190615a6c565b5f82815260208190526040902060010154614a16816151aa565b610e6f8383615393565b5f80516020615d07833981519152614a37816151aa565b60405163bbffa97960e01b8152600481018390525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063bbffa979906024016040805180830381865afa158015614a9b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614abf9190615cbd565b506040516303bf076b60e41b81527f4143f9dd901ae26124c50bb2b876e6a4a06e871f5c7f0e960895880d7b095f856004820152602481018290529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690633bf076b0906044016020604051808303815f875af1158015614b4d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614b719190615982565b50614bbd7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000856151b7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d27f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663db006a7587604051602401612eb191815260200190565b5f5f80516020615d07833981519152614c67816151aa565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d285866001600160a01b031663ba087652877f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000604051602401614cfb93929190615a6c565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b0319168252614d4493925090600401615999565b5f604051808303815f875af1158015614d5f573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052614d8691908101906159dd565b806020019051810190614d999190615982565b91507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633bf076b0614df47fcbdb6738b19dd3b24f89f36d3582b7d46aa62654d6d68e2f61094c597ada836b87615249565b846040518363ffffffff1660e01b8152600401614e1b929190918252602082015260400190565b6020604051808303815f875af1158015614e37573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614e5b9190615982565b505092915050565b5f80516020615d07833981519152614e7a816151aa565b614e915f80516020615d4783398151915283615249565b60405160016221581760e21b03198152600481018290525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015614ef9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614f1d9190615b03565b5111614f3b5760405162461bcd60e51b8152600401611ab790615b67565b60405163631ebadb60e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301525f919085169063c63d75b690602401602060405180830381865afa158015614fa2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614fc69190615982565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d285866001600160a01b03166394bf804d857f00000000000000000000000000000000000000000000000000000000000000006040516024016110089291909182526001600160a01b0316602082015260400190565b5f80516020615d07833981519152615063816151aa565b61507a5f80516020615d2783398151915283615249565b60405160016221581760e21b03198152600481018290525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ff7a9fa490602401608060405180830381865afa1580156150e2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906151069190615b03565b51116151245760405162461bcd60e51b8152600401611ab790615b67565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633aada4d284856001600160a01b0316632b9d9c1f6002547f0000000000000000000000000000000000000000000000000000000000000000604051602401612eb19291909182526001600160a01b0316602082015260400190565b6151b481336155e0565b50565b6040516001600160a01b038381166024830152604482018390527f00000000000000000000000000000000000000000000000000000000000000001690633aada4d290859060640160408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b179052516001600160e01b031960e085901b168152612efa929190600401615999565b5f828260405160200161526f9291909182526001600160a01b0316602082015260400190565b60405160208183030381529060405280519060200120905092915050565b6040516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116602483018190526044830184905291633aada4d2917f000000000000000000000000000000000000000000000000000000000000000091908216906386c34f42906064016147a9565b5f61530f8383613931565b61538c575f838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556153443390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610ea5565b505f610ea5565b5f61539e8383613931565b1561538c575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610ea5565b5f83838360405160200161541293929190615a6c565b6040516020818303038152906040528051906020012090509392505050565b5f828260405160200161526f92919091825263ffffffff16602082015260400190565b604080516024810185905263ffffffff84166044820152606481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b039081166084808401919091528351808403909101815260a490920183526020820180516001600160e01b03166337e9a82760e11b1790529151631d56d26960e11b81525f927f00000000000000000000000000000000000000000000000000000000000000001691633aada4d291615537917f000000000000000000000000000000000000000000000000000000000000000091600401615999565b5f604051808303815f875af1158015615552573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261557991908101906159dd565b80602001905181019061558c9190615cdf565b9050818363ffffffff168267ffffffffffffffff167f805a2d8b8d8d00211d6d0b649e13d17c52249698ce305975aec1c912d50acfd6876040516155d291815260200190565b60405180910390a450505050565b6155ea8282613931565b6148345760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401611ab7565b5f60208284031215615629575f80fd5b5035919050565b5f60208284031215615640575f80fd5b81356001600160e01b031981168114615657575f80fd5b9392505050565b6001600160a01b03811681146151b4575f80fd5b5f8060408385031215615683575f80fd5b823561568e8161565e565b946020939093013593505050565b5f80604083850312156156ad575f80fd5b8235915060208301356156bf8161565e565b809150509250929050565b5f805f604084860312156156dc575f80fd5b83356156e78161565e565b9250602084013567ffffffffffffffff80821115615703575f80fd5b818601915086601f830112615716575f80fd5b813581811115615724575f80fd5b87602060c083028501011115615738575f80fd5b6020830194508093505050509250925092565b5f6020828403121561575b575f80fd5b81356156578161565e565b5f805f60608486031215615778575f80fd5b83356157838161565e565b925060208401356157938161565e565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff811182821017156157e1576157e16157a4565b604052919050565b5f80604083850312156157fa575f80fd5b82356158058161565e565b915060208381013567ffffffffffffffff80821115615822575f80fd5b818601915086601f830112615835575f80fd5b813581811115615847576158476157a4565b8060051b91506158588483016157b8565b8181529183018401918481019089841115615871575f80fd5b938501935b8385101561588f57843582529385019390850190615876565b8096505050505050509250929050565b5f805f604084860312156158b1575f80fd5b83356158bc8161565e565b9250602084013567ffffffffffffffff808211156158d8575f80fd5b818601915086601f8301126158eb575f80fd5b8135818111156158f9575f80fd5b8760208260051b8501011115615738575f80fd5b803563ffffffff81168114615920575f80fd5b919050565b5f8060408385031215615936575f80fd5b61568e8361590d565b5f8060408385031215615950575f80fd5b823591506159606020840161590d565b90509250929050565b5f60208284031215615979575f80fd5b6156578261590d565b5f60208284031215615992575f80fd5b5051919050565b60018060a01b0383168152604060208201525f82518060408401528060208501606085015e5f606082850101526060601f19601f8301168401019150509392505050565b5f60208083850312156159ee575f80fd5b825167ffffffffffffffff80821115615a05575f80fd5b818501915085601f830112615a18575f80fd5b815181811115615a2a57615a2a6157a4565b615a3c601f8201601f191685016157b8565b91508082528684828501011115615a51575f80fd5b808484018584015e5f90820190930192909252509392505050565b9283526001600160a01b03918216602084015216604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b5f82615ab957634e487b7160e01b5f52601260045260245ffd5b500490565b81810381811115610ea557610ea5615a8b565b8082028115828204841417610ea557610ea5615a8b565b5f60208284031215615af8575f80fd5b81516156578161565e565b5f60808284031215615b13575f80fd5b6040516080810181811067ffffffffffffffff82111715615b3657615b366157a4565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b6020808252818101527f4d61696e6e6574436f6e74726f6c6c65722f696e76616c69642d616374696f6e604082015260600190565b60208082528181018390525f90604080840186845b87811015615c36578135615bc48161565e565b6001600160a01b0390811684528286013590615bdf8261565e565b908116848701528285013590615bf48261565e565b9081168486015260609083820135615c0b8161565e565b16908401526080828101359084015260a0808301359084015260c09283019290910190600101615bb1565b5090979650505050505050565b602080825282518282018190525f9190848201906040850190845b81811015615c7a57835183529284019291840191600101615c5e565b50909695505050505050565b602080825281018290525f6001600160fb1b03831115615ca4575f80fd5b8260051b80856040850137919091016040019392505050565b5f8060408385031215615cce575f80fd5b505080516020909101519092909150565b5f60208284031215615cef575f80fd5b815167ffffffffffffffff81168114615657575f80fdfeab4f864e5201b0fde9b5ee3e4cf96384802b0ffdfcf7f9de4699ce21a30afc4f37a654d17f66a87e6840766cbc5e150ff574075a7a1d321c0005aad1833651084f6f546d5800d82b8a8c9264a9bf10c52df96121f25b3b82ce1da699f16eb705c80e541ae8dbb00d82e12edc8dbc29e6ae9ebed737088df9145797f7edca3b42a26469706673582212205140f20c4cd18de2752acb72b4161e923b60f64b87d00998cc870e641ac4d06c64736f6c634300081900330000000000000000000000001369f7b2b38c76b6478c0f0e66d94923421891ba000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a00000000000000000000000026512a41c8406800f21094a7a7a0f980f6e25d43000000000000000000000000f6e72db5454dd049d0788e411b06cfaf168530420000000000000000000000003225737a9bbb6473cb4a45b7244aca2befdb276a000000000000000000000000bd3fa81b58ba92a82136038b25adec7066af3155
Deployed Bytecode
0x608060405234801561000f575f80fd5b506004361061047a575f3560e01c8063704d1eaf11610258578063c09cea981161014b578063d9acb348116100ca578063ec5568891161008f578063ec55688914610c6f578063edaafe2014610c96578063ef3d3ddb14610cbd578063f092159414610ce4578063f4b9fa7514610d0b578063fbfa77cf14610d32575f80fd5b8063d9acb34814610be8578063dc836b7a14610bfb578063e08471fc14610c22578063e3329e3214610c35578063e604ddab14610c5c575f80fd5b8063cf6761d711610110578063cf6761d714610b60578063d0a7705414610b87578063d547741f14610b9b578063d72f444814610bae578063d86f2a0614610bc1575f80fd5b8063c09cea9814610aec578063c284f59814610b0b578063c2be370614610b32578063c77d9a5214610b45578063c95c29d914610b4d575f80fd5b80639beaa558116101d7578063b2eae5ad1161019c578063b2eae5ad14610a78578063b5cbf20214610a8b578063b8faa7f614610a9e578063bcd7e46c14610ac5578063c07793ad14610ad8575f80fd5b80639beaa558146109fd578063a0b0c6af14610a10578063a217fddf14610a23578063a46a3cf614610a2a578063ad91c80d14610a51575f80fd5b8063900724691161021d578063900724691461097657806391d148541461099d57806395f4324e146109b057806396122b62146109d75780639ba6c1da146109ea575f80fd5b8063704d1eaf146108db5780637891c0431461090257806381455ca91461091557806385f4881d1461093c5780638986012d1461094f575f80fd5b806336568abe116103705780634cf282fb116102ef5780635a0e4895116102b45780635a0e4895146108555780635acb70531461087b5780635bb1a9741461088e578063603b0ade146108a157806360f0a5ac146108c8575f80fd5b80634cf282fb146107ce57806350f5fc06146107f5578063536f6b7e1461081c578063538636131461082f578063558e0a7714610842575f80fd5b806340e492161161033557806340e49216146107475780634390e9dd1461075a578063439e2e451461076d57806343dc75d314610780578063475d182a146107a7575f80fd5b806336568abe146106c05780633ab63d10146106d35780633df1c8c6146106e65780633e413bee146106f95780633ede937f14610720575f80fd5b80631aa5f08d116103fc578063248b7ef7116103c1578063248b7ef7146106615780632cefff96146106745780632d4dcb89146106875780632e5f26751461069a5780632f2ff15d146106ad575f80fd5b80631aa5f08d146105dd5780631cbda1b1146105f1578063240b7844146106045780632483e7151461062b578063248a9ca31461063f575f80fd5b80630b372e57116104425780630b372e57146105345780630fd761e014610555578063115c48d51461057c57806314886aa71461058f57806319ece4ec146105b6575f80fd5b80630187148f1461047e57806301ffc9a71461049357806302a4ea53146104bb578063032988da146104ce57806304bda2621461050d575b5f80fd5b61049161048c366004615619565b610d59565b005b6104a66104a1366004615630565b610e75565b60405190151581526020015b60405180910390f35b6104916104c9366004615619565b610eab565b6104f57f0000000000000000000000009d39a5de30e57443bff2a8307a4256c8797a349781565b6040516001600160a01b0390911681526020016104b2565b6104f57f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf1685304281565b610547610542366004615672565b61109a565b6040519081526020016104b2565b6104f57f0000000000000000000000004c9edd5852cd905f086c759e8383e09bff1e68b381565b61049161058a366004615619565b6112b3565b6105477f292071ee2770abc65b11bb80fa8c381ada7ff4428c832813b075a12da648670c81565b6105477f213c645fc0f2b08264743dd819fb1d54d9a3d9d1eab0fa654e1a7bf7b22ee79681565b6105475f80516020615d6783398151915281565b6104916105ff366004615619565b6117c5565b6104f57f000000000000000000000000e3490297a08d6fc8da46edb7b6142e4f461b62d381565b6105475f80516020615d0783398151915281565b61054761064d366004615619565b5f9081526020819052604090206001015490565b61049161066f366004615672565b6119cc565b610491610682366004615672565b611b44565b610547610695366004615619565b611dd7565b6104916106a8366004615672565b611fd7565b6104916106bb36600461569c565b61219e565b6104916106ce36600461569c565b6121c2565b6104916106e13660046156ca565b6121fa565b6104916106f4366004615619565b6123b7565b6104f57f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b6105477f8e6d782dd232ba18cda332ab87226668a41414f4096db2b33575872cd6fca16a81565b61049161075536600461574b565b612591565b61049161076836600461574b565b6126d2565b61049161077b366004615766565b6128cb565b6105477f971711e0ecfa693edaceb1e022ac9879076ac4289525ade0c331a15ff1f96fc181565b6105477fdbd6b16a066c313d3b984d4f2d682f97665d1912ea24d2b7e0f3ba43aa0493c581565b6104f57f000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f81565b6104f57f0000000000000000000000004c21b7577c8fe8b0b0669165ee7c8f67fa1454cf81565b61049161082a366004615619565b612a05565b61049161083d36600461574b565b612c8d565b61049161085036600461574b565b612d43565b6105477ed4cb8ac2838f11d95b0136a919a13b994f920024aba35eee16dc433c65851c81565b610491610889366004615619565b612f3c565b61049161089c36600461574b565b61322c565b6105477f519fa96e0bcf84b705fc396cd38f7f5e661413cb0fe321a78e8a29091b5bf26281565b6104916108d636600461574b565b61338a565b6104f57f00000000000000000000000031d3f59ad4aac0eee2247c65ebe8bf6e9e470a5381565b610547610910366004615672565b613403565b6105477f000000000000000000000000000000000000000000000000000000e8d4a5100081565b61054761094a366004615672565b6136cc565b6105477fcb0537d5e5dba65a8edbac12555995860e5b8e1b70996011edb1ca8173e56d3c81565b6105477fcbdb6738b19dd3b24f89f36d3582b7d46aa62654d6d68e2f61094c597ada836b81565b6104a66109ab36600461569c565b613931565b6104f57f00000000000000000000000043415eb6ff9db7e26a15b704e7a3edce97d31c4e81565b6104916109e5366004615619565b613959565b6104916109f83660046157e9565b613c08565b610491610a0b36600461589f565b613d30565b610491610a1e36600461574b565b613e5a565b6105475f81565b6105477f0ac42a08299cbc4428ec38ad4a8e7d7440779fbbb20ea90bd10c094a406cfa6f81565b6105477f48f98264e3feb9c04c94251c86b84a95f369fb2973906e457f22ec9080cb675581565b610491610a86366004615619565b613fc7565b610491610a99366004615925565b6140dd565b6104f57f0000000000000000000000003225737a9bbb6473cb4a45b7244aca2befdb276a81565b610491610ad336600461593f565b61413d565b6105475f80516020615d4783398151915281565b610547610afa366004615969565b60016020525f908152604090205481565b6105477f4143f9dd901ae26124c50bb2b876e6a4a06e871f5c7f0e960895880d7b095f8581565b610491610b40366004615672565b6144c7565b610491614726565b610491610b5b366004615672565b614838565b6105477f88fe4304240f9fdabd8d614954877c91faacf3746c24df5803bac9e49977b63b81565b6105475f80516020615d2783398151915281565b610491610ba936600461569c565b6149fc565b610491610bbc366004615619565b614a20565b6105477f5def078412c37c191fd2d189c95907ded1a100c5252bc3d643bb61986695451781565b610547610bf6366004615672565b614c4f565b6105477f0476a9fd902eafdb5bcdabd9f0523dd7aacf7aa0c38c0e6ab912f5fed00f8e1181565b610491610c3036600461574b565b614e63565b6104f57f000000000000000000000000bd3fa81b58ba92a82136038b25adec7066af315581565b610491610c6a36600461574b565b61504c565b6104f57f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e81565b6104f57f000000000000000000000000629ad4d779f46b8a1491d3f76f7e97cb04d8b1cd81565b6105477ffa746459736d4da7e93566b5ec05608174be6bf01c7207464bfb77d034bbdc7f81565b6104f57f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a81565b6104f57f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f81565b6104f57f00000000000000000000000026512a41c8406800f21094a7a7a0f980f6e25d4381565b5f80516020615d07833981519152610d70816151aa565b6040516303bf076b60e41b81527f88fe4304240f9fdabd8d614954877c91faacf3746c24df5803bac9e49977b63b60048201819052602482018490529083906001600160a01b037f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a1690633bf076b0906044016020604051808303815f875af1158015610dff573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e239190615982565b50610e6f7f0000000000000000000000004c9edd5852cd905f086c759e8383e09bff1e68b37f000000000000000000000000e3490297a08d6fc8da46edb7b6142e4f461b62d3866151b7565b50505050565b5f6001600160e01b03198216637965db0b60e01b1480610ea557506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f80516020615d07833981519152610ec2816151aa565b6040516303bf076b60e41b81527fdbd6b16a066c313d3b984d4f2d682f97665d1912ea24d2b7e0f3ba43aa0493c560048201819052602482018490529083906001600160a01b037f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a1690633bf076b0906044016020604051808303815f875af1158015610f51573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f759190615982565b507f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d27f0000000000000000000000009d39a5de30e57443bff2a8307a4256c8797a34977f0000000000000000000000009d39a5de30e57443bff2a8307a4256c8797a34976001600160a01b031663cdac52ed8860405160240161100891815260200190565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b031916825261105193925090600401615999565b5f604051808303815f875af115801561106c573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261109391908101906159dd565b5050505050565b5f5f80516020615d078339815191526110b2816151aa565b7fcbdb6738b19dd3b24f89f36d3582b7d46aa62654d6d68e2f61094c597ada836b84847f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b0316633bf076b061110e8585615249565b836040518363ffffffff1660e01b8152600401611135929190918252602082015260400190565b6020604051808303815f875af1158015611151573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111759190615982565b507f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d288896001600160a01b031663b460af948a7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e60405160240161120a93929190615a6c565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b031916825261125393925090600401615999565b5f604051808303815f875af115801561126e573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261129591908101906159dd565b8060200190518101906112a89190615982565b979650505050505050565b5f80516020615d078339815191526112ca816151aa565b6040516317024edd60e21b81527ed4cb8ac2838f11d95b0136a919a13b994f920024aba35eee16dc433c65851c60048201819052602482018490529083906001600160a01b037f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a1690635c093b74906044016020604051808303815f875af1158015611358573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061137c9190615982565b506113c87f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb487f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf16853042866151b7565b6040516370a0823160e01b81526001600160a01b037f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf16853042811660048301525f917f000000000000000000000000000000000000000000000000000000e8d4a51000917f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f16906370a0823190602401602060405180830381865afa158015611470573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114949190615982565b61149e9190615a9f565b90508085116114b5576114b08561528d565b611646565b845b8015611644577f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf168530426001600160a01b031663d9c55ce16040518163ffffffff1660e01b81526004016020604051808303815f875af115801561151a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061153e9190615982565b506040516370a0823160e01b81526001600160a01b037f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf16853042811660048301527f000000000000000000000000000000000000000000000000000000e8d4a51000917f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f909116906370a0823190602401602060405180830381865afa1580156115e7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061160b9190615982565b6116159190615a9f565b91505f8282106116255782611627565b815b90506116328161528d565b61163c8183615abe565b9150506114b7565b505b5f6116717f000000000000000000000000000000000000000000000000000000e8d4a5100087615ad1565b90506116be7f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f7f0000000000000000000000003225737a9bbb6473cb4a45b7244aca2befdb276a836151b7565b6040516001600160a01b037f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e8116602483018190526044830184905291633aada4d2917f0000000000000000000000003225737a9bbb6473cb4a45b7244aca2befdb276a919082169063f2c07aae906064015b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b031916825261177a93925090600401615999565b5f604051808303815f875af1158015611795573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526117bc91908101906159dd565b50505050505050565b5f80516020615d078339815191526117dc816151aa565b6040516303bf076b60e41b81527f292071ee2770abc65b11bb80fa8c381ada7ff4428c832813b075a12da648670c60048201819052602482018490529083906001600160a01b037f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a1690633bf076b0906044016020604051808303815f875af115801561186b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061188f9190615982565b5061193a7f00000000000000000000000031d3f59ad4aac0eee2247c65ebe8bf6e9e470a536001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118ef573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119139190615ae8565b7f00000000000000000000000031d3f59ad4aac0eee2247c65ebe8bf6e9e470a53866151b7565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d27f00000000000000000000000031d3f59ad4aac0eee2247c65ebe8bf6e9e470a537f00000000000000000000000031d3f59ad4aac0eee2247c65ebe8bf6e9e470a536001600160a01b031663db006a758860405160240161100891815260200190565b5f80516020615d078339815191526119e3816151aa565b611a0d7f971711e0ecfa693edaceb1e022ac9879076ac4289525ade0c331a15ff1f96fc184615249565b60405160016221581760e21b03198152600481018290525f907f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015611a75573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a999190615b03565b5111611ac05760405162461bcd60e51b8152600401611ab790615b67565b60405180910390fd5b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d285866001600160a01b0316631b8f1830877f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6040516024016110089291909182526001600160a01b0316602082015260400190565b5f80516020615d07833981519152611b5b816151aa565b7f8e6d782dd232ba18cda332ab87226668a41414f4096db2b33575872cd6fca16a83837f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b0316633bf076b0611bb78585615249565b836040518363ffffffff1660e01b8152600401611bde929190918252602082015260400190565b6020604051808303815f875af1158015611bfa573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c1e9190615982565b505f866001600160a01b031663b16a19de6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c5c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c809190615ae8565b90505f876001600160a01b0316637535d2466040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cbf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ce39190615ae8565b9050611cf08282896151b7565b604080516001600160a01b038481166024830152604482018a90527f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e16606482018190525f6084808401919091528351808403909101815260a490920183526020820180516001600160e01b031663617ba03760e01b1790529151631d56d26960e11b8152633aada4d291611d8a91859190600401615999565b5f604051808303815f875af1158015611da5573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611dcc91908101906159dd565b505050505050505050565b5f5f80516020615d07833981519152611def816151aa565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d27f0000000000000000000000009d39a5de30e57443bff2a8307a4256c8797a34977f0000000000000000000000009d39a5de30e57443bff2a8307a4256c8797a34976001600160a01b0316639343d9e187604051602401611e8191815260200190565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b0319168252611eca93925090600401615999565b5f604051808303815f875af1158015611ee5573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611f0c91908101906159dd565b806020019051810190611f1f9190615982565b6040516303bf076b60e41b81527fdbd6b16a066c313d3b984d4f2d682f97665d1912ea24d2b7e0f3ba43aa0493c56004820152602481018290529092507f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b031690633bf076b0906044016020604051808303815f875af1158015611fac573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fd09190615982565b5050919050565b5f80516020615d07833981519152611fee816151aa565b6040516303d1689d60e11b8152600481018390527f971711e0ecfa693edaceb1e022ac9879076ac4289525ade0c331a15ff1f96fc19084906001600160a01b038216906307a2d13a90602401602060405180830381865afa158015612055573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120799190615982565b7f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b0316633bf076b06120b28585615249565b836040518363ffffffff1660e01b81526004016120d9929190918252602082015260400190565b6020604051808303815f875af11580156120f5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121199190615982565b507f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d287886001600160a01b031663107703ab897f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6040516024016117319291909182526001600160a01b0316602082015260400190565b5f828152602081905260409020600101546121b8816151aa565b610e6f8383615304565b6001600160a01b03811633146121eb5760405163334bd91960e11b815260040160405180910390fd5b6121f58282615393565b505050565b5f80516020615d07833981519152612211816151aa565b6122285f80516020615d6783398151915285615249565b60405160016221581760e21b03198152600481018290525f907f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015612290573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122b49190615b03565b51116122d25760405162461bcd60e51b8152600401611ab790615b67565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d286876001600160a01b0316637299aa318888604051602401612324929190615b9c565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b031916825261236d93925090600401615999565b5f604051808303815f875af1158015612388573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526123af91908101906159dd565b505050505050565b5f80516020615d078339815191526123ce816151aa565b6040516303bf076b60e41b81527f213c645fc0f2b08264743dd819fb1d54d9a3d9d1eab0fa654e1a7bf7b22ee79660048201819052602482018490529083906001600160a01b037f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a1690633bf076b0906044016020604051808303815f875af115801561245d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124819190615982565b506124cd7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb487f00000000000000000000000043415eb6ff9db7e26a15b704e7a3edce97d31c4e866151b7565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d27f00000000000000000000000043415eb6ff9db7e26a15b704e7a3edce97d31c4e7f00000000000000000000000043415eb6ff9db7e26a15b704e7a3edce97d31c4e6001600160a01b03166359e6951d887f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486040516024016110089291909182526001600160a01b0316602082015260400190565b5f80516020615d078339815191526125a8816151aa565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d27f000000000000000000000000e3490297a08d6fc8da46edb7b6142e4f461b62d37f000000000000000000000000e3490297a08d6fc8da46edb7b6142e4f461b62d36001600160a01b03166340e492168660405160240161264791906001600160a01b0391909116815260200190565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b031916825261269093925090600401615999565b5f604051808303815f875af11580156126ab573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526121f591908101906159dd565b5f80516020615d078339815191526126e9816151aa565b6127005f80516020615d2783398151915283615249565b60405160016221581760e21b03198152600481018290525f907f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015612768573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061278c9190615b03565b51116127aa5760405162461bcd60e51b8152600401611ab790615b67565b60405163ce96cb7760e01b81526001600160a01b037f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e811660048301525f919085169063ce96cb7790602401602060405180830381865afa158015612811573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906128359190615982565b90507f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d285866001600160a01b031663b460af94857f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e60405160240161100893929190615a6c565b5f80516020615d078339815191526128e2816151aa565b61290d7f48f98264e3feb9c04c94251c86b84a95f369fb2973906e457f22ec9080cb675585856153fc565b6040516303bf076b60e41b8152600481018290526024810184905283907f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b031690633bf076b0906044016020604051808303815f875af115801561297a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061299e9190615982565b507f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d287886001600160a01b031663a9059cbb89896040516024016117319291906001600160a01b03929092168252602082015260400190565b5f80516020615d07833981519152612a1c816151aa565b6040516303bf076b60e41b81527fcb0537d5e5dba65a8edbac12555995860e5b8e1b70996011edb1ca8173e56d3c60048201819052602482018490529083906001600160a01b037f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a1690633bf076b0906044016020604051808303815f875af1158015612aab573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612acf9190615982565b507f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d27f00000000000000000000000026512a41c8406800f21094a7a7a0f980f6e25d437f00000000000000000000000026512a41c8406800f21094a7a7a0f980f6e25d436001600160a01b0316633b30414788604051602401612b6291815260200190565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b0319168252612bab93925090600401615999565b5f604051808303815f875af1158015612bc6573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612bed91908101906159dd565b506040516001600160a01b037f000000000000000000000000629ad4d779f46b8a1491d3f76f7e97cb04d8b1cd811660248301527f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e8116604483018190526064830187905291633aada4d2917f000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f91908216906323b872dd90608401611008565b5f80516020615d07833981519152612ca4816151aa565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d27f000000000000000000000000e3490297a08d6fc8da46edb7b6142e4f461b62d37f000000000000000000000000e3490297a08d6fc8da46edb7b6142e4f461b62d36001600160a01b031663538636138660405160240161264791906001600160a01b0391909116815260200190565b5f80516020615d07833981519152612d5a816151aa565b612d715f80516020615d4783398151915283615249565b60405160016221581760e21b03198152600481018290525f907f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015612dd9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612dfd9190615b03565b5111612e1b5760405162461bcd60e51b8152600401611ab790615b67565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d284856001600160a01b03166369d77a446002547f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e604051602401612eb193929190615a6c565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b0319168252612efa93925090600401615999565b5f604051808303815f875af1158015612f15573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610e6f91908101906159dd565b5f80516020615d07833981519152612f53816151aa565b6040516303bf076b60e41b81527ed4cb8ac2838f11d95b0136a919a13b994f920024aba35eee16dc433c65851c60048201819052602482018490529083906001600160a01b037f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a1690633bf076b0906044016020604051808303815f875af1158015612fe1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906130059190615982565b505f6130317f000000000000000000000000000000000000000000000000000000e8d4a5100086615ad1565b905061307e7f000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f7f0000000000000000000000003225737a9bbb6473cb4a45b7244aca2befdb276a836151b7565b604080517f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b031660248201819052604480830185905283518084039091018152606490920183526020820180516001600160e01b031663068f301560e41b1790529151631d56d26960e11b8152633aada4d291613127917f0000000000000000000000003225737a9bbb6473cb4a45b7244aca2befdb276a9190600401615999565b5f604051808303815f875af1158015613142573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261316991908101906159dd565b506131b57f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f7f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf16853042836151b7565b6040516001600160a01b037f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e8116602483018190526044830188905291633aada4d2917f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf16853042919082169063067d927490606401612324565b5f80516020615d07833981519152613243816151aa565b61325a5f80516020615d4783398151915283615249565b60405160016221581760e21b03198152600481018290525f907f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b03169063ff7a9fa490602401608060405180830381865afa1580156132c2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906132e69190615b03565b51116133045760405162461bcd60e51b8152600401611ab790615b67565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d284856001600160a01b031663b9cf06346002547f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e604051602401612eb19291909182526001600160a01b0316602082015260400190565b7f0ac42a08299cbc4428ec38ad4a8e7d7440779fbbb20ea90bd10c094a406cfa6f6133b4816151aa565b6133cb5f80516020615d0783398151915283615393565b506040516001600160a01b038316907f10e1f7ce9fd7d1b90a66d13a2ab3cb8dd7f29f3f8d520b143b063ccfbab6906b905f90a25050565b5f5f80516020615d0783398151915261341b816151aa565b5f846001600160a01b0316637535d2466040518163ffffffff1660e01b8152600401602060405180830381865afa158015613458573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061347c9190615ae8565b90507f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d282836001600160a01b03166369328dec896001600160a01b031663b16a19de6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156134f9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061351d9190615ae8565b6040516001600160a01b039182166024820152604481018b90527f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e909116606482015260840160408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b03191682526135ac93925090600401615999565b5f604051808303815f875af11580156135c7573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526135ee91908101906159dd565b8060200190518101906136019190615982565b92507f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b0316633bf076b061365c7f519fa96e0bcf84b705fc396cd38f7f5e661413cb0fe321a78e8a29091b5bf26288615249565b856040518363ffffffff1660e01b8152600401613683929190918252602082015260400190565b6020604051808303815f875af115801561369f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906136c39190615982565b50505092915050565b5f5f80516020615d078339815191526136e4816151aa565b5f80516020615d6783398151915284847f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b0316633bf076b061372d8585615249565b836040518363ffffffff1660e01b8152600401613754929190918252602082015260400190565b6020604051808303815f875af1158015613770573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137949190615982565b505f876001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156137d2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137f69190615ae8565b90506138038189896151b7565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d2898a6001600160a01b0316636e553f658b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6040516024016138879291909182526001600160a01b0316602082015260400190565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b03191682526138d093925090600401615999565b5f604051808303815f875af11580156138eb573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261391291908101906159dd565b8060200190518101906139259190615982565b98975050505050505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b5f80516020615d07833981519152613970816151aa565b6040516317024edd60e21b81527fcb0537d5e5dba65a8edbac12555995860e5b8e1b70996011edb1ca8173e56d3c60048201819052602482018490529083906001600160a01b037f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a1690635c093b74906044016020604051808303815f875af11580156139ff573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613a239190615982565b507f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d27f000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f7f000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f6001600160a01b031663a9059cbb7f000000000000000000000000629ad4d779f46b8a1491d3f76f7e97cb04d8b1cd89604051602401613aea9291906001600160a01b03929092168252602082015260400190565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b0319168252613b3393925090600401615999565b5f604051808303815f875af1158015613b4e573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052613b7591908101906159dd565b507f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d27f00000000000000000000000026512a41c8406800f21094a7a7a0f980f6e25d437f00000000000000000000000026512a41c8406800f21094a7a7a0f980f6e25d436001600160a01b031663b38a16208860405160240161100891815260200190565b5f80516020615d07833981519152613c1f816151aa565b613c365f80516020615d6783398151915284615249565b60405160016221581760e21b03198152600481018290525f907f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015613c9e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613cc29190615b03565b5111613ce05760405162461bcd60e51b8152600401611ab790615b67565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d285866001600160a01b0316632acc56f9876040516024016110089190615c43565b5f80516020615d07833981519152613d47816151aa565b613d5e5f80516020615d6783398151915285615249565b60405160016221581760e21b03198152600481018290525f907f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015613dc6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613dea9190615b03565b5111613e085760405162461bcd60e51b8152600401611ab790615b67565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d286876001600160a01b03166341b678338888604051602401612324929190615c86565b5f80516020615d07833981519152613e71816151aa565b613e885f80516020615d2783398151915283615249565b60405160016221581760e21b03198152600481018290525f907f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015613ef0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613f149190615b03565b5111613f325760405162461bcd60e51b8152600401611ab790615b67565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d284856001600160a01b031662a06d196002547f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e604051602401612eb193929190615a6c565b5f80516020615d07833981519152613fde816151aa565b6040516303bf076b60e41b81527f5def078412c37c191fd2d189c95907ded1a100c5252bc3d643bb61986695451760048201819052602482018490529083906001600160a01b037f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a1690633bf076b0906044016020604051808303815f875af115801561406d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906140919190615982565b50610e6f7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb487f000000000000000000000000e3490297a08d6fc8da46edb7b6142e4f461b62d3866151b7565b5f6140e7816151aa565b63ffffffff83165f8181526001602052604090819020849055517f5e7cfea10f05abc55e716d0d5031f3eea4eabbe012e9bf1d56c5034bba4bfa30906141309085815260200190565b60405180910390a2505050565b5f80516020615d07833981519152614154816151aa565b6040516303bf076b60e41b81527f0476a9fd902eafdb5bcdabd9f0523dd7aacf7aa0c38c0e6ab912f5fed00f8e1160048201819052602482018590529084906001600160a01b037f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a1690633bf076b0906044016020604051808303815f875af11580156141e3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906142079190615982565b506142327ffa746459736d4da7e93566b5ec05608174be6bf01c7207464bfb77d034bbdc7f85615431565b6040516303bf076b60e41b8152600481018290526024810187905286907f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b031690633bf076b0906044016020604051808303815f875af115801561429f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906142c39190615982565b5063ffffffff86165f90815260016020526040812054908190036143395760405162461bcd60e51b815260206004820152602760248201527f4d61696e6e6574436f6e74726f6c6c65722f646f6d61696e2d6e6f742d636f6e604482015266199a59dd5c995960ca1b6064820152608401611ab7565b6143847f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb487f000000000000000000000000bd3fa81b58ba92a82136038b25adec7066af31558a6151b7565b5f7f000000000000000000000000bd3fa81b58ba92a82136038b25adec7066af31556001600160a01b031663cb75c11c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156143e1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906144059190615ae8565b6040516352b7631960e11b81526001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881166004830152919091169063a56ec63290602401602060405180830381865afa15801561446b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061448f9190615982565b90505b808911156144b6576144a5818984615454565b6144af818a615abe565b9850614492565b8815611dcc57611dcc898984615454565b5f80516020615d078339815191526144de816151aa565b5f80516020615d4783398151915283837f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b0316633bf076b06145278585615249565b836040518363ffffffff1660e01b815260040161454e929190918252602082015260400190565b6020604051808303815f875af115801561456a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061458e9190615982565b505f866001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156145cc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145f09190615ae8565b90506145fd8188886151b7565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d288896001600160a01b03166385b77f458a7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e60405160240161469193929190615a6c565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b03191682526146da93925090600401615999565b5f604051808303815f875af11580156146f5573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261471c91908101906159dd565b5050505050505050565b5f80516020615d0783398151915261473d816151aa565b6040516001600160a01b037f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e81166024830181905291633aada4d2917f0000000000000000000000009d39a5de30e57443bff2a8307a4256c8797a3497919082169063f2888dbb906044015b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b03191682526147f293925090600401615999565b5f604051808303815f875af115801561480d573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261483491908101906159dd565b5050565b5f80516020615d0783398151915261484f816151aa565b6040516303d1689d60e11b8152600481018390525f80516020615d278339815191529084906001600160a01b038216906307a2d13a90602401602060405180830381865afa1580156148a3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906148c79190615982565b7f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b0316633bf076b06149008585615249565b836040518363ffffffff1660e01b8152600401614927929190918252602082015260400190565b6020604051808303815f875af1158015614943573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906149679190615982565b507f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d287886001600160a01b0316637d41c86e897f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e60405160240161173193929190615a6c565b5f82815260208190526040902060010154614a16816151aa565b610e6f8383615393565b5f80516020615d07833981519152614a37816151aa565b60405163bbffa97960e01b8152600481018390525f907f0000000000000000000000004c21b7577c8fe8b0b0669165ee7c8f67fa1454cf6001600160a01b03169063bbffa979906024016040805180830381865afa158015614a9b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614abf9190615cbd565b506040516303bf076b60e41b81527f4143f9dd901ae26124c50bb2b876e6a4a06e871f5c7f0e960895880d7b095f856004820152602481018290529091507f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b031690633bf076b0906044016020604051808303815f875af1158015614b4d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614b719190615982565b50614bbd7f00000000000000000000000043415eb6ff9db7e26a15b704e7a3edce97d31c4e7f0000000000000000000000004c21b7577c8fe8b0b0669165ee7c8f67fa1454cf856151b7565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d27f0000000000000000000000004c21b7577c8fe8b0b0669165ee7c8f67fa1454cf7f0000000000000000000000004c21b7577c8fe8b0b0669165ee7c8f67fa1454cf6001600160a01b031663db006a7587604051602401612eb191815260200190565b5f5f80516020615d07833981519152614c67816151aa565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d285866001600160a01b031663ba087652877f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e604051602401614cfb93929190615a6c565b60408051808303601f1901815291815260208201805160e094851b6001600160e01b03909116179052519185901b6001600160e01b0319168252614d4493925090600401615999565b5f604051808303815f875af1158015614d5f573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052614d8691908101906159dd565b806020019051810190614d999190615982565b91507f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b0316633bf076b0614df47fcbdb6738b19dd3b24f89f36d3582b7d46aa62654d6d68e2f61094c597ada836b87615249565b846040518363ffffffff1660e01b8152600401614e1b929190918252602082015260400190565b6020604051808303815f875af1158015614e37573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614e5b9190615982565b505092915050565b5f80516020615d07833981519152614e7a816151aa565b614e915f80516020615d4783398151915283615249565b60405160016221581760e21b03198152600481018290525f907f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b03169063ff7a9fa490602401608060405180830381865afa158015614ef9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614f1d9190615b03565b5111614f3b5760405162461bcd60e51b8152600401611ab790615b67565b60405163631ebadb60e11b81526001600160a01b037f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e811660048301525f919085169063c63d75b690602401602060405180830381865afa158015614fa2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614fc69190615982565b90507f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d285866001600160a01b03166394bf804d857f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6040516024016110089291909182526001600160a01b0316602082015260400190565b5f80516020615d07833981519152615063816151aa565b61507a5f80516020615d2783398151915283615249565b60405160016221581760e21b03198152600481018290525f907f0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a6001600160a01b03169063ff7a9fa490602401608060405180830381865afa1580156150e2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906151069190615b03565b51116151245760405162461bcd60e51b8152600401611ab790615b67565b7f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e6001600160a01b0316633aada4d284856001600160a01b0316632b9d9c1f6002547f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e604051602401612eb19291909182526001600160a01b0316602082015260400190565b6151b481336155e0565b50565b6040516001600160a01b038381166024830152604482018390527f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e1690633aada4d290859060640160408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b179052516001600160e01b031960e085901b168152612efa929190600401615999565b5f828260405160200161526f9291909182526001600160a01b0316602082015260400190565b60405160208183030381529060405280519060200120905092915050565b6040516001600160a01b037f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e8116602483018190526044830184905291633aada4d2917f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf1685304291908216906386c34f42906064016147a9565b5f61530f8383613931565b61538c575f838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556153443390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610ea5565b505f610ea5565b5f61539e8383613931565b1561538c575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610ea5565b5f83838360405160200161541293929190615a6c565b6040516020818303038152906040528051906020012090509392505050565b5f828260405160200161526f92919091825263ffffffff16602082015260400190565b604080516024810185905263ffffffff84166044820152606481018390527f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b039081166084808401919091528351808403909101815260a490920183526020820180516001600160e01b03166337e9a82760e11b1790529151631d56d26960e11b81525f927f000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e1691633aada4d291615537917f000000000000000000000000bd3fa81b58ba92a82136038b25adec7066af315591600401615999565b5f604051808303815f875af1158015615552573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261557991908101906159dd565b80602001905181019061558c9190615cdf565b9050818363ffffffff168267ffffffffffffffff167f805a2d8b8d8d00211d6d0b649e13d17c52249698ce305975aec1c912d50acfd6876040516155d291815260200190565b60405180910390a450505050565b6155ea8282613931565b6148345760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401611ab7565b5f60208284031215615629575f80fd5b5035919050565b5f60208284031215615640575f80fd5b81356001600160e01b031981168114615657575f80fd5b9392505050565b6001600160a01b03811681146151b4575f80fd5b5f8060408385031215615683575f80fd5b823561568e8161565e565b946020939093013593505050565b5f80604083850312156156ad575f80fd5b8235915060208301356156bf8161565e565b809150509250929050565b5f805f604084860312156156dc575f80fd5b83356156e78161565e565b9250602084013567ffffffffffffffff80821115615703575f80fd5b818601915086601f830112615716575f80fd5b813581811115615724575f80fd5b87602060c083028501011115615738575f80fd5b6020830194508093505050509250925092565b5f6020828403121561575b575f80fd5b81356156578161565e565b5f805f60608486031215615778575f80fd5b83356157838161565e565b925060208401356157938161565e565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff811182821017156157e1576157e16157a4565b604052919050565b5f80604083850312156157fa575f80fd5b82356158058161565e565b915060208381013567ffffffffffffffff80821115615822575f80fd5b818601915086601f830112615835575f80fd5b813581811115615847576158476157a4565b8060051b91506158588483016157b8565b8181529183018401918481019089841115615871575f80fd5b938501935b8385101561588f57843582529385019390850190615876565b8096505050505050509250929050565b5f805f604084860312156158b1575f80fd5b83356158bc8161565e565b9250602084013567ffffffffffffffff808211156158d8575f80fd5b818601915086601f8301126158eb575f80fd5b8135818111156158f9575f80fd5b8760208260051b8501011115615738575f80fd5b803563ffffffff81168114615920575f80fd5b919050565b5f8060408385031215615936575f80fd5b61568e8361590d565b5f8060408385031215615950575f80fd5b823591506159606020840161590d565b90509250929050565b5f60208284031215615979575f80fd5b6156578261590d565b5f60208284031215615992575f80fd5b5051919050565b60018060a01b0383168152604060208201525f82518060408401528060208501606085015e5f606082850101526060601f19601f8301168401019150509392505050565b5f60208083850312156159ee575f80fd5b825167ffffffffffffffff80821115615a05575f80fd5b818501915085601f830112615a18575f80fd5b815181811115615a2a57615a2a6157a4565b615a3c601f8201601f191685016157b8565b91508082528684828501011115615a51575f80fd5b808484018584015e5f90820190930192909252509392505050565b9283526001600160a01b03918216602084015216604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b5f82615ab957634e487b7160e01b5f52601260045260245ffd5b500490565b81810381811115610ea557610ea5615a8b565b8082028115828204841417610ea557610ea5615a8b565b5f60208284031215615af8575f80fd5b81516156578161565e565b5f60808284031215615b13575f80fd5b6040516080810181811067ffffffffffffffff82111715615b3657615b366157a4565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b6020808252818101527f4d61696e6e6574436f6e74726f6c6c65722f696e76616c69642d616374696f6e604082015260600190565b60208082528181018390525f90604080840186845b87811015615c36578135615bc48161565e565b6001600160a01b0390811684528286013590615bdf8261565e565b908116848701528285013590615bf48261565e565b9081168486015260609083820135615c0b8161565e565b16908401526080828101359084015260a0808301359084015260c09283019290910190600101615bb1565b5090979650505050505050565b602080825282518282018190525f9190848201906040850190845b81811015615c7a57835183529284019291840191600101615c5e565b50909695505050505050565b602080825281018290525f6001600160fb1b03831115615ca4575f80fd5b8260051b80856040850137919091016040019392505050565b5f8060408385031215615cce575f80fd5b505080516020909101519092909150565b5f60208284031215615cef575f80fd5b815167ffffffffffffffff81168114615657575f80fdfeab4f864e5201b0fde9b5ee3e4cf96384802b0ffdfcf7f9de4699ce21a30afc4f37a654d17f66a87e6840766cbc5e150ff574075a7a1d321c0005aad1833651084f6f546d5800d82b8a8c9264a9bf10c52df96121f25b3b82ce1da699f16eb705c80e541ae8dbb00d82e12edc8dbc29e6ae9ebed737088df9145797f7edca3b42a26469706673582212205140f20c4cd18de2752acb72b4161e923b60f64b87d00998cc870e641ac4d06c64736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000001369f7b2b38c76b6478c0f0e66d94923421891ba000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a00000000000000000000000026512a41c8406800f21094a7a7a0f980f6e25d43000000000000000000000000f6e72db5454dd049d0788e411b06cfaf168530420000000000000000000000003225737a9bbb6473cb4a45b7244aca2befdb276a000000000000000000000000bd3fa81b58ba92a82136038b25adec7066af3155
-----Decoded View---------------
Arg [0] : admin_ (address): 0x1369f7b2b38c76B6478c0f0E66D94923421891Ba
Arg [1] : proxy_ (address): 0x491EDFB0B8b608044e227225C715981a30F3A44E
Arg [2] : rateLimits_ (address): 0x5F5cfCB8a463868E37Ab27B5eFF3ba02112dF19a
Arg [3] : vault_ (address): 0x26512A41C8406800f21094a7a7A0f980f6e25d43
Arg [4] : psm_ (address): 0xf6e72Db5454dd049d0788e411b06CfAF16853042
Arg [5] : daiUsds_ (address): 0x3225737a9Bbb6473CB4a45b7244ACa2BeFdB276A
Arg [6] : cctp_ (address): 0xBd3fa81B58Ba92a82136038B25aDec7066af3155
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000001369f7b2b38c76b6478c0f0e66d94923421891ba
Arg [1] : 000000000000000000000000491edfb0b8b608044e227225c715981a30f3a44e
Arg [2] : 0000000000000000000000005f5cfcb8a463868e37ab27b5eff3ba02112df19a
Arg [3] : 00000000000000000000000026512a41c8406800f21094a7a7a0f980f6e25d43
Arg [4] : 000000000000000000000000f6e72db5454dd049d0788e411b06cfaf16853042
Arg [5] : 0000000000000000000000003225737a9bbb6473cb4a45b7244aca2befdb276a
Arg [6] : 000000000000000000000000bd3fa81b58ba92a82136038b25adec7066af3155
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.