Source Code
Overview
ETH Balance
ETH Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 28755072 | 7 days ago | 0.0002 ETH | ||||
| 28754338 | 7 days ago | 0.0001 ETH | ||||
| 28754329 | 7 days ago | 0.0002 ETH | ||||
| 28754319 | 7 days ago | 0.0002 ETH | ||||
| 28754304 | 7 days ago | 0.0002 ETH | ||||
| 28754043 | 7 days ago | 0.0002 ETH | ||||
| 28674304 | 11 days ago | 0.00046804 ETH | ||||
| 28673953 | 11 days ago | 0.00156978 ETH | ||||
| 28667454 | 11 days ago | 0.0001 ETH | ||||
| 28667447 | 11 days ago | 0.0002 ETH | ||||
| 28642752 | 12 days ago | 0.0001 ETH | ||||
| 28642427 | 12 days ago | 0.0001 ETH | ||||
| 28642331 | 12 days ago | 0.0001 ETH | ||||
| 28642283 | 12 days ago | 0.0002 ETH | ||||
| 28642092 | 12 days ago | 0.0002 ETH | ||||
| 28641838 | 12 days ago | 0.0001 ETH | ||||
| 28641747 | 12 days ago | 0.0001 ETH | ||||
| 28641728 | 12 days ago | 0.0001 ETH | ||||
| 28641700 | 12 days ago | 0.0001 ETH | ||||
| 28641668 | 12 days ago | 0.0001 ETH | ||||
| 28641515 | 12 days ago | 0.0001 ETH | ||||
| 28641336 | 12 days ago | 0.0001 ETH | ||||
| 28640799 | 12 days ago | 0.0002 ETH | ||||
| 28623530 | 13 days ago | 1.5 ETH | ||||
| 28526983 | 16 days ago | 0.00042941 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
RSETHPoolV2ExternalBridge
Compiler Version
v0.8.27+commit.40a35a09
Optimization Enabled:
Yes with 4000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.27;
import {
ERC20Upgradeable, IERC20Upgradeable
} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { UtilLib } from "contracts/utils/UtilLib.sol";
import {
IStargatePoolNative,
SendParam,
MessagingFee,
OFTReceipt,
MessagingReceipt,
TxReceipt
} from "contracts/external/layerzero/interfaces/IStargatePoolNative.sol";
import { IL2Messenger } from "contracts/interfaces/L2/IL2Messenger.sol";
interface IOracle {
function getRate() external view returns (uint256);
}
interface IERC20WrsETH is IERC20Upgradeable {
function mint(address to, uint256 amount) external;
}
interface IRsETHTokenWrapper {
function allowedTokens(address asset) external view returns (bool);
function maxAmountToDepositBridgerAsset(address asset) external view returns (uint256);
}
/// @title RSETHPoolV2ExternalBridge
/// @notice This contract is the pool for swapping ETH for rsETH. It uses external bridges (e.g. LayerZero/Stargate) for
/// bridging ETH between chains instead of native bridging.
contract RSETHPoolV2ExternalBridge is ERC20Upgradeable, AccessControlUpgradeable, ReentrancyGuardUpgradeable {
using SafeERC20 for IERC20;
IERC20WrsETH public wrsETH;
uint256 public feeBps; // Basis points for fees
uint256 public feeEarnedInETH;
address public rsETHOracle;
bytes32 public constant BRIDGER_ROLE = keccak256("BRIDGER_ROLE");
bytes32 public constant TIMELOCK_ROLE = keccak256("TIMELOCK_ROLE");
/// @notice The corresponding L1Vault contract for the L2 chain
address public l1VaultETHForL2Chain;
/// @notice The StargatePool used for L2 --> L1 bridging
IStargatePoolNative public stargatePool;
/// @notice The LayerZero ID for the ETH mainnet
uint32 public dstLzChainId;
/// @notice The latest transaction receipt info from the StargatePoolNative
TxReceipt public latestTxReceipt;
/// @notice New variable added for pausable functionality
bool public paused;
/// @notice THe daily minting limit for rsETH
uint256 public dailyMintLimit;
/// @notice The amount of rsETH that was minted today
uint256 public dailyMintAmount;
/// @notice The last day that rsETH was minted
uint256 public lastMintDay;
/// @notice The start timestamp for the daily minting limit
uint256 public startTimestamp;
/// @notice The address of the L2 bridge contract
address public l2Bridge;
/// @notice The address of the L2 messenger contract
address public messenger;
/// @notice The pauser role identifier
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
/// @notice The operator role identifier
bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
modifier whenNotPaused() {
if (paused) revert ContractPaused();
_;
}
modifier whenPaused() {
if (!paused) revert ContractNotPaused();
_;
}
/// @dev Modifier to enforce the daily minting limit
/// @param amount The ETH amount sent in the deposit
modifier limitDailyMint(uint256 amount) {
if (block.timestamp < startTimestamp) {
revert MintBeforeStartTimestamp();
}
// Calculate the amount of rsETH that will be minted
(uint256 rsETHAmount,) = viewSwapRsETHAmountAndFee(amount);
uint256 currentDay = getCurrentDay();
// If the current day is greater than the last mint day, reset the daily mint amount
if (currentDay > lastMintDay) {
lastMintDay = currentDay;
dailyMintAmount = 0;
}
// Check if the daily mint amount plus the amount to mint is greater than the daily mint limit
if (dailyMintAmount + rsETHAmount > dailyMintLimit) {
revert DailyMintLimitExceeded();
}
dailyMintAmount += rsETHAmount;
_;
}
error InvalidAmount();
error TransferFailed();
error InsufficientETHBalance();
error InvalidMinAmount();
error InsufficientNativeFee();
error InvalidSlippageTolerance();
error ContractPaused();
error ContractNotPaused();
error DailyMintLimitExceeded();
error InvalidDailyMintLimit();
error MintBeforeStartTimestamp();
error InvalidStartTimestamp();
error InvalidLzChainId();
error InvalidFeeAmount();
error DeprecatedFunction();
error UnsupportedOracle();
error TokenNotAllowedInWrapper();
error ExceedsMaxAmountToDepositInWrapper();
error InsufficientETHBalanceForReverseSwap();
error InsufficientBalanceInPool();
event SwapOccurred(address indexed user, uint256 rsETHAmount, uint256 fee, string referralId);
event ReverseSwapOccurred(address indexed user, address indexed rsETH, uint256 rsETHAmount, uint256 tokenAmount);
event FeesWithdrawn(uint256 feeEarnedInETH);
event AssetsMovedForBridging(uint256 amount);
event BridgedETHToL1ViaNativeBridge(address indexed l1Receiver, uint256 amount);
event BridgedETHToL1(uint32 lzChainId, address l1Receiver, uint256 amountSent, uint256 amountReceived);
event FeeBpsSet(uint256 feeBps);
event OracleSet(address oracle);
event L1VaultETHForL2ChainSet(address l1VaultETHForL2Chain);
event StargatePoolSet(address stargatePool);
event LzChainIdSet(uint32 lzChainId);
event Paused(address account);
event Unpaused(address account);
event DailyMintLimitSet(uint256 dailyMintLimit);
event L2BridgeSet(address l2Bridge);
event MessengerSet(address messenger);
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
/**
* @notice Reinitializes the contract to enable native bridging of ETH
* @param _l2Bridge The address of the L2 bridge contract
* @param _messenger The address of the L2 messenger contract
*/
function reinitialize(
address _l2Bridge,
address _messenger
)
external
reinitializer(5)
onlyRole(DEFAULT_ADMIN_ROLE)
{
UtilLib.checkNonZeroAddress(_l2Bridge);
UtilLib.checkNonZeroAddress(_messenger);
l2Bridge = _l2Bridge;
messenger = _messenger;
emit L2BridgeSet(_l2Bridge);
emit MessengerSet(_messenger);
}
/// @dev Reinitializer function to set the daily minting limit
/// @param _dailyMintLimit The daily minting limit
/// @param _startTimestamp The start timestamp for the daily minting limit
function reinitialize(
uint256 _dailyMintLimit,
uint256 _startTimestamp
)
external
reinitializer(4)
onlyRole(DEFAULT_ADMIN_ROLE)
{
if (_dailyMintLimit == 0) {
revert InvalidDailyMintLimit();
}
// startTimestamp cannot be in the past
if (block.timestamp > _startTimestamp) {
revert InvalidStartTimestamp();
}
dailyMintLimit = _dailyMintLimit;
startTimestamp = _startTimestamp;
}
/// @dev Reinitialize the contract
/// @param _dstLzChainId The LayerZero ID for the ETH mainnet
function reinitialize(uint32 _dstLzChainId) external reinitializer(3) onlyRole(DEFAULT_ADMIN_ROLE) {
dstLzChainId = _dstLzChainId;
}
/// @dev Reinitialize the contract
/// @param _l1VaultETHForL2Chain The address of the L1VaultETH for the L2 chain
/// @param _stargatePool The address of the StargatePool used for L2 --> L1 bridging
/// @param _dstLzChainId The LayerZero ID for the ETH mainnet
function reinitialize(
address _l1VaultETHForL2Chain,
address _stargatePool,
uint32 _dstLzChainId
)
external
reinitializer(2)
onlyRole(DEFAULT_ADMIN_ROLE)
{
UtilLib.checkNonZeroAddress(_l1VaultETHForL2Chain);
UtilLib.checkNonZeroAddress(_stargatePool);
l1VaultETHForL2Chain = _l1VaultETHForL2Chain;
stargatePool = IStargatePoolNative(_stargatePool);
dstLzChainId = _dstLzChainId;
}
/// @dev Initialize the contract
/// @param admin The admin address
/// @param bridger The bridger address
/// @param _wrsETH The rsETH token address
/// @param _feeBps The fee basis points
/// @param _rsETHOracle The rsETHOracle address
function initialize(
address admin,
address bridger,
address _wrsETH,
uint256 _feeBps,
address _rsETHOracle
)
external
initializer
{
UtilLib.checkNonZeroAddress(_wrsETH);
UtilLib.checkNonZeroAddress(_rsETHOracle);
__ERC20_init("rsETH", "rsETH");
__AccessControl_init();
__ReentrancyGuard_init();
_grantRole(DEFAULT_ADMIN_ROLE, admin);
_setupRole(BRIDGER_ROLE, admin);
_setupRole(BRIDGER_ROLE, bridger);
wrsETH = IERC20WrsETH(_wrsETH);
feeBps = _feeBps;
rsETHOracle = _rsETHOracle;
}
/// @dev Gets the rate from the rsETHOracle
function getRate() public view returns (uint256) {
return IOracle(rsETHOracle).getRate();
}
/// @dev Swaps ETH for rsETH
/// @param referralId The referral id
function deposit(string memory referralId) external payable nonReentrant whenNotPaused limitDailyMint(msg.value) {
uint256 amount = msg.value;
if (amount == 0) revert InvalidAmount();
(uint256 rsETHAmount, uint256 fee) = viewSwapRsETHAmountAndFee(amount);
feeEarnedInETH += fee;
wrsETH.mint(msg.sender, rsETHAmount);
emit SwapOccurred(msg.sender, rsETHAmount, fee, referralId);
}
/// @dev view function to get the rsETH amount for a given amount of ETH
/// @param amount The amount of ETH
/// @return rsETHAmount The amount of rsETH that will be received
/// @return fee The fee that will be charged
function viewSwapRsETHAmountAndFee(uint256 amount) public view returns (uint256 rsETHAmount, uint256 fee) {
fee = amount * feeBps / 10_000;
uint256 amountAfterFee = amount - fee;
// rate of rsETH in ETH
uint256 rsETHToETHrate = getRate();
// Calculate the final rsETH amount
rsETHAmount = amountAfterFee * 1e18 / rsETHToETHrate;
}
/**
* @dev Quote the native fee for sending ETH to L1
* @param amount The amount of ETH to send
* @param minAmount The minimum amount of ETH to receive on L1 after slippage
* @return The fee to be paid in native currency
*/
function getNativeFee(uint256 amount, uint256 minAmount) external view returns (uint256) {
if (minAmount > amount || minAmount == 0) {
revert InvalidMinAmount();
}
SendParam memory sendParam = SendParam({
dstEid: dstLzChainId,
to: getReceiver(),
amountLD: amount,
minAmountLD: minAmount,
extraOptions: bytes(""),
composeMsg: bytes(""),
oftCmd: bytes("")
});
MessagingFee memory fee = stargatePool.quoteSend(sendParam, false);
return fee.nativeFee;
}
/**
* @dev Get the receiver address in the bytes32 format
* @return The receiver address in the bytes32 format
*/
function getReceiver() public view returns (bytes32) {
return bytes32(uint256(uint160(l1VaultETHForL2Chain)));
}
/**
* @dev Get the ETH balance minus the fees
* @return The ETH balance minus the fees
*/
function getETHBalanceMinusFees() public view returns (uint256) {
return address(this).balance - feeEarnedInETH;
}
/**
* @dev Get the minimum amount after slippage
* @param amount The amount
* @param slippageTolerance The slippage tolerance
* @return The minimum amount after slippage
*/
function getMinAmount(uint256 amount, uint256 slippageTolerance) external pure returns (uint256) {
if (slippageTolerance > 100) revert InvalidSlippageTolerance();
return amount - (amount * slippageTolerance / 10_000);
}
/// @notice Gets the current day relative to the start timestamp
/// @return uint256 The current day relative to the start timestamp
function getCurrentDay() public view returns (uint256) {
return (block.timestamp - startTimestamp) / 1 days;
}
/// @notice Gets the remaining daily minting limit
/// @return uint256 The remaining daily minting limit
function remainingDailyMintLimit() external view returns (uint256) {
// If we're on a new day but no mint has occurred yet, treat dailyMintAmount as 0
uint256 effectiveDailyMintAmount = (getCurrentDay() > lastMintDay) ? 0 : dailyMintAmount;
return dailyMintLimit - effectiveDailyMintAmount;
}
/// @notice Gets the next daily mint limit reset timestamp
/// @return uint256 The next daily mint limit reset timestamp
function getNextDailyLimitResetTimestamp() external view returns (uint256) {
return startTimestamp + (getCurrentDay() + 1) * 1 days;
}
/**
* @notice View quote for swapping minted rsETH to a supported pool asset
* @dev Functionally, it works as the opposite of `viewSwapRsETHAmountAndFee`
* @param rsETHAmount Amount of rsETH to swap.
* @return ethAmount Amount of ETH the caller would receive.
*/
function viewSwapAssetToPremintedRsETH(uint256 rsETHAmount) public view returns (uint256 ethAmount) {
// Rate of rsETH in ETH
uint256 rsETHToETHrate = getRate();
if (rsETHToETHrate == 0) revert UnsupportedOracle();
// Calculate the amount of token user will get for the amount of rsETH
ethAmount = rsETHAmount * rsETHToETHrate / 1e18;
}
/*//////////////////////////////////////////////////////////////
ACCESS RESTRICTED FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Operator-only swap from minted rsETH to ETH from the pool
* @dev Functionally, it works as the opposite of `deposit`, but it does not charge any fees
* @param rsETH Address of the rsETH token on this chain (must be allowed in wrapper)
* @param rsETHAmount Amount of rsETH to swap for ETH
*/
function swapAssetToPremintedRsETH(
address rsETH,
uint256 rsETHAmount
)
external
nonReentrant
onlyRole(OPERATOR_ROLE)
{
UtilLib.checkNonZeroAddress(rsETH);
IRsETHTokenWrapper wrapper = IRsETHTokenWrapper(address(wrsETH));
if (!wrapper.allowedTokens(rsETH)) revert TokenNotAllowedInWrapper();
if (rsETHAmount == 0) revert InvalidAmount();
if (rsETHAmount > wrapper.maxAmountToDepositBridgerAsset(rsETH)) revert ExceedsMaxAmountToDepositInWrapper();
// Get the amount of ETH to transfer to the user for the given amount of rsETH provided
uint256 ethAmount = viewSwapAssetToPremintedRsETH(rsETHAmount);
// Transfer rsETH from sender to the wrapper
IERC20(rsETH).safeTransferFrom(msg.sender, address(wrapper), rsETHAmount);
// Transfer the ETH from the pool to the sender
if (getETHBalanceMinusFees() < ethAmount) revert InsufficientETHBalanceForReverseSwap();
(bool success,) = payable(msg.sender).call{ value: ethAmount }("");
if (!success) revert TransferFailed();
emit ReverseSwapOccurred(msg.sender, rsETH, rsETHAmount, ethAmount);
}
/// @dev Withdraws fees earned by the pool
function withdrawFees(address receiver) external nonReentrant onlyRole(BRIDGER_ROLE) {
// withdraw fees in ETH
uint256 amountToSendInETH = feeEarnedInETH;
feeEarnedInETH = 0;
(bool success,) = payable(receiver).call{ value: amountToSendInETH }("");
if (!success) revert TransferFailed();
emit FeesWithdrawn(amountToSendInETH);
}
/// @dev Withdraws assets from the contract for bridging
function moveAssetsForBridging() external view onlyRole(BRIDGER_ROLE) {
revert DeprecatedFunction();
}
/// @notice Withdraws ETH from L2 to L1 using the L2's native bridge
/// @param amount The amount of ETH to bridge via the native bridge
function bridgeAssetsViaNativeBridge(uint256 amount) external nonReentrant onlyRole(BRIDGER_ROLE) {
UtilLib.checkNonZeroAddress(l2Bridge);
UtilLib.checkNonZeroAddress(messenger);
UtilLib.checkNonZeroAddress(l1VaultETHForL2Chain);
if (amount == 0) revert InvalidAmount();
// withdraw ETH - fees
uint256 ethBalanceMinusFees = getETHBalanceMinusFees();
if (amount > ethBalanceMinusFees) revert InsufficientETHBalance();
IL2Messenger(messenger).sendETHToL1ViaBridge{ value: amount }(l2Bridge, l1VaultETHForL2Chain, amount);
emit BridgedETHToL1ViaNativeBridge(l1VaultETHForL2Chain, amount);
}
/// @dev Withdraws assets from the L2 to L1 using LayerZero
/// @param amount The amount of ETH to bridge
/// @param minAmount The minimum amount of ETH to receive on L1
/// @param nativeFee The native fee to pay for the bridge
function bridgeAssets(
uint256 amount,
uint256 minAmount,
uint256 nativeFee
)
external
payable
nonReentrant
onlyRole(BRIDGER_ROLE)
{
if (getETHBalanceMinusFees() < amount) {
revert InsufficientETHBalance();
}
if (minAmount > amount || minAmount == 0) {
revert InvalidMinAmount();
}
if (msg.value < nativeFee) {
revert InsufficientNativeFee();
}
SendParam memory sendParam = SendParam({
dstEid: dstLzChainId,
to: getReceiver(),
amountLD: amount,
minAmountLD: minAmount,
extraOptions: bytes(""),
composeMsg: bytes(""),
oftCmd: bytes("")
});
MessagingFee memory fee = MessagingFee({ nativeFee: nativeFee, lzTokenFee: 0 });
(MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt) =
stargatePool.send{ value: nativeFee + amount }(sendParam, fee, msg.sender);
latestTxReceipt = TxReceipt({ guid: msgReceipt.guid, amountReceivedLD: oftReceipt.amountReceivedLD });
emit BridgedETHToL1(dstLzChainId, l1VaultETHForL2Chain, oftReceipt.amountSentLD, oftReceipt.amountReceivedLD);
}
/// @dev Sets the fee basis points
/// @param _feeBps The fee basis points
function setFeeBps(uint256 _feeBps) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (_feeBps > 1000) revert InvalidFeeAmount();
feeBps = _feeBps;
emit FeeBpsSet(_feeBps);
}
/// @dev Sets the rsETHOracle address
/// @param _rsETHOracle The rsETHOracle address
function setRSETHOracle(address _rsETHOracle) external onlyRole(TIMELOCK_ROLE) {
UtilLib.checkNonZeroAddress(_rsETHOracle);
rsETHOracle = _rsETHOracle;
emit OracleSet(_rsETHOracle);
}
/// @dev Sets the new L1VaultETH for the L2 chain
/// @param _l1VaultETHForL2Chain The new L1VaultETH for the L2 chain
function setL1VaultETHForL2Chain(address _l1VaultETHForL2Chain) external onlyRole(TIMELOCK_ROLE) {
UtilLib.checkNonZeroAddress(_l1VaultETHForL2Chain);
l1VaultETHForL2Chain = _l1VaultETHForL2Chain;
emit L1VaultETHForL2ChainSet(_l1VaultETHForL2Chain);
}
/// @dev Sets the new stargatePool address
/// @param _stargatePool The new stargatePool address
function setStargatePool(address _stargatePool) external onlyRole(TIMELOCK_ROLE) {
UtilLib.checkNonZeroAddress(_stargatePool);
stargatePool = IStargatePoolNative(_stargatePool);
emit StargatePoolSet(_stargatePool);
}
/// @dev Sets the destination LayerZero chain ID
/// @param _dstLzChainId The destination LayerZero chain ID
function setDstLzChainId(uint32 _dstLzChainId) external onlyRole(TIMELOCK_ROLE) {
if (_dstLzChainId == 0) {
revert InvalidLzChainId();
}
dstLzChainId = _dstLzChainId;
emit LzChainIdSet(_dstLzChainId);
}
/**
* @notice Sets the new l2Bridge address
* @param _l2Bridge The new l2Bridge address
*/
function setL2Bridge(address _l2Bridge) external onlyRole(TIMELOCK_ROLE) {
UtilLib.checkNonZeroAddress(_l2Bridge);
l2Bridge = _l2Bridge;
emit L2BridgeSet(_l2Bridge);
}
/**
* @notice Sets the L2 messenger address
* @param _messenger The new L2 messenger address
*/
function setMessenger(address _messenger) external onlyRole(TIMELOCK_ROLE) {
UtilLib.checkNonZeroAddress(_messenger);
messenger = _messenger;
emit MessengerSet(_messenger);
}
/// @dev Pauses the pausable methods in the contract
function pause() external onlyRole(PAUSER_ROLE) whenNotPaused {
paused = true;
emit Paused(msg.sender);
}
/// @dev Unpauses the pausable methods in the contract
function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) whenPaused {
paused = false;
emit Unpaused(msg.sender);
}
/// @dev Sets the daily minting limit
/// @param _dailyMintLimit The new daily minting limit
function setDailyMintLimit(uint256 _dailyMintLimit) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (_dailyMintLimit == 0) {
revert InvalidDailyMintLimit();
}
dailyMintLimit = _dailyMintLimit;
emit DailyMintLimitSet(_dailyMintLimit);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
__ERC20_init_unchained(name_, symbol_);
}
function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[45] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(account),
" is missing role ",
StringsUpgradeable.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @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 override 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 override 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 override 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 `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @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 Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
* 0 before setting it to a non-zero value.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.27;
/// @title UtilLib - Utility library
/// @notice Utility functions
library UtilLib {
error ZeroAddressNotAllowed();
/// @dev zero address check modifier
/// @param address_ address to check
function checkNonZeroAddress(address address_) internal pure {
if (address_ == address(0)) revert ZeroAddressNotAllowed();
}
function getMin(uint256 a, uint256 b) internal pure returns (uint256) {
if (a < b) return a;
return b;
}
function getMax(uint256 a, uint256 b) internal pure returns (uint256) {
if (a > b) return a;
return b;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.27;
/**
* @dev Struct representing send parameters for the send() operation
*/
struct SendParam {
uint32 dstEid; // Destination endpoint ID.
bytes32 to; // Recipient address.
uint256 amountLD; // Amount to send in local decimals
uint256 minAmountLD; // Minimum amount to send in local decimals
bytes extraOptions; // Additional options supplied by the caller to be used in the LayerZero message
bytes composeMsg; // The composed message for the send() operation
bytes oftCmd; // The OFT command to be executed, unused in default OFT implementations
}
/**
* @dev Struct representing the messaging fee for the OFT send() operation
*/
struct MessagingFee {
uint256 nativeFee; // The fee to be paid in native currency
uint256 lzTokenFee; // The fee to be paid in ZRO tokens
}
/**
* @dev Struct representing messaging receipt information
*/
struct MessagingReceipt {
bytes32 guid; // The GUID of the message
uint64 nonce; // The nonce of the message
MessagingFee fee; // The fee paid for the message (native currency and LZ tokens)
}
/**
* @dev Struct representing OFT receipt information
*/
struct OFTReceipt {
uint256 amountSentLD; // Amount of tokens ACTUALLY debited from the sender in local decimals
uint256 amountReceivedLD; // Amount of tokens to be received on the remote side
}
/// @dev Struct representing the receipt of a transaction from the StargatePoolNative contract
struct TxReceipt {
bytes32 guid; // The GUID of the message
uint256 amountReceivedLD; // Amount of tokens received in local decimals
}
/// @title IStargatePoolNative interface
/// @notice Interface for the StargatePoolNative contract, used for bridging ETH between L1 and L2 chains
interface IStargatePoolNative {
/// @notice Sends tokens to another chain
/// @dev This function handles the cross-chain token transfer
/// @param _sendParam Parameters for the send operation
/// @param _fee Messaging fee for the LayerZero protocol
/// @param _refundAddress Address to refund excess fees
/// @return msgReceipt Receipt of the messaging operation
/// @return oftReceipt Receipt of the OFT operation
function send(
SendParam calldata _sendParam,
MessagingFee calldata _fee,
address _refundAddress
)
external
payable
returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt);
/// @notice Quotes the fee for sending tokens to another chain
/// @dev This function estimates the fee without executing the transfer
/// @param _sendParam Parameters for the send operation
/// @param _payInLzToken Whether to pay the fee in LZ tokens
/// @return MessagingFee structure containing the estimated fees
function quoteSend(SendParam calldata _sendParam, bool _payInLzToken) external view returns (MessagingFee memory);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.27;
/**
* @title IL2Messenger
* @notice Generic interface for bridging ETH from L2 to L1
*/
interface IL2Messenger {
/// @notice Error thrown when the message value does not match the expected value
error MismatchedMsgValue();
/**
* @notice Bridge ETH from L2 to L1 via a specified bridge contract
* @param l2bridge The address of the L2 bridge contract
* @param target The address of the recipient on L1
* @param value The amount of ETH to send
*/
function sendETHToL1ViaBridge(address l2bridge, address target, uint256 value) external payable;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @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 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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
/**
* @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 v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
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;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
/**
* @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.
*
* _Available since v3.1._
*/
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 `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = MathUpgradeable.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, MathUpgradeable.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import {Initializable} from "../../proxy/utils/Initializable.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);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @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 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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @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.
*/
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].
*/
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: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUpgradeable {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMathUpgradeable {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @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 IERC165Upgradeable {
/**
* @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": [
"ds-test/=lib/forge-std/src/",
"forge-std/=lib/forge-std/src/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@eigenlayer/contracts/=lib/eigenlayer-contracts/src/contracts/",
"@openzeppelin-upgrades/=lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable-v4.9.0/",
"eigenlayer-contracts/=lib/eigenlayer-contracts/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"eth-gas-reporter/=node_modules/eth-gas-reporter/",
"hardhat/=node_modules/hardhat/",
"openzeppelin-contracts-upgradeable-v4.9.0/=lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable-v4.9.0/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts-v4.9.0/=lib/eigenlayer-contracts/lib/openzeppelin-contracts-v4.9.0/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/",
"solidity-code-metrics/=node_modules/solidity-code-metrics/",
"zeus-templates/=lib/eigenlayer-contracts/lib/zeus-templates/src/"
],
"optimizer": {
"enabled": true,
"runs": 4000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ContractNotPaused","type":"error"},{"inputs":[],"name":"ContractPaused","type":"error"},{"inputs":[],"name":"DailyMintLimitExceeded","type":"error"},{"inputs":[],"name":"DeprecatedFunction","type":"error"},{"inputs":[],"name":"ExceedsMaxAmountToDepositInWrapper","type":"error"},{"inputs":[],"name":"InsufficientBalanceInPool","type":"error"},{"inputs":[],"name":"InsufficientETHBalance","type":"error"},{"inputs":[],"name":"InsufficientETHBalanceForReverseSwap","type":"error"},{"inputs":[],"name":"InsufficientNativeFee","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidDailyMintLimit","type":"error"},{"inputs":[],"name":"InvalidFeeAmount","type":"error"},{"inputs":[],"name":"InvalidLzChainId","type":"error"},{"inputs":[],"name":"InvalidMinAmount","type":"error"},{"inputs":[],"name":"InvalidSlippageTolerance","type":"error"},{"inputs":[],"name":"InvalidStartTimestamp","type":"error"},{"inputs":[],"name":"MintBeforeStartTimestamp","type":"error"},{"inputs":[],"name":"TokenNotAllowedInWrapper","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"UnsupportedOracle","type":"error"},{"inputs":[],"name":"ZeroAddressNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AssetsMovedForBridging","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"lzChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"l1Receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountSent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountReceived","type":"uint256"}],"name":"BridgedETHToL1","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"l1Receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgedETHToL1ViaNativeBridge","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"dailyMintLimit","type":"uint256"}],"name":"DailyMintLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"feeBps","type":"uint256"}],"name":"FeeBpsSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"feeEarnedInETH","type":"uint256"}],"name":"FeesWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"l1VaultETHForL2Chain","type":"address"}],"name":"L1VaultETHForL2ChainSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"l2Bridge","type":"address"}],"name":"L2BridgeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"lzChainId","type":"uint32"}],"name":"LzChainIdSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"messenger","type":"address"}],"name":"MessengerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oracle","type":"address"}],"name":"OracleSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"rsETH","type":"address"},{"indexed":false,"internalType":"uint256","name":"rsETHAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"ReverseSwapOccurred","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"stargatePool","type":"address"}],"name":"StargatePoolSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"rsETHAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"string","name":"referralId","type":"string"}],"name":"SwapOccurred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"BRIDGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TIMELOCK_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"nativeFee","type":"uint256"}],"name":"bridgeAssets","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"bridgeAssetsViaNativeBridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dailyMintAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dailyMintLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"referralId","type":"string"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"dstLzChainId","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeEarnedInETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentDay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getETHBalanceMinusFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"slippageTolerance","type":"uint256"}],"name":"getMinAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"}],"name":"getNativeFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextDailyLimitResetTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReceiver","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"bridger","type":"address"},{"internalType":"address","name":"_wrsETH","type":"address"},{"internalType":"uint256","name":"_feeBps","type":"uint256"},{"internalType":"address","name":"_rsETHOracle","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"l1VaultETHForL2Chain","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2Bridge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastMintDay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestTxReceipt","outputs":[{"internalType":"bytes32","name":"guid","type":"bytes32"},{"internalType":"uint256","name":"amountReceivedLD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messenger","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"moveAssetsForBridging","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_l1VaultETHForL2Chain","type":"address"},{"internalType":"address","name":"_stargatePool","type":"address"},{"internalType":"uint32","name":"_dstLzChainId","type":"uint32"}],"name":"reinitialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_l2Bridge","type":"address"},{"internalType":"address","name":"_messenger","type":"address"}],"name":"reinitialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_dstLzChainId","type":"uint32"}],"name":"reinitialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_dailyMintLimit","type":"uint256"},{"internalType":"uint256","name":"_startTimestamp","type":"uint256"}],"name":"reinitialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"remainingDailyMintLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","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":[],"name":"rsETHOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_dailyMintLimit","type":"uint256"}],"name":"setDailyMintLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_dstLzChainId","type":"uint32"}],"name":"setDstLzChainId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feeBps","type":"uint256"}],"name":"setFeeBps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_l1VaultETHForL2Chain","type":"address"}],"name":"setL1VaultETHForL2Chain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_l2Bridge","type":"address"}],"name":"setL2Bridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_messenger","type":"address"}],"name":"setMessenger","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rsETHOracle","type":"address"}],"name":"setRSETHOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_stargatePool","type":"address"}],"name":"setStargatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stargatePool","outputs":[{"internalType":"contract IStargatePoolNative","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"rsETH","type":"address"},{"internalType":"uint256","name":"rsETHAmount","type":"uint256"}],"name":"swapAssetToPremintedRsETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"rsETHAmount","type":"uint256"}],"name":"viewSwapAssetToPremintedRsETH","outputs":[{"internalType":"uint256","name":"ethAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"viewSwapRsETHAmountAndFee","outputs":[{"internalType":"uint256","name":"rsETHAmount","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wrsETH","outputs":[{"internalType":"contract IERC20WrsETH","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
6080604052348015600f57600080fd5b506016601a565b60d7565b600054610100900460ff161560855760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161460d5576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b614474806100e66000396000f3fe60806040526004361061042f5760003560e01c806370a0823111610228578063b22c63ed11610128578063e27cafb9116100bb578063f08442e81161008a578063f5b541a61161006f578063f5b541a614610cb0578063f64f721514610ce4578063fd0c9ff114610d0457600080fd5b8063f08442e814610c5c578063f288a2e214610c7c57600080fd5b8063e27cafb914610bda578063e63ab1e914610bf1578063e6fd48bc14610c25578063e9f3c0e014610c3c57600080fd5b8063d5ebc537116100f7578063d5ebc53714610b3f578063dc5b954f14610b5f578063dd62ed3e14610b74578063e129200f14610bba57600080fd5b8063b22c63ed14610aca578063b2d52d2714610adf578063d0d96ad314610aff578063d547741f14610b1f57600080fd5b806391d14854116101bb578063a26e11861161018a578063a9059cbb1161016f578063a9059cbb14610a69578063a9d951a314610a89578063ae1f6aaf14610aa957600080fd5b8063a26e118614610a36578063a457c2d714610a4957600080fd5b806391d14854146109a857806395d89b41146109ee57806398aca92214610a03578063a217fddf14610a2157600080fd5b80638164da57116101f75780638164da571461093c5780638456cb591461095c57806390ed579b1461097157806391ca47c71461098757600080fd5b806370a082311461087b57806372599fdf146108b157806372c27b62146108d15780637beb5929146108f157600080fd5b80633bd927ba11610333578063513b5064116102c657806362680e4b11610295578063679aefce1161027a578063679aefce14610831578063687b0a11146108465780636a648e6e1461085b57600080fd5b806362680e4b146107fa578063662859671461081157600080fd5b8063513b50641461078c578063530b97a41461079f57806354d1d5e4146107bf5780635c975abb146107df57600080fd5b80633e6968b6116103025780633e6968b61461072d5780633f4ba83a1461074257806345f22d2b146107575780634bf02a531461077757600080fd5b80633bd927ba146106985780633cb747bf146106b85780633d36d971146106d95780633d75e451146106f957600080fd5b806324a9d853116103c65780632fd9470f1161039557806336568abe1161037a57806336568abe14610638578063385fbf0314610658578063395093511461067857600080fd5b80632fd9470f146105fc578063313ce5671461061c57600080fd5b806324a9d8531461057457806329c6e0ec1461058a5780632c0f0fd0146105bc5780632f2ff15d146105dc57600080fd5b8063164e68de11610402578063164e68de146104e357806318160ddd1461050557806323b872dd14610524578063248a9ca31461054457600080fd5b806301ffc9a71461043457806306fdde0314610469578063095ea7b31461048b5780631092ca9e146104ab575b600080fd5b34801561044057600080fd5b5061045461044f366004613bd4565b610d1b565b60405190151581526020015b60405180910390f35b34801561047557600080fd5b5061047e610db4565b6040516104609190613c66565b34801561049757600080fd5b506104546104a6366004613c95565b610e46565b3480156104b757600080fd5b5060ff546104cb906001600160a01b031681565b6040516001600160a01b039091168152602001610460565b3480156104ef57600080fd5b506105036104fe366004613cbf565b610e5e565b005b34801561051157600080fd5b506035545b604051908152602001610460565b34801561053057600080fd5b5061045461053f366004613cda565b610f68565b34801561055057600080fd5b5061051661055f366004613d17565b60009081526097602052604090206001015490565b34801561058057600080fd5b5061051660fc5481565b34801561059657600080fd5b5061010154610102546105a7919082565b60408051928352602083019190915201610460565b3480156105c857600080fd5b506105036105d7366004613c95565b610f8c565b3480156105e857600080fd5b506105036105f7366004613d30565b6112b9565b34801561060857600080fd5b50610503610617366004613cbf565b6112e3565b34801561062857600080fd5b5060405160128152602001610460565b34801561064457600080fd5b50610503610653366004613d30565b61137a565b34801561066457600080fd5b50610503610673366004613d70565b611407565b34801561068457600080fd5b50610454610693366004613c95565b6114ef565b3480156106a457600080fd5b506105166106b3366004613d8b565b61152e565b3480156106c457600080fd5b50610109546104cb906001600160a01b031681565b3480156106e557600080fd5b506105036106f4366004613cbf565b61169e565b34801561070557600080fd5b506105167fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a881565b34801561073957600080fd5b5061051661172d565b34801561074e57600080fd5b50610503611751565b34801561076357600080fd5b50610503610772366004613dad565b6117db565b34801561078357600080fd5b50610516611962565b61050361079a366004613df0565b611992565b3480156107ab57600080fd5b506105036107ba366004613e1c565b611c5d565b3480156107cb57600080fd5b5060fe546104cb906001600160a01b031681565b3480156107eb57600080fd5b50610103546104549060ff1681565b34801561080657600080fd5b506105166101045481565b34801561081d57600080fd5b5061050361082c366004613cbf565b611eb1565b34801561083d57600080fd5b50610516611f40565b34801561085257600080fd5b50610503611fc7565b34801561086757600080fd5b50610516610876366004613d17565b612023565b34801561088757600080fd5b50610516610896366004613cbf565b6001600160a01b031660009081526033602052604090205490565b3480156108bd57600080fd5b506105166108cc366004613d8b565b61208e565b3480156108dd57600080fd5b506105036108ec366004613d17565b6120ec565b3480156108fd57600080fd5b50610100546109279074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610460565b34801561094857600080fd5b50610503610957366004613d17565b612168565b34801561096857600080fd5b5061050361233a565b34801561097d57600080fd5b5061051660fd5481565b34801561099357600080fd5b50610100546104cb906001600160a01b031681565b3480156109b457600080fd5b506104546109c3366004613d30565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156109fa57600080fd5b5061047e6123e0565b348015610a0f57600080fd5b5060ff546001600160a01b0316610516565b348015610a2d57600080fd5b50610516600081565b610503610a44366004613ec1565b6123ef565b348015610a5557600080fd5b50610454610a64366004613c95565b61263e565b348015610a7557600080fd5b50610454610a84366004613c95565b6126e8565b348015610a9557600080fd5b50610503610aa4366004613f5b565b6126f6565b348015610ab557600080fd5b50610108546104cb906001600160a01b031681565b348015610ad657600080fd5b506105166128ad565b348015610aeb57600080fd5b50610503610afa366004613d17565b6128bd565b348015610b0b57600080fd5b50610503610b1a366004613d70565b612938565b348015610b2b57600080fd5b50610503610b3a366004613d30565b612a70565b348015610b4b57600080fd5b50610503610b5a366004613d8b565b612a95565b348015610b6b57600080fd5b50610516612c05565b348015610b8057600080fd5b50610516610b8f366004613f5b565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b348015610bc657600080fd5b5060fb546104cb906001600160a01b031681565b348015610be657600080fd5b506105166101065481565b348015610bfd57600080fd5b506105167f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b348015610c3157600080fd5b506105166101075481565b348015610c4857600080fd5b50610503610c57366004613cbf565b612c3c565b348015610c6857600080fd5b50610503610c77366004613cbf565b612cca565b348015610c8857600080fd5b506105167ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f0581565b348015610cbc57600080fd5b506105167f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92981565b348015610cf057600080fd5b506105a7610cff366004613d17565b612d58565b348015610d1057600080fd5b506105166101055481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610dae57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b606060368054610dc390613f85565b80601f0160208091040260200160405190810160405280929190818152602001828054610def90613f85565b8015610e3c5780601f10610e1157610100808354040283529160200191610e3c565b820191906000526020600020905b815481529060010190602001808311610e1f57829003601f168201915b5050505050905090565b600033610e54818585612db8565b5060019392505050565b610e66612f10565b7fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a8610e9081612f69565b60fd80546000918290556040519091906001600160a01b0385169083908381818185875af1925050503d8060008114610ee5576040519150601f19603f3d011682016040523d82523d6000602084013e610eea565b606091505b5050905080610f25576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040518281527f9800e6f57aeb4360eaa72295a820a4293e1e66fbfcabcd8874ae141304a76deb9060200160405180910390a1505050610f65600160c955565b50565b600033610f76858285612f7a565b610f8185858561300c565b506001949350505050565b610f94612f10565b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929610fbe81612f69565b610fc783613200565b60fb546040517fe744092e0000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015290911690819063e744092e90602401602060405180830381865afa15801561102c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110509190613fbf565b611086576040517f3d62a5ed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b826000036110c0576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f6d47a8af0000000000000000000000000000000000000000000000000000000081526001600160a01b038581166004830152821690636d47a8af90602401602060405180830381865afa15801561111f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111439190613fe1565b83111561117c576040517f2d18571a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061118784612023565b905061119e6001600160a01b038616338487613240565b806111a76128ad565b10156111df576040517ffd2a43b300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604051600090339083908381818185875af1925050503d8060008114611221576040519150601f19603f3d011682016040523d82523d6000602084013e611226565b606091505b5050905080611261576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051868152602081018490526001600160a01b0388169133917fc88d3cb9d2245978f77db2a015d4d9964aee2e1a40c11c48e327244295eb95c6910160405180910390a3505050506112b5600160c955565b5050565b6000828152609760205260409020600101546112d481612f69565b6112de83836132c8565b505050565b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f0561130d81612f69565b61131682613200565b610100805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556040519081527f6f7f6cd6f9a78fedb0b8576aec8d9936dd568a97a7bee04c04b6def8ecf94246906020015b60405180910390a15050565b6001600160a01b03811633146113fd5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6112b5828261336a565b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f0561143181612f69565b8163ffffffff16600003611471576040517fad37f3b200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61010080547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8516908102919091179091556040519081527f6a0069e448e7997547087b602ba66a8d345228f37044caf804c15c364cef85749060200161136e565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190610e549082908690611529908790614010565b612db8565b60008282118061153c575081155b15611573576040517f9c68554f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160e081019091526101005463ffffffff74010000000000000000000000000000000000000000909104168152600090602081016115bc60ff546001600160a01b031690565b81526020808201879052604080830187905280518083018252600080825260608501919091528151808401835281815260808501528151928301825280835260a0909301919091526101005490517f3b6f743b00000000000000000000000000000000000000000000000000000000815292935090916001600160a01b0390911690633b6f743b9061165490859085906004016140a2565b6040805180830381865afa158015611670573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116949190614115565b5195945050505050565b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f056116c881612f69565b6116d182613200565b610108805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556040519081527f89cc8b78d1d756d0d3e4ddfaa8c2d6e34e6411d44747977490a6adbba56a295e9060200161136e565b60006201518061010754426117429190614131565b61174c9190614144565b905090565b600061175c81612f69565b6101035460ff16611799576040517fdcdde9dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610103805460ff191690556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a150565b600054600290610100900460ff161580156117fd575060005460ff8083169116105b61186f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016113f4565b6000805461ffff191660ff83161761010017815561188c81612f69565b61189585613200565b61189e84613200565b5060ff805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386811691909117825561010080549186167fffffffffffffffff000000000000000000000000000000000000000000000000909216919091177401000000000000000000000000000000000000000063ffffffff8616021790556000805461ff001916905560405190821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050565b600061196c61172d565b611977906001614010565b6119849062015180614166565b6101075461174c9190614010565b61199a612f10565b7fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a86119c481612f69565b836119cd6128ad565b1015611a05576040517fbbb20aae00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83831180611a11575082155b15611a48576040517f9c68554f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81341015611a82576040517f9c92bdfb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160e081019091526101005463ffffffff7401000000000000000000000000000000000000000090910416815260009060208101611acb60ff546001600160a01b031690565b81526020808201889052604080830188905280518083018252600080825260608501919091528151808401835281815260808501528151808401835281815260a0909401939093528051808201909152868152908101829052610100549293509181906001600160a01b031663c7c7f5b3611b468a89614010565b8686336040518563ffffffff1660e01b8152600401611b679392919061417d565b60c06040518083038185885af1158015611b85573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611baa91906141ba565b60408051808201825283518082526020848101805193820184905261010192909255610102929092556101005460ff548551925185517401000000000000000000000000000000000000000090930463ffffffff1683526001600160a01b039091169382019390935292830152606082015291935091507f2bfc0ed497a2253b9aa4e4a88269dcc8efa7489803743d7cfa748ec9c241c6d79060800160405180910390a150505050506112de600160c955565b600054610100900460ff1615808015611c7d5750600054600160ff909116105b80611c975750303b158015611c97575060005460ff166001145b611d095760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016113f4565b6000805460ff191660011790558015611d2c576000805461ff0019166101001790555b611d3584613200565b611d3e82613200565b611db26040518060400160405280600581526020017f72734554480000000000000000000000000000000000000000000000000000008152506040518060400160405280600581526020017f72734554480000000000000000000000000000000000000000000000000000008152506133ed565b611dba613474565b611dc26134f3565b611dcd6000876132c8565b611df77fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a887613578565b611e217fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a886613578565b60fb80546001600160a01b0380871673ffffffffffffffffffffffffffffffffffffffff199283161790925560fc85905560fe8054928516929091169190911790558015611ea9576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f05611edb81612f69565b611ee482613200565b610109805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556040519081527faf53bfd91676a5f7c3d8a2bcd6a9df83b50bde13a00670e3db6a6cefa04823bc9060200161136e565b60fe54604080517f679aefce00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163679aefce9160048083019260209291908290030181865afa158015611fa3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174c9190613fe1565b7fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a8611ff181612f69565b6040517fc2d7f81300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008061202e611f40565b90508060000361206a576040517fe2ec750300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b670de0b6b3a764000061207d8285614166565b6120879190614144565b9392505050565b600060648211156120cb576040517fc31c0b6e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6127106120d88385614166565b6120e29190614144565b6120879084614131565b60006120f781612f69565b6103e8821115612133576040517f52338c8000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60fc8290556040518281527f4f78c4ceb393a616bbd264a4584a9ad15d722042ce1e135e6a8380217f5cb42b9060200161136e565b612170612f10565b7fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a861219a81612f69565b610108546121b0906001600160a01b0316613200565b610109546121c6906001600160a01b0316613200565b60ff546121db906001600160a01b0316613200565b81600003612215576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061221f6128ad565b90508083111561225b576040517fbbb20aae00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610109546101085460ff546040517f3cb1665a0000000000000000000000000000000000000000000000000000000081526001600160a01b039283166004820152908216602482015260448101869052911690633cb1665a9085906064016000604051808303818588803b1580156122d257600080fd5b505af11580156122e6573d6000803e3d6000fd5b505060ff546040518781526001600160a01b0390911693507f12aba247ace0f7647709010832c60c00d18dc6f13457365d372e1dc0e660c1b89250602001905060405180910390a25050610f65600160c955565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a61236481612f69565b6101035460ff16156123a2576040517fab35696f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610103805460ff191660011790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258906020016117d0565b606060378054610dc390613f85565b6123f7612f10565b6101035460ff1615612435576040517fab35696f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3461010754421015612473576040517fa5b2ac7800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061247e82612d58565b509050600061248b61172d565b9050610106548111156124a5576101068190556000610105555b6101045482610105546124b89190614010565b11156124f0576040517f4888a9d000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8161010560008282546125039190614010565b909155503490506000819003612545576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008061255183612d58565b915091508060fd60008282546125679190614010565b909155505060fb546040517f40c10f19000000000000000000000000000000000000000000000000000000008152336004820152602481018490526001600160a01b03909116906340c10f1990604401600060405180830381600087803b1580156125d157600080fd5b505af11580156125e5573d6000803e3d6000fd5b50505050336001600160a01b03167f6fc20b1cf8f9d1126dbd5964e2517cd71083acf40aed30fb6e0c4850d251c94f83838a60405161262693929190614248565b60405180910390a2505050505050610f65600160c955565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190838110156126db5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016113f4565b610f818286868403612db8565b600033610e5481858561300c565b600054600590610100900460ff16158015612718575060005460ff8083169116105b61278a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016113f4565b6000805461ffff191660ff8316176101001781556127a781612f69565b6127b084613200565b6127b983613200565b61010880546001600160a01b0386811673ffffffffffffffffffffffffffffffffffffffff1992831681179093556101098054918716919092161790556040519081527f89cc8b78d1d756d0d3e4ddfaa8c2d6e34e6411d44747977490a6adbba56a295e9060200160405180910390a16040516001600160a01b03841681527faf53bfd91676a5f7c3d8a2bcd6a9df83b50bde13a00670e3db6a6cefa04823bc9060200160405180910390a1506000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a1505050565b600060fd544761174c9190614131565b60006128c881612f69565b81600003612902576040517ff6471bcc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101048290556040518281527fd3450cfe4bfe879ec69b0a93239482844018e6ae06a421fa83820a3a19e144199060200161136e565b600054600390610100900460ff1615801561295a575060005460ff8083169116105b6129cc5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016113f4565b6000805461ffff191660ff8316176101001781556129e981612f69565b5061010080547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8516021790556000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200161136e565b600082815260976020526040902060010154612a8b81612f69565b6112de838361336a565b600054600490610100900460ff16158015612ab7575060005460ff8083169116105b612b295760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016113f4565b6000805461ffff191660ff831617610100178155612b4681612f69565b83600003612b80576040517ff6471bcc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82421115612bba576040517ffebd12a000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506101048390556101078290556000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020016128a0565b60008061010654612c1461172d565b11612c225761010554612c25565b60005b90508061010454612c369190614131565b91505090565b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f05612c6681612f69565b612c6f82613200565b60ff805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556040519081527f57f23006f7da44c512e8442994ab51a9ebf42c1d21203a72a968013665be22ad9060200161136e565b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f05612cf481612f69565b612cfd82613200565b60fe805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556040519081527f3f32684a32a11dabdbb8c0177de80aa3ae36a004d75210335b49e544e48cd0aa9060200161136e565b60008061271060fc5484612d6c9190614166565b612d769190614144565b90506000612d848285614131565b90506000612d90611f40565b905080612da583670de0b6b3a7640000614166565b612daf9190614144565b93505050915091565b6001600160a01b038316612e335760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016113f4565b6001600160a01b038216612eaf5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016113f4565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600260c95403612f625760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016113f4565b600260c955565b610f658133613582565b600160c955565b6001600160a01b0383811660009081526034602090815260408083209386168352929052205460001981146130065781811015612ff95760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016113f4565b6130068484848403612db8565b50505050565b6001600160a01b0383166130885760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016113f4565b6001600160a01b0382166131045760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016113f4565b6001600160a01b038316600090815260336020526040902054818110156131935760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016113f4565b6001600160a01b0380851660008181526033602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906131f39086815260200190565b60405180910390a3613006565b6001600160a01b038116610f65576040517f8579befe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790526130069085906135f7565b60008281526097602090815260408083206001600160a01b038516845290915290205460ff166112b55760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556133263390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526097602090815260408083206001600160a01b038516845290915290205460ff16156112b55760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600054610100900460ff1661346a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016113f4565b6112b582826136df565b600054610100900460ff166134f15760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016113f4565b565b600054610100900460ff166135705760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016113f4565b6134f1613775565b6112b582826132c8565b60008281526097602090815260408083206001600160a01b038516845290915290205460ff166112b5576135b5816137f2565b6135c0836020613804565b6040516020016135d1929190614267565b60408051601f198184030181529082905262461bcd60e51b82526113f491600401613c66565b600061364c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613a2d9092919063ffffffff16565b905080516000148061366d57508080602001905181019061366d9190613fbf565b6112de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016113f4565b600054610100900460ff1661375c5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016113f4565b60366137688382614336565b5060376112de8282614336565b600054610100900460ff16612f735760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016113f4565b6060610dae6001600160a01b03831660145b60606000613813836002614166565b61381e906002614010565b67ffffffffffffffff81111561383657613836613e7a565b6040519080825280601f01601f191660200182016040528015613860576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613897576138976143f5565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106138fa576138fa6143f5565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000613936846002614166565b613941906001614010565b90505b60018111156139de577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613982576139826143f5565b1a60f81b828281518110613998576139986143f5565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936139d78161440b565b9050613944565b5083156120875760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016113f4565b6060613a3c8484600085613a44565b949350505050565b606082471015613abc5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016113f4565b600080866001600160a01b03168587604051613ad89190614422565b60006040518083038185875af1925050503d8060008114613b15576040519150601f19603f3d011682016040523d82523d6000602084013e613b1a565b606091505b5091509150613b2b87838387613b36565b979650505050505050565b60608315613ba5578251600003613b9e576001600160a01b0385163b613b9e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016113f4565b5081613a3c565b613a3c8383815115613bba5781518083602001fd5b8060405162461bcd60e51b81526004016113f49190613c66565b600060208284031215613be657600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461208757600080fd5b60005b83811015613c31578181015183820152602001613c19565b50506000910152565b60008151808452613c52816020860160208601613c16565b601f01601f19169290920160200192915050565b6020815260006120876020830184613c3a565b80356001600160a01b0381168114613c9057600080fd5b919050565b60008060408385031215613ca857600080fd5b613cb183613c79565b946020939093013593505050565b600060208284031215613cd157600080fd5b61208782613c79565b600080600060608486031215613cef57600080fd5b613cf884613c79565b9250613d0660208501613c79565b929592945050506040919091013590565b600060208284031215613d2957600080fd5b5035919050565b60008060408385031215613d4357600080fd5b82359150613d5360208401613c79565b90509250929050565b803563ffffffff81168114613c9057600080fd5b600060208284031215613d8257600080fd5b61208782613d5c565b60008060408385031215613d9e57600080fd5b50508035926020909101359150565b600080600060608486031215613dc257600080fd5b613dcb84613c79565b9250613dd960208501613c79565b9150613de760408501613d5c565b90509250925092565b600080600060608486031215613e0557600080fd5b505081359360208301359350604090920135919050565b600080600080600060a08688031215613e3457600080fd5b613e3d86613c79565b9450613e4b60208701613c79565b9350613e5960408701613c79565b925060608601359150613e6e60808701613c79565b90509295509295909350565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613eb957613eb9613e7a565b604052919050565b600060208284031215613ed357600080fd5b813567ffffffffffffffff811115613eea57600080fd5b8201601f81018413613efb57600080fd5b803567ffffffffffffffff811115613f1557613f15613e7a565b613f286020601f19601f84011601613e90565b818152856020838501011115613f3d57600080fd5b81602084016020830137600091810160200191909152949350505050565b60008060408385031215613f6e57600080fd5b613f7783613c79565b9150613d5360208401613c79565b600181811c90821680613f9957607f821691505b602082108103613fb957634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215613fd157600080fd5b8151801515811461208757600080fd5b600060208284031215613ff357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610dae57610dae613ffa565b63ffffffff81511682526020810151602083015260408101516040830152606081015160608301526000608082015160e0608085015261406660e0850182613c3a565b905060a083015184820360a086015261407f8282613c3a565b91505060c083015184820360c08601526140998282613c3a565b95945050505050565b6040815260006140b56040830185614023565b905082151560208301529392505050565b6000604082840312156140d857600080fd5b6040805190810167ffffffffffffffff811182821017156140fb576140fb613e7a565b604052825181526020928301519281019290925250919050565b60006040828403121561412757600080fd5b61208783836140c6565b81810381811115610dae57610dae613ffa565b60008261416157634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610dae57610dae613ffa565b6080815260006141906080830186614023565b905083516020830152602084015160408301526001600160a01b0383166060830152949350505050565b60008082840360c08112156141ce57600080fd5b60808112156141dc57600080fd5b506040516060810167ffffffffffffffff8111828210171561420057614200613e7a565b60405283518152602084015167ffffffffffffffff8116811461422257600080fd5b602082015261423485604086016140c6565b60408201529150613d5384608085016140c6565b8381528260208201526060604082015260006140996060830184613c3a565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161429f816017850160208801613c16565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516142dc816028840160208801613c16565b01602801949350505050565b601f8211156112de57806000526020600020601f840160051c8101602085101561430f5750805b601f840160051c820191505b8181101561432f576000815560010161431b565b5050505050565b815167ffffffffffffffff81111561435057614350613e7a565b6143648161435e8454613f85565b846142e8565b6020601f82116001811461439857600083156143805750848201515b600019600385901b1c1916600184901b17845561432f565b600084815260208120601f198516915b828110156143c857878501518255602094850194600190920191016143a8565b50848210156143e65786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b60008161441a5761441a613ffa565b506000190190565b60008251614434818460208701613c16565b919091019291505056fea2646970667358221220f5202783ecf6165b5a0cbcbca57204d5e7ad3000f93b7a1aad1b40f6ab738b7364736f6c634300081b0033
Deployed Bytecode
0x60806040526004361061042f5760003560e01c806370a0823111610228578063b22c63ed11610128578063e27cafb9116100bb578063f08442e81161008a578063f5b541a61161006f578063f5b541a614610cb0578063f64f721514610ce4578063fd0c9ff114610d0457600080fd5b8063f08442e814610c5c578063f288a2e214610c7c57600080fd5b8063e27cafb914610bda578063e63ab1e914610bf1578063e6fd48bc14610c25578063e9f3c0e014610c3c57600080fd5b8063d5ebc537116100f7578063d5ebc53714610b3f578063dc5b954f14610b5f578063dd62ed3e14610b74578063e129200f14610bba57600080fd5b8063b22c63ed14610aca578063b2d52d2714610adf578063d0d96ad314610aff578063d547741f14610b1f57600080fd5b806391d14854116101bb578063a26e11861161018a578063a9059cbb1161016f578063a9059cbb14610a69578063a9d951a314610a89578063ae1f6aaf14610aa957600080fd5b8063a26e118614610a36578063a457c2d714610a4957600080fd5b806391d14854146109a857806395d89b41146109ee57806398aca92214610a03578063a217fddf14610a2157600080fd5b80638164da57116101f75780638164da571461093c5780638456cb591461095c57806390ed579b1461097157806391ca47c71461098757600080fd5b806370a082311461087b57806372599fdf146108b157806372c27b62146108d15780637beb5929146108f157600080fd5b80633bd927ba11610333578063513b5064116102c657806362680e4b11610295578063679aefce1161027a578063679aefce14610831578063687b0a11146108465780636a648e6e1461085b57600080fd5b806362680e4b146107fa578063662859671461081157600080fd5b8063513b50641461078c578063530b97a41461079f57806354d1d5e4146107bf5780635c975abb146107df57600080fd5b80633e6968b6116103025780633e6968b61461072d5780633f4ba83a1461074257806345f22d2b146107575780634bf02a531461077757600080fd5b80633bd927ba146106985780633cb747bf146106b85780633d36d971146106d95780633d75e451146106f957600080fd5b806324a9d853116103c65780632fd9470f1161039557806336568abe1161037a57806336568abe14610638578063385fbf0314610658578063395093511461067857600080fd5b80632fd9470f146105fc578063313ce5671461061c57600080fd5b806324a9d8531461057457806329c6e0ec1461058a5780632c0f0fd0146105bc5780632f2ff15d146105dc57600080fd5b8063164e68de11610402578063164e68de146104e357806318160ddd1461050557806323b872dd14610524578063248a9ca31461054457600080fd5b806301ffc9a71461043457806306fdde0314610469578063095ea7b31461048b5780631092ca9e146104ab575b600080fd5b34801561044057600080fd5b5061045461044f366004613bd4565b610d1b565b60405190151581526020015b60405180910390f35b34801561047557600080fd5b5061047e610db4565b6040516104609190613c66565b34801561049757600080fd5b506104546104a6366004613c95565b610e46565b3480156104b757600080fd5b5060ff546104cb906001600160a01b031681565b6040516001600160a01b039091168152602001610460565b3480156104ef57600080fd5b506105036104fe366004613cbf565b610e5e565b005b34801561051157600080fd5b506035545b604051908152602001610460565b34801561053057600080fd5b5061045461053f366004613cda565b610f68565b34801561055057600080fd5b5061051661055f366004613d17565b60009081526097602052604090206001015490565b34801561058057600080fd5b5061051660fc5481565b34801561059657600080fd5b5061010154610102546105a7919082565b60408051928352602083019190915201610460565b3480156105c857600080fd5b506105036105d7366004613c95565b610f8c565b3480156105e857600080fd5b506105036105f7366004613d30565b6112b9565b34801561060857600080fd5b50610503610617366004613cbf565b6112e3565b34801561062857600080fd5b5060405160128152602001610460565b34801561064457600080fd5b50610503610653366004613d30565b61137a565b34801561066457600080fd5b50610503610673366004613d70565b611407565b34801561068457600080fd5b50610454610693366004613c95565b6114ef565b3480156106a457600080fd5b506105166106b3366004613d8b565b61152e565b3480156106c457600080fd5b50610109546104cb906001600160a01b031681565b3480156106e557600080fd5b506105036106f4366004613cbf565b61169e565b34801561070557600080fd5b506105167fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a881565b34801561073957600080fd5b5061051661172d565b34801561074e57600080fd5b50610503611751565b34801561076357600080fd5b50610503610772366004613dad565b6117db565b34801561078357600080fd5b50610516611962565b61050361079a366004613df0565b611992565b3480156107ab57600080fd5b506105036107ba366004613e1c565b611c5d565b3480156107cb57600080fd5b5060fe546104cb906001600160a01b031681565b3480156107eb57600080fd5b50610103546104549060ff1681565b34801561080657600080fd5b506105166101045481565b34801561081d57600080fd5b5061050361082c366004613cbf565b611eb1565b34801561083d57600080fd5b50610516611f40565b34801561085257600080fd5b50610503611fc7565b34801561086757600080fd5b50610516610876366004613d17565b612023565b34801561088757600080fd5b50610516610896366004613cbf565b6001600160a01b031660009081526033602052604090205490565b3480156108bd57600080fd5b506105166108cc366004613d8b565b61208e565b3480156108dd57600080fd5b506105036108ec366004613d17565b6120ec565b3480156108fd57600080fd5b50610100546109279074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610460565b34801561094857600080fd5b50610503610957366004613d17565b612168565b34801561096857600080fd5b5061050361233a565b34801561097d57600080fd5b5061051660fd5481565b34801561099357600080fd5b50610100546104cb906001600160a01b031681565b3480156109b457600080fd5b506104546109c3366004613d30565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156109fa57600080fd5b5061047e6123e0565b348015610a0f57600080fd5b5060ff546001600160a01b0316610516565b348015610a2d57600080fd5b50610516600081565b610503610a44366004613ec1565b6123ef565b348015610a5557600080fd5b50610454610a64366004613c95565b61263e565b348015610a7557600080fd5b50610454610a84366004613c95565b6126e8565b348015610a9557600080fd5b50610503610aa4366004613f5b565b6126f6565b348015610ab557600080fd5b50610108546104cb906001600160a01b031681565b348015610ad657600080fd5b506105166128ad565b348015610aeb57600080fd5b50610503610afa366004613d17565b6128bd565b348015610b0b57600080fd5b50610503610b1a366004613d70565b612938565b348015610b2b57600080fd5b50610503610b3a366004613d30565b612a70565b348015610b4b57600080fd5b50610503610b5a366004613d8b565b612a95565b348015610b6b57600080fd5b50610516612c05565b348015610b8057600080fd5b50610516610b8f366004613f5b565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b348015610bc657600080fd5b5060fb546104cb906001600160a01b031681565b348015610be657600080fd5b506105166101065481565b348015610bfd57600080fd5b506105167f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b348015610c3157600080fd5b506105166101075481565b348015610c4857600080fd5b50610503610c57366004613cbf565b612c3c565b348015610c6857600080fd5b50610503610c77366004613cbf565b612cca565b348015610c8857600080fd5b506105167ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f0581565b348015610cbc57600080fd5b506105167f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92981565b348015610cf057600080fd5b506105a7610cff366004613d17565b612d58565b348015610d1057600080fd5b506105166101055481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610dae57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b606060368054610dc390613f85565b80601f0160208091040260200160405190810160405280929190818152602001828054610def90613f85565b8015610e3c5780601f10610e1157610100808354040283529160200191610e3c565b820191906000526020600020905b815481529060010190602001808311610e1f57829003601f168201915b5050505050905090565b600033610e54818585612db8565b5060019392505050565b610e66612f10565b7fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a8610e9081612f69565b60fd80546000918290556040519091906001600160a01b0385169083908381818185875af1925050503d8060008114610ee5576040519150601f19603f3d011682016040523d82523d6000602084013e610eea565b606091505b5050905080610f25576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040518281527f9800e6f57aeb4360eaa72295a820a4293e1e66fbfcabcd8874ae141304a76deb9060200160405180910390a1505050610f65600160c955565b50565b600033610f76858285612f7a565b610f8185858561300c565b506001949350505050565b610f94612f10565b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929610fbe81612f69565b610fc783613200565b60fb546040517fe744092e0000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015290911690819063e744092e90602401602060405180830381865afa15801561102c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110509190613fbf565b611086576040517f3d62a5ed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b826000036110c0576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f6d47a8af0000000000000000000000000000000000000000000000000000000081526001600160a01b038581166004830152821690636d47a8af90602401602060405180830381865afa15801561111f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111439190613fe1565b83111561117c576040517f2d18571a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061118784612023565b905061119e6001600160a01b038616338487613240565b806111a76128ad565b10156111df576040517ffd2a43b300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604051600090339083908381818185875af1925050503d8060008114611221576040519150601f19603f3d011682016040523d82523d6000602084013e611226565b606091505b5050905080611261576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051868152602081018490526001600160a01b0388169133917fc88d3cb9d2245978f77db2a015d4d9964aee2e1a40c11c48e327244295eb95c6910160405180910390a3505050506112b5600160c955565b5050565b6000828152609760205260409020600101546112d481612f69565b6112de83836132c8565b505050565b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f0561130d81612f69565b61131682613200565b610100805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556040519081527f6f7f6cd6f9a78fedb0b8576aec8d9936dd568a97a7bee04c04b6def8ecf94246906020015b60405180910390a15050565b6001600160a01b03811633146113fd5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6112b5828261336a565b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f0561143181612f69565b8163ffffffff16600003611471576040517fad37f3b200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61010080547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8516908102919091179091556040519081527f6a0069e448e7997547087b602ba66a8d345228f37044caf804c15c364cef85749060200161136e565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190610e549082908690611529908790614010565b612db8565b60008282118061153c575081155b15611573576040517f9c68554f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160e081019091526101005463ffffffff74010000000000000000000000000000000000000000909104168152600090602081016115bc60ff546001600160a01b031690565b81526020808201879052604080830187905280518083018252600080825260608501919091528151808401835281815260808501528151928301825280835260a0909301919091526101005490517f3b6f743b00000000000000000000000000000000000000000000000000000000815292935090916001600160a01b0390911690633b6f743b9061165490859085906004016140a2565b6040805180830381865afa158015611670573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116949190614115565b5195945050505050565b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f056116c881612f69565b6116d182613200565b610108805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556040519081527f89cc8b78d1d756d0d3e4ddfaa8c2d6e34e6411d44747977490a6adbba56a295e9060200161136e565b60006201518061010754426117429190614131565b61174c9190614144565b905090565b600061175c81612f69565b6101035460ff16611799576040517fdcdde9dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610103805460ff191690556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a150565b600054600290610100900460ff161580156117fd575060005460ff8083169116105b61186f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016113f4565b6000805461ffff191660ff83161761010017815561188c81612f69565b61189585613200565b61189e84613200565b5060ff805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386811691909117825561010080549186167fffffffffffffffff000000000000000000000000000000000000000000000000909216919091177401000000000000000000000000000000000000000063ffffffff8616021790556000805461ff001916905560405190821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050565b600061196c61172d565b611977906001614010565b6119849062015180614166565b6101075461174c9190614010565b61199a612f10565b7fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a86119c481612f69565b836119cd6128ad565b1015611a05576040517fbbb20aae00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83831180611a11575082155b15611a48576040517f9c68554f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81341015611a82576040517f9c92bdfb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160e081019091526101005463ffffffff7401000000000000000000000000000000000000000090910416815260009060208101611acb60ff546001600160a01b031690565b81526020808201889052604080830188905280518083018252600080825260608501919091528151808401835281815260808501528151808401835281815260a0909401939093528051808201909152868152908101829052610100549293509181906001600160a01b031663c7c7f5b3611b468a89614010565b8686336040518563ffffffff1660e01b8152600401611b679392919061417d565b60c06040518083038185885af1158015611b85573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611baa91906141ba565b60408051808201825283518082526020848101805193820184905261010192909255610102929092556101005460ff548551925185517401000000000000000000000000000000000000000090930463ffffffff1683526001600160a01b039091169382019390935292830152606082015291935091507f2bfc0ed497a2253b9aa4e4a88269dcc8efa7489803743d7cfa748ec9c241c6d79060800160405180910390a150505050506112de600160c955565b600054610100900460ff1615808015611c7d5750600054600160ff909116105b80611c975750303b158015611c97575060005460ff166001145b611d095760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016113f4565b6000805460ff191660011790558015611d2c576000805461ff0019166101001790555b611d3584613200565b611d3e82613200565b611db26040518060400160405280600581526020017f72734554480000000000000000000000000000000000000000000000000000008152506040518060400160405280600581526020017f72734554480000000000000000000000000000000000000000000000000000008152506133ed565b611dba613474565b611dc26134f3565b611dcd6000876132c8565b611df77fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a887613578565b611e217fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a886613578565b60fb80546001600160a01b0380871673ffffffffffffffffffffffffffffffffffffffff199283161790925560fc85905560fe8054928516929091169190911790558015611ea9576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f05611edb81612f69565b611ee482613200565b610109805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556040519081527faf53bfd91676a5f7c3d8a2bcd6a9df83b50bde13a00670e3db6a6cefa04823bc9060200161136e565b60fe54604080517f679aefce00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163679aefce9160048083019260209291908290030181865afa158015611fa3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174c9190613fe1565b7fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a8611ff181612f69565b6040517fc2d7f81300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008061202e611f40565b90508060000361206a576040517fe2ec750300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b670de0b6b3a764000061207d8285614166565b6120879190614144565b9392505050565b600060648211156120cb576040517fc31c0b6e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6127106120d88385614166565b6120e29190614144565b6120879084614131565b60006120f781612f69565b6103e8821115612133576040517f52338c8000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60fc8290556040518281527f4f78c4ceb393a616bbd264a4584a9ad15d722042ce1e135e6a8380217f5cb42b9060200161136e565b612170612f10565b7fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a861219a81612f69565b610108546121b0906001600160a01b0316613200565b610109546121c6906001600160a01b0316613200565b60ff546121db906001600160a01b0316613200565b81600003612215576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061221f6128ad565b90508083111561225b576040517fbbb20aae00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610109546101085460ff546040517f3cb1665a0000000000000000000000000000000000000000000000000000000081526001600160a01b039283166004820152908216602482015260448101869052911690633cb1665a9085906064016000604051808303818588803b1580156122d257600080fd5b505af11580156122e6573d6000803e3d6000fd5b505060ff546040518781526001600160a01b0390911693507f12aba247ace0f7647709010832c60c00d18dc6f13457365d372e1dc0e660c1b89250602001905060405180910390a25050610f65600160c955565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a61236481612f69565b6101035460ff16156123a2576040517fab35696f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610103805460ff191660011790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258906020016117d0565b606060378054610dc390613f85565b6123f7612f10565b6101035460ff1615612435576040517fab35696f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3461010754421015612473576040517fa5b2ac7800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061247e82612d58565b509050600061248b61172d565b9050610106548111156124a5576101068190556000610105555b6101045482610105546124b89190614010565b11156124f0576040517f4888a9d000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8161010560008282546125039190614010565b909155503490506000819003612545576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008061255183612d58565b915091508060fd60008282546125679190614010565b909155505060fb546040517f40c10f19000000000000000000000000000000000000000000000000000000008152336004820152602481018490526001600160a01b03909116906340c10f1990604401600060405180830381600087803b1580156125d157600080fd5b505af11580156125e5573d6000803e3d6000fd5b50505050336001600160a01b03167f6fc20b1cf8f9d1126dbd5964e2517cd71083acf40aed30fb6e0c4850d251c94f83838a60405161262693929190614248565b60405180910390a2505050505050610f65600160c955565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190838110156126db5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016113f4565b610f818286868403612db8565b600033610e5481858561300c565b600054600590610100900460ff16158015612718575060005460ff8083169116105b61278a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016113f4565b6000805461ffff191660ff8316176101001781556127a781612f69565b6127b084613200565b6127b983613200565b61010880546001600160a01b0386811673ffffffffffffffffffffffffffffffffffffffff1992831681179093556101098054918716919092161790556040519081527f89cc8b78d1d756d0d3e4ddfaa8c2d6e34e6411d44747977490a6adbba56a295e9060200160405180910390a16040516001600160a01b03841681527faf53bfd91676a5f7c3d8a2bcd6a9df83b50bde13a00670e3db6a6cefa04823bc9060200160405180910390a1506000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a1505050565b600060fd544761174c9190614131565b60006128c881612f69565b81600003612902576040517ff6471bcc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101048290556040518281527fd3450cfe4bfe879ec69b0a93239482844018e6ae06a421fa83820a3a19e144199060200161136e565b600054600390610100900460ff1615801561295a575060005460ff8083169116105b6129cc5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016113f4565b6000805461ffff191660ff8316176101001781556129e981612f69565b5061010080547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8516021790556000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200161136e565b600082815260976020526040902060010154612a8b81612f69565b6112de838361336a565b600054600490610100900460ff16158015612ab7575060005460ff8083169116105b612b295760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016113f4565b6000805461ffff191660ff831617610100178155612b4681612f69565b83600003612b80576040517ff6471bcc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82421115612bba576040517ffebd12a000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506101048390556101078290556000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020016128a0565b60008061010654612c1461172d565b11612c225761010554612c25565b60005b90508061010454612c369190614131565b91505090565b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f05612c6681612f69565b612c6f82613200565b60ff805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556040519081527f57f23006f7da44c512e8442994ab51a9ebf42c1d21203a72a968013665be22ad9060200161136e565b7ff66846415d2bf9eabda9e84793ff9c0ea96d87f50fc41e66aa16469c6a442f05612cf481612f69565b612cfd82613200565b60fe805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091556040519081527f3f32684a32a11dabdbb8c0177de80aa3ae36a004d75210335b49e544e48cd0aa9060200161136e565b60008061271060fc5484612d6c9190614166565b612d769190614144565b90506000612d848285614131565b90506000612d90611f40565b905080612da583670de0b6b3a7640000614166565b612daf9190614144565b93505050915091565b6001600160a01b038316612e335760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016113f4565b6001600160a01b038216612eaf5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016113f4565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600260c95403612f625760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016113f4565b600260c955565b610f658133613582565b600160c955565b6001600160a01b0383811660009081526034602090815260408083209386168352929052205460001981146130065781811015612ff95760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016113f4565b6130068484848403612db8565b50505050565b6001600160a01b0383166130885760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016113f4565b6001600160a01b0382166131045760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016113f4565b6001600160a01b038316600090815260336020526040902054818110156131935760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016113f4565b6001600160a01b0380851660008181526033602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906131f39086815260200190565b60405180910390a3613006565b6001600160a01b038116610f65576040517f8579befe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790526130069085906135f7565b60008281526097602090815260408083206001600160a01b038516845290915290205460ff166112b55760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556133263390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526097602090815260408083206001600160a01b038516845290915290205460ff16156112b55760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600054610100900460ff1661346a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016113f4565b6112b582826136df565b600054610100900460ff166134f15760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016113f4565b565b600054610100900460ff166135705760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016113f4565b6134f1613775565b6112b582826132c8565b60008281526097602090815260408083206001600160a01b038516845290915290205460ff166112b5576135b5816137f2565b6135c0836020613804565b6040516020016135d1929190614267565b60408051601f198184030181529082905262461bcd60e51b82526113f491600401613c66565b600061364c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613a2d9092919063ffffffff16565b905080516000148061366d57508080602001905181019061366d9190613fbf565b6112de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016113f4565b600054610100900460ff1661375c5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016113f4565b60366137688382614336565b5060376112de8282614336565b600054610100900460ff16612f735760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016113f4565b6060610dae6001600160a01b03831660145b60606000613813836002614166565b61381e906002614010565b67ffffffffffffffff81111561383657613836613e7a565b6040519080825280601f01601f191660200182016040528015613860576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613897576138976143f5565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106138fa576138fa6143f5565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000613936846002614166565b613941906001614010565b90505b60018111156139de577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613982576139826143f5565b1a60f81b828281518110613998576139986143f5565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936139d78161440b565b9050613944565b5083156120875760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016113f4565b6060613a3c8484600085613a44565b949350505050565b606082471015613abc5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016113f4565b600080866001600160a01b03168587604051613ad89190614422565b60006040518083038185875af1925050503d8060008114613b15576040519150601f19603f3d011682016040523d82523d6000602084013e613b1a565b606091505b5091509150613b2b87838387613b36565b979650505050505050565b60608315613ba5578251600003613b9e576001600160a01b0385163b613b9e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016113f4565b5081613a3c565b613a3c8383815115613bba5781518083602001fd5b8060405162461bcd60e51b81526004016113f49190613c66565b600060208284031215613be657600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461208757600080fd5b60005b83811015613c31578181015183820152602001613c19565b50506000910152565b60008151808452613c52816020860160208601613c16565b601f01601f19169290920160200192915050565b6020815260006120876020830184613c3a565b80356001600160a01b0381168114613c9057600080fd5b919050565b60008060408385031215613ca857600080fd5b613cb183613c79565b946020939093013593505050565b600060208284031215613cd157600080fd5b61208782613c79565b600080600060608486031215613cef57600080fd5b613cf884613c79565b9250613d0660208501613c79565b929592945050506040919091013590565b600060208284031215613d2957600080fd5b5035919050565b60008060408385031215613d4357600080fd5b82359150613d5360208401613c79565b90509250929050565b803563ffffffff81168114613c9057600080fd5b600060208284031215613d8257600080fd5b61208782613d5c565b60008060408385031215613d9e57600080fd5b50508035926020909101359150565b600080600060608486031215613dc257600080fd5b613dcb84613c79565b9250613dd960208501613c79565b9150613de760408501613d5c565b90509250925092565b600080600060608486031215613e0557600080fd5b505081359360208301359350604090920135919050565b600080600080600060a08688031215613e3457600080fd5b613e3d86613c79565b9450613e4b60208701613c79565b9350613e5960408701613c79565b925060608601359150613e6e60808701613c79565b90509295509295909350565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613eb957613eb9613e7a565b604052919050565b600060208284031215613ed357600080fd5b813567ffffffffffffffff811115613eea57600080fd5b8201601f81018413613efb57600080fd5b803567ffffffffffffffff811115613f1557613f15613e7a565b613f286020601f19601f84011601613e90565b818152856020838501011115613f3d57600080fd5b81602084016020830137600091810160200191909152949350505050565b60008060408385031215613f6e57600080fd5b613f7783613c79565b9150613d5360208401613c79565b600181811c90821680613f9957607f821691505b602082108103613fb957634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215613fd157600080fd5b8151801515811461208757600080fd5b600060208284031215613ff357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610dae57610dae613ffa565b63ffffffff81511682526020810151602083015260408101516040830152606081015160608301526000608082015160e0608085015261406660e0850182613c3a565b905060a083015184820360a086015261407f8282613c3a565b91505060c083015184820360c08601526140998282613c3a565b95945050505050565b6040815260006140b56040830185614023565b905082151560208301529392505050565b6000604082840312156140d857600080fd5b6040805190810167ffffffffffffffff811182821017156140fb576140fb613e7a565b604052825181526020928301519281019290925250919050565b60006040828403121561412757600080fd5b61208783836140c6565b81810381811115610dae57610dae613ffa565b60008261416157634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610dae57610dae613ffa565b6080815260006141906080830186614023565b905083516020830152602084015160408301526001600160a01b0383166060830152949350505050565b60008082840360c08112156141ce57600080fd5b60808112156141dc57600080fd5b506040516060810167ffffffffffffffff8111828210171561420057614200613e7a565b60405283518152602084015167ffffffffffffffff8116811461422257600080fd5b602082015261423485604086016140c6565b60408201529150613d5384608085016140c6565b8381528260208201526060604082015260006140996060830184613c3a565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161429f816017850160208801613c16565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516142dc816028840160208801613c16565b01602801949350505050565b601f8211156112de57806000526020600020601f840160051c8101602085101561430f5750805b601f840160051c820191505b8181101561432f576000815560010161431b565b5050505050565b815167ffffffffffffffff81111561435057614350613e7a565b6143648161435e8454613f85565b846142e8565b6020601f82116001811461439857600083156143805750848201515b600019600385901b1c1916600184901b17845561432f565b600084815260208120601f198516915b828110156143c857878501518255602094850194600190920191016143a8565b50848210156143e65786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b60008161441a5761441a613ffa565b506000190190565b60008251614434818460208701613c16565b919091019291505056fea2646970667358221220f5202783ecf6165b5a0cbcbca57204d5e7ad3000f93b7a1aad1b40f6ab738b7364736f6c634300081b0033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
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.