Feature Tip: Add private address tag to any address under My Name Tag !
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 | 20022661 | 89 days ago | IN | 0 ETH | 0.03589868 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xC8286Bcc...71FD2f618 The constructor portion of the code might be different and could alter the actual behaviour of the contract
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; } /* * 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; /* * 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 */ 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 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 = 5000 * (10 ** decimals()); minStakingAmt = 15 * (10 ** decimals()); cap = 100_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; } function renounceOwnership() public override onlyOwner {} 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); } /* * 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); } function getWCOMAIByrsCOMAIAfterFee(uint256 rsCOMAIAmount) public view returns (uint256, uint256, uint256) { require( rsCOMAIAmount > bridgingFee, "wCOMAI amount must be more than bridging fee" ); uint256 bridgingFeeAmt = rsCOMAIAmount * bridgingFee / 1000; if(bridgingFeeAmt < 1 * (10 ** decimals())) bridgingFeeAmt = 1 * (10 ** decimals()); uint256 amountAfterBridgingFee = rsCOMAIAmount - bridgingFeeAmt; // Apply the staking fee as a percentage (e.g., 0.1%) // Note: Multiply by 1000 to convert the decimal percentage to an integer uint256 unstakingFeeAmt = 0; if(unstakingFee > 0) { /* * * Formula to calculate unstakingFeeAmt. 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 * */ unstakingFeeAmt = (amountAfterBridgingFee * unstakingFee) / 1000; } // Subtract the percentage-based staking fee from the amount after bridging fee uint256 unstakingAmt = amountAfterBridgingFee - unstakingFeeAmt; require(unstakingAmt > 0, "Wrap amount after fee must be more than 0"); 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 = 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) { 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 payable(withdrawalManager).call{value: msg.value}(""); } 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 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" ); 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 the wrap amount after free is more than 0 (uint256 wrapAmountAfterFee, uint256 bridgeFeeAmt, uint256 feeAmt) = calculateAmtAfterFee(wcomaiAmount); // Ensure that at least 15 COMAI is being bridged // based on the smart contract require(wrapAmountAfterFee >= minStakingAmt, "Does not meet minimum staking amount"); uint256 rsCOMAIAmount = wrapAmountAfterFee; // Perform token transfers _mintRsCOMAI(msg.sender, rsCOMAIAmount); require( cap >= totalRsCOMAIMinted, "Deposit amount exceeds maximum" ); _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 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, bool positive) external hasManageStakingConfigRole { uint256 duration = 365 days / (block.timestamp - lastRebaseTime); uint256 mintAmount = totalRsCOMAIMinted * apr / 1000000 / duration; if(positive) { totalRsCOMAIMinted = totalRsCOMAIMinted + mintAmount; } else { require(totalRsCOMAIMinted >= mintAmount, "Invalid Rebase"); 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 _RsCOMAIAmount; } 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 _sharesAmount; } 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":"maxDepositPerRequest","type":"uint256"}],"name":"UpdateMaxDepositPerRequest","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":[{"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":"_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":"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":"maxDepositPerRequest","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"},{"internalType":"bool","name":"positive","type":"bool"}],"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":[],"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":"_maxDepositPerRequest","type":"uint256"}],"name":"setMaxDepositPerRequest","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":"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":[],"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"}]
Deployed Bytecode
0x6080604052600436106104105760003560e01c80637e203c8b1161021e578063be2b9cd511610123578063e6c8a5f3116100ab578063f2fde38b1161007a578063f2fde38b14610cc6578063f5eb42dc14610ce6578063f96bc9f614610d06578063fb8363b614610d26578063fc72ed5b14610d5357600080fd5b8063e6c8a5f314610c35578063e78cea9214610c70578063ea598cb014610c90578063eff9884314610cb057600080fd5b8063d547741f116100f2578063d547741f14610b78578063d8990b6614610b98578063dd07a2a314610bba578063dd62ed3e14610bda578063e30c397814610c2057600080fd5b8063be2b9cd514610b0d578063c23c9e0314610b23578063cc23e3a214610b43578063d5002f2e14610b6357600080fd5b806395d89b41116101a6578063a457c2d711610175578063a457c2d714610a73578063a7d6889614610a93578063a9059cbb14610ab3578063ac4a0fb614610ad3578063b187bd2614610af357600080fd5b806395d89b41146109ee578063996c6cc314610a1e578063a1e8028014610a3e578063a217fddf14610a5e57600080fd5b806389067c5e116101ed57806389067c5e1461096d5780638abdf5aa146109835780638da5cb5b146109995780638fcb4e5b146109ae57806391d14854146109ce57600080fd5b80637e203c8b14610902578063829c1c571461091757806382d85ad31461093757806382fe535a1461094d57600080fd5b806339c5dec71161032457806366442a06116102ac5780636f6c35291161027b5780636f6c35291461086457806370a0823114610898578063715018a6146108b857806379ba5097146108cd5780637b9fe087146108e257600080fd5b806366442a06146107ae578063687080da1461080457806368cd79b3146108245780636eb382121461084457600080fd5b806344be0404116102f357806344be0404146107005780634772daef146107205780635a9249e6146107405780635cdf76f8146107785780635cf4cde01461079857600080fd5b806339c5dec714610658578063410dbf7e14610678578063420fa47e146106985780634310d128146106cc57600080fd5b806323b872dd116103a7578063313ce56711610376578063313ce567146105b2578063355274ea146105ce57806336568abe146105e4578063389ed26714610604578063395093511461063857600080fd5b806323b872dd14610532578063248a9ca3146105525780632e17de78146105725780632f2ff15d1461059257600080fd5b806318160ddd116103e357806318160ddd146104d05780631924063e146104f357806320ba569814610509578063230957211461051f57600080fd5b806301ffc9a71461041557806306fdde031461044a578063095ea7b31461048e57806316c38b3c146104ae575b600080fd5b34801561042157600080fd5b50610435610430366004614662565b610d73565b60405190151581526020015b60405180910390f35b34801561045657600080fd5b506040805180820190915260128152715269767573205374616b656420434f4d414960701b60208201525b60405161044191906146d2565b34801561049a57600080fd5b506104356104a93660046146fc565b610daa565b3480156104ba57600080fd5b506104ce6104c9366004614734565b610dc0565b005b3480156104dc57600080fd5b506104e5610e89565b604051908152602001610441565b3480156104ff57600080fd5b506104e5600f5481565b34801561051557600080fd5b506104e560035481565b6104ce61052d366004614751565b610e99565b34801561053e57600080fd5b5061043561054d36600461476a565b611312565b34801561055e57600080fd5b506104e561056d366004614751565b6113ba565b34801561057e57600080fd5b506104ce61058d366004614751565b6113dc565b34801561059e57600080fd5b506104ce6105ad3660046147a6565b611700565b3480156105be57600080fd5b5060405160128152602001610441565b3480156105da57600080fd5b506104e560095481565b3480156105f057600080fd5b506104ce6105ff3660046147a6565b611722565b34801561061057600080fd5b506104e57f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d81565b34801561064457600080fd5b506104356106533660046146fc565b61175a565b34801561066457600080fd5b506104ce6106733660046147d2565b611790565b34801561068457600080fd5b506104ce610693366004614751565b611868565b3480156106a457600080fd5b506104e57f9e3114703ec4a93cd6bc7e2610274229541e8ba5acacf7825f26bce4fae601e081565b3480156106d857600080fd5b506104e57f7e21c1f853a961caf8adc0c26c941d090de97558d402e0fe1d0eea44495dee7d81565b34801561070c57600080fd5b506104ce61071b366004614751565b611935565b34801561072c57600080fd5b506104ce61073b366004614890565b6119be565b34801561074c57600080fd5b50601154610760906001600160a01b031681565b6040516001600160a01b039091168152602001610441565b34801561078457600080fd5b506104ce610793366004614751565b611a37565b3480156107a457600080fd5b506104e560065481565b3480156107ba57600080fd5b506107ce6107c93660046146fc565b611b08565b604080519586526020860194909452911515928401929092526001600160a01b039091166060830152608082015260a001610441565b34801561081057600080fd5b506104e561081f366004614751565b611b62565b34801561083057600080fd5b506104ce61083f366004614751565b611bab565b34801561085057600080fd5b506104ce61085f3660046147d2565b611c93565b34801561087057600080fd5b506104e57f8265d83785d3287e7d7481132632b4a43778b737fb1aeb3bb294f9e9984de84081565b3480156108a457600080fd5b506104e56108b33660046147d2565b611ce9565b3480156108c457600080fd5b506104ce611d0b565b3480156108d957600080fd5b506104ce611d15565b3480156108ee57600080fd5b506104ce6108fd3660046146fc565b611d5a565b34801561090e57600080fd5b50610481611fc0565b34801561092357600080fd5b506104ce610932366004614751565b61204e565b34801561094357600080fd5b506104e560105481565b34801561095957600080fd5b50600d54610760906001600160a01b031681565b34801561097957600080fd5b506104e560055481565b34801561098f57600080fd5b506104e5600e5481565b3480156109a557600080fd5b50610760612116565b3480156109ba57600080fd5b506104e56109c93660046146fc565b61214b565b3480156109da57600080fd5b506104356109e93660046147a6565b6121e7565b3480156109fa57600080fd5b506040805180820190915260078152667273434f4d414960c81b6020820152610481565b348015610a2a57600080fd5b50600754610760906001600160a01b031681565b348015610a4a57600080fd5b506104ce610a593660046148cd565b61221f565b348015610a6a57600080fd5b506104e5600081565b348015610a7f57600080fd5b50610435610a8e3660046146fc565b612ac4565b348015610a9f57600080fd5b506104ce610aae366004614751565b612b51565b348015610abf57600080fd5b50610435610ace3660046146fc565b612baa565b348015610adf57600080fd5b506104ce610aee366004614942565b612bb7565b348015610aff57600080fd5b50600a546104359060ff1681565b348015610b1957600080fd5b506104e560085481565b348015610b2f57600080fd5b506104e5610b3e366004614751565b612ebd565b348015610b4f57600080fd5b506104ce610b5e366004614751565b612eea565b348015610b6f57600080fd5b506000546104e5565b348015610b8457600080fd5b506104ce610b933660046147a6565b612fb1565b348015610ba457600080fd5b506104e5600080516020614f1383398151915281565b348015610bc657600080fd5b506104ce610bd53660046149c2565b612fcd565b348015610be657600080fd5b506104e5610bf53660046149f2565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b348015610c2c57600080fd5b50610760613113565b348015610c4157600080fd5b50610c55610c50366004614751565b61313c565b60408051938452602084019290925290820152606001610441565b348015610c7c57600080fd5b50601254610760906001600160a01b031681565b348015610c9c57600080fd5b506104e5610cab366004614751565b61326e565b348015610cbc57600080fd5b506104e560045481565b348015610cd257600080fd5b506104ce610ce13660046147d2565b613679565b348015610cf257600080fd5b506104e5610d013660046147d2565b6136fe565b348015610d1257600080fd5b50610c55610d21366004614751565b61371c565b348015610d3257600080fd5b50610d46610d413660046147d2565b6137c4565b6040516104419190614a1c565b348015610d5f57600080fd5b506104ce610d6e3660046147d2565b613875565b60006001600160e01b03198216637965db0b60e01b1480610da457506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000610db7338484613957565b50600192915050565b610dea7f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d336121e7565b610e3b5760405162461bcd60e51b815260206004820152601f60248201527f43616c6c657220646f6573206e6f7420686176652050415553455f524f4c450060448201526064015b60405180910390fd5b600a805460ff191682151590811790915560405160ff909116151581527f752d7e161ff5146f80e3820893176eb40532811e5e20400dfdde57455213706a906020015b60405180910390a150565b6000610e9460105490565b905090565b610ea1613a64565b600a5460ff1615610ec45760405162461bcd60e51b8152600401610e3290614a95565b60075460408051808201909152601f81527f77726170706564546f6b656e206164647265737320697320696e76616c6964006020820152610f0e916001600160a01b031690613a9c565b600d5460408051606081019091526021808252610f3d926001600160a01b03169190614ef26020830139613a9c565b600e5481903414610f905760405162461bcd60e51b815260206004820152601c60248201527f46656520616d6f756e74206973206e6f742073756666696369656e74000000006044820152606401610e32565b81610f9a33611ce9565b1015610fe85760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e74207273434f4d41492062616c616e6365000000006044820152606401610e32565b336000908152600c602052604081205490805b8281101561117a57336000908152600c6020526040812080548390811061102457611024614ac1565b6000918252602090912060049091020154905080156110435750611168565b6040805160a081018252878152602080820188905260008284018190526007546001600160a01b03166060840152426080840152338152600c9091529190912080548490811061109557611095614ac1565b6000918252602091829020835160049290920201908155828201516001808301919091556040808501516002840180546060808901516001600160a81b0319909216931515610100600160a81b031916939093176101006001600160a01b039283160217909155608096870151600390950194909455600754825189815242968101969096529185018c905284018a90529091169282019290925290935033907fbacf71ad475b68e36b9cd14cedd8cf7d1f098c65f4c59255d2ade1ceae5782529060a00160405180910390a25061117a565b8061117281614aed565b915050610ffb565b508061129657336000818152600c60209081526040808320815160a081018352898152808401898152818401868152600780546001600160a01b03908116606086019081524260808701818152885460018181018b55998d529a909b2096516004909a0290960198895593519588019590955590516002870180549351861661010002610100600160a81b0319921515929092166001600160a81b031990941693909317179091559451600390940193909355925490517fbacf71ad475b68e36b9cd14cedd8cf7d1f098c65f4c59255d2ade1ceae5782529361128d93889390928b928b9216909485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b60405180910390a25b6112a03385613ac4565b600d546040516001600160a01b03909116903490600081818185875af1925050503d80600081146112ed576040519150601f19603f3d011682016040523d82523d6000602084013e6112f2565b606091505b50505050505061130f6001600080516020614f9b83398151915255565b50565b6001600160a01b0383166000908152600260209081526040808320338452909152812054828110156113905760405162461bcd60e51b815260206004820152602160248201527f5452414e534645525f414d4f554e545f455843454544535f414c4c4f57414e436044820152604560f81b6064820152608401610e32565b61139b858585613b50565b6113af85336113aa8487613bf6565b613957565b506001949350505050565b6000908152600080516020614f7b833981519152602052604090206001015490565b6113e4613a64565b600a5460ff16156114075760405162461bcd60e51b8152600401610e3290614a95565b336000908152600c6020526040902054811061145d5760405162461bcd60e51b8152602060048201526015602482015274092dcecc2d8d2c840e4cae2eacae6e840d2dcc8caf605b1b6044820152606401610e32565b336000908152600c6020526040812080548390811061147e5761147e614ac1565b60009182526020918290206040805160a0810182526004939093029091018054808452600182015494840194909452600281015460ff81161515928401929092526101009091046001600160a01b03166060830152600301546080820152915061152a5760405162461bcd60e51b815260206004820152601860248201527f4e6f20756e7374616b65207265717565737420666f756e6400000000000000006044820152606401610e32565b806040015161157b5760405162461bcd60e51b815260206004820152601860248201527f556e7374616b65206e6f7420617070726f7665642079657400000000000000006044820152606401610e32565b60008061158b836020015161371c565b925050915061159a3082613c02565b336000908152600c602052604090208054859081106115bb576115bb614ac1565b600091825260208220600491820201828155600181018390556002810180546001600160a81b0319169055600301829055606085015160405163a9059cbb60e01b81523392810192909252602482018590526001600160a01b03169063a9059cbb906044016020604051808303816000875af115801561163f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116639190614b06565b9050806116ab5760405162461bcd60e51b81526020600482015260166024820152751dd0d3d35052481d1c985b9cd9995c8819985a5b195960521b6044820152606401610e32565b6040805186815242602082015233917ff60fc3345e4a664f6362b5b4012f91076079b5510d9d05200c7bb2dfa42527a1910160405180910390a25050505061130f6001600080516020614f9b83398151915255565b611709826113ba565b61171281613d33565b61171c8383613d3d565b50505050565b6001600160a01b038116331461174b5760405163334bd91960e11b815260040160405180910390fd5b6117558282613de2565b505050565b3360008181526002602090815260408083206001600160a01b03871684529091528120549091610db79185906113aa9086613e5e565b6117a8600080516020614f13833981519152336121e7565b6117c45760405162461bcd60e51b8152600401610e3290614b23565b6001600160a01b03811661181a5760405162461bcd60e51b815260206004820152601d60248201527f50726f746f636f6c207661756c742063616e6e6f74206265206e756c6c0000006044820152606401610e32565b601180546001600160a01b0319166001600160a01b0383169081179091556040519081527fc951a375519c58813e1685228d8f3e6598feb2b4b983bf8c884d75ec66df4e7690602001610e7e565b611880600080516020614f13833981519152336121e7565b61189c5760405162461bcd60e51b8152600401610e3290614b23565b601481106119005760405162461bcd60e51b815260206004820152602b60248201527f5374616b696e67206665652063616e6e6f74206265206d6f7265207468616e2060448201526a0657175616c20746f2032360ac1b6064820152608401610e32565b60048190556040518181527f14b8f3121162b96e557f0b6b5ec1ca50101edca232c06fe45c5050b18ed7f5c690602001610e7e565b61194d600080516020614f13833981519152336121e7565b6119695760405162461bcd60e51b8152600401610e3290614b23565b600081116119895760405162461bcd60e51b8152600401610e3290614b72565b60088190556040518181527f8ae9492f6d2f8c6b1e56cf2abf5f30b8678b0411dedc80a9a26bd32ddb9f1df990602001610e7e565b6119d6600080516020614f13833981519152336121e7565b6119f25760405162461bcd60e51b8152600401610e3290614b23565b6119fb81613e6a565b600b611a078282614c3f565b507fa00e4803eb83f18f2ad4c35f0c8c913b8d36880df9b2e0c9f1f71c9307eb716e81604051610e7e91906146d2565b611a4f600080516020614f13833981519152336121e7565b611a6b5760405162461bcd60e51b8152600401610e3290614b23565b662386f26fc10000811115611ad35760405162461bcd60e51b815260206004820152602860248201527f53657276696365206665652063616e6e6f74206265206d6f7265207468616e206044820152670605c6062408aa8960c31b6064820152608401610e32565b600e8190556040518181527f8b38756fb556c8c4a497c16769c97c5da0bd2caafd23456b1b1c9ab4206fba5090602001610e7e565b600c6020528160005260406000208181548110611b2457600080fd5b60009182526020909120600490910201805460018201546002830154600390930154919450925060ff82169161010090046001600160a01b03169085565b600080611b6e60005490565b9050600054600003611b81575090919050565b611b9e81611b98611b9160105490565b8690613ecd565b90613ed9565b9392505050565b50919050565b611bc3600080516020614f13833981519152336121e7565b611bdf5760405162461bcd60e51b8152600401610e3290614b23565b611beb6012600a614de3565b611bf690600f614df2565b8111611c5e5760405162461bcd60e51b815260206004820152603160248201527f4d696e207374616b696e6720616d6f756e74206d757374206265206d6f7265206044820152707468616e206272696467696e672066656560781b6064820152608401610e32565b60068190556040518181527f61e72f410bf254d0a4e3ae5404b6179ce38ae766eff8f767dc5a122ee4a1653d90602001610e7e565b611cab600080516020614f13833981519152336121e7565b611cc75760405162461bcd60e51b8152600401610e3290614b23565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815260016020526040812054610da490611b62565b611d13613ee5565b565b3380611d1f613113565b6001600160a01b031614611d515760405163118cdaa760e01b81526001600160a01b0382166004820152602401610e32565b61130f81613f17565b611d847f9e3114703ec4a93cd6bc7e2610274229541e8ba5acacf7825f26bce4fae601e0336121e7565b611de25760405162461bcd60e51b815260206004820152602960248201527f43616c6c657220646f6573206e6f74206861766520544f4b454e5f534146455f60448201526850554c4c5f524f4c4560b81b6064820152608401610e32565b600a5460ff1615611e055760405162461bcd60e51b8152600401610e3290614a95565b611e2782604051806060016040528060288152602001614f3360289139613a9c565b60008111611e775760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610e32565b4781811015611ed45760405162461bcd60e51b8152602060048201526024808201527f4e6f7420656e6f756768206e617469766520746f6b656e7320696e20636f6e746044820152631c9858dd60e21b6064820152608401610e32565b6000836001600160a01b03168360405160006040518083038185875af1925050503d8060008114611f21576040519150601f19603f3d011682016040523d82523d6000602084013e611f26565b606091505b5050905080611f775760405162461bcd60e51b815260206004820152601c60248201527f4e617469766520746f6b656e207472616e73666572206661696c6564000000006044820152606401610e32565b604080516001600160a01b0386168152602081018590527fbf5083663e042fcc8c207dc7c302c797ab721761e0d1ab346cf343341b67f58391015b60405180910390a150505050565b600b8054611fcd90614bbd565b80601f0160208091040260200160405190810160405280929190818152602001828054611ff990614bbd565b80156120465780601f1061201b57610100808354040283529160200191612046565b820191906000526020600020905b81548152906001019060200180831161202957829003601f168201915b505050505081565b612066600080516020614f13833981519152336121e7565b6120825760405162461bcd60e51b8152600401610e3290614b23565b60648111156120e15760405162461bcd60e51b815260206004820152602560248201527f556e7374616b696e67206665652063616e6e6f74206265206d6f7265207468616044820152646e2031302560d81b6064820152608401610e32565b60038190556040518181527f671bd930a19e6b5b8ff84de6230a7b8a922829f8b7581df2e39d50d71f92987490602001610e7e565b6000807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b546001600160a01b031692915050565b6000612158338484613f4f565b6040518281526001600160a01b0384169033907f9d9c909296d9c674451c0c24f02cb64981eb3b727f99865939192f880a755dcb9060200160405180910390a360006121a383611b62565b9050836001600160a01b0316336001600160a01b0316600080516020614f5b833981519152836040516121d891815260200190565b60405180910390a39392505050565b6000918252600080516020614f7b833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6122497f7e21c1f853a961caf8adc0c26c941d090de97558d402e0fe1d0eea44495dee7d336121e7565b6122aa5760405162461bcd60e51b815260206004820152602c60248201527f43616c6c657220646f6573206e6f74206861766520415050524f56455f57495460448201526b4844524157414c5f524f4c4560a01b6064820152608401610e32565b6122b2613a64565b600a5460ff16156122d55760405162461bcd60e51b8152600401610e3290614a95565b6000816123245760405162461bcd60e51b815260206004820152601760248201527f526571756573747320617272617920697320656d7074790000000000000000006044820152606401610e32565b600c60008484600081811061233b5761233b614ac1565b61235192602060409092020190810191506147d2565b6001600160a01b03166001600160a01b03168152602001908152602001600020805490508383600081811061238857612388614ac1565b90506040020160200135106123e95760405162461bcd60e51b815260206004820152602160248201527f4669727374207265717565737420696e646578206f7574206f6620626f756e646044820152607360f81b6064820152608401610e32565b6000600c60008585600081811061240257612402614ac1565b61241892602060409092020190810191506147d2565b6001600160a01b03166001600160a01b031681526020019081526020016000208484600081811061244b5761244b614ac1565b905060400201602001358154811061246557612465614ac1565b600091825260208220600260049092020101546001600160a01b036101009091041691505b838110156127e557368585838181106124a5576124a5614ac1565b604002919091019150600c905060006124c160208401846147d2565b6001600160a01b031681526020808201929092526040016000205490820135106125255760405162461bcd60e51b8152602060048201526015602482015274092dcecc2d8d2c840e4cae2eacae6e840d2dcc8caf605b1b6044820152606401610e32565b6000600c8161253760208501856147d2565b6001600160a01b03166001600160a01b0316815260200190815260200160002082602001358154811061256c5761256c614ac1565b906000526020600020906004020160000154116125c05760405162461bcd60e51b815260206004820152601260248201527114995c5d595cdd081a5cc81a5b9d985b1a5960721b6044820152606401610e32565b600c60006125d160208401846147d2565b6001600160a01b03166001600160a01b0316815260200190815260200160002081602001358154811061260657612606614ac1565b600091825260209091206002600490920201015460ff161561266a5760405162461bcd60e51b815260206004820152601b60248201527f5265717565737420697320616c726561647920617070726f76656400000000006044820152606401610e32565b6001600160a01b038316600c600061268560208501856147d2565b6001600160a01b03166001600160a01b031681526020019081526020016000208260200135815481106126ba576126ba614ac1565b600091825260209091206004909102016002015461010090046001600160a01b03161461274f5760405162461bcd60e51b815260206004820152603960248201527f5772617070656420746f6b656e206973206e6f74207468652073616d6520616360448201527f726f737320616c6c20756e7374616b65207265717565737473000000000000006064820152608401610e32565b6000806127b1600c8261276560208701876147d2565b6001600160a01b03166001600160a01b0316815260200190815260200160002084602001358154811061279a5761279a614ac1565b90600052602060002090600402016001015461371c565b92505091508082876127c39190614e09565b6127cd9190614e09565b955050505080806127dd90614aed565b91505061248a565b50604051636eb1769f60e11b815233600482015230602482015282906001600160a01b0383169063dd62ed3e90604401602060405180830381865afa158015612832573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128569190614e1c565b10156128a45760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420746f6b656e20616c6c6f77616e6365000000006044820152606401610e32565b60005b8381101561294a57368585838181106128c2576128c2614ac1565b60400291909101915060019050600c60006128e060208501856147d2565b6001600160a01b03166001600160a01b0316815260200190815260200160002082602001358154811061291557612915614ac1565b60009182526020909120600490910201600201805460ff1916911515919091179055508061294281614aed565b9150506128a7565b506040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b038216906323b872dd906064016020604051808303816000875af115801561299e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129c29190614b06565b612a0e5760405162461bcd60e51b815260206004820152601860248201527f636f6d6169416d74207472616e73666572206661696c656400000000000000006044820152606401610e32565b60005b83811015612aa65736858583818110612a2c57612a2c614ac1565b604002919091019150612a44905060208201826147d2565b6001600160a01b03167f6989ab5544b7750d8fd06869e7fc1852b2f28bf9d75e9fa272405986fd263a64826020013542604051612a8b929190918252602082015260400190565b60405180910390a25080612a9e81614aed565b915050612a11565b505050612ac06001600080516020614f9b83398151915255565b5050565b3360009081526002602090815260408083206001600160a01b038616845290915281205482811015612b385760405162461bcd60e51b815260206004820152601e60248201527f4445435245415345445f414c4c4f57414e43455f42454c4f575f5a45524f00006044820152606401610e32565b612b4733856113aa8487613bf6565b5060019392505050565b612b69600080516020614f13833981519152336121e7565b612b855760405162461bcd60e51b8152600401610e3290614b23565b60008111612ba55760405162461bcd60e51b8152600401610e3290614b72565b600955565b6000610db7338484613b50565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff16600081158015612bfd5750825b905060008267ffffffffffffffff166001148015612c1a5750303b155b905081158015612c28575080155b15612c465760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315612c7057845460ff60401b1916600160401b1785555b6001600160a01b038a16612cbd5760405162461bcd60e51b815260206004820152601460248201527313dddb995c8818d85b9b9bdd081899481b9d5b1b60621b6044820152606401610e32565b612cc68a6140bf565b612cce6140d0565b612cd66140d8565b612ce16000806140e8565b612cec60008b613d3d565b50612d177f8265d83785d3287e7d7481132632b4a43778b737fb1aeb3bb294f9e9984de8408b613d3d565b50612d30600080516020614f138339815191528b613d3d565b50612d5b7f7e21c1f853a961caf8adc0c26c941d090de97558d402e0fe1d0eea44495dee7d8b613d3d565b50612d867f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d8b613d3d565b50600780546001600160a01b03808c166001600160a01b031992831617909255601180548a8416908316179055600d8054928d1692909116919091179055612dcd88613e6a565b600b612dd98982614c3f565b5060036005819055600a90556000600455660aa87bee538000600e556012612e0290600a614de3565b612e0e90611388614df2565b600855612e1d6012600a614de3565b612e2890600f614df2565b600655612e376012600a614de3565b612e4490620186a0614df2565b600955601280546001600160a01b0319166001600160a01b038816179055612e6b8a613f17565b8315612eb157845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050565b600080612ec960105490565b905080600003612eda575090919050565b611b9e81611b98611b9160005490565b612f02600080516020614f13833981519152336121e7565b612f1e5760405162461bcd60e51b8152600401610e3290614b23565b60038111612f7c5760405162461bcd60e51b815260206004820152602560248201527f4272696467696e67206665652073686f756c64206265206d6f7265207468616e60448201526420302e332560d81b6064820152608401610e32565b60058190556040518181527f04d485944ec6b81a573c140fc8ea83b6738f1bbb036d17d185027a5c4107cdf990602001610e7e565b612fba826113ba565b612fc381613d33565b61171c8383613de2565b612fe5600080516020614f13833981519152336121e7565b6130015760405162461bcd60e51b8152600401610e3290614b23565b6000600f54426130119190614e35565b61301f906301e13380614e48565b9050600081620f4240856010546130369190614df2565b6130409190614e48565b61304a9190614e48565b9050821561306857806010546130609190614e09565b6010556130bd565b8060105410156130ab5760405162461bcd60e51b815260206004820152600e60248201526d496e76616c69642052656261736560901b6044820152606401610e32565b806010546130b99190614e35565b6010555b42600f556010546000547fa904dcf42a3461c90173c0b966672b2cb4350e529ea12d44e562fcec43836324918691604080519384526020840192909252908201526060810183905242608082015260a001611fb2565b6000807f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0061213b565b600080600060055484116131625760405162461bcd60e51b8152600401610e3290614e6a565b60006103e8600554866131759190614df2565b61317f9190614e48565b905061318d6012600a614de3565b613198906001614df2565b8110156131b9576131ab6012600a614de3565b6131b6906001614df2565b90505b60006131c58287614e35565b905060008060045411156131f1576103e8600454836131e49190614df2565b6131ee9190614e48565b90505b60006131fd8284614e35565b9050600081116132615760405162461bcd60e51b815260206004820152602960248201527f5772617020616d6f756e7420616674657220666565206d757374206265206d6f60448201526807265207468616e20360bc1b6064820152608401610e32565b9792965094509092505050565b6000613278613a64565b600a5460ff161561329b5760405162461bcd60e51b8152600401610e3290614a95565b8160085410156132ed5760405162461bcd60e51b815260206004820152601e60248201527f4465706f73697420616d6f756e742065786365656473206d6178696d756d00006044820152606401610e32565b6000600b80546132fc90614bbd565b80601f016020809104026020016040519081016040528092919081815260200182805461332890614bbd565b80156133755780601f1061334a57610100808354040283529160200191613375565b820191906000526020600020905b81548152906001019060200180831161335857829003601f168201915b5050600754939450506001600160a01b039092169150613396905082613e6a565b6133d5816040518060400160405280601f81526020017f77726170706564546f6b656e206164647265737320697320696e76616c696400815250613a9c565b6040516370a0823160e01b815233600482015284906001600160a01b038316906370a0823190602401602060405180830381865afa15801561341b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061343f9190614e1c565b101561348d5760405162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e742077434f4d41492062616c616e636500000000006044820152606401610e32565b601154604080516060810190915260228082526134bc926001600160a01b03169190614ed06020830139613a9c565b60008060006134ca8761313c565b92509250925060065483101561352e5760405162461bcd60e51b8152602060048201526024808201527f446f6573206e6f74206d656574206d696e696d756d207374616b696e6720616d6044820152631bdd5b9d60e21b6064820152608401610e32565b82613539338261414b565b601054600954101561358d5760405162461bcd60e51b815260206004820152601e60248201527f4465706f73697420616d6f756e742065786365656473206d6178696d756d00006044820152606401610e32565b6135973383613c02565b60006135a38486614e09565b90506135ae816141c5565b6012546040516302a3830960e41b81526001600160a01b0390911690632a383090906135e09084908b90600401614eb6565b600060405180830381600087803b1580156135fa57600080fd5b505af115801561360e573d6000803e3d6000fd5b505060408051428152602081018d90529081018590523392507f445b6299c386d845a282565eba224a183ae1062133e1b062b35d93f855fd59bd915060600160405180910390a250955050505050506136746001600080516020614f9b83398151915255565b919050565b613681613ee5565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319166001600160a01b03831690811782556136c5612116565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a35050565b6001600160a01b038116600090815260016020526040812054610da4565b600080600060055484116137425760405162461bcd60e51b8152600401610e3290614e6a565b60006103e8600554866137559190614df2565b61375f9190614e48565b905061376d6012600a614de3565b613778906001614df2565b8110156137995761378b6012600a614de3565b613796906001614df2565b90505b60006137a58287614e35565b905060008060035411156131f1576103e8600354836131e49190614df2565b6001600160a01b0381166000908152600c60209081526040808320805482518185028101850190935280835260609492939192909184015b8282101561386a5760008481526020908190206040805160a081018252600486029092018054835260018082015484860152600282015460ff81161515938501939093526101009092046001600160a01b0316606084015260030154608083015290835290920191016137fc565b505050509050919050565b61388d600080516020614f13833981519152336121e7565b6138a95760405162461bcd60e51b8152600401610e3290614b23565b6001600160a01b0381166139095760405162461bcd60e51b815260206004820152602160248201527f5769746864726177616c206d616e616765722063616e6e6f74206265206e756c6044820152601b60fa1b6064820152608401610e32565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527fd85a538f003fe4c6d5aaff33960bcc7bcf9f994d5a6ddda17b8e8901b57bf7df90602001610e7e565b6001600160a01b0383166139ad5760405162461bcd60e51b815260206004820152601960248201527f415050524f56455f46524f4d5f5a45524f5f41444452455353000000000000006044820152606401610e32565b6001600160a01b038216613a035760405162461bcd60e51b815260206004820152601760248201527f415050524f56455f544f5f5a45524f5f414444524553530000000000000000006044820152606401610e32565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600080516020614f9b833981519152805460011901613a9657604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b806001600160a01b0383166117555760405162461bcd60e51b8152600401610e3291906146d2565b6000613acf82612ebd565b9050613adb838261429e565b508160106000828254613aee9190614e35565b9091555050604080518381524260208201526001600160a01b038516917f49995e5dd6158cf69ad3e9777c46755a1a826a446c6416992167462dad033b2a91015b60405180910390a2505050565b6001600080516020614f9b83398151915255565b6000613b5b82612ebd565b9050613b68848483613f4f565b826001600160a01b0316846001600160a01b0316600080516020614f5b83398151915284604051613b9b91815260200190565b60405180910390a3826001600160a01b0316846001600160a01b03167f9d9c909296d9c674451c0c24f02cb64981eb3b727f99865939192f880a755dcb83604051613be891815260200190565b60405180910390a350505050565b6000611b9e8284614e35565b8015612ac057306001600160a01b03831603613cf05760075460115460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810184905291169063a9059cbb906044015b6020604051808303816000875af1158015613c6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c929190614b06565b612ac05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220746f2070726f746f636f6c207661756c742061646472656044820152681cdcc819985a5b195960ba1b6064820152608401610e32565b6007546011546040516323b872dd60e01b81526001600160a01b0385811660048301529182166024820152604481018490529116906323b872dd90606401613c4f565b61130f813361443c565b6000600080516020614f7b833981519152613d5884846121e7565b613dd8576000848152602082815260408083206001600160a01b03871684529091529020805460ff19166001179055613d8e3390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610da4565b6000915050610da4565b6000600080516020614f7b833981519152613dfd84846121e7565b15613dd8576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610da4565b6000611b9e8284614e09565b805160301461130f5760405162461bcd60e51b815260206004820152602960248201527f6e617469766557616c6c65745265636569766572206d757374206265206f66206044820152680d8cadccee8d04068760bb1b6064820152608401610e32565b6000611b9e8284614df2565b6000611b9e8284614e48565b33613eee612116565b6001600160a01b031614611d135760405163118cdaa760e01b8152336004820152602401610e32565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319168155612ac082614475565b6001600160a01b038316613fa55760405162461bcd60e51b815260206004820152601e60248201527f5452414e534645525f46524f4d5f5448455f5a45524f5f4144445245535300006044820152606401610e32565b6001600160a01b038216613ffb5760405162461bcd60e51b815260206004820152601c60248201527f5452414e534645525f544f5f5448455f5a45524f5f41444452455353000000006044820152606401610e32565b6001600160a01b038316600090815260016020526040902054808211156140645760405162461bcd60e51b815260206004820152601f60248201527f5452414e534645525f414d4f554e545f455843454544535f42414c414e4345006044820152606401610e32565b61406e8183613bf6565b6001600160a01b03808616600090815260016020526040808220939093559085168152205461409d9083613e5e565b6001600160a01b03909316600090815260016020526040902092909255505050565b6140c76144e6565b61130f8161452f565b611d136144e6565b6140e06144e6565b611d13614561565b600080516020614f7b8339815191526000614102846113ba565b600085815260208490526040808220600101869055519192508491839187917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a450505050565b600061415682612ebd565b9050806000036141635750805b61416d8382614569565b5081601060008282546141809190614e09565b9091555050604080518381524260208201526001600160a01b038516917f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f9101613b2f565b801561130f576007546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015614222573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142469190614b06565b61130f5760405162461bcd60e51b815260206004820152602360248201527f5472616e7366657220746f20636f6e74726163742061646472657373206661696044820152621b195960ea1b6064820152608401610e32565b60006001600160a01b0383166142f65760405162461bcd60e51b815260206004820152601a60248201527f4255524e5f46524f4d5f5448455f5a45524f5f414444524553530000000000006044820152606401610e32565b6001600160a01b0383166000908152600160205260409020548083111561435f5760405162461bcd60e51b815260206004820152601b60248201527f4255524e5f414d4f554e545f455843454544535f42414c414e434500000000006044820152606401610e32565b600061436a84611b62565b905061437f8461437960005490565b90613bf6565b600081905592506143908285613bf6565b6001600160a01b0386166000908152600160205260408120919091556143b585611b62565b60408051848152602081018390529081018790529091506001600160a01b038716907f8b2a1e1ad5e0578c3dd82494156e985dade827a87c573b5c1c7716a32162ad649060600160405180910390a26040518281526000906001600160a01b03881690600080516020614f5b8339815191529060200160405180910390a350505092915050565b61444682826121e7565b612ac05760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610e32565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16611d1357604051631afcd79f60e31b815260040160405180910390fd5b6145376144e6565b6001600160a01b038116611d5157604051631e4fbdf760e01b815260006004820152602401610e32565b613b3c6144e6565b60006001600160a01b0383166145c15760405162461bcd60e51b815260206004820152601860248201527f4d494e545f544f5f5448455f5a45524f5f4144445245535300000000000000006044820152606401610e32565b60006145cc83611b62565b9050806000036145d95750815b6145ec836145e660005490565b90613e5e565b60008181556001600160a01b0386168152600160205260409020549092506146149084613e5e565b6001600160a01b038516600081815260016020526040808220939093559151909190600080516020614f5b833981519152906146539085815260200190565b60405180910390a35092915050565b60006020828403121561467457600080fd5b81356001600160e01b031981168114611b9e57600080fd5b6000815180845260005b818110156146b257602081850181015186830182015201614696565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000611b9e602083018461468c565b80356001600160a01b038116811461367457600080fd5b6000806040838503121561470f57600080fd5b614718836146e5565b946020939093013593505050565b801515811461130f57600080fd5b60006020828403121561474657600080fd5b8135611b9e81614726565b60006020828403121561476357600080fd5b5035919050565b60008060006060848603121561477f57600080fd5b614788846146e5565b9250614796602085016146e5565b9150604084013590509250925092565b600080604083850312156147b957600080fd5b823591506147c9602084016146e5565b90509250929050565b6000602082840312156147e457600080fd5b611b9e826146e5565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261481457600080fd5b813567ffffffffffffffff8082111561482f5761482f6147ed565b604051601f8301601f19908116603f01168101908282118183101715614857576148576147ed565b8160405283815286602085880101111561487057600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000602082840312156148a257600080fd5b813567ffffffffffffffff8111156148b957600080fd5b6148c584828501614803565b949350505050565b600080602083850312156148e057600080fd5b823567ffffffffffffffff808211156148f857600080fd5b818501915085601f83011261490c57600080fd5b81358181111561491b57600080fd5b8660208260061b850101111561493057600080fd5b60209290920196919550909350505050565b600080600080600060a0868803121561495a57600080fd5b614963866146e5565b9450614971602087016146e5565b9350604086013567ffffffffffffffff81111561498d57600080fd5b61499988828901614803565b9350506149a8606087016146e5565b91506149b6608087016146e5565b90509295509295909350565b600080604083850312156149d557600080fd5b8235915060208301356149e781614726565b809150509250929050565b60008060408385031215614a0557600080fd5b614a0e836146e5565b91506147c9602084016146e5565b602080825282518282018190526000919060409081850190868401855b82811015614a88578151805185528681015187860152858101511515868601526060808201516001600160a01b0316908601526080908101519085015260a09093019290850190600101614a39565b5091979650505050505050565b60208082526012908201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201614aff57614aff614ad7565b5060010190565b600060208284031215614b1857600080fd5b8151611b9e81614726565b6020808252602f908201527f43616c6c657220646f6573206e6f742068617665204d414e4147455f5354414b60408201526e494e475f5550444154455f524f4c4560881b606082015260800190565b6020808252602b908201527f4d6178206465706f736974207065722072657175657374206d7573742062652060408201526a06d6f7265207468616e20360ac1b606082015260800190565b600181811c90821680614bd157607f821691505b602082108103611ba557634e487b7160e01b600052602260045260246000fd5b601f82111561175557600081815260208120601f850160051c81016020861015614c185750805b601f850160051c820191505b81811015614c3757828155600101614c24565b505050505050565b815167ffffffffffffffff811115614c5957614c596147ed565b614c6d81614c678454614bbd565b84614bf1565b602080601f831160018114614ca25760008415614c8a5750858301515b600019600386901b1c1916600185901b178555614c37565b600085815260208120601f198616915b82811015614cd157888601518255948401946001909101908401614cb2565b5085821015614cef5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600181815b80851115614d3a578160001904821115614d2057614d20614ad7565b80851615614d2d57918102915b93841c9390800290614d04565b509250929050565b600082614d5157506001610da4565b81614d5e57506000610da4565b8160018114614d745760028114614d7e57614d9a565b6001915050610da4565b60ff841115614d8f57614d8f614ad7565b50506001821b610da4565b5060208310610133831016604e8410600b8410161715614dbd575081810a610da4565b614dc78383614cff565b8060001904821115614ddb57614ddb614ad7565b029392505050565b6000611b9e60ff841683614d42565b8082028115828204841417610da457610da4614ad7565b80820180821115610da457610da4614ad7565b600060208284031215614e2e57600080fd5b5051919050565b81810381811115610da457610da4614ad7565b600082614e6557634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602c908201527f77434f4d414920616d6f756e74206d757374206265206d6f7265207468616e2060408201526b6272696467696e672066656560a01b606082015260800190565b8281526040602082015260006148c5604083018461468c56fe50726f746f636f6c207661756c7420616464726573732063616e6e6f7420626520307769746864726177616c20616464726573732063616e6e6f74206265206e756c6ccdc459158320f1e5dc6a2790e6223a1fae30e193e0b9c0c623cd787aee91ddd3526563697069656e7420616464726573732063616e6e6f74206265206e756c6c2061646472657373ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a2646970667358221220ee1a5ed547a9bce1ba278e307b8f2b8d5ba48d148e0367a5b730007e30893cb864736f6c63430008140033
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.