Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 19615099 | 139 days ago | IN | 0 ETH | 0.10082974 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
RivusCOMAI
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.20; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { ERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import { SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./interface/IwCOMAI.sol"; import "./interface/IBridge.sol"; import "./rsCOMAI.sol"; contract RivusCOMAI is Initializable, RsCOMAI, Ownable2StepUpgradeable, ReentrancyGuardUpgradeable, AccessControlUpgradeable { using SafeERC20 for IERC20; struct UnstakeRequest { uint256 amount; uint256 comaiAmt; bool isReadyForUnstake; address wrappedToken; uint256 timestamp; } /* * set the exchange rate of wCOMAI:RivusCOMAI. * exchange rate is in 10^18 */ uint256 public exchangeRate; // 1 * 10^18 /* * How much COMAI it cost to unstake. This is to account for bridging cost from Commume to eth */ uint256 public unstakingFee; /* * How much COMAI it cost to stake. This is to account for bridging cost from eth to Commume */ uint256 public stakingFee; /* * How much COMAI it cost to bridge. */ uint256 public bridgingFee; /* * How much is needed to be staked to be able to perform staking in 1 txn */ uint256 public minStakingAmt; /* * Underlying token */ address public wrappedToken; /* * Set the max amount of wCOMAI that can be deposited at once */ uint256 public maxDepositPerRequest; /* * Total Supply Limit */ uint256 public cap; /* * Determine if the contract is paused */ bool public isPaused; /* * Commume wallet that will receive the wCOMAI after wrap() * NOTE: it must be at least 48 chars so validation shall * be done to ensure that it is true */ string public nativeWalletReceiver; /* * Set the max amount of unstake request for a given user */ uint256 public maxUnstakeRequests; /* * Mapping from address to current active UnstakeRequest[] */ mapping(address => UnstakeRequest[]) public unstakeRequests; /* * The address that can be allowed to withdraw */ address public withdrawalManager; /* * The service fee that is charged for each unstake request in ETH * This is to pay for the gas fees for the withdrawal manager */ uint256 public serviceFee; uint256 public lastRebaseTime; /* * * Defines totalSupply for RivusCOMAI * * */ uint256 public totalRsCOMAIMinted; /* * Defines both the upper bound and lower bound of the exchange rate */ uint256 public lowerExchangeRateBound; uint256 public upperExchangeRateBound; address public protocolVault; address public bridge; bytes32 public constant PAUSE_ROLE = keccak256("PAUSE_ROLE"); bytes32 public constant EXCHANGE_UPDATE_ROLE = keccak256("EXCHANGE_UPDATE_ROLE"); bytes32 public constant MANAGE_STAKING_CONFIG_ROLE = keccak256("MANAGE_STAKING_CONFIG_ROLE"); bytes32 public constant TOKEN_SAFE_PULL_ROLE = keccak256("TOKEN_SAFE_PULL_ROLE"); bytes32 public constant APPROVE_WITHDRAWAL_ROLE = keccak256("APPROVE_WITHDRAWAL_ROLE"); modifier canPauseRole() { require(hasRole(PAUSE_ROLE, msg.sender), "Caller does not have PAUSE_ROLE"); _; } modifier hasExchangeUpdateRole() { require( hasRole(EXCHANGE_UPDATE_ROLE, msg.sender), "Caller does not have EXCHANGE_UPDATE_ROLE" ); _; } modifier hasManageStakingConfigRole() { require( hasRole(MANAGE_STAKING_CONFIG_ROLE, msg.sender), "Caller does not have MANAGE_STAKING_UPDATE_ROLE" ); _; } modifier hasTokenSafePullRole() { require( hasRole(TOKEN_SAFE_PULL_ROLE, msg.sender), "Caller does not have TOKEN_SAFE_PULL_ROLE" ); _; } modifier hasApproveWithdrawalRole() { require( hasRole(APPROVE_WITHDRAWAL_ROLE, msg.sender), "Caller does not have APPROVE_WITHDRAWAL_ROLE" ); _; } struct UserRequest { address user; uint256 requestIndex; } // Declaration of all events event UserUnstakeRequested( address indexed user, uint256 idx, uint256 requestTimestamp, uint256 wstAmount, uint256 outComaiAmt, address wrappedToken ); event AdminUnstakeApproved( address indexed user, uint256 idx, uint256 approvedTimestamp ); event UserUnstake( address indexed user, uint256 idx, uint256 unstakeTimestamp ); event UserStake( address indexed user, uint256 stakeTimestamp, uint256 inComaiAmt, uint256 wstAmount ); event UpdateProtocolVault(address newProtocolVault); event UpdateServiceFee(uint256 serviceFee); event UpdateWithdrawalManager(address withdrawalManager); event UpdateMinStakingAmt(uint256 minStakingAmt); event UpdateStakingFee(uint256 stakingFee); event UpdateBridgeFee(uint256 bridgingFee); event UpdateMaxDepositPerRequest(uint256 maxDepositPerRequest); event UpdateMaxUnstakeRequest(uint256 maxUnstakeRequests); event UpdateExchangeRate(uint256 newRate); event LowerBoundUpdated(uint256 newLowerBound); event UpperBoundUpdated(uint256 newUpperBound); event ContractPaused(bool paused); event UpdateWComai(address newWCOMAI); event UpdateUnstakingFee(uint256 newUnstakingFee); event UpdateNativeCommumeReceiver(string newNativeWalletReceiver); event Mint(address indexed recipient, uint256 amount, uint256 timestamp); event Burn(address indexed provider, uint256 amount, uint256 timestamp); event ERC20TokenPulled(address tokenAddress, address to, uint256 amount); event NativeTokenPulled(address to, uint256 amount); // event Rebase(uint256 apr, uint256 totalSharesAmount, uint256 burnAmount, address excuter, uint256 timestamp); event Rebase(uint256 apr, uint256 totalRsCOMAIMinted, uint256 totalShares, uint256 mintAmoount, uint256 timestamp); /* * * In this initialization function, we initialize and * set the intiailOwner as the owner of RivusCOMAI */ function initialize( address _owner, address _wCOMAI, string memory _nativeTokenReceiver, address _protocolVault, address _bridge ) public initializer { require(_owner != address(0), "Owner cannot be null"); __Ownable_init(_owner); __AccessControl_init(); __ReentrancyGuard_init(); _setRoleAdmin(DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_ROLE); _grantRole(DEFAULT_ADMIN_ROLE, _owner); _grantRole(EXCHANGE_UPDATE_ROLE, _owner); _grantRole(MANAGE_STAKING_CONFIG_ROLE, _owner); _grantRole(APPROVE_WITHDRAWAL_ROLE, _owner); _grantRole(PAUSE_ROLE, _owner); wrappedToken = _wCOMAI; protocolVault = _protocolVault; withdrawalManager = _owner; _checkValidCommumeWallet(_nativeTokenReceiver); nativeWalletReceiver = _nativeTokenReceiver; bridgingFee = 3; // multiplier is 1000 unstakingFee = 10; // multiplier is 1000 stakingFee = 0; // multiplier is 1000 serviceFee = 0.003 ether; maxDepositPerRequest = 1_000_000 * (10 ** decimals()); minStakingAmt = 15 * (10 ** decimals()); maxUnstakeRequests = 1_000_000 * (10 ** decimals()); lowerExchangeRateBound = 0.5 ether; upperExchangeRateBound = 1.5 ether; exchangeRate = 1 ether; // 1 * 10^18 cap = 1_000_000 * (10 ** decimals()); bridge = _bridge; _transferOwnership(_owner); } function _getTotalMintedRsCOMAI() internal view override returns (uint256) { return totalRsCOMAIMinted; } /* * Common setters for the contract * */ /* * * Function to update the current ETH service fee to support gas transactions for unstaking. * * Value Boundary: serviceFee can be 0 ETH * */ function setServiceFee(uint256 _serviceFee) public hasManageStakingConfigRole { require(_serviceFee <= 0.01 ether, "Service fee cannot be more than 0.01 ETH"); serviceFee = _serviceFee; emit UpdateServiceFee(serviceFee); } /* * * Function to set the withdrawal manager address that will receive the ETH service fee * * Value boundary: withdrawalManager cannot be address(0) * */ function setWithdrawalManager(address _withdrawalManager) public hasManageStakingConfigRole { require(_withdrawalManager != address(0), "Withdrawal manager cannot be null"); withdrawalManager = _withdrawalManager; emit UpdateWithdrawalManager(withdrawalManager); } /* * * This function sets the protocol vault address that * shall be responsible for receiving the staking fees. * * Boundary: address cannot be address(0) * */ function setProtocolVault(address _protocolVault) public hasManageStakingConfigRole { require(_protocolVault != address(0), "Protocol vault cannot be null"); protocolVault = _protocolVault; emit UpdateProtocolVault(protocolVault); } /* * * This method sets the min staking amount required to perform staking * * Value Boundary: minStakingAmt can be any value even 0 in the event that minStakingAmt by comaibridge changes in the future * */ function setMinStakingAmt(uint256 _minStakingAmt) public hasManageStakingConfigRole { require(_minStakingAmt > 15 * (10 ** decimals()), "Min staking amount must be more than bridging fee"); minStakingAmt = _minStakingAmt; emit UpdateMinStakingAmt(minStakingAmt); } function updateBridge(address _bridge) public hasManageStakingConfigRole { bridge = _bridge; } /* * * Value Boundary: stakingFee can be between 0-999 (0% to 99.9%) * * 0% can be set in case stakingFee is disabled in the future. * */ function setStakingFee(uint256 _stakingFee) public hasManageStakingConfigRole { // Staking fee cannot be equivalent to 2% staking fee. Max it can go is 19 (1.9%) require(_stakingFee < 20, "Staking fee cannot be more than equal to 20"); stakingFee = _stakingFee; emit UpdateStakingFee(stakingFee); } /* * * This function sets the bridging fee that is used to bridge from eth to Commume * * Value Boundary: bridgingFee can be any value even 0 in the event that bridgingFee by comaibridge changes in the future * */ function setBridgingFee(uint256 _bridgingFee) public hasManageStakingConfigRole { require(_bridgingFee > 3, "Bridging fee should be more than 0.3%"); bridgingFee = _bridgingFee; // Assuming _bridgingFee is passed in mwei emit UpdateBridgeFee(bridgingFee); } /* * * Set the maximum number of deposit per request for a given user * * Value Boundary: maxDepositPerRequest must be more than 0 * */ function setMaxDepositPerRequest(uint256 _maxDepositPerRequest) public hasManageStakingConfigRole { require(_maxDepositPerRequest > 0, "Max deposit per request must be more than 0"); maxDepositPerRequest = _maxDepositPerRequest; emit UpdateMaxDepositPerRequest(maxDepositPerRequest); } function updateCap(uint256 _newCap) public hasManageStakingConfigRole { require(_newCap > 0, "Max deposit per request must be more than 0"); cap = _newCap; } /* * * Set maximum unstake request * * Value Boundary: maxUnstakeRequests must be more than 0 * */ function setMaxUnstakeRequest(uint256 _maxUnstakeRequests) public hasManageStakingConfigRole { require(_maxUnstakeRequests > 0, "Max unstake requests must be more than 0"); maxUnstakeRequests = _maxUnstakeRequests; emit UpdateMaxUnstakeRequest(maxUnstakeRequests); } function renounceOwnership() public override onlyOwner {} // Ensure that the lower bound is less than upper bound function setLowerExchangeRateBound(uint256 _newLowerBound) public hasExchangeUpdateRole { require(_newLowerBound > 0, "New lower bound must be more than 0"); require( _newLowerBound < upperExchangeRateBound, "New lower bound must be less than current upper bound" ); lowerExchangeRateBound = _newLowerBound; emit LowerBoundUpdated(_newLowerBound); } // Ensure that the upper bound is more than lower bound function setUpperExchangeRateBound(uint256 _newUpperBound) public hasExchangeUpdateRole { require(_newUpperBound > 0, "New upper bound must be more than 0"); require( _newUpperBound > lowerExchangeRateBound, "New upper bound must be greater than current lower bound" ); upperExchangeRateBound = _newUpperBound; emit UpperBoundUpdated(_newUpperBound); } function setPaused(bool _isPaused) public canPauseRole { isPaused = _isPaused; emit ContractPaused(isPaused); } /* * * This function determines the unstaking fee that is charged to the user * * The value is in gwei so if _unstakingFee is 1 gwei, it means 1 COMAI is charged as unstaking fee * * Value Boundary: UnstakingFee can be any value even 0 in the event that unstakingFee is not longer charged. * */ function setUnstakingFee(uint256 _unstakingFee) public hasManageStakingConfigRole { require(_unstakingFee <= 100, "Unstaking fee cannot be more than 10%"); unstakingFee = _unstakingFee; emit UpdateUnstakingFee(unstakingFee); } /* * * This function sets to wcomai address that will be used to wrap and unwrap * * Value boundary: wCOMAI cannot be address(0) * */ function setWCOMAI(address _wCOMAI) public hasManageStakingConfigRole { // Check to ensure _wCOMAI is not null _requireNonZeroAddress(_wCOMAI, "wCOMAI address cannot be null"); wrappedToken = _wCOMAI; emit UpdateWComai(_wCOMAI); } /* * Function to set the natvive token receiver. Validation performed to determine if 48 characters */ function setNativeTokenReceiver(string memory _nativeWalletReceiver) public hasManageStakingConfigRole { // Ensure it is a valid Commume wallet before updating. _checkValidCommumeWallet(_nativeWalletReceiver); nativeWalletReceiver = _nativeWalletReceiver; emit UpdateNativeCommumeReceiver(_nativeWalletReceiver); } /* * * These those methods shall help to calculate the exchange rate * of rsCOMAI given wCOMAI input and vice versa * * Note that there would be precision loss that would be rounded down * so the user will get less than expected to a precision of up to 1 wei if the rounding * down happens. * */ function getRsCOMAIbyWCOMAI(uint256 wcomaiAmount) public view returns (uint256) { return (wcomaiAmount * exchangeRate) / 1 ether; } function getWCOMAIByrsCOMAI(uint256 rsCOMAIAmount) public view returns (uint256) { return (rsCOMAIAmount * 1 ether) / exchangeRate; } function getWCOMAIByrsCOMAIAfterFee(uint256 rsCOMAIAmount) public view returns (uint256, uint256, uint256) { uint256 unstakingFeeAmt = rsCOMAIAmount * unstakingFee / 1000; uint256 bridgingFeeAmt = rsCOMAIAmount * bridgingFee / 1000; if(bridgingFeeAmt < 1 * (10 ** decimals())) bridgingFeeAmt = 1 * (10 ** decimals()); uint256 unstakingAmt = rsCOMAIAmount - bridgingFeeAmt - unstakingFeeAmt; return (unstakingAmt, bridgingFeeAmt, unstakingFeeAmt); } /* * * Here we add utility functions so that * we can perform checks using DRY principles * */ /* * * */ function _transferToVault(address from, uint256 _feeAmt) internal { if(_feeAmt > 0) { if(from == address(this)) { require( IERC20(wrappedToken).transfer(address(protocolVault), _feeAmt), "Transfer to protocol vault address failed" ); } else { require( IERC20(wrappedToken).transferFrom(from, address(protocolVault), _feeAmt), "Transfer to protocol vault address failed" ); } } } function _transferToContract(uint256 _wrapAmt) internal { if(_wrapAmt > 0) { require( IERC20(wrappedToken).transferFrom(msg.sender, address(this), _wrapAmt), "Transfer to contract address failed" ); } } // Check if the address is a non null address // @param _address The address to check // @param errorMessage The error message to display if the address is null function _requireNonZeroAddress(address _address, string memory errorMessage) internal pure { require(_address != address(0), errorMessage); } /* * * this method is used to check if the native wallet receiver is valid * Commume walllet must be 48 characters * * @param _nativeWalletReceiver The native wallet receiver to check * */ function _checkValidCommumeWallet(string memory _nativeWalletReceiver) internal pure { require( bytes(_nativeWalletReceiver).length == 48, "nativeWalletReceiver must be of length 48" ); } /* * * Mints only if the max supply is exceeded * */ // Check if the contract is paused modifier checkPaused() { require(!isPaused, "Contract is paused"); _; } /* * This function is used for users to request for unstaking * When users request for unstaking, they will need to pay a fee * The fee will be used to pay for the gas fees for the withdrawal manager * * After user successfully request for unstake, the withdrawal manage will * need to approve the request before the user can unstake * * @params rsCOMAIAmt The amount of rsCOMAI to unstake * * */ function requestUnstake(uint256 rsCOMAIAmt) public payable nonReentrant checkPaused { // Check that wrappedToken and withdrawalManager is a valid address _requireNonZeroAddress( address(wrappedToken), "wrappedToken address is invalid" ); _requireNonZeroAddress( address(withdrawalManager), "withdrawal address cannot be null" ); uint256 outWComaiAmt = getWCOMAIByrsCOMAI(rsCOMAIAmt); // Ensure that the fee amount is sufficient require(msg.value >= serviceFee, "Fee amount is not sufficient"); // Check if enough balance require(balanceOf(msg.sender) >= rsCOMAIAmt, "Insufficient rsCOMAI balance"); uint256 length = unstakeRequests[msg.sender].length; bool added = false; // Loop throught the list of existing unstake requests for (uint256 i = 0; i < length; i++) { uint256 currAmt = unstakeRequests[msg.sender][i].amount; if (currAmt > 0) { continue; } else { // If the curr amt is zero, it means // we can add the unstake request in this index unstakeRequests[msg.sender][i] = UnstakeRequest({ amount: rsCOMAIAmt, comaiAmt: outWComaiAmt, isReadyForUnstake: false, timestamp: block.timestamp, wrappedToken: wrappedToken }); added = true; emit UserUnstakeRequested( msg.sender, i, block.timestamp, rsCOMAIAmt, outWComaiAmt, wrappedToken ); break; } } // If we have not added the unstake request, it means that // we need to push a new unstake request into the array if (!added) { require( unstakeRequests[msg.sender].length < maxUnstakeRequests, "Maximum unstake requests exceeded" ); unstakeRequests[msg.sender].push( UnstakeRequest({ amount: rsCOMAIAmt, comaiAmt: outWComaiAmt, isReadyForUnstake: false, timestamp: block.timestamp, wrappedToken: wrappedToken }) ); emit UserUnstakeRequested( msg.sender, length, block.timestamp, rsCOMAIAmt, outWComaiAmt, wrappedToken ); } // Perform burn _burnRsCOMAI(msg.sender, rsCOMAIAmt); // transfer the service fee to the withdrawal manager // withdrawalManager have already been checked to be a non zero address // in the guard condition at start of function bool success = payable(withdrawalManager).send(serviceFee); require(success, "Service fee transfer failed"); } function getUnstakeRequestByUser(address user) public view returns (UnstakeRequest[] memory) { return unstakeRequests[user]; } /* * * This method shall be used to approve withdrawals by the user * The withdrawal manager will need to approve the withdrawal. * * Note that multiple requests can be approved at once * * @params requests The list of requests to approve * * */ function approveMultipleUnstakes(UserRequest[] calldata requests) public hasApproveWithdrawalRole nonReentrant checkPaused { uint256 totalRequiredComaiAmt = 0; require(requests.length > 0, "Requests array is empty"); require( requests[0].requestIndex < unstakeRequests[requests[0].user].length, "First request index out of bounds" ); // There might be cases that the underlying token might be different // so we need to add checks to ensure that the unstaking is the same token // across all indexes in the current requests UserRequest[] array // If there is 2 different tokens underlying in the requests, we return the // error as system is not designed to handle such a scenario. // In that scenario, the user needs to unstake the tokens separately // in two separate request address commonWrappedToken = unstakeRequests[requests[0].user][requests[0].requestIndex].wrappedToken; // Loop through each request to unstake and check if the request is valid for (uint256 i = 0; i < requests.length; i++) { UserRequest calldata request = requests[i]; require( request.requestIndex < unstakeRequests[request.user].length, "Invalid request index" ); require( unstakeRequests[request.user][request.requestIndex].amount > 0, "Request is invalid" ); require( !unstakeRequests[request.user][request.requestIndex].isReadyForUnstake, "Request is already approved" ); // Check if wrappedToken is the same for all requests require( unstakeRequests[request.user][request.requestIndex].wrappedToken == commonWrappedToken, "Wrapped token is not the same across all unstake requests" ); (uint256 wcomaiAmt,,uint256 unstakingFeeAmt) = getWCOMAIByrsCOMAIAfterFee(unstakeRequests[request.user][request.requestIndex].comaiAmt); totalRequiredComaiAmt = totalRequiredComaiAmt + wcomaiAmt + unstakingFeeAmt; } // Check if the sender has allowed the contract to spend enough tokens require( IERC20(commonWrappedToken).allowance(msg.sender, address(this)) >= totalRequiredComaiAmt, "Insufficient token allowance" ); for (uint256 i = 0; i < requests.length; i++) { UserRequest calldata request = requests[i]; unstakeRequests[request.user][request.requestIndex] .isReadyForUnstake = true; } // Transfer the COMAI from the withdrawal manager to this contract require( IERC20(commonWrappedToken).transferFrom( msg.sender, address(this), totalRequiredComaiAmt ), "comaiAmt transfer failed" ); // Emit events after state changes and external interactions for (uint256 i = 0; i < requests.length; i++) { UserRequest calldata request = requests[i]; emit AdminUnstakeApproved( request.user, request.requestIndex, block.timestamp ); } } /* * * This method shall be used by the user to unstake and withdraw the * redeemed COMAI to their wallet * * @params requestIndex The index of the request to unstake * */ function unstake(uint256 requestIndex) public nonReentrant checkPaused { require( requestIndex < unstakeRequests[msg.sender].length, "Invalid request index" ); UnstakeRequest memory request = unstakeRequests[msg.sender][requestIndex]; require(request.amount > 0, "No unstake request found"); require(request.isReadyForUnstake, "Unstake not approved yet"); // Transfer wCOMAI tokens back to the user (uint256 amountToTransfer,,uint256 unstakingFeeAmt) = getWCOMAIByrsCOMAIAfterFee(request.comaiAmt); _transferToVault(address(this), unstakingFeeAmt); // Update state to false delete unstakeRequests[msg.sender][requestIndex]; // Perform ERC20 transfer bool transferSuccessful = IERC20(request.wrappedToken).transfer( msg.sender, amountToTransfer ); require(transferSuccessful, "wCOMAI transfer failed"); // Process the unstake event emit UserUnstake(msg.sender, requestIndex, block.timestamp); } /* * * This method shall be used by the admin to exchange the market rate * and the value of wCOMAI:RivusCOMAI. * * Owner shall be multisignature wallet * * @params newRate The new exchange rate * */ function updateExchangeRate(uint256 newRate) public hasExchangeUpdateRole { require(newRate > 0, "New rate must be more than 0"); require( newRate >= lowerExchangeRateBound && newRate <= upperExchangeRateBound, "New rate must be within bounds" ); // This also checks for newRate > 0 since lowerExchangeRateBound is always more than 0 // Recommended min lower and upper bound is define upon initialization require( lowerExchangeRateBound > 0 && upperExchangeRateBound > 0, "Bounds must be more than 0" ); exchangeRate = newRate; emit UpdateExchangeRate(newRate); } /* * This method calculates the amount of wCOMAI after deducting both * the bridging fee and the staking fee * * In this calculation: * 1. We first deduct the bridging fee from the wCOMAI amount * 2. We then calculate the staking fee based on the amountAfterBridgingFee * 3. We then deduct the staking fee from the amountAfterBridgingFee * * Note: * 1. wCOMAIAmont must be bigger than bridgingFee * 2. amountAfterTotalFees much be more than 0 * */ function calculateAmtAfterFee(uint256 wcomaiAmount) public view returns (uint256, uint256, uint256) { require( wcomaiAmount > bridgingFee, "wCOMAI amount must be more than bridging fee" ); uint256 _bridgeFee = wcomaiAmount * bridgingFee / 1000; if(_bridgeFee < 1 * (10 ** decimals())) _bridgeFee = 1 * (10 ** decimals()); uint256 amountAfterBridgingFee = wcomaiAmount - _bridgeFee; // Apply the staking fee as a percentage (e.g., 0.1%) // Note: Multiply by 1000 to convert the decimal percentage to an integer uint256 feeAmount = 0; if(stakingFee > 0) { /* * * Formula to calculate feeAmount. Note that there might be precision loss of * 1 wei due to the division which is approx 4e-7 if COMAI is $400 which is negliglbe * So we can accept this precision loss * */ feeAmount = (amountAfterBridgingFee * stakingFee) / 1000; } // Subtract the percentage-based staking fee from the amount after bridging fee uint256 amountAfterTotalFees = amountAfterBridgingFee - feeAmount; require(amountAfterTotalFees > 0, "Wrap amount after fee must be more than 0"); return (amountAfterTotalFees, _bridgeFee, feeAmount); } /** * @dev Mint RsCOMAI */ function _mintRsCOMAI( address _recipient, uint256 _amount ) internal { uint256 sharesAmount = getSharesByMintedRsCOMAI(_amount); if (sharesAmount == 0) { //RsCOMAI totalSupply is 0: assume that shares correspond to RsCOMAI 1-to-1 sharesAmount = _amount; } _mintShares(_recipient, sharesAmount); totalRsCOMAIMinted += _amount; emit Mint(_recipient, _amount, block.timestamp); } /** * @notice Burn _provideramount RsCOMAI to payback minted RsCOMAI for _provider. */ function _burnRsCOMAI( address _provider, uint256 _amount ) internal { uint256 sharesAmount = getSharesByMintedRsCOMAI(_amount); _burnShares(_provider, sharesAmount); totalRsCOMAIMinted -= _amount; emit Burn(_provider, _amount, block.timestamp); } /* * This function shall be used by the user to wrap their wCOMAI tokens * and get RivusCOMAI in return * * Note that stakingFee cna be 0% (0) so we do need to check for that * */ function wrap(uint256 wcomaiAmount) public nonReentrant checkPaused returns (uint256) { require( maxDepositPerRequest >= wcomaiAmount, "Deposit amount exceeds maximum" ); require( cap >= totalRsCOMAIMinted, "Deposit amount exceeds maximum" ); string memory _nativeWalletReceiver = nativeWalletReceiver; IERC20 _wrappedToken = IERC20(wrappedToken); // Check that the nativeWalletReceiver is not an empty string _checkValidCommumeWallet(_nativeWalletReceiver); _requireNonZeroAddress( address(_wrappedToken), "wrappedToken address is invalid" ); require( _wrappedToken.balanceOf(msg.sender) >= wcomaiAmount, "Insufficient wCOMAI balance" ); // Check to ensure that the protocol vault address is not zero _requireNonZeroAddress( address(protocolVault), "Protocol vault address cannot be 0" ); // Ensure that at least 15 COMAI is being bridged // based on the smart contract require(wcomaiAmount >= minStakingAmt, "Does not meet minimum staking amount"); // Ensure that the wrap amount after free is more than 0 (uint256 wrapAmountAfterFee, uint256 bridgeFeeAmt, uint256 feeAmt) = calculateAmtAfterFee(wcomaiAmount); uint256 rsCOMAIAmount = getRsCOMAIbyWCOMAI(wrapAmountAfterFee); // Perform token transfers _mintRsCOMAI(msg.sender, rsCOMAIAmount); _transferToVault(msg.sender, feeAmt); uint256 amtToBridge = wrapAmountAfterFee + bridgeFeeAmt; _transferToContract(amtToBridge); IBridge(bridge).bridgeBack(amtToBridge, _nativeWalletReceiver); emit UserStake(msg.sender, block.timestamp, wcomaiAmount, rsCOMAIAmount); return rsCOMAIAmount; } function safePullERC20( address tokenAddress, address to, uint256 amount ) public hasTokenSafePullRole checkPaused { _requireNonZeroAddress(to, "Recipient address cannot be null address"); require(amount > 0, "Amount must be greater than 0"); IERC20 token = IERC20(tokenAddress); uint256 balance = token.balanceOf(address(this)); require(balance >= amount, "Not enough tokens in contract"); // "to" have been checked to be a non zero address bool success = token.transfer(to, amount); require(success, "Token transfer failed"); emit ERC20TokenPulled(tokenAddress, to, amount); } function pullNativeToken(address to, uint256 amount) public hasTokenSafePullRole checkPaused { _requireNonZeroAddress(to, "Recipient address cannot be null address"); require(amount > 0, "Amount must be greater than 0"); uint256 balance = address(this).balance; require(balance >= amount, "Not enough native tokens in contract"); // "to" have been checked to be a non zero address (bool success, ) = to.call{ value: amount }(""); require(success, "Native token transfer failed"); emit NativeTokenPulled(to, amount); } function rebase(uint256 apr) external hasManageStakingConfigRole { // uint256 totalSharesAmount = getTotalShares(); // uint256 burnAmount = totalSharesAmount * apr / 1000000 / 365; // _burnSharesForOnlyRebase(burnAmount); // lastRebaseTime = block.timestamp; // emit Rebase( // apr, // totalSharesAmount, // burnAmount, // address(msg.sender), // block.timestamp // ); uint256 mintAmount = totalRsCOMAIMinted * apr / 1000000 / 365; totalRsCOMAIMinted = totalRsCOMAIMinted + mintAmount; lastRebaseTime = block.timestamp; emit Rebase( apr, totalRsCOMAIMinted, getTotalShares(), mintAmount, block.timestamp ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {ERC165Upgradeable} from "../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, IAccessControl, ERC165Upgradeable { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl struct AccessControlStorage { mapping(bytes32 role => RoleData) _roles; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800; function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) { assembly { $.slot := AccessControlStorageLocation } } /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } 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(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { AccessControlStorage storage $ = _getAccessControlStorage(); bytes32 previousAdminRole = getRoleAdmin(role); $._roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (!hasRole(role, account)) { $._roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (hasRole(role, account)) { $._roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol) pragma solidity ^0.8.20; import {OwnableUpgradeable} from "./OwnableUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is specified at deployment time in the constructor for `Ownable`. This * can later be changed with {transferOwnership} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable2Step struct Ownable2StepStorage { address _pendingOwner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable2Step")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant Ownable2StepStorageLocation = 0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00; function _getOwnable2StepStorage() private pure returns (Ownable2StepStorage storage $) { assembly { $.slot := Ownable2StepStorageLocation } } event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); function __Ownable2Step_init() internal onlyInitializing { } function __Ownable2Step_init_unchained() internal onlyInitializing { } /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { Ownable2StepStorage storage $ = _getOwnable2StepStorage(); return $._pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { Ownable2StepStorage storage $ = _getOwnable2StepStorage(); $._pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { Ownable2StepStorage storage $ = _getOwnable2StepStorage(); delete $._pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() public virtual { address sender = _msgSender(); if (pendingOwner() != sender) { revert OwnableUnauthorizedAccount(sender); } _transferOwnership(sender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable struct OwnableStorage { address _owner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300; function _getOwnableStorage() private pure returns (OwnableStorage storage $) { assembly { $.slot := OwnableStorageLocation } } /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ function __Ownable_init(address initialOwner) internal onlyInitializing { __Ownable_init_unchained(initialOwner); } function __Ownable_init_unchained(address initialOwner) internal onlyInitializing { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { OwnableStorage storage $ = _getOwnableStorage(); return $._owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { OwnableStorage storage $ = _getOwnableStorage(); address oldOwner = $._owner; $._owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @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 Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._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 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._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() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @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 { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol"; import {IERC20Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.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}. * * 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. */ abstract contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20, IERC20Metadata, IERC20Errors { /// @custom:storage-location erc7201:openzeppelin.storage.ERC20 struct ERC20Storage { mapping(address account => uint256) _balances; mapping(address account => mapping(address spender => uint256)) _allowances; uint256 _totalSupply; string _name; string _symbol; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC20")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ERC20StorageLocation = 0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00; function _getERC20Storage() private pure returns (ERC20Storage storage $) { assembly { $.slot := ERC20StorageLocation } } /** * @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 { ERC20Storage storage $ = _getERC20Storage(); $._name = name_; $._symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { ERC20Storage storage $ = _getERC20Storage(); return $._name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { ERC20Storage storage $ = _getERC20Storage(); 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 returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` 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 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); 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 `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` 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. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { ERC20Storage storage $ = _getERC20Storage(); if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows $._totalSupply += value; } else { uint256 fromBalance = $._balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. $._balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. $._totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. $._balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` 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. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { ERC20Storage storage $ = _getERC20Storage(); if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } $._allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; 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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.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); * } * ``` */ abstract contract ERC165Upgradeable is Initializable, IERC165 { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; 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; /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard struct ReentrancyGuardStorage { uint256 _status; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) { assembly { $.slot := ReentrancyGuardStorageLocation } } /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); $._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 { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // On the first call to nonReentrant, _status will be NOT_ENTERED if ($._status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail $._status = ENTERED; } function _nonReentrantAfter() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // 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) { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); return $._status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../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 An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @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); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @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(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) 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 FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; interface IBridge { function claimTokens(bytes memory signature, uint256 tokenAmount) external returns(bool); function bridgeBack(uint256 _amount, string memory _to) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.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.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; interface IwCOMAI { function mint(address to, uint256 amount) external returns (bool); function burnFrom(address account, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "./lib/SafeMath.sol"; import "./interface/IERC20.sol"; /** * @title Interest-bearing ERC20-like token for RivusCOMAI protocol. * * This contract is abstract. To make the contract deployable override the * `_getTotalMintedRsCOMAI` function. `RivusCOMAI.sol` contract inherits RsCOMAI and defines * the `_getTotalMintedRsCOMAI` function. * * RsCOMAI balances are dynamic and represent the holder's share in the total amount * of Ether controlled by the protocol. Account shares aren't normalized, so the * contract also stores the sum of all shares to calculate each account's token balance * which equals to: * * shares[account] * _getTotalMintedRsCOMAI() / _getTotalShares() * * For example, assume that we have: * * _getTotalMintedRsCOMAI() -> 1000 RsCOMAI * sharesOf(user1) -> 100 * sharesOf(user2) -> 400 * * Therefore: * * balanceOf(user1) -> 2 tokens which corresponds 200 RsCOMAI * balanceOf(user2) -> 8 tokens which corresponds 800 RsCOMAI * * Since balances of all token holders change when the amount of total supplied RsCOMAI * changes, this token cannot fully implement ERC20 standard: it only emits `Transfer` * events upon explicit transfer between holders. In contrast, when total amount of * pooled Ether increases, no `Transfer` events are generated: doing so would require * emitting an event for each token holder and thus running an unbounded loop. */ abstract contract RsCOMAI is IERC20 { using SafeMath for uint256; uint256 private totalShares; /** * @dev RsCOMAI balances are dynamic and are calculated based on the accounts' shares * and the total supply by the protocol. Account shares aren't * normalized, so the contract also stores the sum of all shares to calculate * each account's token balance which equals to: * * shares[account] * _getTotalMintedRsCOMAI() / _getTotalShares() */ mapping(address => uint256) private shares; /** * @dev Allowances are nominated in tokens, not token shares. */ mapping(address => mapping(address => uint256)) private allowances; /** * @notice An executed shares transfer from `sender` to `recipient`. * * @dev emitted in pair with an ERC20-defined `Transfer` event. */ event TransferShares( address indexed from, address indexed to, uint256 sharesValue ); /** * @notice An executed `burnShares` request * * @dev Reports simultaneously burnt shares amount * and corresponding RsCOMAI amount. * The RsCOMAI amount is calculated twice: before and after the burning incurred rebase. * * @param account holder of the burnt shares * @param preRebaseTokenAmount amount of RsCOMAI the burnt shares corresponded to before the burn * @param postRebaseTokenAmount amount of RsCOMAI the burnt shares corresponded to after the burn * @param sharesAmount amount of burnt shares */ event SharesBurnt( address indexed account, uint256 preRebaseTokenAmount, uint256 postRebaseTokenAmount, uint256 sharesAmount ); /** * @return the name of the token. */ function name() public pure returns (string memory) { return "Rivus Staked COMAI"; } /** * @return the symbol of the token, usually a shorter version of the * name. */ function symbol() public pure returns (string memory) { return "rsCOMAI"; } /** * @return the number of decimals for getting user representation of a token amount. */ function decimals() public pure returns (uint8) { return 18; } /** * @return the amount of RsCOMAI in existence. * * @dev Always equals to `_getTotalMintedRsCOMAI()` since token amount * is pegged to the total amount of RsCOMAI controlled by the protocol. */ function totalSupply() public view returns (uint256) { return _getTotalMintedRsCOMAI(); } /** * @return the amount of tokens owned by the `_account`. * * @dev Balances are dynamic and equal the `_account`'s share in the amount of the * total Ether controlled by the protocol. See `sharesOf`. */ function balanceOf(address _account) public view returns (uint256) { return getMintedRsCOMAIByShares(_sharesOf(_account)); } /** * @notice Moves `_amount` tokens from the caller's account to the `_recipient` account. * * @return a boolean value indicating whether the operation succeeded. * Emits a `Transfer` event. * Emits a `TransferShares` event. * * Requirements: * * - `_recipient` cannot be the zero address. * - the caller must have a balance of at least `_amount`. * - the contract must not be paused. * * @dev The `_amount` argument is the amount of tokens, not shares. */ function transfer( address _recipient, uint256 _amount ) public returns (bool) { _transfer(msg.sender, _recipient, _amount); return true; } /** * @return the remaining number of tokens that `_spender` is allowed to spend * on behalf of `_owner` through `transferFrom`. This is zero by default. * * @dev This value changes when `approve` or `transferFrom` is called. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowances[_owner][_spender]; } /** * @notice Sets `_amount` as the allowance of `_spender` over the caller's tokens. * * @return a boolean value indicating whether the operation succeeded. * Emits an `Approval` event. * * Requirements: * * - `_spender` cannot be the zero address. * - the contract must not be paused. * * @dev The `_amount` argument is the amount of tokens, not shares. */ function approve(address _spender, uint256 _amount) public returns (bool) { _approve(msg.sender, _spender, _amount); return true; } /** * @notice Moves `_amount` tokens from `_sender` to `_recipient` using the * allowance mechanism. `_amount` is then deducted from the caller's * allowance. * * @return a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. * Emits a `TransferShares` event. * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `_sender` and `_recipient` cannot be the zero addresses. * - `_sender` must have a balance of at least `_amount`. * - the caller must have allowance for `_sender`'s tokens of at least `_amount`. * - the contract must not be paused. * * @dev The `_amount` argument is the amount of tokens, not shares. */ function transferFrom( address _sender, address _recipient, uint256 _amount ) public returns (bool) { uint256 currentAllowance = allowances[_sender][msg.sender]; require( currentAllowance >= _amount, "TRANSFER_AMOUNT_EXCEEDS_ALLOWANCE" ); _transfer(_sender, _recipient, _amount); _approve(_sender, msg.sender, currentAllowance.sub(_amount)); return true; } /** * @notice Atomically increases the allowance granted to `_spender` by the caller by `_addedValue`. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in: * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol#L42 * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `_spender` cannot be the the zero address. * - the contract must not be paused. */ function increaseAllowance( address _spender, uint256 _addedValue ) public returns (bool) { _approve( msg.sender, _spender, allowances[msg.sender][_spender].add(_addedValue) ); return true; } /** * @notice Atomically decreases the allowance granted to `_spender` by the caller by `_subtractedValue`. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in: * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol#L42 * 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`. * - the contract must not be paused. */ function decreaseAllowance( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 currentAllowance = allowances[msg.sender][_spender]; require( currentAllowance >= _subtractedValue, "DECREASED_ALLOWANCE_BELOW_ZERO" ); _approve(msg.sender, _spender, currentAllowance.sub(_subtractedValue)); return true; } /** * @return the total amount of shares in existence. * * @dev The sum of all accounts' shares can be an arbitrary number, therefore * it is necessary to store it in order to calculate each account's relative share. */ function getTotalShares() public view returns (uint256) { return _getTotalShares(); } /** * @return the amount of shares owned by `_account`. */ function sharesOf(address _account) public view returns (uint256) { return _sharesOf(_account); } /** * @return the amount of shares that corresponds to `_RsCOMAIAmount` protocol-supplied RsCOMAI. */ function getSharesByMintedRsCOMAI( uint256 _RsCOMAIAmount ) public view returns (uint256) { uint256 totalMintedRsCOMAI = _getTotalMintedRsCOMAI(); if (totalMintedRsCOMAI == 0) { return 0; } else { return _RsCOMAIAmount.mul(_getTotalShares()).div(totalMintedRsCOMAI); } } /** * @return the amount of RsCOMAI that corresponds to `_sharesAmount` token shares. */ function getMintedRsCOMAIByShares( uint256 _sharesAmount ) public view returns (uint256) { uint256 totalSharesAmount = _getTotalShares(); if (totalShares == 0) { return 0; } else { return _sharesAmount.mul(_getTotalMintedRsCOMAI()).div(totalSharesAmount); } } /** * @notice Moves `_sharesAmount` token shares from the caller's account to the `_recipient` account. * * @return amount of transferred tokens. * Emits a `TransferShares` event. * Emits a `Transfer` event. * * Requirements: * * - `_recipient` cannot be the zero address. * - the caller must have at least `_sharesAmount` shares. * - the contract must not be paused. * * @dev The `_sharesAmount` argument is the amount of shares, not tokens. */ function transferShares( address _recipient, uint256 _sharesAmount ) public returns (uint256) { _transferShares(msg.sender, _recipient, _sharesAmount); emit TransferShares(msg.sender, _recipient, _sharesAmount); uint256 tokensAmount = getMintedRsCOMAIByShares(_sharesAmount); emit Transfer(msg.sender, _recipient, tokensAmount); return tokensAmount; } /** * @return the total amount of RsCOMAI. * @dev This is used for calculating tokens from shares and vice versa. * @dev This function is required to be implemented in a derived contract. */ function _getTotalMintedRsCOMAI() internal view virtual returns (uint256); /** * @notice Moves `_amount` tokens from `_sender` to `_recipient`. * Emits a `Transfer` event. * Emits a `TransferShares` event. */ function _transfer( address _sender, address _recipient, uint256 _amount ) internal { uint256 _sharesToTransfer = getSharesByMintedRsCOMAI(_amount); _transferShares(_sender, _recipient, _sharesToTransfer); emit Transfer(_sender, _recipient, _amount); emit TransferShares(_sender, _recipient, _sharesToTransfer); } /** * @notice Sets `_amount` as the allowance of `_spender` over the `_owner` s tokens. * * Emits an `Approval` event. * * Requirements: * * - `_owner` cannot be the zero address. * - `_spender` cannot be the zero address. * - the contract must not be paused. */ function _approve( address _owner, address _spender, uint256 _amount ) internal { require(_owner != address(0), "APPROVE_FROM_ZERO_ADDRESS"); require(_spender != address(0), "APPROVE_TO_ZERO_ADDRESS"); allowances[_owner][_spender] = _amount; emit Approval(_owner, _spender, _amount); } /** * @return the total amount of shares in existence. */ function _getTotalShares() internal view returns (uint256) { return totalShares; } /** * @return the amount of shares owned by `_account`. */ function _sharesOf(address _account) internal view returns (uint256) { return shares[_account]; } /** * @notice Moves `_sharesAmount` shares from `_sender` to `_recipient`. * * Requirements: * * - `_sender` cannot be the zero address. * - `_recipient` cannot be the zero address. * - `_sender` must hold at least `_sharesAmount` shares. * - the contract must not be paused. */ function _transferShares( address _sender, address _recipient, uint256 _sharesAmount ) internal { require(_sender != address(0), "TRANSFER_FROM_THE_ZERO_ADDRESS"); require(_recipient != address(0), "TRANSFER_TO_THE_ZERO_ADDRESS"); uint256 currentSenderShares = shares[_sender]; require( _sharesAmount <= currentSenderShares, "TRANSFER_AMOUNT_EXCEEDS_BALANCE" ); shares[_sender] = currentSenderShares.sub(_sharesAmount); shares[_recipient] = shares[_recipient].add(_sharesAmount); } /** * @notice Creates `_sharesAmount` shares and assigns them to `_recipient`, increasing the total amount of shares. * @dev This doesn't increase the token total supply. * * Requirements: * * - `_recipient` cannot be the zero address. * - the contract must not be paused. */ function _mintShares( address _recipient, uint256 _sharesAmount ) internal returns (uint256 newTotalShares) { require(_recipient != address(0), "MINT_TO_THE_ZERO_ADDRESS"); uint256 _amount = getMintedRsCOMAIByShares(_sharesAmount); if (_amount == 0) { //RsCOMAI totalSupply is 0: assume that shares correspond to RsCOMAI 1-to-1 _amount = _sharesAmount; } newTotalShares = _getTotalShares().add(_sharesAmount); totalShares = newTotalShares; shares[_recipient] = shares[_recipient].add(_sharesAmount); emit Transfer(address(0), _recipient, _amount); } /** * @notice Destroys `_sharesAmount` shares from `_account`'s holdings, decreasing the total amount of shares. * @dev This doesn't decrease the token total supply. * * Requirements: * * - `_account` cannot be the zero address. * - `_account` must hold at least `_sharesAmount` shares. * - the contract must not be paused. */ function _burnShares( address _account, uint256 _sharesAmount ) internal returns (uint256 newTotalShares) { require(_account != address(0), "BURN_FROM_THE_ZERO_ADDRESS"); uint256 accountShares = shares[_account]; require(_sharesAmount <= accountShares, "BURN_AMOUNT_EXCEEDS_BALANCE"); uint256 preRebaseTokenAmount = getMintedRsCOMAIByShares(_sharesAmount); newTotalShares = _getTotalShares().sub(_sharesAmount); totalShares = newTotalShares; shares[_account] = accountShares.sub(_sharesAmount); uint256 postRebaseTokenAmount = getMintedRsCOMAIByShares(_sharesAmount); emit SharesBurnt( _account, preRebaseTokenAmount, postRebaseTokenAmount, _sharesAmount ); emit Transfer(_account, address(0), preRebaseTokenAmount); } /** * @notice Destroys `_sharesAmount` shares from `_account`'s holdings, decreasing the total amount of shares. * @dev This doesn't decrease the token total supply. * * Requirements: * * - `_account` cannot be the zero address. * - `_account` must hold at least `_sharesAmount` shares. * - the contract must not be paused. */ function _burnSharesForOnlyRebase( uint256 _sharesAmount ) internal returns (uint256 newTotalShares) { uint256 preRebaseTokenAmount = getMintedRsCOMAIByShares(_sharesAmount); newTotalShares = _getTotalShares().sub(_sharesAmount); totalShares = newTotalShares; uint256 postRebaseTokenAmount = getMintedRsCOMAIByShares(_sharesAmount); emit SharesBurnt( address(this), preRebaseTokenAmount, postRebaseTokenAmount, _sharesAmount ); // Notice: we're not emitting a Transfer event to the zero address here since shares burn // works by redistributing the amount of tokens corresponding to the burned shares between // all other token holders. The total supply of the token doesn't change as the result. // This is equivalent to performing a send from `address` to each other token holder address, // but we cannot reflect this as it would require sending an unbounded number of events. // We're emitting `SharesBurnt` event to provide an explicit rebase log record nonetheless. } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"idx","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"approvedTimestamp","type":"uint256"}],"name":"AdminUnstakeApproved","type":"event"},{"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":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"paused","type":"bool"}],"name":"ContractPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC20TokenPulled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newLowerBound","type":"uint256"}],"name":"LowerBoundUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"NativeTokenPulled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"apr","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalRsCOMAIMinted","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalShares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintAmoount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Rebase","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":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"preRebaseTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"postRebaseTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sharesAmount","type":"uint256"}],"name":"SharesBurnt","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":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"sharesValue","type":"uint256"}],"name":"TransferShares","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"bridgingFee","type":"uint256"}],"name":"UpdateBridgeFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"UpdateExchangeRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxDepositPerRequest","type":"uint256"}],"name":"UpdateMaxDepositPerRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxUnstakeRequests","type":"uint256"}],"name":"UpdateMaxUnstakeRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minStakingAmt","type":"uint256"}],"name":"UpdateMinStakingAmt","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newNativeWalletReceiver","type":"string"}],"name":"UpdateNativeCommumeReceiver","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newProtocolVault","type":"address"}],"name":"UpdateProtocolVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"serviceFee","type":"uint256"}],"name":"UpdateServiceFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"stakingFee","type":"uint256"}],"name":"UpdateStakingFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newUnstakingFee","type":"uint256"}],"name":"UpdateUnstakingFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newWCOMAI","type":"address"}],"name":"UpdateWComai","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"withdrawalManager","type":"address"}],"name":"UpdateWithdrawalManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newUpperBound","type":"uint256"}],"name":"UpperBoundUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"stakeTimestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"inComaiAmt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"wstAmount","type":"uint256"}],"name":"UserStake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"idx","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unstakeTimestamp","type":"uint256"}],"name":"UserUnstake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"idx","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"requestTimestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"wstAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"outComaiAmt","type":"uint256"},{"indexed":false,"internalType":"address","name":"wrappedToken","type":"address"}],"name":"UserUnstakeRequested","type":"event"},{"inputs":[],"name":"APPROVE_WITHDRAWAL_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":"EXCHANGE_UPDATE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGE_STAKING_CONFIG_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN_SAFE_PULL_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","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":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"requestIndex","type":"uint256"}],"internalType":"struct RivusCOMAI.UserRequest[]","name":"requests","type":"tuple[]"}],"name":"approveMultipleUnstakes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridgingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"wcomaiAmount","type":"uint256"}],"name":"calculateAmtAfterFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","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":[],"name":"exchangeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_sharesAmount","type":"uint256"}],"name":"getMintedRsCOMAIByShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"uint256","name":"wcomaiAmount","type":"uint256"}],"name":"getRsCOMAIbyWCOMAI","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_RsCOMAIAmount","type":"uint256"}],"name":"getSharesByMintedRsCOMAI","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUnstakeRequestByUser","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"comaiAmt","type":"uint256"},{"internalType":"bool","name":"isReadyForUnstake","type":"bool"},{"internalType":"address","name":"wrappedToken","type":"address"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct RivusCOMAI.UnstakeRequest[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"rsCOMAIAmount","type":"uint256"}],"name":"getWCOMAIByrsCOMAI","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"rsCOMAIAmount","type":"uint256"}],"name":"getWCOMAIByrsCOMAIAfterFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"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":"_owner","type":"address"},{"internalType":"address","name":"_wCOMAI","type":"address"},{"internalType":"string","name":"_nativeTokenReceiver","type":"string"},{"internalType":"address","name":"_protocolVault","type":"address"},{"internalType":"address","name":"_bridge","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRebaseTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lowerExchangeRateBound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxDepositPerRequest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxUnstakeRequests","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minStakingAmt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"nativeWalletReceiver","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"pullNativeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"apr","type":"uint256"}],"name":"rebase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"rsCOMAIAmt","type":"uint256"}],"name":"requestUnstake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"safePullERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"serviceFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bridgingFee","type":"uint256"}],"name":"setBridgingFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newLowerBound","type":"uint256"}],"name":"setLowerExchangeRateBound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxDepositPerRequest","type":"uint256"}],"name":"setMaxDepositPerRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxUnstakeRequests","type":"uint256"}],"name":"setMaxUnstakeRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minStakingAmt","type":"uint256"}],"name":"setMinStakingAmt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_nativeWalletReceiver","type":"string"}],"name":"setNativeTokenReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isPaused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_protocolVault","type":"address"}],"name":"setProtocolVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serviceFee","type":"uint256"}],"name":"setServiceFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakingFee","type":"uint256"}],"name":"setStakingFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_unstakingFee","type":"uint256"}],"name":"setUnstakingFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newUpperBound","type":"uint256"}],"name":"setUpperExchangeRateBound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_wCOMAI","type":"address"}],"name":"setWCOMAI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_withdrawalManager","type":"address"}],"name":"setWithdrawalManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"sharesOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingFee","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":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalRsCOMAIMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_sharesAmount","type":"uint256"}],"name":"transferShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestIndex","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"unstakeRequests","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"comaiAmt","type":"uint256"},{"internalType":"bool","name":"isReadyForUnstake","type":"bool"},{"internalType":"address","name":"wrappedToken","type":"address"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unstakingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_bridge","type":"address"}],"name":"updateBridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newCap","type":"uint256"}],"name":"updateCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"updateExchangeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upperExchangeRateBound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawalManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"wcomaiAmount","type":"uint256"}],"name":"wrap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wrappedToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50615aa980620000216000396000f3fe6080604052600436106104945760003560e01c80637b9fe08711610260578063b9e205ae11610144578063dd62ed3e116100c1578063eff9884311610085578063eff9884314610e7a578063f2fde38b14610e90578063f5eb42dc14610eb0578063f96bc9f614610ed0578063fb8363b614610ef0578063fc72ed5b14610f1d57600080fd5b8063dd62ed3e14610da4578063e30c397814610dea578063e6c8a5f314610dff578063e78cea9214610e3a578063ea598cb014610e5a57600080fd5b8063cc23e3a211610108578063cc23e3a214610d0d578063cc4eedc914610d2d578063d5002f2e14610d4d578063d547741f14610d62578063d8990b6614610d8257600080fd5b8063b9e205ae14610c77578063bc4f2d6d14610c97578063be2b9cd514610cb7578063c23c9e0314610ccd578063c448c4e114610ced57600080fd5b806395d89b41116101dd578063a7602c7e116101a1578063a7602c7e14610bc7578063a7d6889614610bdd578063a9059cbb14610bfd578063ac4a0fb614610c1d578063b187bd2614610c3d578063b1ed4a6c14610c5757600080fd5b806395d89b4114610b22578063996c6cc314610b52578063a1e8028014610b72578063a217fddf14610b92578063a457c2d714610ba757600080fd5b806389067c5e1161022457806389067c5e14610aa15780638abdf5aa14610ab75780638da5cb5b14610acd5780638fcb4e5b14610ae257806391d1485414610b0257600080fd5b80637b9fe08714610a165780637e203c8b14610a36578063829c1c5714610a4b57806382d85ad314610a6b57806382fe535a14610a8157600080fd5b806339509351116103875780635cdf76f81161030457806368cd79b3116102c857806368cd79b31461096a5780636eb382121461098a5780636f6c3529146109aa57806370a08231146109cc578063715018a6146109ec57806379ba509714610a0157600080fd5b80635cdf76f81461089e5780635cf4cde0146108be578063603d0f77146108d457806366442a06146108f4578063687080da1461094a57600080fd5b80634310d1281161034b5780634310d128146107dc57806344be0404146108105780634772daef1461083057806358e3b5ec146108505780635a9249e61461086657600080fd5b8063395093511461073257806339c5dec7146107525780633ba0b9a914610772578063410dbf7e14610788578063420fa47e146107a857600080fd5b806323b872dd116104155780632f2ff15d116103d95780632f2ff15d1461068c578063313ce567146106ac578063355274ea146106c857806336568abe146106de578063389ed267146106fe57600080fd5b806323b872dd146105ec578063248a9ca31461060c5780632680f5cd1461062c5780632d1ede9a1461064c5780632e17de781461066c57600080fd5b80631723be121161045c5780631723be121461057457806318160ddd146105985780631924063e146105ad57806320ba5698146105c357806323095721146105d957600080fd5b806301ffc9a71461049957806306fdde03146104ce578063095ea7b3146105125780630fbdc6771461053257806316c38b3c14610554575b600080fd5b3480156104a557600080fd5b506104b96104b43660046150c1565b610f3d565b60405190151581526020015b60405180910390f35b3480156104da57600080fd5b506040805180820190915260128152715269767573205374616b656420434f4d414960701b60208201525b6040516104c59190615131565b34801561051e57600080fd5b506104b961052d36600461515b565b610f74565b34801561053e57600080fd5b5061055261054d366004615185565b610f8a565b005b34801561056057600080fd5b5061055261056f3660046151ac565b611064565b34801561058057600080fd5b5061058a60145481565b6040519081526020016104c5565b3480156105a457600080fd5b5061058a611121565b3480156105b957600080fd5b5061058a60115481565b3480156105cf57600080fd5b5061058a60045481565b6105526105e7366004615185565b611131565b3480156105f857600080fd5b506104b96106073660046151c9565b611645565b34801561061857600080fd5b5061058a610627366004615185565b6116ed565b34801561063857600080fd5b50610552610647366004615185565b61170f565b34801561065857600080fd5b506105526106673660046151c9565b61184b565b34801561067857600080fd5b50610552610687366004615185565b611ae6565b34801561069857600080fd5b506105526106a7366004615205565b611e0a565b3480156106b857600080fd5b50604051601281526020016104c5565b3480156106d457600080fd5b5061058a600a5481565b3480156106ea57600080fd5b506105526106f9366004615205565b611e2c565b34801561070a57600080fd5b5061058a7f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d81565b34801561073e57600080fd5b506104b961074d36600461515b565b611e64565b34801561075e57600080fd5b5061055261076d366004615231565b611e9a565b34801561077e57600080fd5b5061058a60035481565b34801561079457600080fd5b506105526107a3366004615185565b611f72565b3480156107b457600080fd5b5061058a7f9e3114703ec4a93cd6bc7e2610274229541e8ba5acacf7825f26bce4fae601e081565b3480156107e857600080fd5b5061058a7f7e21c1f853a961caf8adc0c26c941d090de97558d402e0fe1d0eea44495dee7d81565b34801561081c57600080fd5b5061055261082b366004615185565b61203f565b34801561083c57600080fd5b5061055261084b3660046152ef565b6120c8565b34801561085c57600080fd5b5061058a60135481565b34801561087257600080fd5b50601554610886906001600160a01b031681565b6040516001600160a01b0390911681526020016104c5565b3480156108aa57600080fd5b506105526108b9366004615185565b612141565b3480156108ca57600080fd5b5061058a60075481565b3480156108e057600080fd5b506105526108ef366004615231565b612212565b34801561090057600080fd5b5061091461090f36600461515b565b6122d3565b604080519586526020860194909452911515928401929092526001600160a01b039091166060830152608082015260a0016104c5565b34801561095657600080fd5b5061058a610965366004615185565b61232d565b34801561097657600080fd5b50610552610985366004615185565b612378565b34801561099657600080fd5b506105526109a5366004615231565b612460565b3480156109b657600080fd5b5061058a600080516020615a5483398151915281565b3480156109d857600080fd5b5061058a6109e7366004615231565b6124b6565b3480156109f857600080fd5b506105526124d8565b348015610a0d57600080fd5b506105526124e2565b348015610a2257600080fd5b50610552610a3136600461515b565b612527565b348015610a4257600080fd5b5061050561274a565b348015610a5757600080fd5b50610552610a66366004615185565b6127d8565b348015610a7757600080fd5b5061058a60125481565b348015610a8d57600080fd5b50600f54610886906001600160a01b031681565b348015610aad57600080fd5b5061058a60065481565b348015610ac357600080fd5b5061058a60105481565b348015610ad957600080fd5b506108866128a0565b348015610aee57600080fd5b5061058a610afd36600461515b565b6128d5565b348015610b0e57600080fd5b506104b9610b1d366004615205565b612971565b348015610b2e57600080fd5b506040805180820190915260078152667273434f4d414960c81b6020820152610505565b348015610b5e57600080fd5b50600854610886906001600160a01b031681565b348015610b7e57600080fd5b50610552610b8d36600461532c565b6129a9565b348015610b9e57600080fd5b5061058a600081565b348015610bb357600080fd5b506104b9610bc236600461515b565b61324a565b348015610bd357600080fd5b5061058a600d5481565b348015610be957600080fd5b50610552610bf8366004615185565b6132d7565b348015610c0957600080fd5b506104b9610c1836600461515b565b613330565b348015610c2957600080fd5b50610552610c383660046153a1565b61333d565b348015610c4957600080fd5b50600b546104b99060ff1681565b348015610c6357600080fd5b5061058a610c72366004615185565b613671565b348015610c8357600080fd5b50610552610c92366004615185565b613694565b348015610ca357600080fd5b50610552610cb2366004615185565b61380d565b348015610cc357600080fd5b5061058a60095481565b348015610cd957600080fd5b5061058a610ce8366004615185565b6138db565b348015610cf957600080fd5b5061058a610d08366004615185565b61390a565b348015610d1957600080fd5b50610552610d28366004615185565b613922565b348015610d3957600080fd5b50610552610d48366004615185565b6139e9565b348015610d5957600080fd5b5060005461058a565b348015610d6e57600080fd5b50610552610d7d366004615205565b613b1d565b348015610d8e57600080fd5b5061058a6000805160206159ac83398151915281565b348015610db057600080fd5b5061058a610dbf366004615421565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b348015610df657600080fd5b50610886613b39565b348015610e0b57600080fd5b50610e1f610e1a366004615185565b613b62565b604080519384526020840192909252908201526060016104c5565b348015610e4657600080fd5b50601654610886906001600160a01b031681565b348015610e6657600080fd5b5061058a610e75366004615185565b613cd9565b348015610e8657600080fd5b5061058a60055481565b348015610e9c57600080fd5b50610552610eab366004615231565b6140f0565b348015610ebc57600080fd5b5061058a610ecb366004615231565b614175565b348015610edc57600080fd5b50610e1f610eeb366004615185565b614193565b348015610efc57600080fd5b50610f10610f0b366004615231565b614231565b6040516104c5919061544b565b348015610f2957600080fd5b50610552610f38366004615231565b6142e2565b60006001600160e01b03198216637965db0b60e01b1480610f6e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000610f813384846143c4565b50600192915050565b610fa26000805160206159ac83398151915233612971565b610fc75760405162461bcd60e51b8152600401610fbe906154c4565b60405180910390fd5b600081116110285760405162461bcd60e51b815260206004820152602860248201527f4d617820756e7374616b65207265717565737473206d757374206265206d6f72604482015267065207468616e20360c41b6064820152608401610fbe565b600d8190556040518181527f3822db87795eff9f96c9dca0cd5bc25a68f62c46e0bc261b5f67bbd5a598c495906020015b60405180910390a150565b61108e7f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d33612971565b6110da5760405162461bcd60e51b815260206004820152601f60248201527f43616c6c657220646f6573206e6f7420686176652050415553455f524f4c45006044820152606401610fbe565b600b805460ff191682151590811790915560405160ff909116151581527f752d7e161ff5146f80e3820893176eb40532811e5e20400dfdde57455213706a90602001611059565b600061112c60125490565b905090565b6111396144d1565b600b5460ff161561115c5760405162461bcd60e51b8152600401610fbe90615513565b60085460408051808201909152601f81527f77726170706564546f6b656e206164647265737320697320696e76616c69640060208201526111a6916001600160a01b031690614509565b600f54604080516060810190915260218082526111d5926001600160a01b0316919061598b6020830139614509565b60006111e08261390a565b90506010543410156112345760405162461bcd60e51b815260206004820152601c60248201527f46656520616d6f756e74206973206e6f742073756666696369656e74000000006044820152606401610fbe565b8161123e336124b6565b101561128c5760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74207273434f4d41492062616c616e6365000000006044820152606401610fbe565b336000908152600e602052604081205490805b8281101561141e57336000908152600e602052604081208054839081106112c8576112c861553f565b6000918252602090912060049091020154905080156112e7575061140c565b6040805160a081018252878152602080820188905260008284018190526008546001600160a01b03166060840152426080840152338152600e909152919091208054849081106113395761133961553f565b6000918252602091829020835160049290920201908155828201516001808301919091556040808501516002840180546060808901516001600160a81b0319909216931515610100600160a81b031916939093176101006001600160a01b039283160217909155608096870151600390950194909455600854825189815242968101969096529185018c905284018a90529091169282019290925290935033907fbacf71ad475b68e36b9cd14cedd8cf7d1f098c65f4c59255d2ade1ceae5782529060a00160405180910390a25061141e565b806114168161556b565b91505061129f565b50806115a457600d54336000908152600e60205260409020541061148e5760405162461bcd60e51b815260206004820152602160248201527f4d6178696d756d20756e7374616b6520726571756573747320657863656564656044820152601960fa1b6064820152608401610fbe565b336000818152600e60209081526040808320815160a081018352898152808401898152818401868152600880546001600160a01b03908116606086019081524260808701818152885460018181018b55998d529a909b2096516004909a0290960198895593519588019590955590516002870180549351861661010002610100600160a81b0319921515929092166001600160a81b031990941693909317179091559451600390940193909355925490517fbacf71ad475b68e36b9cd14cedd8cf7d1f098c65f4c59255d2ade1ceae5782529361159b93889390928b928b9216909485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b60405180910390a25b6115ae3385614531565b600f546010546040516000926001600160a01b03169180156108fc029184818181858888f193505050509050806116275760405162461bcd60e51b815260206004820152601b60248201527f5365727669636520666565207472616e73666572206661696c656400000000006044820152606401610fbe565b505050506116426001600080516020615a3483398151915255565b50565b6001600160a01b0383166000908152600260209081526040808320338452909152812054828110156116c35760405162461bcd60e51b815260206004820152602160248201527f5452414e534645525f414d4f554e545f455843454544535f414c4c4f57414e436044820152604560f81b6064820152608401610fbe565b6116ce8585856145bd565b6116e285336116dd8487614663565b6143c4565b506001949350505050565b6000908152600080516020615a14833981519152602052604090206001015490565b611727600080516020615a5483398151915233612971565b6117435760405162461bcd60e51b8152600401610fbe90615584565b6000811161179f5760405162461bcd60e51b815260206004820152602360248201527f4e657720757070657220626f756e64206d757374206265206d6f72652074686160448201526206e20360ec1b6064820152608401610fbe565b60135481116118165760405162461bcd60e51b815260206004820152603860248201527f4e657720757070657220626f756e64206d75737420626520677265617465722060448201527f7468616e2063757272656e74206c6f77657220626f756e6400000000000000006064820152608401610fbe565b60148190556040518181527f4091f60ba6c7aad614db78570cc879e0c6c771deb4738653a4e5acda9cf3b24f90602001611059565b6118757f9e3114703ec4a93cd6bc7e2610274229541e8ba5acacf7825f26bce4fae601e033612971565b6118915760405162461bcd60e51b8152600401610fbe906155cd565b600b5460ff16156118b45760405162461bcd60e51b8152600401610fbe90615513565b6118d6826040518060600160405280602881526020016159cc60289139614509565b600081116119265760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610fbe565b6040516370a0823160e01b815230600482015283906000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561196f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119939190615616565b9050828110156119e55760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420656e6f75676820746f6b656e7320696e20636f6e74726163740000006044820152606401610fbe565b60405163a9059cbb60e01b81526001600160a01b038581166004830152602482018590526000919084169063a9059cbb906044016020604051808303816000875af1158015611a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a5c919061562f565b905080611aa35760405162461bcd60e51b8152602060048201526015602482015274151bdad95b881d1c985b9cd9995c8819985a5b1959605a1b6044820152606401610fbe565b7fcf343f8f9fbc18b83ca8ace5a1d7f60b823933d6fd1e58458dad0d5f210caae9868686604051611ad69392919061564c565b60405180910390a1505050505050565b611aee6144d1565b600b5460ff1615611b115760405162461bcd60e51b8152600401610fbe90615513565b336000908152600e60205260409020548110611b675760405162461bcd60e51b8152602060048201526015602482015274092dcecc2d8d2c840e4cae2eacae6e840d2dcc8caf605b1b6044820152606401610fbe565b336000908152600e60205260408120805483908110611b8857611b8861553f565b60009182526020918290206040805160a0810182526004939093029091018054808452600182015494840194909452600281015460ff81161515928401929092526101009091046001600160a01b031660608301526003015460808201529150611c345760405162461bcd60e51b815260206004820152601860248201527f4e6f20756e7374616b65207265717565737420666f756e6400000000000000006044820152606401610fbe565b8060400151611c855760405162461bcd60e51b815260206004820152601860248201527f556e7374616b65206e6f7420617070726f7665642079657400000000000000006044820152606401610fbe565b600080611c958360200151614193565b9250509150611ca4308261466f565b336000908152600e60205260409020805485908110611cc557611cc561553f565b600091825260208220600491820201828155600181018390556002810180546001600160a81b0319169055600301829055606085015160405163a9059cbb60e01b81523392810192909252602482018590526001600160a01b03169063a9059cbb906044016020604051808303816000875af1158015611d49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6d919061562f565b905080611db55760405162461bcd60e51b81526020600482015260166024820152751dd0d3d35052481d1c985b9cd9995c8819985a5b195960521b6044820152606401610fbe565b6040805186815242602082015233917ff60fc3345e4a664f6362b5b4012f91076079b5510d9d05200c7bb2dfa42527a1910160405180910390a2505050506116426001600080516020615a3483398151915255565b611e13826116ed565b611e1c81614796565b611e2683836147a0565b50505050565b6001600160a01b0381163314611e555760405163334bd91960e11b815260040160405180910390fd5b611e5f8282614845565b505050565b3360008181526002602090815260408083206001600160a01b03871684529091528120549091610f819185906116dd90866148c1565b611eb26000805160206159ac83398151915233612971565b611ece5760405162461bcd60e51b8152600401610fbe906154c4565b6001600160a01b038116611f245760405162461bcd60e51b815260206004820152601d60248201527f50726f746f636f6c207661756c742063616e6e6f74206265206e756c6c0000006044820152606401610fbe565b601580546001600160a01b0319166001600160a01b0383169081179091556040519081527fc951a375519c58813e1685228d8f3e6598feb2b4b983bf8c884d75ec66df4e7690602001611059565b611f8a6000805160206159ac83398151915233612971565b611fa65760405162461bcd60e51b8152600401610fbe906154c4565b6014811061200a5760405162461bcd60e51b815260206004820152602b60248201527f5374616b696e67206665652063616e6e6f74206265206d6f7265207468616e2060448201526a0657175616c20746f2032360ac1b6064820152608401610fbe565b60058190556040518181527f14b8f3121162b96e557f0b6b5ec1ca50101edca232c06fe45c5050b18ed7f5c690602001611059565b6120576000805160206159ac83398151915233612971565b6120735760405162461bcd60e51b8152600401610fbe906154c4565b600081116120935760405162461bcd60e51b8152600401610fbe90615670565b60098190556040518181527f8ae9492f6d2f8c6b1e56cf2abf5f30b8678b0411dedc80a9a26bd32ddb9f1df990602001611059565b6120e06000805160206159ac83398151915233612971565b6120fc5760405162461bcd60e51b8152600401610fbe906154c4565b612105816148cd565b600c612111828261573d565b507fa00e4803eb83f18f2ad4c35f0c8c913b8d36880df9b2e0c9f1f71c9307eb716e816040516110599190615131565b6121596000805160206159ac83398151915233612971565b6121755760405162461bcd60e51b8152600401610fbe906154c4565b662386f26fc100008111156121dd5760405162461bcd60e51b815260206004820152602860248201527f53657276696365206665652063616e6e6f74206265206d6f7265207468616e206044820152670605c6062408aa8960c31b6064820152608401610fbe565b60108190556040518181527f8b38756fb556c8c4a497c16769c97c5da0bd2caafd23456b1b1c9ab4206fba5090602001611059565b61222a6000805160206159ac83398151915233612971565b6122465760405162461bcd60e51b8152600401610fbe906154c4565b612285816040518060400160405280601d81526020017f77434f4d414920616464726573732063616e6e6f74206265206e756c6c000000815250614509565b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f6e8b5beb095ca7ce96c098c0f952592119fe8883380f7304ffcc843b1efedd4390602001611059565b600e60205281600052604060002081815481106122ef57600080fd5b60009182526020909120600490910201805460018201546002830154600390930154919450925060ff82169161010090046001600160a01b03169085565b60008061233960005490565b905060005460000361234e5750600092915050565b61236b8161236561235e60125490565b8690614930565b9061493c565b9392505050565b50919050565b6123906000805160206159ac83398151915233612971565b6123ac5760405162461bcd60e51b8152600401610fbe906154c4565b6123b86012600a6158e1565b6123c390600f6158f0565b811161242b5760405162461bcd60e51b815260206004820152603160248201527f4d696e207374616b696e6720616d6f756e74206d757374206265206d6f7265206044820152707468616e206272696467696e672066656560781b6064820152608401610fbe565b60078190556040518181527f61e72f410bf254d0a4e3ae5404b6179ce38ae766eff8f767dc5a122ee4a1653d90602001611059565b6124786000805160206159ac83398151915233612971565b6124945760405162461bcd60e51b8152600401610fbe906154c4565b601680546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815260016020526040812054610f6e9061232d565b6124e0614948565b565b33806124ec613b39565b6001600160a01b03161461251e5760405163118cdaa760e01b81526001600160a01b0382166004820152602401610fbe565b6116428161497a565b6125517f9e3114703ec4a93cd6bc7e2610274229541e8ba5acacf7825f26bce4fae601e033612971565b61256d5760405162461bcd60e51b8152600401610fbe906155cd565b600b5460ff16156125905760405162461bcd60e51b8152600401610fbe90615513565b6125b2826040518060600160405280602881526020016159cc60289139614509565b600081116126025760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610fbe565b478181101561265f5760405162461bcd60e51b8152602060048201526024808201527f4e6f7420656e6f756768206e617469766520746f6b656e7320696e20636f6e746044820152631c9858dd60e21b6064820152608401610fbe565b6000836001600160a01b03168360405160006040518083038185875af1925050503d80600081146126ac576040519150601f19603f3d011682016040523d82523d6000602084013e6126b1565b606091505b50509050806127025760405162461bcd60e51b815260206004820152601c60248201527f4e617469766520746f6b656e207472616e73666572206661696c6564000000006044820152606401610fbe565b604080516001600160a01b0386168152602081018590527fbf5083663e042fcc8c207dc7c302c797ab721761e0d1ab346cf343341b67f583910160405180910390a150505050565b600c8054612757906156bb565b80601f0160208091040260200160405190810160405280929190818152602001828054612783906156bb565b80156127d05780601f106127a5576101008083540402835291602001916127d0565b820191906000526020600020905b8154815290600101906020018083116127b357829003601f168201915b505050505081565b6127f06000805160206159ac83398151915233612971565b61280c5760405162461bcd60e51b8152600401610fbe906154c4565b606481111561286b5760405162461bcd60e51b815260206004820152602560248201527f556e7374616b696e67206665652063616e6e6f74206265206d6f7265207468616044820152646e2031302560d81b6064820152608401610fbe565b60048190556040518181527f671bd930a19e6b5b8ff84de6230a7b8a922829f8b7581df2e39d50d71f92987490602001611059565b6000807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b546001600160a01b031692915050565b60006128e23384846149b2565b6040518281526001600160a01b0384169033907f9d9c909296d9c674451c0c24f02cb64981eb3b727f99865939192f880a755dcb9060200160405180910390a3600061292d8361232d565b9050836001600160a01b0316336001600160a01b03166000805160206159f48339815191528360405161296291815260200190565b60405180910390a39392505050565b6000918252600080516020615a14833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6129d37f7e21c1f853a961caf8adc0c26c941d090de97558d402e0fe1d0eea44495dee7d33612971565b612a345760405162461bcd60e51b815260206004820152602c60248201527f43616c6c657220646f6573206e6f74206861766520415050524f56455f57495460448201526b4844524157414c5f524f4c4560a01b6064820152608401610fbe565b612a3c6144d1565b600b5460ff1615612a5f5760405162461bcd60e51b8152600401610fbe90615513565b600081612aae5760405162461bcd60e51b815260206004820152601760248201527f526571756573747320617272617920697320656d7074790000000000000000006044820152606401610fbe565b600e600084846000818110612ac557612ac561553f565b612adb9260206040909202019081019150615231565b6001600160a01b03166001600160a01b031681526020019081526020016000208054905083836000818110612b1257612b1261553f565b9050604002016020013510612b735760405162461bcd60e51b815260206004820152602160248201527f4669727374207265717565737420696e646578206f7574206f6620626f756e646044820152607360f81b6064820152608401610fbe565b6000600e600085856000818110612b8c57612b8c61553f565b612ba29260206040909202019081019150615231565b6001600160a01b03166001600160a01b0316815260200190815260200160002084846000818110612bd557612bd561553f565b9050604002016020013581548110612bef57612bef61553f565b600091825260208220600260049092020101546001600160a01b036101009091041691505b83811015612f6f5736858583818110612c2f57612c2f61553f565b604002919091019150600e90506000612c4b6020840184615231565b6001600160a01b03168152602080820192909252604001600020549082013510612caf5760405162461bcd60e51b8152602060048201526015602482015274092dcecc2d8d2c840e4cae2eacae6e840d2dcc8caf605b1b6044820152606401610fbe565b6000600e81612cc16020850185615231565b6001600160a01b03166001600160a01b03168152602001908152602001600020826020013581548110612cf657612cf661553f565b90600052602060002090600402016000015411612d4a5760405162461bcd60e51b815260206004820152601260248201527114995c5d595cdd081a5cc81a5b9d985b1a5960721b6044820152606401610fbe565b600e6000612d5b6020840184615231565b6001600160a01b03166001600160a01b03168152602001908152602001600020816020013581548110612d9057612d9061553f565b600091825260209091206002600490920201015460ff1615612df45760405162461bcd60e51b815260206004820152601b60248201527f5265717565737420697320616c726561647920617070726f76656400000000006044820152606401610fbe565b6001600160a01b038316600e6000612e0f6020850185615231565b6001600160a01b03166001600160a01b03168152602001908152602001600020826020013581548110612e4457612e4461553f565b600091825260209091206004909102016002015461010090046001600160a01b031614612ed95760405162461bcd60e51b815260206004820152603960248201527f5772617070656420746f6b656e206973206e6f74207468652073616d6520616360448201527f726f737320616c6c20756e7374616b65207265717565737473000000000000006064820152608401610fbe565b600080612f3b600e82612eef6020870187615231565b6001600160a01b03166001600160a01b03168152602001908152602001600020846020013581548110612f2457612f2461553f565b906000526020600020906004020160010154614193565b9250509150808287612f4d9190615907565b612f579190615907565b95505050508080612f679061556b565b915050612c14565b50604051636eb1769f60e11b815233600482015230602482015282906001600160a01b0383169063dd62ed3e90604401602060405180830381865afa158015612fbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe09190615616565b101561302e5760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420746f6b656e20616c6c6f77616e6365000000006044820152606401610fbe565b60005b838110156130d4573685858381811061304c5761304c61553f565b60400291909101915060019050600e600061306a6020850185615231565b6001600160a01b03166001600160a01b0316815260200190815260200160002082602001358154811061309f5761309f61553f565b60009182526020909120600490910201600201805460ff191691151591909117905550806130cc8161556b565b915050613031565b506040516323b872dd60e01b81526001600160a01b038216906323b872dd906131059033903090879060040161564c565b6020604051808303816000875af1158015613124573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613148919061562f565b6131945760405162461bcd60e51b815260206004820152601860248201527f636f6d6169416d74207472616e73666572206661696c656400000000000000006044820152606401610fbe565b60005b8381101561322c57368585838181106131b2576131b261553f565b6040029190910191506131ca90506020820182615231565b6001600160a01b03167f6989ab5544b7750d8fd06869e7fc1852b2f28bf9d75e9fa272405986fd263a64826020013542604051613211929190918252602082015260400190565b60405180910390a250806132248161556b565b915050613197565b5050506132466001600080516020615a3483398151915255565b5050565b3360009081526002602090815260408083206001600160a01b0386168452909152812054828110156132be5760405162461bcd60e51b815260206004820152601e60248201527f4445435245415345445f414c4c4f57414e43455f42454c4f575f5a45524f00006044820152606401610fbe565b6132cd33856116dd8487614663565b5060019392505050565b6132ef6000805160206159ac83398151915233612971565b61330b5760405162461bcd60e51b8152600401610fbe906154c4565b6000811161332b5760405162461bcd60e51b8152600401610fbe90615670565b600a55565b6000610f813384846145bd565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff166000811580156133835750825b905060008267ffffffffffffffff1660011480156133a05750303b155b9050811580156133ae575080155b156133cc5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156133f657845460ff60401b1916600160401b1785555b6001600160a01b038a166134435760405162461bcd60e51b815260206004820152601460248201527313dddb995c8818d85b9b9bdd081899481b9d5b1b60621b6044820152606401610fbe565b61344c8a614b22565b613454614b33565b61345c614b3b565b613467600080614b4b565b61347260008b6147a0565b5061348b600080516020615a548339815191528b6147a0565b506134a46000805160206159ac8339815191528b6147a0565b506134cf7f7e21c1f853a961caf8adc0c26c941d090de97558d402e0fe1d0eea44495dee7d8b6147a0565b506134fa7f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d8b6147a0565b50600880546001600160a01b03808c166001600160a01b031992831617909255601580548a8416908316179055600f8054928d1692909116919091179055613541886148cd565b600c61354d898261573d565b506003600655600a6004556000600555660aa87bee538000601055601261357590600a6158e1565b61358290620f42406158f0565b6009556135916012600a6158e1565b61359c90600f6158f0565b6007556135ab6012600a6158e1565b6135b890620f42406158f0565b600d556706f05b59d3b200006013556714d1120d7b160000601455670de0b6b3a76400006003556135eb6012600a6158e1565b6135f890620f42406158f0565b600a55601680546001600160a01b0319166001600160a01b03881617905561361f8a61497a565b831561366557845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050565b6000670de0b6b3a76400006003548361368a91906158f0565b610f6e919061591a565b6136ac600080516020615a5483398151915233612971565b6136c85760405162461bcd60e51b8152600401610fbe90615584565b600081116137185760405162461bcd60e51b815260206004820152601c60248201527f4e65772072617465206d757374206265206d6f7265207468616e2030000000006044820152606401610fbe565b601354811015801561372c57506014548111155b6137785760405162461bcd60e51b815260206004820152601e60248201527f4e65772072617465206d7573742062652077697468696e20626f756e647300006044820152606401610fbe565b600060135411801561378c57506000601454115b6137d85760405162461bcd60e51b815260206004820152601a60248201527f426f756e6473206d757374206265206d6f7265207468616e20300000000000006044820152606401610fbe565b60038190556040518181527f4fc1b45960547ee95894b08a284c3c066cf5aca706a7420639c42c3ec2e118a490602001611059565b6138256000805160206159ac83398151915233612971565b6138415760405162461bcd60e51b8152600401610fbe906154c4565b600061016d620f42408360125461385891906158f0565b613862919061591a565b61386c919061591a565b90508060125461387c9190615907565b6012819055426011556000547fa904dcf42a3461c90173c0b966672b2cb4350e529ea12d44e562fcec43836324918491604080519384526020840192909252908201526060810183905242608082015260a00160405180910390a15050565b6000806138e760125490565b9050806000036138fa5750600092915050565b61236b8161236561235e60005490565b60035460009061368a83670de0b6b3a76400006158f0565b61393a6000805160206159ac83398151915233612971565b6139565760405162461bcd60e51b8152600401610fbe906154c4565b600381116139b45760405162461bcd60e51b815260206004820152602560248201527f4272696467696e67206665652073686f756c64206265206d6f7265207468616e60448201526420302e332560d81b6064820152608401610fbe565b60068190556040518181527f04d485944ec6b81a573c140fc8ea83b6738f1bbb036d17d185027a5c4107cdf990602001611059565b613a01600080516020615a5483398151915233612971565b613a1d5760405162461bcd60e51b8152600401610fbe90615584565b60008111613a795760405162461bcd60e51b815260206004820152602360248201527f4e6577206c6f77657220626f756e64206d757374206265206d6f72652074686160448201526206e20360ec1b6064820152608401610fbe565b6014548110613ae85760405162461bcd60e51b815260206004820152603560248201527f4e6577206c6f77657220626f756e64206d757374206265206c657373207468616044820152741b8818dd5c9c995b9d081d5c1c195c88189bdd5b99605a1b6064820152608401610fbe565b60138190556040518181527ff995fb2f30f70b5dacab19046768ab20d01b477e6a3a0075a2fb2fad3872b77690602001611059565b613b26826116ed565b613b2f81614796565b611e268383614845565b6000807f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c006128c5565b60008060006006548411613bcd5760405162461bcd60e51b815260206004820152602c60248201527f77434f4d414920616d6f756e74206d757374206265206d6f7265207468616e2060448201526b6272696467696e672066656560a01b6064820152608401610fbe565b60006103e860065486613be091906158f0565b613bea919061591a565b9050613bf86012600a6158e1565b613c039060016158f0565b811015613c2457613c166012600a6158e1565b613c219060016158f0565b90505b6000613c30828761593c565b90506000806005541115613c5c576103e860055483613c4f91906158f0565b613c59919061591a565b90505b6000613c68828461593c565b905060008111613ccc5760405162461bcd60e51b815260206004820152602960248201527f5772617020616d6f756e7420616674657220666565206d757374206265206d6f60448201526807265207468616e20360bc1b6064820152608401610fbe565b9792965094509092505050565b6000613ce36144d1565b600b5460ff1615613d065760405162461bcd60e51b8152600401610fbe90615513565b816009541015613d585760405162461bcd60e51b815260206004820152601e60248201527f4465706f73697420616d6f756e742065786365656473206d6178696d756d00006044820152606401610fbe565b601254600a541015613dac5760405162461bcd60e51b815260206004820152601e60248201527f4465706f73697420616d6f756e742065786365656473206d6178696d756d00006044820152606401610fbe565b6000600c8054613dbb906156bb565b80601f0160208091040260200160405190810160405280929190818152602001828054613de7906156bb565b8015613e345780601f10613e0957610100808354040283529160200191613e34565b820191906000526020600020905b815481529060010190602001808311613e1757829003601f168201915b5050600854939450506001600160a01b039092169150613e559050826148cd565b613e94816040518060400160405280601f81526020017f77726170706564546f6b656e206164647265737320697320696e76616c696400815250614509565b6040516370a0823160e01b815233600482015284906001600160a01b038316906370a0823190602401602060405180830381865afa158015613eda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613efe9190615616565b1015613f4c5760405162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e742077434f4d41492062616c616e636500000000006044820152606401610fbe565b60155460408051606081019091526022808252613f7b926001600160a01b031691906159696020830139614509565b600754841015613fd95760405162461bcd60e51b8152602060048201526024808201527f446f6573206e6f74206d656574206d696e696d756d207374616b696e6720616d6044820152631bdd5b9d60e21b6064820152608401610fbe565b6000806000613fe787613b62565b9250925092506000613ff884613671565b90506140043382614bae565b61400e338361466f565b600061401a8486615907565b905061402581614c28565b6016546040516302a3830960e41b81526001600160a01b0390911690632a383090906140579084908b9060040161594f565b600060405180830381600087803b15801561407157600080fd5b505af1158015614085573d6000803e3d6000fd5b505060408051428152602081018d90529081018590523392507f445b6299c386d845a282565eba224a183ae1062133e1b062b35d93f855fd59bd915060600160405180910390a250955050505050506140eb6001600080516020615a3483398151915255565b919050565b6140f8614948565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319166001600160a01b038316908117825561413c6128a0565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a35050565b6001600160a01b038116600090815260016020526040812054610f6e565b6000806000806103e8600454866141aa91906158f0565b6141b4919061591a565b905060006103e8600654876141c991906158f0565b6141d3919061591a565b90506141e16012600a6158e1565b6141ec9060016158f0565b81101561420d576141ff6012600a6158e1565b61420a9060016158f0565b90505b60008261421a838961593c565b614224919061593c565b9791965091945092505050565b6001600160a01b0381166000908152600e60209081526040808320805482518185028101850190935280835260609492939192909184015b828210156142d75760008481526020908190206040805160a081018252600486029092018054835260018082015484860152600282015460ff81161515938501939093526101009092046001600160a01b031660608401526003015460808301529083529092019101614269565b505050509050919050565b6142fa6000805160206159ac83398151915233612971565b6143165760405162461bcd60e51b8152600401610fbe906154c4565b6001600160a01b0381166143765760405162461bcd60e51b815260206004820152602160248201527f5769746864726177616c206d616e616765722063616e6e6f74206265206e756c6044820152601b60fa1b6064820152608401610fbe565b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527fd85a538f003fe4c6d5aaff33960bcc7bcf9f994d5a6ddda17b8e8901b57bf7df90602001611059565b6001600160a01b03831661441a5760405162461bcd60e51b815260206004820152601960248201527f415050524f56455f46524f4d5f5a45524f5f41444452455353000000000000006044820152606401610fbe565b6001600160a01b0382166144705760405162461bcd60e51b815260206004820152601760248201527f415050524f56455f544f5f5a45524f5f414444524553530000000000000000006044820152606401610fbe565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600080516020615a3483398151915280546001190161450357604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b806001600160a01b038316611e5f5760405162461bcd60e51b8152600401610fbe9190615131565b600061453c826138db565b90506145488382614cfd565b50816012600082825461455b919061593c565b9091555050604080518381524260208201526001600160a01b038516917f49995e5dd6158cf69ad3e9777c46755a1a826a446c6416992167462dad033b2a91015b60405180910390a2505050565b6001600080516020615a3483398151915255565b60006145c8826138db565b90506145d58484836149b2565b826001600160a01b0316846001600160a01b03166000805160206159f48339815191528460405161460891815260200190565b60405180910390a3826001600160a01b0316846001600160a01b03167f9d9c909296d9c674451c0c24f02cb64981eb3b727f99865939192f880a755dcb8360405161465591815260200190565b60405180910390a350505050565b600061236b828461593c565b801561324657306001600160a01b0383160361475d5760085460155460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810184905291169063a9059cbb906044015b6020604051808303816000875af11580156146db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146ff919061562f565b6132465760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220746f2070726f746f636f6c207661756c742061646472656044820152681cdcc819985a5b195960ba1b6064820152608401610fbe565b6008546015546040516323b872dd60e01b81526001600160a01b03928316926323b872dd926146bc92879290911690869060040161564c565b6116428133614e9b565b6000600080516020615a148339815191526147bb8484612971565b61483b576000848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556147f13390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610f6e565b6000915050610f6e565b6000600080516020615a148339815191526148608484612971565b1561483b576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610f6e565b600061236b8284615907565b80516030146116425760405162461bcd60e51b815260206004820152602960248201527f6e617469766557616c6c65745265636569766572206d757374206265206f66206044820152680d8cadccee8d04068760bb1b6064820152608401610fbe565b600061236b82846158f0565b600061236b828461591a565b336149516128a0565b6001600160a01b0316146124e05760405163118cdaa760e01b8152336004820152602401610fbe565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b031916815561324682614ed4565b6001600160a01b038316614a085760405162461bcd60e51b815260206004820152601e60248201527f5452414e534645525f46524f4d5f5448455f5a45524f5f4144445245535300006044820152606401610fbe565b6001600160a01b038216614a5e5760405162461bcd60e51b815260206004820152601c60248201527f5452414e534645525f544f5f5448455f5a45524f5f41444452455353000000006044820152606401610fbe565b6001600160a01b03831660009081526001602052604090205480821115614ac75760405162461bcd60e51b815260206004820152601f60248201527f5452414e534645525f414d4f554e545f455843454544535f42414c414e4345006044820152606401610fbe565b614ad18183614663565b6001600160a01b038086166000908152600160205260408082209390935590851681522054614b0090836148c1565b6001600160a01b03909316600090815260016020526040902092909255505050565b614b2a614f45565b61164281614f8e565b6124e0614f45565b614b43614f45565b6124e0614fc0565b600080516020615a148339815191526000614b65846116ed565b600085815260208490526040808220600101869055519192508491839187917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a450505050565b6000614bb9826138db565b905080600003614bc65750805b614bd08382614fc8565b508160126000828254614be39190615907565b9091555050604080518381524260208201526001600160a01b038516917f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f910161459c565b8015611642576008546040516323b872dd60e01b81526001600160a01b03909116906323b872dd90614c629033903090869060040161564c565b6020604051808303816000875af1158015614c81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ca5919061562f565b6116425760405162461bcd60e51b815260206004820152602360248201527f5472616e7366657220746f20636f6e74726163742061646472657373206661696044820152621b195960ea1b6064820152608401610fbe565b60006001600160a01b038316614d555760405162461bcd60e51b815260206004820152601a60248201527f4255524e5f46524f4d5f5448455f5a45524f5f414444524553530000000000006044820152606401610fbe565b6001600160a01b03831660009081526001602052604090205480831115614dbe5760405162461bcd60e51b815260206004820152601b60248201527f4255524e5f414d4f554e545f455843454544535f42414c414e434500000000006044820152606401610fbe565b6000614dc98461232d565b9050614dde84614dd860005490565b90614663565b60008190559250614def8285614663565b6001600160a01b038616600090815260016020526040812091909155614e148561232d565b60408051848152602081018390529081018790529091506001600160a01b038716907f8b2a1e1ad5e0578c3dd82494156e985dade827a87c573b5c1c7716a32162ad649060600160405180910390a26040518281526000906001600160a01b038816906000805160206159f48339815191529060200160405180910390a350505092915050565b614ea58282612971565b6132465760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610fbe565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166124e057604051631afcd79f60e31b815260040160405180910390fd5b614f96614f45565b6001600160a01b03811661251e57604051631e4fbdf760e01b815260006004820152602401610fbe565b6145a9614f45565b60006001600160a01b0383166150205760405162461bcd60e51b815260206004820152601860248201527f4d494e545f544f5f5448455f5a45524f5f4144445245535300000000000000006044820152606401610fbe565b600061502b8361232d565b9050806000036150385750815b61504b8361504560005490565b906148c1565b60008181556001600160a01b03861681526001602052604090205490925061507390846148c1565b6001600160a01b0385166000818152600160205260408082209390935591519091906000805160206159f4833981519152906150b29085815260200190565b60405180910390a35092915050565b6000602082840312156150d357600080fd5b81356001600160e01b03198116811461236b57600080fd5b6000815180845260005b81811015615111576020818501810151868301820152016150f5565b506000602082860101526020601f19601f83011685010191505092915050565b60208152600061236b60208301846150eb565b80356001600160a01b03811681146140eb57600080fd5b6000806040838503121561516e57600080fd5b61517783615144565b946020939093013593505050565b60006020828403121561519757600080fd5b5035919050565b801515811461164257600080fd5b6000602082840312156151be57600080fd5b813561236b8161519e565b6000806000606084860312156151de57600080fd5b6151e784615144565b92506151f560208501615144565b9150604084013590509250925092565b6000806040838503121561521857600080fd5b8235915061522860208401615144565b90509250929050565b60006020828403121561524357600080fd5b61236b82615144565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261527357600080fd5b813567ffffffffffffffff8082111561528e5761528e61524c565b604051601f8301601f19908116603f011681019082821181831017156152b6576152b661524c565b816040528381528660208588010111156152cf57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60006020828403121561530157600080fd5b813567ffffffffffffffff81111561531857600080fd5b61532484828501615262565b949350505050565b6000806020838503121561533f57600080fd5b823567ffffffffffffffff8082111561535757600080fd5b818501915085601f83011261536b57600080fd5b81358181111561537a57600080fd5b8660208260061b850101111561538f57600080fd5b60209290920196919550909350505050565b600080600080600060a086880312156153b957600080fd5b6153c286615144565b94506153d060208701615144565b9350604086013567ffffffffffffffff8111156153ec57600080fd5b6153f888828901615262565b93505061540760608701615144565b915061541560808701615144565b90509295509295909350565b6000806040838503121561543457600080fd5b61543d83615144565b915061522860208401615144565b602080825282518282018190526000919060409081850190868401855b828110156154b7578151805185528681015187860152858101511515868601526060808201516001600160a01b0316908601526080908101519085015260a09093019290850190600101615468565b5091979650505050505050565b6020808252602f908201527f43616c6c657220646f6573206e6f742068617665204d414e4147455f5354414b60408201526e494e475f5550444154455f524f4c4560881b606082015260800190565b60208082526012908201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161557d5761557d615555565b5060010190565b60208082526029908201527f43616c6c657220646f6573206e6f7420686176652045584348414e47455f5550604082015268444154455f524f4c4560b81b606082015260800190565b60208082526029908201527f43616c6c657220646f6573206e6f74206861766520544f4b454e5f534146455f60408201526850554c4c5f524f4c4560b81b606082015260800190565b60006020828403121561562857600080fd5b5051919050565b60006020828403121561564157600080fd5b815161236b8161519e565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020808252602b908201527f4d6178206465706f736974207065722072657175657374206d7573742062652060408201526a06d6f7265207468616e20360ac1b606082015260800190565b600181811c908216806156cf57607f821691505b60208210810361237257634e487b7160e01b600052602260045260246000fd5b601f821115611e5f57600081815260208120601f850160051c810160208610156157165750805b601f850160051c820191505b8181101561573557828155600101615722565b505050505050565b815167ffffffffffffffff8111156157575761575761524c565b61576b8161576584546156bb565b846156ef565b602080601f8311600181146157a057600084156157885750858301515b600019600386901b1c1916600185901b178555615735565b600085815260208120601f198616915b828110156157cf578886015182559484019460019091019084016157b0565b50858210156157ed5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600181815b8085111561583857816000190482111561581e5761581e615555565b8085161561582b57918102915b93841c9390800290615802565b509250929050565b60008261584f57506001610f6e565b8161585c57506000610f6e565b8160018114615872576002811461587c57615898565b6001915050610f6e565b60ff84111561588d5761588d615555565b50506001821b610f6e565b5060208310610133831016604e8410600b84101617156158bb575081810a610f6e565b6158c583836157fd565b80600019048211156158d9576158d9615555565b029392505050565b600061236b60ff841683615840565b8082028115828204841417610f6e57610f6e615555565b80820180821115610f6e57610f6e615555565b60008261593757634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610f6e57610f6e615555565b82815260406020820152600061532460408301846150eb56fe50726f746f636f6c207661756c7420616464726573732063616e6e6f7420626520307769746864726177616c20616464726573732063616e6e6f74206265206e756c6ccdc459158320f1e5dc6a2790e6223a1fae30e193e0b9c0c623cd787aee91ddd3526563697069656e7420616464726573732063616e6e6f74206265206e756c6c2061646472657373ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f008265d83785d3287e7d7481132632b4a43778b737fb1aeb3bb294f9e9984de840a2646970667358221220334d013fbd9bd5a9fb335796eb901c0fa996bd84e193c9842e6298d0776a8b6164736f6c63430008140033
Deployed Bytecode
0x6080604052600436106104945760003560e01c80637b9fe08711610260578063b9e205ae11610144578063dd62ed3e116100c1578063eff9884311610085578063eff9884314610e7a578063f2fde38b14610e90578063f5eb42dc14610eb0578063f96bc9f614610ed0578063fb8363b614610ef0578063fc72ed5b14610f1d57600080fd5b8063dd62ed3e14610da4578063e30c397814610dea578063e6c8a5f314610dff578063e78cea9214610e3a578063ea598cb014610e5a57600080fd5b8063cc23e3a211610108578063cc23e3a214610d0d578063cc4eedc914610d2d578063d5002f2e14610d4d578063d547741f14610d62578063d8990b6614610d8257600080fd5b8063b9e205ae14610c77578063bc4f2d6d14610c97578063be2b9cd514610cb7578063c23c9e0314610ccd578063c448c4e114610ced57600080fd5b806395d89b41116101dd578063a7602c7e116101a1578063a7602c7e14610bc7578063a7d6889614610bdd578063a9059cbb14610bfd578063ac4a0fb614610c1d578063b187bd2614610c3d578063b1ed4a6c14610c5757600080fd5b806395d89b4114610b22578063996c6cc314610b52578063a1e8028014610b72578063a217fddf14610b92578063a457c2d714610ba757600080fd5b806389067c5e1161022457806389067c5e14610aa15780638abdf5aa14610ab75780638da5cb5b14610acd5780638fcb4e5b14610ae257806391d1485414610b0257600080fd5b80637b9fe08714610a165780637e203c8b14610a36578063829c1c5714610a4b57806382d85ad314610a6b57806382fe535a14610a8157600080fd5b806339509351116103875780635cdf76f81161030457806368cd79b3116102c857806368cd79b31461096a5780636eb382121461098a5780636f6c3529146109aa57806370a08231146109cc578063715018a6146109ec57806379ba509714610a0157600080fd5b80635cdf76f81461089e5780635cf4cde0146108be578063603d0f77146108d457806366442a06146108f4578063687080da1461094a57600080fd5b80634310d1281161034b5780634310d128146107dc57806344be0404146108105780634772daef1461083057806358e3b5ec146108505780635a9249e61461086657600080fd5b8063395093511461073257806339c5dec7146107525780633ba0b9a914610772578063410dbf7e14610788578063420fa47e146107a857600080fd5b806323b872dd116104155780632f2ff15d116103d95780632f2ff15d1461068c578063313ce567146106ac578063355274ea146106c857806336568abe146106de578063389ed267146106fe57600080fd5b806323b872dd146105ec578063248a9ca31461060c5780632680f5cd1461062c5780632d1ede9a1461064c5780632e17de781461066c57600080fd5b80631723be121161045c5780631723be121461057457806318160ddd146105985780631924063e146105ad57806320ba5698146105c357806323095721146105d957600080fd5b806301ffc9a71461049957806306fdde03146104ce578063095ea7b3146105125780630fbdc6771461053257806316c38b3c14610554575b600080fd5b3480156104a557600080fd5b506104b96104b43660046150c1565b610f3d565b60405190151581526020015b60405180910390f35b3480156104da57600080fd5b506040805180820190915260128152715269767573205374616b656420434f4d414960701b60208201525b6040516104c59190615131565b34801561051e57600080fd5b506104b961052d36600461515b565b610f74565b34801561053e57600080fd5b5061055261054d366004615185565b610f8a565b005b34801561056057600080fd5b5061055261056f3660046151ac565b611064565b34801561058057600080fd5b5061058a60145481565b6040519081526020016104c5565b3480156105a457600080fd5b5061058a611121565b3480156105b957600080fd5b5061058a60115481565b3480156105cf57600080fd5b5061058a60045481565b6105526105e7366004615185565b611131565b3480156105f857600080fd5b506104b96106073660046151c9565b611645565b34801561061857600080fd5b5061058a610627366004615185565b6116ed565b34801561063857600080fd5b50610552610647366004615185565b61170f565b34801561065857600080fd5b506105526106673660046151c9565b61184b565b34801561067857600080fd5b50610552610687366004615185565b611ae6565b34801561069857600080fd5b506105526106a7366004615205565b611e0a565b3480156106b857600080fd5b50604051601281526020016104c5565b3480156106d457600080fd5b5061058a600a5481565b3480156106ea57600080fd5b506105526106f9366004615205565b611e2c565b34801561070a57600080fd5b5061058a7f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d81565b34801561073e57600080fd5b506104b961074d36600461515b565b611e64565b34801561075e57600080fd5b5061055261076d366004615231565b611e9a565b34801561077e57600080fd5b5061058a60035481565b34801561079457600080fd5b506105526107a3366004615185565b611f72565b3480156107b457600080fd5b5061058a7f9e3114703ec4a93cd6bc7e2610274229541e8ba5acacf7825f26bce4fae601e081565b3480156107e857600080fd5b5061058a7f7e21c1f853a961caf8adc0c26c941d090de97558d402e0fe1d0eea44495dee7d81565b34801561081c57600080fd5b5061055261082b366004615185565b61203f565b34801561083c57600080fd5b5061055261084b3660046152ef565b6120c8565b34801561085c57600080fd5b5061058a60135481565b34801561087257600080fd5b50601554610886906001600160a01b031681565b6040516001600160a01b0390911681526020016104c5565b3480156108aa57600080fd5b506105526108b9366004615185565b612141565b3480156108ca57600080fd5b5061058a60075481565b3480156108e057600080fd5b506105526108ef366004615231565b612212565b34801561090057600080fd5b5061091461090f36600461515b565b6122d3565b604080519586526020860194909452911515928401929092526001600160a01b039091166060830152608082015260a0016104c5565b34801561095657600080fd5b5061058a610965366004615185565b61232d565b34801561097657600080fd5b50610552610985366004615185565b612378565b34801561099657600080fd5b506105526109a5366004615231565b612460565b3480156109b657600080fd5b5061058a600080516020615a5483398151915281565b3480156109d857600080fd5b5061058a6109e7366004615231565b6124b6565b3480156109f857600080fd5b506105526124d8565b348015610a0d57600080fd5b506105526124e2565b348015610a2257600080fd5b50610552610a3136600461515b565b612527565b348015610a4257600080fd5b5061050561274a565b348015610a5757600080fd5b50610552610a66366004615185565b6127d8565b348015610a7757600080fd5b5061058a60125481565b348015610a8d57600080fd5b50600f54610886906001600160a01b031681565b348015610aad57600080fd5b5061058a60065481565b348015610ac357600080fd5b5061058a60105481565b348015610ad957600080fd5b506108866128a0565b348015610aee57600080fd5b5061058a610afd36600461515b565b6128d5565b348015610b0e57600080fd5b506104b9610b1d366004615205565b612971565b348015610b2e57600080fd5b506040805180820190915260078152667273434f4d414960c81b6020820152610505565b348015610b5e57600080fd5b50600854610886906001600160a01b031681565b348015610b7e57600080fd5b50610552610b8d36600461532c565b6129a9565b348015610b9e57600080fd5b5061058a600081565b348015610bb357600080fd5b506104b9610bc236600461515b565b61324a565b348015610bd357600080fd5b5061058a600d5481565b348015610be957600080fd5b50610552610bf8366004615185565b6132d7565b348015610c0957600080fd5b506104b9610c1836600461515b565b613330565b348015610c2957600080fd5b50610552610c383660046153a1565b61333d565b348015610c4957600080fd5b50600b546104b99060ff1681565b348015610c6357600080fd5b5061058a610c72366004615185565b613671565b348015610c8357600080fd5b50610552610c92366004615185565b613694565b348015610ca357600080fd5b50610552610cb2366004615185565b61380d565b348015610cc357600080fd5b5061058a60095481565b348015610cd957600080fd5b5061058a610ce8366004615185565b6138db565b348015610cf957600080fd5b5061058a610d08366004615185565b61390a565b348015610d1957600080fd5b50610552610d28366004615185565b613922565b348015610d3957600080fd5b50610552610d48366004615185565b6139e9565b348015610d5957600080fd5b5060005461058a565b348015610d6e57600080fd5b50610552610d7d366004615205565b613b1d565b348015610d8e57600080fd5b5061058a6000805160206159ac83398151915281565b348015610db057600080fd5b5061058a610dbf366004615421565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b348015610df657600080fd5b50610886613b39565b348015610e0b57600080fd5b50610e1f610e1a366004615185565b613b62565b604080519384526020840192909252908201526060016104c5565b348015610e4657600080fd5b50601654610886906001600160a01b031681565b348015610e6657600080fd5b5061058a610e75366004615185565b613cd9565b348015610e8657600080fd5b5061058a60055481565b348015610e9c57600080fd5b50610552610eab366004615231565b6140f0565b348015610ebc57600080fd5b5061058a610ecb366004615231565b614175565b348015610edc57600080fd5b50610e1f610eeb366004615185565b614193565b348015610efc57600080fd5b50610f10610f0b366004615231565b614231565b6040516104c5919061544b565b348015610f2957600080fd5b50610552610f38366004615231565b6142e2565b60006001600160e01b03198216637965db0b60e01b1480610f6e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000610f813384846143c4565b50600192915050565b610fa26000805160206159ac83398151915233612971565b610fc75760405162461bcd60e51b8152600401610fbe906154c4565b60405180910390fd5b600081116110285760405162461bcd60e51b815260206004820152602860248201527f4d617820756e7374616b65207265717565737473206d757374206265206d6f72604482015267065207468616e20360c41b6064820152608401610fbe565b600d8190556040518181527f3822db87795eff9f96c9dca0cd5bc25a68f62c46e0bc261b5f67bbd5a598c495906020015b60405180910390a150565b61108e7f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d33612971565b6110da5760405162461bcd60e51b815260206004820152601f60248201527f43616c6c657220646f6573206e6f7420686176652050415553455f524f4c45006044820152606401610fbe565b600b805460ff191682151590811790915560405160ff909116151581527f752d7e161ff5146f80e3820893176eb40532811e5e20400dfdde57455213706a90602001611059565b600061112c60125490565b905090565b6111396144d1565b600b5460ff161561115c5760405162461bcd60e51b8152600401610fbe90615513565b60085460408051808201909152601f81527f77726170706564546f6b656e206164647265737320697320696e76616c69640060208201526111a6916001600160a01b031690614509565b600f54604080516060810190915260218082526111d5926001600160a01b0316919061598b6020830139614509565b60006111e08261390a565b90506010543410156112345760405162461bcd60e51b815260206004820152601c60248201527f46656520616d6f756e74206973206e6f742073756666696369656e74000000006044820152606401610fbe565b8161123e336124b6565b101561128c5760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74207273434f4d41492062616c616e6365000000006044820152606401610fbe565b336000908152600e602052604081205490805b8281101561141e57336000908152600e602052604081208054839081106112c8576112c861553f565b6000918252602090912060049091020154905080156112e7575061140c565b6040805160a081018252878152602080820188905260008284018190526008546001600160a01b03166060840152426080840152338152600e909152919091208054849081106113395761133961553f565b6000918252602091829020835160049290920201908155828201516001808301919091556040808501516002840180546060808901516001600160a81b0319909216931515610100600160a81b031916939093176101006001600160a01b039283160217909155608096870151600390950194909455600854825189815242968101969096529185018c905284018a90529091169282019290925290935033907fbacf71ad475b68e36b9cd14cedd8cf7d1f098c65f4c59255d2ade1ceae5782529060a00160405180910390a25061141e565b806114168161556b565b91505061129f565b50806115a457600d54336000908152600e60205260409020541061148e5760405162461bcd60e51b815260206004820152602160248201527f4d6178696d756d20756e7374616b6520726571756573747320657863656564656044820152601960fa1b6064820152608401610fbe565b336000818152600e60209081526040808320815160a081018352898152808401898152818401868152600880546001600160a01b03908116606086019081524260808701818152885460018181018b55998d529a909b2096516004909a0290960198895593519588019590955590516002870180549351861661010002610100600160a81b0319921515929092166001600160a81b031990941693909317179091559451600390940193909355925490517fbacf71ad475b68e36b9cd14cedd8cf7d1f098c65f4c59255d2ade1ceae5782529361159b93889390928b928b9216909485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b60405180910390a25b6115ae3385614531565b600f546010546040516000926001600160a01b03169180156108fc029184818181858888f193505050509050806116275760405162461bcd60e51b815260206004820152601b60248201527f5365727669636520666565207472616e73666572206661696c656400000000006044820152606401610fbe565b505050506116426001600080516020615a3483398151915255565b50565b6001600160a01b0383166000908152600260209081526040808320338452909152812054828110156116c35760405162461bcd60e51b815260206004820152602160248201527f5452414e534645525f414d4f554e545f455843454544535f414c4c4f57414e436044820152604560f81b6064820152608401610fbe565b6116ce8585856145bd565b6116e285336116dd8487614663565b6143c4565b506001949350505050565b6000908152600080516020615a14833981519152602052604090206001015490565b611727600080516020615a5483398151915233612971565b6117435760405162461bcd60e51b8152600401610fbe90615584565b6000811161179f5760405162461bcd60e51b815260206004820152602360248201527f4e657720757070657220626f756e64206d757374206265206d6f72652074686160448201526206e20360ec1b6064820152608401610fbe565b60135481116118165760405162461bcd60e51b815260206004820152603860248201527f4e657720757070657220626f756e64206d75737420626520677265617465722060448201527f7468616e2063757272656e74206c6f77657220626f756e6400000000000000006064820152608401610fbe565b60148190556040518181527f4091f60ba6c7aad614db78570cc879e0c6c771deb4738653a4e5acda9cf3b24f90602001611059565b6118757f9e3114703ec4a93cd6bc7e2610274229541e8ba5acacf7825f26bce4fae601e033612971565b6118915760405162461bcd60e51b8152600401610fbe906155cd565b600b5460ff16156118b45760405162461bcd60e51b8152600401610fbe90615513565b6118d6826040518060600160405280602881526020016159cc60289139614509565b600081116119265760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610fbe565b6040516370a0823160e01b815230600482015283906000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561196f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119939190615616565b9050828110156119e55760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420656e6f75676820746f6b656e7320696e20636f6e74726163740000006044820152606401610fbe565b60405163a9059cbb60e01b81526001600160a01b038581166004830152602482018590526000919084169063a9059cbb906044016020604051808303816000875af1158015611a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a5c919061562f565b905080611aa35760405162461bcd60e51b8152602060048201526015602482015274151bdad95b881d1c985b9cd9995c8819985a5b1959605a1b6044820152606401610fbe565b7fcf343f8f9fbc18b83ca8ace5a1d7f60b823933d6fd1e58458dad0d5f210caae9868686604051611ad69392919061564c565b60405180910390a1505050505050565b611aee6144d1565b600b5460ff1615611b115760405162461bcd60e51b8152600401610fbe90615513565b336000908152600e60205260409020548110611b675760405162461bcd60e51b8152602060048201526015602482015274092dcecc2d8d2c840e4cae2eacae6e840d2dcc8caf605b1b6044820152606401610fbe565b336000908152600e60205260408120805483908110611b8857611b8861553f565b60009182526020918290206040805160a0810182526004939093029091018054808452600182015494840194909452600281015460ff81161515928401929092526101009091046001600160a01b031660608301526003015460808201529150611c345760405162461bcd60e51b815260206004820152601860248201527f4e6f20756e7374616b65207265717565737420666f756e6400000000000000006044820152606401610fbe565b8060400151611c855760405162461bcd60e51b815260206004820152601860248201527f556e7374616b65206e6f7420617070726f7665642079657400000000000000006044820152606401610fbe565b600080611c958360200151614193565b9250509150611ca4308261466f565b336000908152600e60205260409020805485908110611cc557611cc561553f565b600091825260208220600491820201828155600181018390556002810180546001600160a81b0319169055600301829055606085015160405163a9059cbb60e01b81523392810192909252602482018590526001600160a01b03169063a9059cbb906044016020604051808303816000875af1158015611d49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6d919061562f565b905080611db55760405162461bcd60e51b81526020600482015260166024820152751dd0d3d35052481d1c985b9cd9995c8819985a5b195960521b6044820152606401610fbe565b6040805186815242602082015233917ff60fc3345e4a664f6362b5b4012f91076079b5510d9d05200c7bb2dfa42527a1910160405180910390a2505050506116426001600080516020615a3483398151915255565b611e13826116ed565b611e1c81614796565b611e2683836147a0565b50505050565b6001600160a01b0381163314611e555760405163334bd91960e11b815260040160405180910390fd5b611e5f8282614845565b505050565b3360008181526002602090815260408083206001600160a01b03871684529091528120549091610f819185906116dd90866148c1565b611eb26000805160206159ac83398151915233612971565b611ece5760405162461bcd60e51b8152600401610fbe906154c4565b6001600160a01b038116611f245760405162461bcd60e51b815260206004820152601d60248201527f50726f746f636f6c207661756c742063616e6e6f74206265206e756c6c0000006044820152606401610fbe565b601580546001600160a01b0319166001600160a01b0383169081179091556040519081527fc951a375519c58813e1685228d8f3e6598feb2b4b983bf8c884d75ec66df4e7690602001611059565b611f8a6000805160206159ac83398151915233612971565b611fa65760405162461bcd60e51b8152600401610fbe906154c4565b6014811061200a5760405162461bcd60e51b815260206004820152602b60248201527f5374616b696e67206665652063616e6e6f74206265206d6f7265207468616e2060448201526a0657175616c20746f2032360ac1b6064820152608401610fbe565b60058190556040518181527f14b8f3121162b96e557f0b6b5ec1ca50101edca232c06fe45c5050b18ed7f5c690602001611059565b6120576000805160206159ac83398151915233612971565b6120735760405162461bcd60e51b8152600401610fbe906154c4565b600081116120935760405162461bcd60e51b8152600401610fbe90615670565b60098190556040518181527f8ae9492f6d2f8c6b1e56cf2abf5f30b8678b0411dedc80a9a26bd32ddb9f1df990602001611059565b6120e06000805160206159ac83398151915233612971565b6120fc5760405162461bcd60e51b8152600401610fbe906154c4565b612105816148cd565b600c612111828261573d565b507fa00e4803eb83f18f2ad4c35f0c8c913b8d36880df9b2e0c9f1f71c9307eb716e816040516110599190615131565b6121596000805160206159ac83398151915233612971565b6121755760405162461bcd60e51b8152600401610fbe906154c4565b662386f26fc100008111156121dd5760405162461bcd60e51b815260206004820152602860248201527f53657276696365206665652063616e6e6f74206265206d6f7265207468616e206044820152670605c6062408aa8960c31b6064820152608401610fbe565b60108190556040518181527f8b38756fb556c8c4a497c16769c97c5da0bd2caafd23456b1b1c9ab4206fba5090602001611059565b61222a6000805160206159ac83398151915233612971565b6122465760405162461bcd60e51b8152600401610fbe906154c4565b612285816040518060400160405280601d81526020017f77434f4d414920616464726573732063616e6e6f74206265206e756c6c000000815250614509565b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f6e8b5beb095ca7ce96c098c0f952592119fe8883380f7304ffcc843b1efedd4390602001611059565b600e60205281600052604060002081815481106122ef57600080fd5b60009182526020909120600490910201805460018201546002830154600390930154919450925060ff82169161010090046001600160a01b03169085565b60008061233960005490565b905060005460000361234e5750600092915050565b61236b8161236561235e60125490565b8690614930565b9061493c565b9392505050565b50919050565b6123906000805160206159ac83398151915233612971565b6123ac5760405162461bcd60e51b8152600401610fbe906154c4565b6123b86012600a6158e1565b6123c390600f6158f0565b811161242b5760405162461bcd60e51b815260206004820152603160248201527f4d696e207374616b696e6720616d6f756e74206d757374206265206d6f7265206044820152707468616e206272696467696e672066656560781b6064820152608401610fbe565b60078190556040518181527f61e72f410bf254d0a4e3ae5404b6179ce38ae766eff8f767dc5a122ee4a1653d90602001611059565b6124786000805160206159ac83398151915233612971565b6124945760405162461bcd60e51b8152600401610fbe906154c4565b601680546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815260016020526040812054610f6e9061232d565b6124e0614948565b565b33806124ec613b39565b6001600160a01b03161461251e5760405163118cdaa760e01b81526001600160a01b0382166004820152602401610fbe565b6116428161497a565b6125517f9e3114703ec4a93cd6bc7e2610274229541e8ba5acacf7825f26bce4fae601e033612971565b61256d5760405162461bcd60e51b8152600401610fbe906155cd565b600b5460ff16156125905760405162461bcd60e51b8152600401610fbe90615513565b6125b2826040518060600160405280602881526020016159cc60289139614509565b600081116126025760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610fbe565b478181101561265f5760405162461bcd60e51b8152602060048201526024808201527f4e6f7420656e6f756768206e617469766520746f6b656e7320696e20636f6e746044820152631c9858dd60e21b6064820152608401610fbe565b6000836001600160a01b03168360405160006040518083038185875af1925050503d80600081146126ac576040519150601f19603f3d011682016040523d82523d6000602084013e6126b1565b606091505b50509050806127025760405162461bcd60e51b815260206004820152601c60248201527f4e617469766520746f6b656e207472616e73666572206661696c6564000000006044820152606401610fbe565b604080516001600160a01b0386168152602081018590527fbf5083663e042fcc8c207dc7c302c797ab721761e0d1ab346cf343341b67f583910160405180910390a150505050565b600c8054612757906156bb565b80601f0160208091040260200160405190810160405280929190818152602001828054612783906156bb565b80156127d05780601f106127a5576101008083540402835291602001916127d0565b820191906000526020600020905b8154815290600101906020018083116127b357829003601f168201915b505050505081565b6127f06000805160206159ac83398151915233612971565b61280c5760405162461bcd60e51b8152600401610fbe906154c4565b606481111561286b5760405162461bcd60e51b815260206004820152602560248201527f556e7374616b696e67206665652063616e6e6f74206265206d6f7265207468616044820152646e2031302560d81b6064820152608401610fbe565b60048190556040518181527f671bd930a19e6b5b8ff84de6230a7b8a922829f8b7581df2e39d50d71f92987490602001611059565b6000807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b546001600160a01b031692915050565b60006128e23384846149b2565b6040518281526001600160a01b0384169033907f9d9c909296d9c674451c0c24f02cb64981eb3b727f99865939192f880a755dcb9060200160405180910390a3600061292d8361232d565b9050836001600160a01b0316336001600160a01b03166000805160206159f48339815191528360405161296291815260200190565b60405180910390a39392505050565b6000918252600080516020615a14833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6129d37f7e21c1f853a961caf8adc0c26c941d090de97558d402e0fe1d0eea44495dee7d33612971565b612a345760405162461bcd60e51b815260206004820152602c60248201527f43616c6c657220646f6573206e6f74206861766520415050524f56455f57495460448201526b4844524157414c5f524f4c4560a01b6064820152608401610fbe565b612a3c6144d1565b600b5460ff1615612a5f5760405162461bcd60e51b8152600401610fbe90615513565b600081612aae5760405162461bcd60e51b815260206004820152601760248201527f526571756573747320617272617920697320656d7074790000000000000000006044820152606401610fbe565b600e600084846000818110612ac557612ac561553f565b612adb9260206040909202019081019150615231565b6001600160a01b03166001600160a01b031681526020019081526020016000208054905083836000818110612b1257612b1261553f565b9050604002016020013510612b735760405162461bcd60e51b815260206004820152602160248201527f4669727374207265717565737420696e646578206f7574206f6620626f756e646044820152607360f81b6064820152608401610fbe565b6000600e600085856000818110612b8c57612b8c61553f565b612ba29260206040909202019081019150615231565b6001600160a01b03166001600160a01b0316815260200190815260200160002084846000818110612bd557612bd561553f565b9050604002016020013581548110612bef57612bef61553f565b600091825260208220600260049092020101546001600160a01b036101009091041691505b83811015612f6f5736858583818110612c2f57612c2f61553f565b604002919091019150600e90506000612c4b6020840184615231565b6001600160a01b03168152602080820192909252604001600020549082013510612caf5760405162461bcd60e51b8152602060048201526015602482015274092dcecc2d8d2c840e4cae2eacae6e840d2dcc8caf605b1b6044820152606401610fbe565b6000600e81612cc16020850185615231565b6001600160a01b03166001600160a01b03168152602001908152602001600020826020013581548110612cf657612cf661553f565b90600052602060002090600402016000015411612d4a5760405162461bcd60e51b815260206004820152601260248201527114995c5d595cdd081a5cc81a5b9d985b1a5960721b6044820152606401610fbe565b600e6000612d5b6020840184615231565b6001600160a01b03166001600160a01b03168152602001908152602001600020816020013581548110612d9057612d9061553f565b600091825260209091206002600490920201015460ff1615612df45760405162461bcd60e51b815260206004820152601b60248201527f5265717565737420697320616c726561647920617070726f76656400000000006044820152606401610fbe565b6001600160a01b038316600e6000612e0f6020850185615231565b6001600160a01b03166001600160a01b03168152602001908152602001600020826020013581548110612e4457612e4461553f565b600091825260209091206004909102016002015461010090046001600160a01b031614612ed95760405162461bcd60e51b815260206004820152603960248201527f5772617070656420746f6b656e206973206e6f74207468652073616d6520616360448201527f726f737320616c6c20756e7374616b65207265717565737473000000000000006064820152608401610fbe565b600080612f3b600e82612eef6020870187615231565b6001600160a01b03166001600160a01b03168152602001908152602001600020846020013581548110612f2457612f2461553f565b906000526020600020906004020160010154614193565b9250509150808287612f4d9190615907565b612f579190615907565b95505050508080612f679061556b565b915050612c14565b50604051636eb1769f60e11b815233600482015230602482015282906001600160a01b0383169063dd62ed3e90604401602060405180830381865afa158015612fbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe09190615616565b101561302e5760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420746f6b656e20616c6c6f77616e6365000000006044820152606401610fbe565b60005b838110156130d4573685858381811061304c5761304c61553f565b60400291909101915060019050600e600061306a6020850185615231565b6001600160a01b03166001600160a01b0316815260200190815260200160002082602001358154811061309f5761309f61553f565b60009182526020909120600490910201600201805460ff191691151591909117905550806130cc8161556b565b915050613031565b506040516323b872dd60e01b81526001600160a01b038216906323b872dd906131059033903090879060040161564c565b6020604051808303816000875af1158015613124573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613148919061562f565b6131945760405162461bcd60e51b815260206004820152601860248201527f636f6d6169416d74207472616e73666572206661696c656400000000000000006044820152606401610fbe565b60005b8381101561322c57368585838181106131b2576131b261553f565b6040029190910191506131ca90506020820182615231565b6001600160a01b03167f6989ab5544b7750d8fd06869e7fc1852b2f28bf9d75e9fa272405986fd263a64826020013542604051613211929190918252602082015260400190565b60405180910390a250806132248161556b565b915050613197565b5050506132466001600080516020615a3483398151915255565b5050565b3360009081526002602090815260408083206001600160a01b0386168452909152812054828110156132be5760405162461bcd60e51b815260206004820152601e60248201527f4445435245415345445f414c4c4f57414e43455f42454c4f575f5a45524f00006044820152606401610fbe565b6132cd33856116dd8487614663565b5060019392505050565b6132ef6000805160206159ac83398151915233612971565b61330b5760405162461bcd60e51b8152600401610fbe906154c4565b6000811161332b5760405162461bcd60e51b8152600401610fbe90615670565b600a55565b6000610f813384846145bd565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff166000811580156133835750825b905060008267ffffffffffffffff1660011480156133a05750303b155b9050811580156133ae575080155b156133cc5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156133f657845460ff60401b1916600160401b1785555b6001600160a01b038a166134435760405162461bcd60e51b815260206004820152601460248201527313dddb995c8818d85b9b9bdd081899481b9d5b1b60621b6044820152606401610fbe565b61344c8a614b22565b613454614b33565b61345c614b3b565b613467600080614b4b565b61347260008b6147a0565b5061348b600080516020615a548339815191528b6147a0565b506134a46000805160206159ac8339815191528b6147a0565b506134cf7f7e21c1f853a961caf8adc0c26c941d090de97558d402e0fe1d0eea44495dee7d8b6147a0565b506134fa7f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d8b6147a0565b50600880546001600160a01b03808c166001600160a01b031992831617909255601580548a8416908316179055600f8054928d1692909116919091179055613541886148cd565b600c61354d898261573d565b506003600655600a6004556000600555660aa87bee538000601055601261357590600a6158e1565b61358290620f42406158f0565b6009556135916012600a6158e1565b61359c90600f6158f0565b6007556135ab6012600a6158e1565b6135b890620f42406158f0565b600d556706f05b59d3b200006013556714d1120d7b160000601455670de0b6b3a76400006003556135eb6012600a6158e1565b6135f890620f42406158f0565b600a55601680546001600160a01b0319166001600160a01b03881617905561361f8a61497a565b831561366557845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050565b6000670de0b6b3a76400006003548361368a91906158f0565b610f6e919061591a565b6136ac600080516020615a5483398151915233612971565b6136c85760405162461bcd60e51b8152600401610fbe90615584565b600081116137185760405162461bcd60e51b815260206004820152601c60248201527f4e65772072617465206d757374206265206d6f7265207468616e2030000000006044820152606401610fbe565b601354811015801561372c57506014548111155b6137785760405162461bcd60e51b815260206004820152601e60248201527f4e65772072617465206d7573742062652077697468696e20626f756e647300006044820152606401610fbe565b600060135411801561378c57506000601454115b6137d85760405162461bcd60e51b815260206004820152601a60248201527f426f756e6473206d757374206265206d6f7265207468616e20300000000000006044820152606401610fbe565b60038190556040518181527f4fc1b45960547ee95894b08a284c3c066cf5aca706a7420639c42c3ec2e118a490602001611059565b6138256000805160206159ac83398151915233612971565b6138415760405162461bcd60e51b8152600401610fbe906154c4565b600061016d620f42408360125461385891906158f0565b613862919061591a565b61386c919061591a565b90508060125461387c9190615907565b6012819055426011556000547fa904dcf42a3461c90173c0b966672b2cb4350e529ea12d44e562fcec43836324918491604080519384526020840192909252908201526060810183905242608082015260a00160405180910390a15050565b6000806138e760125490565b9050806000036138fa5750600092915050565b61236b8161236561235e60005490565b60035460009061368a83670de0b6b3a76400006158f0565b61393a6000805160206159ac83398151915233612971565b6139565760405162461bcd60e51b8152600401610fbe906154c4565b600381116139b45760405162461bcd60e51b815260206004820152602560248201527f4272696467696e67206665652073686f756c64206265206d6f7265207468616e60448201526420302e332560d81b6064820152608401610fbe565b60068190556040518181527f04d485944ec6b81a573c140fc8ea83b6738f1bbb036d17d185027a5c4107cdf990602001611059565b613a01600080516020615a5483398151915233612971565b613a1d5760405162461bcd60e51b8152600401610fbe90615584565b60008111613a795760405162461bcd60e51b815260206004820152602360248201527f4e6577206c6f77657220626f756e64206d757374206265206d6f72652074686160448201526206e20360ec1b6064820152608401610fbe565b6014548110613ae85760405162461bcd60e51b815260206004820152603560248201527f4e6577206c6f77657220626f756e64206d757374206265206c657373207468616044820152741b8818dd5c9c995b9d081d5c1c195c88189bdd5b99605a1b6064820152608401610fbe565b60138190556040518181527ff995fb2f30f70b5dacab19046768ab20d01b477e6a3a0075a2fb2fad3872b77690602001611059565b613b26826116ed565b613b2f81614796565b611e268383614845565b6000807f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c006128c5565b60008060006006548411613bcd5760405162461bcd60e51b815260206004820152602c60248201527f77434f4d414920616d6f756e74206d757374206265206d6f7265207468616e2060448201526b6272696467696e672066656560a01b6064820152608401610fbe565b60006103e860065486613be091906158f0565b613bea919061591a565b9050613bf86012600a6158e1565b613c039060016158f0565b811015613c2457613c166012600a6158e1565b613c219060016158f0565b90505b6000613c30828761593c565b90506000806005541115613c5c576103e860055483613c4f91906158f0565b613c59919061591a565b90505b6000613c68828461593c565b905060008111613ccc5760405162461bcd60e51b815260206004820152602960248201527f5772617020616d6f756e7420616674657220666565206d757374206265206d6f60448201526807265207468616e20360bc1b6064820152608401610fbe565b9792965094509092505050565b6000613ce36144d1565b600b5460ff1615613d065760405162461bcd60e51b8152600401610fbe90615513565b816009541015613d585760405162461bcd60e51b815260206004820152601e60248201527f4465706f73697420616d6f756e742065786365656473206d6178696d756d00006044820152606401610fbe565b601254600a541015613dac5760405162461bcd60e51b815260206004820152601e60248201527f4465706f73697420616d6f756e742065786365656473206d6178696d756d00006044820152606401610fbe565b6000600c8054613dbb906156bb565b80601f0160208091040260200160405190810160405280929190818152602001828054613de7906156bb565b8015613e345780601f10613e0957610100808354040283529160200191613e34565b820191906000526020600020905b815481529060010190602001808311613e1757829003601f168201915b5050600854939450506001600160a01b039092169150613e559050826148cd565b613e94816040518060400160405280601f81526020017f77726170706564546f6b656e206164647265737320697320696e76616c696400815250614509565b6040516370a0823160e01b815233600482015284906001600160a01b038316906370a0823190602401602060405180830381865afa158015613eda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613efe9190615616565b1015613f4c5760405162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e742077434f4d41492062616c616e636500000000006044820152606401610fbe565b60155460408051606081019091526022808252613f7b926001600160a01b031691906159696020830139614509565b600754841015613fd95760405162461bcd60e51b8152602060048201526024808201527f446f6573206e6f74206d656574206d696e696d756d207374616b696e6720616d6044820152631bdd5b9d60e21b6064820152608401610fbe565b6000806000613fe787613b62565b9250925092506000613ff884613671565b90506140043382614bae565b61400e338361466f565b600061401a8486615907565b905061402581614c28565b6016546040516302a3830960e41b81526001600160a01b0390911690632a383090906140579084908b9060040161594f565b600060405180830381600087803b15801561407157600080fd5b505af1158015614085573d6000803e3d6000fd5b505060408051428152602081018d90529081018590523392507f445b6299c386d845a282565eba224a183ae1062133e1b062b35d93f855fd59bd915060600160405180910390a250955050505050506140eb6001600080516020615a3483398151915255565b919050565b6140f8614948565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319166001600160a01b038316908117825561413c6128a0565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a35050565b6001600160a01b038116600090815260016020526040812054610f6e565b6000806000806103e8600454866141aa91906158f0565b6141b4919061591a565b905060006103e8600654876141c991906158f0565b6141d3919061591a565b90506141e16012600a6158e1565b6141ec9060016158f0565b81101561420d576141ff6012600a6158e1565b61420a9060016158f0565b90505b60008261421a838961593c565b614224919061593c565b9791965091945092505050565b6001600160a01b0381166000908152600e60209081526040808320805482518185028101850190935280835260609492939192909184015b828210156142d75760008481526020908190206040805160a081018252600486029092018054835260018082015484860152600282015460ff81161515938501939093526101009092046001600160a01b031660608401526003015460808301529083529092019101614269565b505050509050919050565b6142fa6000805160206159ac83398151915233612971565b6143165760405162461bcd60e51b8152600401610fbe906154c4565b6001600160a01b0381166143765760405162461bcd60e51b815260206004820152602160248201527f5769746864726177616c206d616e616765722063616e6e6f74206265206e756c6044820152601b60fa1b6064820152608401610fbe565b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527fd85a538f003fe4c6d5aaff33960bcc7bcf9f994d5a6ddda17b8e8901b57bf7df90602001611059565b6001600160a01b03831661441a5760405162461bcd60e51b815260206004820152601960248201527f415050524f56455f46524f4d5f5a45524f5f41444452455353000000000000006044820152606401610fbe565b6001600160a01b0382166144705760405162461bcd60e51b815260206004820152601760248201527f415050524f56455f544f5f5a45524f5f414444524553530000000000000000006044820152606401610fbe565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600080516020615a3483398151915280546001190161450357604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b806001600160a01b038316611e5f5760405162461bcd60e51b8152600401610fbe9190615131565b600061453c826138db565b90506145488382614cfd565b50816012600082825461455b919061593c565b9091555050604080518381524260208201526001600160a01b038516917f49995e5dd6158cf69ad3e9777c46755a1a826a446c6416992167462dad033b2a91015b60405180910390a2505050565b6001600080516020615a3483398151915255565b60006145c8826138db565b90506145d58484836149b2565b826001600160a01b0316846001600160a01b03166000805160206159f48339815191528460405161460891815260200190565b60405180910390a3826001600160a01b0316846001600160a01b03167f9d9c909296d9c674451c0c24f02cb64981eb3b727f99865939192f880a755dcb8360405161465591815260200190565b60405180910390a350505050565b600061236b828461593c565b801561324657306001600160a01b0383160361475d5760085460155460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810184905291169063a9059cbb906044015b6020604051808303816000875af11580156146db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146ff919061562f565b6132465760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220746f2070726f746f636f6c207661756c742061646472656044820152681cdcc819985a5b195960ba1b6064820152608401610fbe565b6008546015546040516323b872dd60e01b81526001600160a01b03928316926323b872dd926146bc92879290911690869060040161564c565b6116428133614e9b565b6000600080516020615a148339815191526147bb8484612971565b61483b576000848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556147f13390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610f6e565b6000915050610f6e565b6000600080516020615a148339815191526148608484612971565b1561483b576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610f6e565b600061236b8284615907565b80516030146116425760405162461bcd60e51b815260206004820152602960248201527f6e617469766557616c6c65745265636569766572206d757374206265206f66206044820152680d8cadccee8d04068760bb1b6064820152608401610fbe565b600061236b82846158f0565b600061236b828461591a565b336149516128a0565b6001600160a01b0316146124e05760405163118cdaa760e01b8152336004820152602401610fbe565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b031916815561324682614ed4565b6001600160a01b038316614a085760405162461bcd60e51b815260206004820152601e60248201527f5452414e534645525f46524f4d5f5448455f5a45524f5f4144445245535300006044820152606401610fbe565b6001600160a01b038216614a5e5760405162461bcd60e51b815260206004820152601c60248201527f5452414e534645525f544f5f5448455f5a45524f5f41444452455353000000006044820152606401610fbe565b6001600160a01b03831660009081526001602052604090205480821115614ac75760405162461bcd60e51b815260206004820152601f60248201527f5452414e534645525f414d4f554e545f455843454544535f42414c414e4345006044820152606401610fbe565b614ad18183614663565b6001600160a01b038086166000908152600160205260408082209390935590851681522054614b0090836148c1565b6001600160a01b03909316600090815260016020526040902092909255505050565b614b2a614f45565b61164281614f8e565b6124e0614f45565b614b43614f45565b6124e0614fc0565b600080516020615a148339815191526000614b65846116ed565b600085815260208490526040808220600101869055519192508491839187917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a450505050565b6000614bb9826138db565b905080600003614bc65750805b614bd08382614fc8565b508160126000828254614be39190615907565b9091555050604080518381524260208201526001600160a01b038516917f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f910161459c565b8015611642576008546040516323b872dd60e01b81526001600160a01b03909116906323b872dd90614c629033903090869060040161564c565b6020604051808303816000875af1158015614c81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ca5919061562f565b6116425760405162461bcd60e51b815260206004820152602360248201527f5472616e7366657220746f20636f6e74726163742061646472657373206661696044820152621b195960ea1b6064820152608401610fbe565b60006001600160a01b038316614d555760405162461bcd60e51b815260206004820152601a60248201527f4255524e5f46524f4d5f5448455f5a45524f5f414444524553530000000000006044820152606401610fbe565b6001600160a01b03831660009081526001602052604090205480831115614dbe5760405162461bcd60e51b815260206004820152601b60248201527f4255524e5f414d4f554e545f455843454544535f42414c414e434500000000006044820152606401610fbe565b6000614dc98461232d565b9050614dde84614dd860005490565b90614663565b60008190559250614def8285614663565b6001600160a01b038616600090815260016020526040812091909155614e148561232d565b60408051848152602081018390529081018790529091506001600160a01b038716907f8b2a1e1ad5e0578c3dd82494156e985dade827a87c573b5c1c7716a32162ad649060600160405180910390a26040518281526000906001600160a01b038816906000805160206159f48339815191529060200160405180910390a350505092915050565b614ea58282612971565b6132465760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610fbe565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166124e057604051631afcd79f60e31b815260040160405180910390fd5b614f96614f45565b6001600160a01b03811661251e57604051631e4fbdf760e01b815260006004820152602401610fbe565b6145a9614f45565b60006001600160a01b0383166150205760405162461bcd60e51b815260206004820152601860248201527f4d494e545f544f5f5448455f5a45524f5f4144445245535300000000000000006044820152606401610fbe565b600061502b8361232d565b9050806000036150385750815b61504b8361504560005490565b906148c1565b60008181556001600160a01b03861681526001602052604090205490925061507390846148c1565b6001600160a01b0385166000818152600160205260408082209390935591519091906000805160206159f4833981519152906150b29085815260200190565b60405180910390a35092915050565b6000602082840312156150d357600080fd5b81356001600160e01b03198116811461236b57600080fd5b6000815180845260005b81811015615111576020818501810151868301820152016150f5565b506000602082860101526020601f19601f83011685010191505092915050565b60208152600061236b60208301846150eb565b80356001600160a01b03811681146140eb57600080fd5b6000806040838503121561516e57600080fd5b61517783615144565b946020939093013593505050565b60006020828403121561519757600080fd5b5035919050565b801515811461164257600080fd5b6000602082840312156151be57600080fd5b813561236b8161519e565b6000806000606084860312156151de57600080fd5b6151e784615144565b92506151f560208501615144565b9150604084013590509250925092565b6000806040838503121561521857600080fd5b8235915061522860208401615144565b90509250929050565b60006020828403121561524357600080fd5b61236b82615144565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261527357600080fd5b813567ffffffffffffffff8082111561528e5761528e61524c565b604051601f8301601f19908116603f011681019082821181831017156152b6576152b661524c565b816040528381528660208588010111156152cf57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60006020828403121561530157600080fd5b813567ffffffffffffffff81111561531857600080fd5b61532484828501615262565b949350505050565b6000806020838503121561533f57600080fd5b823567ffffffffffffffff8082111561535757600080fd5b818501915085601f83011261536b57600080fd5b81358181111561537a57600080fd5b8660208260061b850101111561538f57600080fd5b60209290920196919550909350505050565b600080600080600060a086880312156153b957600080fd5b6153c286615144565b94506153d060208701615144565b9350604086013567ffffffffffffffff8111156153ec57600080fd5b6153f888828901615262565b93505061540760608701615144565b915061541560808701615144565b90509295509295909350565b6000806040838503121561543457600080fd5b61543d83615144565b915061522860208401615144565b602080825282518282018190526000919060409081850190868401855b828110156154b7578151805185528681015187860152858101511515868601526060808201516001600160a01b0316908601526080908101519085015260a09093019290850190600101615468565b5091979650505050505050565b6020808252602f908201527f43616c6c657220646f6573206e6f742068617665204d414e4147455f5354414b60408201526e494e475f5550444154455f524f4c4560881b606082015260800190565b60208082526012908201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161557d5761557d615555565b5060010190565b60208082526029908201527f43616c6c657220646f6573206e6f7420686176652045584348414e47455f5550604082015268444154455f524f4c4560b81b606082015260800190565b60208082526029908201527f43616c6c657220646f6573206e6f74206861766520544f4b454e5f534146455f60408201526850554c4c5f524f4c4560b81b606082015260800190565b60006020828403121561562857600080fd5b5051919050565b60006020828403121561564157600080fd5b815161236b8161519e565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020808252602b908201527f4d6178206465706f736974207065722072657175657374206d7573742062652060408201526a06d6f7265207468616e20360ac1b606082015260800190565b600181811c908216806156cf57607f821691505b60208210810361237257634e487b7160e01b600052602260045260246000fd5b601f821115611e5f57600081815260208120601f850160051c810160208610156157165750805b601f850160051c820191505b8181101561573557828155600101615722565b505050505050565b815167ffffffffffffffff8111156157575761575761524c565b61576b8161576584546156bb565b846156ef565b602080601f8311600181146157a057600084156157885750858301515b600019600386901b1c1916600185901b178555615735565b600085815260208120601f198616915b828110156157cf578886015182559484019460019091019084016157b0565b50858210156157ed5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600181815b8085111561583857816000190482111561581e5761581e615555565b8085161561582b57918102915b93841c9390800290615802565b509250929050565b60008261584f57506001610f6e565b8161585c57506000610f6e565b8160018114615872576002811461587c57615898565b6001915050610f6e565b60ff84111561588d5761588d615555565b50506001821b610f6e565b5060208310610133831016604e8410600b84101617156158bb575081810a610f6e565b6158c583836157fd565b80600019048211156158d9576158d9615555565b029392505050565b600061236b60ff841683615840565b8082028115828204841417610f6e57610f6e615555565b80820180821115610f6e57610f6e615555565b60008261593757634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610f6e57610f6e615555565b82815260406020820152600061532460408301846150eb56fe50726f746f636f6c207661756c7420616464726573732063616e6e6f7420626520307769746864726177616c20616464726573732063616e6e6f74206265206e756c6ccdc459158320f1e5dc6a2790e6223a1fae30e193e0b9c0c623cd787aee91ddd3526563697069656e7420616464726573732063616e6e6f74206265206e756c6c2061646472657373ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f008265d83785d3287e7d7481132632b4a43778b737fb1aeb3bb294f9e9984de840a2646970667358221220334d013fbd9bd5a9fb335796eb901c0fa996bd84e193c9842e6298d0776a8b6164736f6c63430008140033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.