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
Loading...
Loading
Contract Name:
frxETHMinter
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; // ==================================================================== // | ______ _______ | // | / _____________ __ __ / ____(_____ ____ _____ ________ | // | / /_ / ___/ __ `| |/_/ / /_ / / __ \/ __ `/ __ \/ ___/ _ \ | // | / __/ / / / /_/ _> < / __/ / / / / / /_/ / / / / /__/ __/ | // | /_/ /_/ \__,_/_/|_| /_/ /_/_/ /_/\__,_/_/ /_/\___/\___/ | // | | // ==================================================================== // ============================ frxETHMinter ========================== // ==================================================================== // Frax Finance: https://github.com/FraxFinance // Primary Author(s) // Jack Corddry: https://github.com/corddry // Justin Moore: https://github.com/0xJM // Reviewer(s) / Contributor(s) // Travis Moore: https://github.com/FortisFortuna // Dennis: https://github.com/denett // Jamie Turley: https://github.com/jyturley import { frxETH } from "./frxETH.sol"; import { IsfrxETH } from "./IsfrxETH.sol"; import "openzeppelin-contracts/contracts/security/ReentrancyGuard.sol"; import "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; import { IDepositContract } from "./DepositContract.sol"; import "./OperatorRegistry.sol"; /// @title Authorized minter contract for frxETH /// @notice Accepts user-supplied ETH and converts it to frxETH (submit()), and also optionally inline stakes it for sfrxETH (submitAndDeposit()) /** @dev Has permission to mint frxETH. Once +32 ETH has accumulated, adds it to a validator, which then deposits it for ETH 2.0 staking (depositEther()) Withhold ratio refers to what percentage of ETH this contract keeps whenever a user makes a deposit. 0% is kept initially */ contract frxETHMinter is OperatorRegistry, ReentrancyGuard { uint256 public constant DEPOSIT_SIZE = 32 ether; // ETH 2.0 minimum deposit size uint256 public constant RATIO_PRECISION = 1e6; // 1,000,000 uint256 public withholdRatio; // What we keep and don't deposit whenever someone submit()'s ETH uint256 public currentWithheldETH; // Needed for internal tracking mapping(bytes => bool) public activeValidators; // Tracks validators (via their pubkeys) that already have 32 ETH in them IDepositContract public immutable depositContract; // ETH 2.0 deposit contract frxETH public immutable frxETHToken; IsfrxETH public immutable sfrxETHToken; bool public submitPaused; bool public depositEtherPaused; constructor( address depositContractAddress, address frxETHAddress, address sfrxETHAddress, address _owner, address _timelock_address, bytes memory _withdrawalCredential ) OperatorRegistry(_owner, _timelock_address, _withdrawalCredential) { depositContract = IDepositContract(depositContractAddress); frxETHToken = frxETH(frxETHAddress); sfrxETHToken = IsfrxETH(sfrxETHAddress); withholdRatio = 0; // No ETH is withheld initially currentWithheldETH = 0; } /// @notice Mint frxETH and deposit it to receive sfrxETH in one transaction /** @dev Could try using EIP-712 / EIP-2612 here in the future if you replace this contract, but you might run into msg.sender vs tx.origin issues with the ERC4626 */ function submitAndDeposit(address recipient) external payable returns (uint256 shares) { // Give the frxETH to this contract after it is generated _submit(address(this)); // Approve frxETH to sfrxETH for staking frxETHToken.approve(address(sfrxETHToken), msg.value); // Deposit the frxETH and give the generated sfrxETH to the final recipient uint256 sfrxeth_recieved = sfrxETHToken.deposit(msg.value, recipient); require(sfrxeth_recieved > 0, 'No sfrxETH was returned'); return sfrxeth_recieved; } /// @notice Mint frxETH to the recipient using sender's funds. Internal portion function _submit(address recipient) internal nonReentrant { // Initial pause and value checks require(!submitPaused, "Submit is paused"); require(msg.value != 0, "Cannot submit 0"); // Give the sender frxETH frxETHToken.minter_mint(recipient, msg.value); // Track the amount of ETH that we are keeping uint256 withheld_amt = 0; if (withholdRatio != 0) { withheld_amt = (msg.value * withholdRatio) / RATIO_PRECISION; currentWithheldETH += withheld_amt; } emit ETHSubmitted(msg.sender, recipient, msg.value, withheld_amt); } /// @notice Mint frxETH to the sender depending on the ETH value sent function submit() external payable { _submit(msg.sender); } /// @notice Mint frxETH to the recipient using sender's funds function submitAndGive(address recipient) external payable { _submit(recipient); } /// @notice Fallback to minting frxETH to the sender receive() external payable { _submit(msg.sender); } /// @notice Deposit batches of ETH to the ETH 2.0 deposit contract /// @dev Usually a bot will call this periodically /// @param max_deposits Used to prevent gassing out if a whale drops in a huge amount of ETH. Break it down into batches. function depositEther(uint256 max_deposits) external nonReentrant { // Initial pause check require(!depositEtherPaused, "Depositing ETH is paused"); // See how many deposits can be made. Truncation desired. uint256 numDeposits = (address(this).balance - currentWithheldETH) / DEPOSIT_SIZE; require(numDeposits > 0, "Not enough ETH in contract"); uint256 loopsToUse = numDeposits; if (max_deposits == 0) loopsToUse = numDeposits; else if (numDeposits > max_deposits) loopsToUse = max_deposits; // Give each deposit chunk to an empty validator for (uint256 i = 0; i < loopsToUse; ++i) { // Get validator information ( bytes memory pubKey, bytes memory withdrawalCredential, bytes memory signature, bytes32 depositDataRoot ) = getNextValidator(); // Will revert if there are not enough free validators // Make sure the validator hasn't been deposited into already, to prevent stranding an extra 32 eth // until withdrawals are allowed require(!activeValidators[pubKey], "Validator already has 32 ETH"); // Deposit the ether in the ETH 2.0 deposit contract depositContract.deposit{value: DEPOSIT_SIZE}( pubKey, withdrawalCredential, signature, depositDataRoot ); // Set the validator as used so it won't get an extra 32 ETH activeValidators[pubKey] = true; emit DepositSent(pubKey, withdrawalCredential); } } /// @param newRatio of ETH that is sent to deposit contract vs withheld, 1e6 precision /// @notice An input of 1e6 results in 100% of Eth deposited, 0% withheld function setWithholdRatio(uint256 newRatio) external onlyByOwnGov { require (newRatio <= RATIO_PRECISION, "Ratio cannot surpass 100%"); withholdRatio = newRatio; emit WithholdRatioSet(newRatio); } /// @notice Give the withheld ETH to the "to" address function moveWithheldETH(address payable to, uint256 amount) external onlyByOwnGov { require(amount <= currentWithheldETH, "Not enough withheld ETH in contract"); currentWithheldETH -= amount; (bool success,) = payable(to).call{ value: amount }(""); require(success, "Invalid transfer"); emit WithheldETHMoved(to, amount); } /// @notice Toggle allowing submites function togglePauseSubmits() external onlyByOwnGov { submitPaused = !submitPaused; emit SubmitPaused(submitPaused); } /// @notice Toggle allowing depositing ETH to validators function togglePauseDepositEther() external onlyByOwnGov { depositEtherPaused = !depositEtherPaused; emit DepositEtherPaused(depositEtherPaused); } /// @notice For emergencies if something gets stuck function recoverEther(uint256 amount) external onlyByOwnGov { (bool success,) = address(owner).call{ value: amount }(""); require(success, "Invalid transfer"); emit EmergencyEtherRecovered(amount); } /// @notice For emergencies if someone accidentally sent some ERC20 tokens here function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyByOwnGov { require(IERC20(tokenAddress).transfer(owner, tokenAmount), "recoverERC20: Transfer failed"); emit EmergencyERC20Recovered(tokenAddress, tokenAmount); } event EmergencyEtherRecovered(uint256 amount); event EmergencyERC20Recovered(address tokenAddress, uint256 tokenAmount); event ETHSubmitted(address indexed sender, address indexed recipient, uint256 sent_amount, uint256 withheld_amt); event DepositEtherPaused(bool new_status); event DepositSent(bytes indexed pubKey, bytes withdrawalCredential); event SubmitPaused(bool new_status); event WithheldETHMoved(address indexed to, uint256 amount); event WithholdRatioSet(uint256 newRatio); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; // ==================================================================== // | ______ _______ | // | / _____________ __ __ / ____(_____ ____ _____ ________ | // | / /_ / ___/ __ `| |/_/ / /_ / / __ \/ __ `/ __ \/ ___/ _ \ | // | / __/ / / / /_/ _> < / __/ / / / / / /_/ / / / / /__/ __/ | // | /_/ /_/ \__,_/_/|_| /_/ /_/_/ /_/\__,_/_/ /_/\___/\___/ | // | | // ==================================================================== // ============================== frxETH ============================== // ==================================================================== // Frax Finance: https://github.com/FraxFinance // Primary Author(s) // Jack Corddry: https://github.com/corddry // Nader Ghazvini: https://github.com/amirnader-ghazvini // Reviewer(s) / Contributor(s) // Sam Kazemian: https://github.com/samkazemian // Dennis: https://github.com/denett // Travis Moore: https://github.com/FortisFortuna // Jamie Turley: https://github.com/jyturley /// @title Stablecoin pegged to Ether for use within the Frax ecosystem /** @notice Does not accrue ETH 2.0 staking yield: it must be staked at the sfrxETH contract first. ETH -> frxETH conversion is permanent, so a market will develop for the latter. Withdraws are not live (as of deploy time) so loosely pegged to eth but is possible will float */ /// @dev frxETH adheres to EIP-712/EIP-2612 and can use permits import { ERC20PermitPermissionedMint } from "./ERC20/ERC20PermitPermissionedMint.sol"; contract frxETH is ERC20PermitPermissionedMint { /* ========== CONSTRUCTOR ========== */ constructor( address _creator_address, address _timelock_address ) ERC20PermitPermissionedMint(_creator_address, _timelock_address, "Frax Ether", "frxETH") {} }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.0; // Primarily added to prevent ERC20 name collisions in frxETHMinter.sol interface IsfrxETH { function DOMAIN_SEPARATOR() external view returns (bytes32); function allowance(address, address) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function asset() external view returns (address); function balanceOf(address) external view returns (uint256); function convertToAssets(uint256 shares) external view returns (uint256); function convertToShares(uint256 assets) external view returns (uint256); function decimals() external view returns (uint8); function deposit(uint256 assets, address receiver) external returns (uint256 shares); function depositWithSignature(uint256 assets, address receiver, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s) external returns (uint256 shares); function lastRewardAmount() external view returns (uint192); function lastSync() external view returns (uint32); function maxDeposit(address) external view returns (uint256); function maxMint(address) external view returns (uint256); function maxRedeem(address owner) external view returns (uint256); function maxWithdraw(address owner) external view returns (uint256); function mint(uint256 shares, address receiver) external returns (uint256 assets); function name() external view returns (string memory); function nonces(address) external view returns (uint256); function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; function previewDeposit(uint256 assets) external view returns (uint256); function previewMint(uint256 shares) external view returns (uint256); function previewRedeem(uint256 shares) external view returns (uint256); function previewWithdraw(uint256 assets) external view returns (uint256); function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets); function rewardsCycleEnd() external view returns (uint32); function rewardsCycleLength() external view returns (uint32); function symbol() external view returns (string memory); function syncRewards() external; function totalAssets() external view returns (uint256); function totalSupply() external view returns (uint256); function transfer(address to, uint256 amount) external returns (bool); function transferFrom(address from, address to, uint256 amount) external returns (bool); function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @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 ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// 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: CC0-1.0 pragma solidity ^0.8.0; // This interface is designed to be compatible with the Vyper version. /// @notice This is the Ethereum 2.0 deposit contract interface. /// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs interface IDepositContract { /// @notice A processed deposit event. event DepositEvent( bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index ); /// @notice Submit a Phase 0 DepositData object. /// @param pubkey A BLS12-381 public key. /// @param withdrawal_credentials Commitment to a public key for withdrawals. /// @param signature A BLS12-381 signature. /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object. /// Used as a protection against malformed input. function deposit( bytes calldata pubkey, bytes calldata withdrawal_credentials, bytes calldata signature, bytes32 deposit_data_root ) external payable; /// @notice Query the current deposit root hash. /// @return The deposit root hash. function get_deposit_root() external view returns (bytes32); /// @notice Query the current deposit count. /// @return The deposit count encoded as a little endian 64-bit number. function get_deposit_count() external view returns (bytes memory); } // Based on official specification in https://eips.ethereum.org/EIPS/eip-165 interface ERC165 { /// @notice Query if a contract implements an interface /// @param interfaceId The interface identifier, as specified in ERC-165 /// @dev Interface identification is specified in ERC-165. This function /// uses less than 30,000 gas. /// @return `true` if the contract implements `interfaceId` and /// `interfaceId` is not 0xffffffff, `false` otherwise function supportsInterface(bytes4 interfaceId) external pure returns (bool); } // This is a rewrite of the Vyper Eth2.0 deposit contract in Solidity. // It tries to stay as close as possible to the original source code. /// @notice This is the Ethereum 2.0 deposit contract interface. /// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs contract DepositContract is IDepositContract, ERC165 { uint constant DEPOSIT_CONTRACT_TREE_DEPTH = 32; // NOTE: this also ensures `deposit_count` will fit into 64-bits uint constant MAX_DEPOSIT_COUNT = 2**DEPOSIT_CONTRACT_TREE_DEPTH - 1; bytes32[DEPOSIT_CONTRACT_TREE_DEPTH] branch; uint256 deposit_count; bytes32[DEPOSIT_CONTRACT_TREE_DEPTH] zero_hashes; constructor() public { // Compute hashes in empty sparse Merkle tree for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH - 1; height++) zero_hashes[height + 1] = sha256(abi.encodePacked(zero_hashes[height], zero_hashes[height])); } function get_deposit_root() override external view returns (bytes32) { bytes32 node; uint size = deposit_count; for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH; height++) { if ((size & 1) == 1) node = sha256(abi.encodePacked(branch[height], node)); else node = sha256(abi.encodePacked(node, zero_hashes[height])); size /= 2; } return sha256(abi.encodePacked( node, to_little_endian_64(uint64(deposit_count)), bytes24(0) )); } function get_deposit_count() override external view returns (bytes memory) { return to_little_endian_64(uint64(deposit_count)); } function deposit( bytes calldata pubkey, bytes calldata withdrawal_credentials, bytes calldata signature, bytes32 deposit_data_root ) override external payable { // Extended ABI length checks since dynamic types are used. require(pubkey.length == 48, "DepositContract: invalid pubkey length"); require(withdrawal_credentials.length == 32, "DepositContract: invalid withdrawal_credentials length"); require(signature.length == 96, "DepositContract: invalid signature length"); // Check deposit amount require(msg.value >= 1 ether, "DepositContract: deposit value too low"); require(msg.value % 1 gwei == 0, "DepositContract: deposit value not multiple of gwei"); uint deposit_amount = msg.value / 1 gwei; require(deposit_amount <= type(uint64).max, "DepositContract: deposit value too high"); // Emit `DepositEvent` log bytes memory amount = to_little_endian_64(uint64(deposit_amount)); emit DepositEvent( pubkey, withdrawal_credentials, amount, signature, to_little_endian_64(uint64(deposit_count)) ); // Compute deposit data root (`DepositData` hash tree root) bytes32 pubkey_root = sha256(abi.encodePacked(pubkey, bytes16(0))); bytes32 signature_root = sha256(abi.encodePacked( sha256(abi.encodePacked(signature[:64])), sha256(abi.encodePacked(signature[64:], bytes32(0))) )); bytes32 node = sha256(abi.encodePacked( sha256(abi.encodePacked(pubkey_root, withdrawal_credentials)), sha256(abi.encodePacked(amount, bytes24(0), signature_root)) )); // Verify computed and expected deposit data roots match require(node == deposit_data_root, "DepositContract: reconstructed DepositData does not match supplied deposit_data_root"); // Avoid overflowing the Merkle tree (and prevent edge case in computing `branch`) require(deposit_count < MAX_DEPOSIT_COUNT, "DepositContract: merkle tree full"); // Add deposit data root to Merkle tree (update a single `branch` node) deposit_count += 1; uint size = deposit_count; for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH; height++) { if ((size & 1) == 1) { branch[height] = node; return; } node = sha256(abi.encodePacked(branch[height], node)); size /= 2; } // As the loop should always end prematurely with the `return` statement, // this code should be unreachable. We assert `false` just to be safe. assert(false); } function supportsInterface(bytes4 interfaceId) override external pure returns (bool) { return interfaceId == type(ERC165).interfaceId || interfaceId == type(IDepositContract).interfaceId; } function to_little_endian_64(uint64 value) internal pure returns (bytes memory ret) { ret = new bytes(8); bytes8 bytesValue = bytes8(value); // Byteswapping during copying to bytes. ret[0] = bytesValue[7]; ret[1] = bytesValue[6]; ret[2] = bytesValue[5]; ret[3] = bytesValue[4]; ret[4] = bytesValue[3]; ret[5] = bytesValue[2]; ret[6] = bytesValue[1]; ret[7] = bytesValue[0]; } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; // ==================================================================== // | ______ _______ | // | / _____________ __ __ / ____(_____ ____ _____ ________ | // | / /_ / ___/ __ `| |/_/ / /_ / / __ \/ __ `/ __ \/ ___/ _ \ | // | / __/ / / / /_/ _> < / __/ / / / / / /_/ / / / / /__/ __/ | // | /_/ /_/ \__,_/_/|_| /_/ /_/_/ /_/\__,_/_/ /_/\___/\___/ | // | | // ==================================================================== // ========================= OperatorRegistry ========================= // ==================================================================== // Frax Finance: https://github.com/FraxFinance // Primary Author(s) // Jack Corddry: https://github.com/corddry // Justin Moore: https://github.com/0xJM // Reviewer(s) / Contributor(s) // Travis Moore: https://github.com/FortisFortuna // Dennis: https://github.com/denett import "./Utils/Owned.sol"; /// @title Keeps track of validators used for ETH 2.0 staking /// @notice A permissioned owner can add and removed them at will contract OperatorRegistry is Owned { struct Validator { bytes pubKey; bytes signature; bytes32 depositDataRoot; } Validator[] validators; // Array of unused / undeposited validators that can be used at a future time bytes curr_withdrawal_pubkey; // Pubkey for ETH 2.0 withdrawal creds. If you change it, you must empty the validators array address public timelock_address; constructor(address _owner, address _timelock_address, bytes memory _withdrawal_pubkey) Owned(_owner) { timelock_address = _timelock_address; curr_withdrawal_pubkey = _withdrawal_pubkey; } modifier onlyByOwnGov() { require(msg.sender == timelock_address || msg.sender == owner, "Not owner or timelock"); _; } /// @notice Add a new validator /** @dev You should verify offchain that the validator is indeed valid before adding it Reason we don't do that here is for gas */ function addValidator(Validator calldata validator) public onlyByOwnGov { validators.push(validator); emit ValidatorAdded(validator.pubKey, curr_withdrawal_pubkey); } /// @notice Add multiple new validators in one function call /** @dev You should verify offchain that the validators are indeed valid before adding them Reason we don't do that here is for gas */ function addValidators(Validator[] calldata validatorArray) external onlyByOwnGov { uint arrayLength = validatorArray.length; for (uint256 i = 0; i < arrayLength; ++i) { addValidator(validatorArray[i]); } } /// @notice Swap the location of one validator with another function swapValidator(uint256 from_idx, uint256 to_idx) public onlyByOwnGov { // Get the original values Validator memory fromVal = validators[from_idx]; Validator memory toVal = validators[to_idx]; // Set the swapped values validators[to_idx] = fromVal; validators[from_idx] = toVal; emit ValidatorsSwapped(fromVal.pubKey, toVal.pubKey, from_idx, to_idx); } /// @notice Remove validators from the end of the validators array, in case they were added in error function popValidators(uint256 times) public onlyByOwnGov { // Loop through and remove validator entries at the end for (uint256 i = 0; i < times; ++i) { validators.pop(); } emit ValidatorsPopped(times); } /** @notice Remove a validator from the array. If dont_care_about_ordering is true, a swap and pop will occur instead of a more gassy loop */ function removeValidator(uint256 remove_idx, bool dont_care_about_ordering) public onlyByOwnGov { // Get the pubkey for the validator to remove (for informational purposes) bytes memory removed_pubkey = validators[remove_idx].pubKey; // Less gassy to swap and pop if (dont_care_about_ordering){ // Swap the (validator to remove) with the (last validator in the array) swapValidator(remove_idx, validators.length - 1); // Pop off the validator to remove, which is now at the end of the array validators.pop(); } // More gassy, loop else { // Save the original validators Validator[] memory original_validators = validators; // Clear the original validators list delete validators; // Fill the new validators array with all except the value to remove for (uint256 i = 0; i < original_validators.length; ++i) { if (i != remove_idx) { validators.push(original_validators[i]); } } } emit ValidatorRemoved(removed_pubkey, remove_idx, dont_care_about_ordering); } // Internal /// @dev Remove the last validator from the validators array and return its information function getNextValidator() internal returns ( bytes memory pubKey, bytes memory withdrawalCredentials, bytes memory signature, bytes32 depositDataRoot ) { // Make sure there are free validators available uint numVals = numValidators(); require(numVals != 0, "Validator stack is empty"); // Pop the last validator off the array Validator memory popped = validators[numVals - 1]; validators.pop(); // Return the validator's information pubKey = popped.pubKey; withdrawalCredentials = curr_withdrawal_pubkey; signature = popped.signature; depositDataRoot = popped.depositDataRoot; } /// @notice Return the information of the i'th validator in the registry function getValidator(uint i) view external returns ( bytes memory pubKey, bytes memory withdrawalCredentials, bytes memory signature, bytes32 depositDataRoot ) { Validator memory v = validators[i]; // Return the validator's information pubKey = v.pubKey; withdrawalCredentials = curr_withdrawal_pubkey; signature = v.signature; depositDataRoot = v.depositDataRoot; } /// @notice Returns a Validator struct of the given inputs to make formatting addValidator inputs easier function getValidatorStruct( bytes memory pubKey, bytes memory signature, bytes32 depositDataRoot ) external pure returns (Validator memory) { return Validator(pubKey, signature, depositDataRoot); } /// @notice Requires empty validator stack as changing withdrawal creds invalidates signature /// @dev May need to call clearValidatorArray() first function setWithdrawalCredential(bytes memory _new_withdrawal_pubkey) external onlyByOwnGov { require(numValidators() == 0, "Clear validator array first"); curr_withdrawal_pubkey = _new_withdrawal_pubkey; emit WithdrawalCredentialSet(_new_withdrawal_pubkey); } /// @notice Empties the validator array /// @dev Need to do this before setWithdrawalCredential() function clearValidatorArray() external onlyByOwnGov { delete validators; emit ValidatorArrayCleared(); } /// @notice Returns the number of validators function numValidators() public view returns (uint256) { return validators.length; } /// @notice Set the timelock contract function setTimelock(address _timelock_address) external onlyByOwnGov { require(_timelock_address != address(0), "Zero address detected"); timelock_address = _timelock_address; emit TimelockChanged(_timelock_address); } event TimelockChanged(address timelock_address); event WithdrawalCredentialSet(bytes _withdrawalCredential); event ValidatorAdded(bytes pubKey, bytes withdrawalCredential); event ValidatorArrayCleared(); event ValidatorRemoved(bytes pubKey, uint256 remove_idx, bool dont_care_about_ordering); event ValidatorsPopped(uint256 times); event ValidatorsSwapped(bytes from_pubKey, bytes to_pubKey, uint256 from_idx, uint256 to_idx); event KeysCleared(); }
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-contracts/contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; import "openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "../Utils/Owned.sol"; /// @title Parent contract for frxETH.sol /** @notice Combines Openzeppelin's ERC20Permit and ERC20Burnable with Synthetix's Owned. Also includes a list of authorized minters */ /// @dev frxETH adheres to EIP-712/EIP-2612 and can use permits contract ERC20PermitPermissionedMint is ERC20Permit, ERC20Burnable, Owned { // Core address public timelock_address; // Minters address[] public minters_array; // Allowed to mint mapping(address => bool) public minters; // Mapping is also used for faster verification /* ========== CONSTRUCTOR ========== */ constructor( address _creator_address, address _timelock_address, string memory _name, string memory _symbol ) ERC20(_name, _symbol) ERC20Permit(_name) Owned(_creator_address) { timelock_address = _timelock_address; } /* ========== MODIFIERS ========== */ modifier onlyByOwnGov() { require(msg.sender == timelock_address || msg.sender == owner, "Not owner or timelock"); _; } modifier onlyMinters() { require(minters[msg.sender] == true, "Only minters"); _; } /* ========== RESTRICTED FUNCTIONS ========== */ // Used by minters when user redeems function minter_burn_from(address b_address, uint256 b_amount) public onlyMinters { super.burnFrom(b_address, b_amount); emit TokenMinterBurned(b_address, msg.sender, b_amount); } // This function is what other minters will call to mint new tokens function minter_mint(address m_address, uint256 m_amount) public onlyMinters { super._mint(m_address, m_amount); emit TokenMinterMinted(msg.sender, m_address, m_amount); } // Adds whitelisted minters function addMinter(address minter_address) public onlyByOwnGov { require(minter_address != address(0), "Zero address detected"); require(minters[minter_address] == false, "Address already exists"); minters[minter_address] = true; minters_array.push(minter_address); emit MinterAdded(minter_address); } // Remove a minter function removeMinter(address minter_address) public onlyByOwnGov { require(minter_address != address(0), "Zero address detected"); require(minters[minter_address] == true, "Address nonexistant"); // Delete from the mapping delete minters[minter_address]; // 'Delete' from the array by setting the address to 0x0 for (uint i = 0; i < minters_array.length; i++){ if (minters_array[i] == minter_address) { minters_array[i] = address(0); // This will leave a null in the array and keep the indices the same break; } } emit MinterRemoved(minter_address); } function setTimelock(address _timelock_address) public onlyByOwnGov { require(_timelock_address != address(0), "Zero address detected"); timelock_address = _timelock_address; emit TimelockChanged(_timelock_address); } /* ========== EVENTS ========== */ event TokenMinterBurned(address indexed from, address indexed to, uint256 amount); event TokenMinterMinted(address indexed from, address indexed to, uint256 amount); event MinterAdded(address minter_address); event MinterRemoved(address minter_address); event TimelockChanged(address timelock_address); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; // https://docs.synthetix.io/contracts/Owned // NO NEED TO AUDIT contract Owned { address public owner; address public nominatedOwner; constructor (address _owner) { require(_owner != address(0), "Owner address cannot be 0"); owner = _owner; emit OwnerChanged(address(0), _owner); } function nominateNewOwner(address _owner) external onlyOwner { nominatedOwner = _owner; emit OwnerNominated(_owner); } function acceptOwnership() external { require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership"); emit OwnerChanged(owner, nominatedOwner); owner = nominatedOwner; nominatedOwner = address(0); } modifier onlyOwner { require(msg.sender == owner, "Only the contract owner may perform this action"); _; } event OwnerNominated(address newOwner); event OwnerChanged(address oldOwner, address newOwner); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol) pragma solidity ^0.8.0; import "./draft-IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/ECDSA.sol"; import "../../../utils/cryptography/EIP712.sol"; import "../../../utils/Counters.sol"; /** * @dev Implementation 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. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(account, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ 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 v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
{ "remappings": [ "ERC4626/=lib/ERC4626/src/", "ds-test/=lib/solmate/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"depositContractAddress","type":"address"},{"internalType":"address","name":"frxETHAddress","type":"address"},{"internalType":"address","name":"sfrxETHAddress","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_timelock_address","type":"address"},{"internalType":"bytes","name":"_withdrawalCredential","type":"bytes"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"new_status","type":"bool"}],"name":"DepositEtherPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes","name":"pubKey","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"withdrawalCredential","type":"bytes"}],"name":"DepositSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"sent_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"withheld_amt","type":"uint256"}],"name":"ETHSubmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"EmergencyERC20Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyEtherRecovered","type":"event"},{"anonymous":false,"inputs":[],"name":"KeysCleared","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"new_status","type":"bool"}],"name":"SubmitPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"timelock_address","type":"address"}],"name":"TimelockChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"pubKey","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"withdrawalCredential","type":"bytes"}],"name":"ValidatorAdded","type":"event"},{"anonymous":false,"inputs":[],"name":"ValidatorArrayCleared","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"pubKey","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"remove_idx","type":"uint256"},{"indexed":false,"internalType":"bool","name":"dont_care_about_ordering","type":"bool"}],"name":"ValidatorRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"times","type":"uint256"}],"name":"ValidatorsPopped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"from_pubKey","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"to_pubKey","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"from_idx","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"to_idx","type":"uint256"}],"name":"ValidatorsSwapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"_withdrawalCredential","type":"bytes"}],"name":"WithdrawalCredentialSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithheldETHMoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newRatio","type":"uint256"}],"name":"WithholdRatioSet","type":"event"},{"inputs":[],"name":"DEPOSIT_SIZE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RATIO_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"activeValidators","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"pubKey","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"depositDataRoot","type":"bytes32"}],"internalType":"struct OperatorRegistry.Validator","name":"validator","type":"tuple"}],"name":"addValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"pubKey","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"depositDataRoot","type":"bytes32"}],"internalType":"struct OperatorRegistry.Validator[]","name":"validatorArray","type":"tuple[]"}],"name":"addValidators","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"clearValidatorArray","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentWithheldETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositContract","outputs":[{"internalType":"contract IDepositContract","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"max_deposits","type":"uint256"}],"name":"depositEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositEtherPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"frxETHToken","outputs":[{"internalType":"contract frxETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"getValidator","outputs":[{"internalType":"bytes","name":"pubKey","type":"bytes"},{"internalType":"bytes","name":"withdrawalCredentials","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"depositDataRoot","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"pubKey","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"depositDataRoot","type":"bytes32"}],"name":"getValidatorStruct","outputs":[{"components":[{"internalType":"bytes","name":"pubKey","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"depositDataRoot","type":"bytes32"}],"internalType":"struct OperatorRegistry.Validator","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"moveWithheldETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numValidators","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"times","type":"uint256"}],"name":"popValidators","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"remove_idx","type":"uint256"},{"internalType":"bool","name":"dont_care_about_ordering","type":"bool"}],"name":"removeValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_timelock_address","type":"address"}],"name":"setTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_new_withdrawal_pubkey","type":"bytes"}],"name":"setWithdrawalCredential","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newRatio","type":"uint256"}],"name":"setWithholdRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sfrxETHToken","outputs":[{"internalType":"contract IsfrxETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"submit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"submitAndDeposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"submitAndGive","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"submitPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"from_idx","type":"uint256"},{"internalType":"uint256","name":"to_idx","type":"uint256"}],"name":"swapValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timelock_address","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"togglePauseDepositEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"togglePauseSubmits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withholdRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60e06040523480156200001157600080fd5b50604051620034723803806200347283398101604081905262000034916200017b565b828282826001600160a01b038116620000935760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f74206265203000000000000000604482015260640160405180910390fd5b600080546001600160a01b0319166001600160a01b03831690811782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a150600480546001600160a01b0319166001600160a01b03841617905560036200011482826200033b565b505060016005555050506001600160a01b03948516608052505090821660a0521660c0526000600681905560075562000407565b80516001600160a01b03811681146200016057600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60008060008060008060c087890312156200019557600080fd5b620001a08762000148565b95506020620001b181890162000148565b9550620001c16040890162000148565b9450620001d16060890162000148565b9350620001e16080890162000148565b60a08901519093506001600160401b0380821115620001ff57600080fd5b818a0191508a601f8301126200021457600080fd5b81518181111562000229576200022962000165565b604051601f8201601f19908116603f0116810190838211818310171562000254576200025462000165565b816040528281528d868487010111156200026d57600080fd5b600093505b8284101562000291578484018601518185018701529285019262000272565b60008684830101528096505050505050509295509295509295565b600181811c90821680620002c157607f821691505b602082108103620002e257634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200033657600081815260208120601f850160051c81016020861015620003115750805b601f850160051c820191505b8181101562000332578281556001016200031d565b5050505b505050565b81516001600160401b0381111562000357576200035762000165565b6200036f81620003688454620002ac565b84620002e8565b602080601f831160018114620003a757600084156200038e5750858301515b600019600386901b1c1916600185901b17855562000332565b600085815260208120601f198616915b82811015620003d857888601518255948401946001909101908401620003b7565b5085821015620003f75787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c0516130186200045a6000396000818161025a01528181611345015261140901526000818161053f015281816107b501526113730152600081816106b90152610b0801526130186000f3fe6080604052600436106102135760003560e01c8063a3f3498011610118578063bdacb303116100a0578063d32867d01161006f578063d32867d014610650578063dc6663c714610667578063e77df36614610687578063e94ad65b146106a7578063f63a1711146106db57600080fd5b8063bdacb303146105c2578063bfda0c8c146105e2578063c3d31487146105f5578063cdcedf401461061557600080fd5b8063b5d89627116100e7578063b5d89627146104ce578063b5e5e64c146104fe578063b6d24f1814610513578063ba947f271461052d578063bc9944f91461056157600080fd5b8063a3f3498014610464578063aa6fa83c14610479578063ae6e83bf14610499578063b507fb00146104b957600080fd5b80634dcd45471161019b5780635d593f8d1161016a5780635d593f8d146103e457806379ba5097146103f95780638980f11f1461040e5780638da5cb5b1461042e5780638e69d7ad1461044e57600080fd5b80634dcd45471461039357806353a47bb7146103a657806357c59b04146103c65780635bcb2fc6146103dc57600080fd5b806335b5d534116101e257806335b5d534146102e85780633683c2041461030857806336bf3325146103285780633f8380b6146103535780634b9b90c51461037357600080fd5b80631627540c146102285780631c568db614610248578063206583ac1461029957806326839f17146102c857600080fd5b3661022357610221336106fb565b005b600080fd5b34801561023457600080fd5b5061022161024336600461265a565b6108a7565b34801561025457600080fd5b5061027c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102a557600080fd5b506009546102b890610100900460ff1681565b6040519015158152602001610290565b3480156102d457600080fd5b506102216102e336600461267e565b61096e565b3480156102f457600080fd5b50610221610303366004612697565b610c1f565b34801561031457600080fd5b5061022161032336600461275c565b611009565b34801561033457600080fd5b506103456801bc16d674ec80000081565b604051908152602001610290565b34801561035f57600080fd5b5061022161036e366004612799565b6110d4565b34801561037f57600080fd5b5061022161038e3660046127c5565b611264565b6103456103a136600461265a565b611323565b3480156103b257600080fd5b5060015461027c906001600160a01b031681565b3480156103d257600080fd5b5061034560065481565b6102216114d0565b3480156103f057600080fd5b50600254610345565b34801561040557600080fd5b506102216114db565b34801561041a57600080fd5b50610221610429366004612799565b6115c5565b34801561043a57600080fd5b5060005461027c906001600160a01b031681565b34801561045a57600080fd5b5061034560075481565b34801561047057600080fd5b5061022161170e565b34801561048557600080fd5b5061022161049436600461267e565b611784565b3480156104a557600080fd5b506102216104b436600461267e565b61184b565b3480156104c557600080fd5b50610221611921565b3480156104da57600080fd5b506104ee6104e936600461267e565b6119ae565b6040516102909493929190612850565b34801561050a57600080fd5b50610221611bbc565b34801561051f57600080fd5b506009546102b89060ff1681565b34801561053957600080fd5b5061027c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561056d57600080fd5b506105b561057c36600461289b565b60408051606080820183528082526020820152600091810191909152506040805160608101825293845260208401929092529082015290565b6040516102909190612908565b3480156105ce57600080fd5b506102216105dd36600461265a565b611c53565b6102216105f036600461265a565b611d2e565b34801561060157600080fd5b5061022161061036600461267e565b611d37565b34801561062157600080fd5b506102b861063036600461275c565b805160208183018101805160088252928201919093012091525460ff1681565b34801561065c57600080fd5b50610345620f424081565b34801561067357600080fd5b5060045461027c906001600160a01b031681565b34801561069357600080fd5b506102216106a2366004612966565b611e3c565b3480156106b357600080fd5b5061027c7f000000000000000000000000000000000000000000000000000000000000000081565b3480156106e757600080fd5b506102216106f6366004612996565b6121fe565b610703612286565b60095460ff161561074e5760405162461bcd60e51b815260206004820152601060248201526f14dd589b5a5d081a5cc81c185d5cd95960821b60448201526064015b60405180910390fd5b346000036107905760405162461bcd60e51b815260206004820152600f60248201526e043616e6e6f74207375626d6974203608c1b6044820152606401610745565b604051631a895faf60e21b81526001600160a01b0382811660048301523460248301527f00000000000000000000000000000000000000000000000000000000000000001690636a257ebc90604401600060405180830381600087803b1580156107f957600080fd5b505af115801561080d573d6000803e3d6000fd5b50505050600060065460001461085357620f42406006543461082f9190612a21565b6108399190612a40565b9050806007600082825461084d9190612a62565b90915550505b60408051348152602081018390526001600160a01b0384169133917f29b3e86ecfd94a32218997c40b051e650e4fd8c97fc7a4d266be3f7c61c5205b910160405180910390a3506108a46001600555565b50565b6000546001600160a01b031633146109195760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b6064820152608401610745565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906020015b60405180910390a150565b610976612286565b600954610100900460ff16156109ce5760405162461bcd60e51b815260206004820152601860248201527f4465706f736974696e67204554482069732070617573656400000000000000006044820152606401610745565b60006801bc16d674ec800000600754476109e89190612a75565b6109f29190612a40565b905060008111610a445760405162461bcd60e51b815260206004820152601a60248201527f4e6f7420656e6f7567682045544820696e20636f6e74726163740000000000006044820152606401610745565b806000839003610a55575080610a60565b82821115610a605750815b60005b81811015610c1257600080600080610a796122df565b9350935093509350600884604051610a919190612a88565b9081526040519081900360200190205460ff1615610af15760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f7220616c72656164792068617320333220455448000000006044820152606401610745565b6040516304512a2360e31b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906322895118906801bc16d674ec80000090610b4e908890889088908890600401612850565b6000604051808303818588803b158015610b6757600080fd5b505af1158015610b7b573d6000803e3d6000fd5b50505050506001600885604051610b929190612a88565b908152604051908190036020018120805492151560ff1990931692909217909155610bbe908590612a88565b60405180910390207f4d312bd9aebc53f5bfad5cc169f41e65030288ef6b769786d43998abfb69a25084604051610bf59190612aa4565b60405180910390a25050505080610c0b90612ab7565b9050610a63565b5050506108a46001600555565b6004546001600160a01b0316331480610c4257506000546001600160a01b031633145b610c5e5760405162461bcd60e51b815260040161074590612ad0565b600060028381548110610c7357610c73612aff565b9060005260206000209060030201604051806060016040529081600082018054610c9c90612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054610cc890612b15565b8015610d155780601f10610cea57610100808354040283529160200191610d15565b820191906000526020600020905b815481529060010190602001808311610cf857829003601f168201915b50505050508152602001600182018054610d2e90612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054610d5a90612b15565b8015610da75780601f10610d7c57610100808354040283529160200191610da7565b820191906000526020600020905b815481529060010190602001808311610d8a57829003601f168201915b505050505081526020016002820154815250509050600060028381548110610dd157610dd1612aff565b9060005260206000209060030201604051806060016040529081600082018054610dfa90612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054610e2690612b15565b8015610e735780601f10610e4857610100808354040283529160200191610e73565b820191906000526020600020905b815481529060010190602001808311610e5657829003601f168201915b50505050508152602001600182018054610e8c90612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb890612b15565b8015610f055780601f10610eda57610100808354040283529160200191610f05565b820191906000526020600020905b815481529060010190602001808311610ee857829003601f168201915b5050505050815260200160028201548152505090508160028481548110610f2e57610f2e612aff565b600091825260209091208251600390920201908190610f4d9082612bb3565b5060208201516001820190610f629082612bb3565b50604082015181600201559050508060028581548110610f8457610f84612aff565b600091825260209091208251600390920201908190610fa39082612bb3565b5060208201516001820190610fb89082612bb3565b506040918201516002909101558251825191517f03f1d229173cc08c7c85f7dcd914724184489590489ed1d27b31afb31013506192610ffb929188908890612c6d565b60405180910390a150505050565b6004546001600160a01b031633148061102c57506000546001600160a01b031633145b6110485760405162461bcd60e51b815260040161074590612ad0565b600254156110985760405162461bcd60e51b815260206004820152601b60248201527f436c6561722076616c696461746f7220617272617920666972737400000000006044820152606401610745565b60036110a48282612bb3565b507f8ba040512c1273086ac3dc9e59c32b9fc104064d6df4c3747fec10e029bc3fba816040516109639190612aa4565b6004546001600160a01b03163314806110f757506000546001600160a01b031633145b6111135760405162461bcd60e51b815260040161074590612ad0565b6007548111156111715760405162461bcd60e51b815260206004820152602360248201527f4e6f7420656e6f756768207769746868656c642045544820696e20636f6e74726044820152621858dd60ea1b6064820152608401610745565b80600760008282546111839190612a75565b90915550506040516000906001600160a01b0384169083908381818185875af1925050503d80600081146111d3576040519150601f19603f3d011682016040523d82523d6000602084013e6111d8565b606091505b505090508061121c5760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b2103a3930b739b332b960811b6044820152606401610745565b826001600160a01b03167f60b677b352dc4c2f8482a85e1557d78515c38e3f3671be950a8357db6f563b9b8360405161125791815260200190565b60405180910390a2505050565b6004546001600160a01b031633148061128757506000546001600160a01b031633145b6112a35760405162461bcd60e51b815260040161074590612ad0565b6002805460018101825560009190915281906003027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace016112e48282612daf565b507f56fee40578122d6872c25c03569653f7c3535363d7c04df91aa93806113b50c190506113128280612ca6565b600360405161096393929190612e9c565b600061132e306106fb565b60405163095ea7b360e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301523460248301527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b3906044016020604051808303816000875af11580156113bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e09190612f56565b50604051636e553f6560e01b81523460048201526001600160a01b0383811660248301526000917f000000000000000000000000000000000000000000000000000000000000000090911690636e553f65906044016020604051808303816000875af1158015611454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114789190612f73565b9050600081116114ca5760405162461bcd60e51b815260206004820152601760248201527f4e6f2073667278455448207761732072657475726e65640000000000000000006044820152606401610745565b92915050565b6114d9336106fb565b565b6001546001600160a01b031633146115535760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610745565b600054600154604080516001600160a01b0393841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6004546001600160a01b03163314806115e857506000546001600160a01b031633145b6116045760405162461bcd60e51b815260040161074590612ad0565b60005460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb906044016020604051808303816000875af1158015611657573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167b9190612f56565b6116c75760405162461bcd60e51b815260206004820152601d60248201527f7265636f76657245524332303a205472616e73666572206661696c65640000006044820152606401610745565b604080516001600160a01b0384168152602081018390527f2178cd1256ad9200080414ad733212aa6401e6a74954264b7654e671db074f5691015b60405180910390a15050565b6004546001600160a01b031633148061173157506000546001600160a01b031633145b61174d5760405162461bcd60e51b815260040161074590612ad0565b6117596002600061259f565b6040517fbf5f94bdb8a562775e85a1990f734d669663e8de3b240d56ec4b1f71ca66b00790600090a1565b6004546001600160a01b03163314806117a757506000546001600160a01b031633145b6117c35760405162461bcd60e51b815260040161074590612ad0565b620f42408111156118165760405162461bcd60e51b815260206004820152601960248201527f526174696f2063616e6e6f7420737572706173732031303025000000000000006044820152606401610745565b60068190556040518181527f9d9f4a1fa43ffde666e23300e98e21e37dccd7f33bb238071f5341a53f346f9390602001610963565b6004546001600160a01b031633148061186e57506000546001600160a01b031633145b61188a5760405162461bcd60e51b815260040161074590612ad0565b60005b818110156118f05760028054806118a6576118a6612f8c565b600082815260208120600019909201916003830201906118c682826125c0565b6118d46001830160006125c0565b5060006002919091015590556118e981612ab7565b905061188d565b506040518181527f03ed6e686bcf321d69427b429b8e18745c96afc0ba4e6c7eb1f3aefaff088cf390602001610963565b6004546001600160a01b031633148061194457506000546001600160a01b031633145b6119605760405162461bcd60e51b815260040161074590612ad0565b6009805460ff8082161560ff1990921682179092556040519116151581527f4aff1af3f32e78f88c86566e6b50fe05d6ba3d9c7374e042ac17e5191c5fac56906020015b60405180910390a1565b6060806060600080600286815481106119c9576119c9612aff565b90600052602060002090600302016040518060600160405290816000820180546119f290612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054611a1e90612b15565b8015611a6b5780601f10611a4057610100808354040283529160200191611a6b565b820191906000526020600020905b815481529060010190602001808311611a4e57829003601f168201915b50505050508152602001600182018054611a8490612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054611ab090612b15565b8015611afd5780601f10611ad257610100808354040283529160200191611afd565b820191906000526020600020905b815481529060010190602001808311611ae057829003601f168201915b5050505050815260200160028201548152505090508060000151945060038054611b2690612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054611b5290612b15565b8015611b9f5780601f10611b7457610100808354040283529160200191611b9f565b820191906000526020600020905b815481529060010190602001808311611b8257829003601f168201915b505050505093508060200151925080604001519150509193509193565b6004546001600160a01b0316331480611bdf57506000546001600160a01b031633145b611bfb5760405162461bcd60e51b815260040161074590612ad0565b6009805460ff610100808304821615810261ff001990931692909217928390556040517fcead0025c428cc6485390ecd2b3213d7a3d44d3f190a3b880ba9025521365706936119a49390049091161515815260200190565b6004546001600160a01b0316331480611c7657506000546001600160a01b031633145b611c925760405162461bcd60e51b815260040161074590612ad0565b6001600160a01b038116611ce05760405162461bcd60e51b815260206004820152601560248201527416995c9bc81859191c995cdcc819195d1958dd1959605a1b6044820152606401610745565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527ff02fdf7b40fb25784d39342249bbb15cee2bc0288f75ded1cf8ad2e63d4d91aa90602001610963565b6108a4816106fb565b6004546001600160a01b0316331480611d5a57506000546001600160a01b031633145b611d765760405162461bcd60e51b815260040161074590612ad0565b600080546040516001600160a01b039091169083908381818185875af1925050503d8060008114611dc3576040519150601f19603f3d011682016040523d82523d6000602084013e611dc8565b606091505b5050905080611e0c5760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b2103a3930b739b332b960811b6044820152606401610745565b6040518281527f040130779a9eeca4469ba7b0c5223a65f424ea2a23f9b9ee336afd7905ef68b490602001611702565b6004546001600160a01b0316331480611e5f57506000546001600160a01b031633145b611e7b5760405162461bcd60e51b815260040161074590612ad0565b600060028381548110611e9057611e90612aff565b90600052602060002090600302016000018054611eac90612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054611ed890612b15565b8015611f255780601f10611efa57610100808354040283529160200191611f25565b820191906000526020600020905b815481529060010190602001808311611f0857829003601f168201915b505050505090508115611f9757600254611f4790849061030390600190612a75565b6002805480611f5857611f58612f8c565b60008281526020812060001990920191600383020190611f7882826125c0565b611f866001830160006125c0565b6002820160009055505090556121be565b60006002805480602002602001604051908101604052809291908181526020016000905b8282101561211b5783829060005260206000209060030201604051806060016040529081600082018054611fee90612b15565b80601f016020809104026020016040519081016040528092919081815260200182805461201a90612b15565b80156120675780601f1061203c57610100808354040283529160200191612067565b820191906000526020600020905b81548152906001019060200180831161204a57829003601f168201915b5050505050815260200160018201805461208090612b15565b80601f01602080910402602001604051908101604052809291908181526020018280546120ac90612b15565b80156120f95780601f106120ce576101008083540402835291602001916120f9565b820191906000526020600020905b8154815290600101906020018083116120dc57829003601f168201915b5050505050815260200160028201548152505081526020019060010190611fbb565b5050505090506002600061212f919061259f565b60005b81518110156121bb578481146121ab57600282828151811061215657612156612aff565b602090810291909101810151825460018101845560009384529190922082516003909202019081906121889082612bb3565b506020820151600182019061219d9082612bb3565b506040820151816002015550505b6121b481612ab7565b9050612132565b50505b7f0d69d6651f1449a1038428f2773f275a39ef104c76bf46970cdffdbbe1496c518184846040516121f193929190612fa2565b60405180910390a1505050565b6004546001600160a01b031633148061222157506000546001600160a01b031633145b61223d5760405162461bcd60e51b815260040161074590612ad0565b8060005b818110156122805761227084848381811061225e5761225e612aff565b905060200281019061038e9190612fcc565b61227981612ab7565b9050612241565b50505050565b6002600554036122d85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610745565b6002600555565b60608060606000806122f060025490565b9050806000036123425760405162461bcd60e51b815260206004820152601860248201527f56616c696461746f7220737461636b20697320656d70747900000000000000006044820152606401610745565b60006002612351600184612a75565b8154811061236157612361612aff565b906000526020600020906003020160405180606001604052908160008201805461238a90612b15565b80601f01602080910402602001604051908101604052809291908181526020018280546123b690612b15565b80156124035780601f106123d857610100808354040283529160200191612403565b820191906000526020600020905b8154815290600101906020018083116123e657829003601f168201915b5050505050815260200160018201805461241c90612b15565b80601f016020809104026020016040519081016040528092919081815260200182805461244890612b15565b80156124955780601f1061246a57610100808354040283529160200191612495565b820191906000526020600020905b81548152906001019060200180831161247857829003601f168201915b50505050508152602001600282015481525050905060028054806124bb576124bb612f8c565b600082815260208120600019909201916003830201906124db82826125c0565b6124e96001830160006125c0565b600282016000905550509055806000015195506003805461250990612b15565b80601f016020809104026020016040519081016040528092919081815260200182805461253590612b15565b80156125825780601f1061255757610100808354040283529160200191612582565b820191906000526020600020905b81548152906001019060200180831161256557829003601f168201915b505050505094508060200151935080604001519250505090919293565b50805460008255600302906000526020600020908101906108a491906125fa565b5080546125cc90612b15565b6000825580601f106125dc575050565b601f0160209004906000526020600020908101906108a49190612630565b8082111561262c57600061260e82826125c0565b61261c6001830160006125c0565b50600060028201556003016125fa565b5090565b5b8082111561262c5760008155600101612631565b6001600160a01b03811681146108a457600080fd5b60006020828403121561266c57600080fd5b813561267781612645565b9392505050565b60006020828403121561269057600080fd5b5035919050565b600080604083850312156126aa57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126126e057600080fd5b813567ffffffffffffffff808211156126fb576126fb6126b9565b604051601f8301601f19908116603f01168101908282118183101715612723576127236126b9565b8160405283815286602085880101111561273c57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60006020828403121561276e57600080fd5b813567ffffffffffffffff81111561278557600080fd5b612791848285016126cf565b949350505050565b600080604083850312156127ac57600080fd5b82356127b781612645565b946020939093013593505050565b6000602082840312156127d757600080fd5b813567ffffffffffffffff8111156127ee57600080fd5b82016060818503121561267757600080fd5b60005b8381101561281b578181015183820152602001612803565b50506000910152565b6000815180845261283c816020860160208601612800565b601f01601f19169290920160200192915050565b6080815260006128636080830187612824565b82810360208401526128758187612824565b905082810360408401526128898186612824565b91505082606083015295945050505050565b6000806000606084860312156128b057600080fd5b833567ffffffffffffffff808211156128c857600080fd5b6128d4878388016126cf565b945060208601359150808211156128ea57600080fd5b506128f7868287016126cf565b925050604084013590509250925092565b6020815260008251606060208401526129246080840182612824565b90506020840151601f198483030160408501526129418282612824565b915050604084015160608401528091505092915050565b80151581146108a457600080fd5b6000806040838503121561297957600080fd5b82359150602083013561298b81612958565b809150509250929050565b600080602083850312156129a957600080fd5b823567ffffffffffffffff808211156129c157600080fd5b818501915085601f8301126129d557600080fd5b8135818111156129e457600080fd5b8660208260051b85010111156129f957600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612a3b57612a3b612a0b565b500290565b600082612a5d57634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156114ca576114ca612a0b565b818103818111156114ca576114ca612a0b565b60008251612a9a818460208701612800565b9190910192915050565b6020815260006126776020830184612824565b600060018201612ac957612ac9612a0b565b5060010190565b6020808252601590820152744e6f74206f776e6572206f722074696d656c6f636b60581b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600181811c90821680612b2957607f821691505b602082108103612b4957634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115612b9957600081815260208120601f850160051c81016020861015612b765750805b601f850160051c820191505b81811015612b9557828155600101612b82565b5050505b505050565b600019600383901b1c191660019190911b1790565b815167ffffffffffffffff811115612bcd57612bcd6126b9565b612be181612bdb8454612b15565b84612b4f565b602080601f831160018114612c105760008415612bfe5750858301515b612c088582612b9e565b865550612b95565b600085815260208120601f198616915b82811015612c3f57888601518255948401946001909101908401612c20565b5085821015612c5d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608081526000612c806080830187612824565b8281036020840152612c928187612824565b604084019590955250506060015292915050565b6000808335601e19843603018112612cbd57600080fd5b83018035915067ffffffffffffffff821115612cd857600080fd5b602001915036819003821315612ced57600080fd5b9250929050565b67ffffffffffffffff831115612d0c57612d0c6126b9565b612d2083612d1a8354612b15565b83612b4f565b6000601f841160018114612d4e5760008515612d3c5750838201355b612d468682612b9e565b845550612da8565b600083815260209020601f19861690835b82811015612d7f5786850135825560209485019460019092019101612d5f565b5086821015612d9c5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b612db98283612ca6565b67ffffffffffffffff811115612dd157612dd16126b9565b612de581612ddf8554612b15565b85612b4f565b6000601f821160018114612e135760008315612e015750838201355b612e0b8482612b9e565b865550612e6d565b600085815260209020601f19841690835b82811015612e445786850135825560209485019460019092019101612e24565b5084821015612e615760001960f88660031b161c19848701351681555b505060018360011b0185555b50505050612e7e6020830183612ca6565b612e8c818360018601612cf4565b5050604082013560028201555050565b60408152826040820152828460608301376000606084830101526000601f19601f850116820160206060848303018185015260008554612edb81612b15565b8060608601526080600180841660008114612efd5760018114612f1757612f45565b60ff1985168884015283151560051b880183019550612f45565b8a6000528660002060005b85811015612f3d5781548a8201860152908301908801612f22565b890184019650505b50939b9a5050505050505050505050565b600060208284031215612f6857600080fd5b815161267781612958565b600060208284031215612f8557600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b606081526000612fb56060830186612824565b602083019490945250901515604090910152919050565b60008235605e19833603018112612a9a57600080fdfea26469706673582212201949e249f47d5b13c9d780365e79bd871f01ab1b94020f1f47096d1d9871857e64736f6c63430008100033000000000000000000000000b1748c79709f4ba2dd82834b8c82d4a505003f270000000000000000000000002c37fb628b35dfdfd515d41b0caae11b542773c3000000000000000000000000e30521fe7f3beb6ad556887b50739d6c7ca667e6000000000000000000000000b1748c79709f4ba2dd82834b8c82d4a505003f270000000000000000000000008412ebf45bac1b340bbe8f318b928c466c4e39ca00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020010000000000000000000000b1748c79709f4ba2dd82834b8c82d4a505003f27
Deployed Bytecode
0x6080604052600436106102135760003560e01c8063a3f3498011610118578063bdacb303116100a0578063d32867d01161006f578063d32867d014610650578063dc6663c714610667578063e77df36614610687578063e94ad65b146106a7578063f63a1711146106db57600080fd5b8063bdacb303146105c2578063bfda0c8c146105e2578063c3d31487146105f5578063cdcedf401461061557600080fd5b8063b5d89627116100e7578063b5d89627146104ce578063b5e5e64c146104fe578063b6d24f1814610513578063ba947f271461052d578063bc9944f91461056157600080fd5b8063a3f3498014610464578063aa6fa83c14610479578063ae6e83bf14610499578063b507fb00146104b957600080fd5b80634dcd45471161019b5780635d593f8d1161016a5780635d593f8d146103e457806379ba5097146103f95780638980f11f1461040e5780638da5cb5b1461042e5780638e69d7ad1461044e57600080fd5b80634dcd45471461039357806353a47bb7146103a657806357c59b04146103c65780635bcb2fc6146103dc57600080fd5b806335b5d534116101e257806335b5d534146102e85780633683c2041461030857806336bf3325146103285780633f8380b6146103535780634b9b90c51461037357600080fd5b80631627540c146102285780631c568db614610248578063206583ac1461029957806326839f17146102c857600080fd5b3661022357610221336106fb565b005b600080fd5b34801561023457600080fd5b5061022161024336600461265a565b6108a7565b34801561025457600080fd5b5061027c7f000000000000000000000000e30521fe7f3beb6ad556887b50739d6c7ca667e681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102a557600080fd5b506009546102b890610100900460ff1681565b6040519015158152602001610290565b3480156102d457600080fd5b506102216102e336600461267e565b61096e565b3480156102f457600080fd5b50610221610303366004612697565b610c1f565b34801561031457600080fd5b5061022161032336600461275c565b611009565b34801561033457600080fd5b506103456801bc16d674ec80000081565b604051908152602001610290565b34801561035f57600080fd5b5061022161036e366004612799565b6110d4565b34801561037f57600080fd5b5061022161038e3660046127c5565b611264565b6103456103a136600461265a565b611323565b3480156103b257600080fd5b5060015461027c906001600160a01b031681565b3480156103d257600080fd5b5061034560065481565b6102216114d0565b3480156103f057600080fd5b50600254610345565b34801561040557600080fd5b506102216114db565b34801561041a57600080fd5b50610221610429366004612799565b6115c5565b34801561043a57600080fd5b5060005461027c906001600160a01b031681565b34801561045a57600080fd5b5061034560075481565b34801561047057600080fd5b5061022161170e565b34801561048557600080fd5b5061022161049436600461267e565b611784565b3480156104a557600080fd5b506102216104b436600461267e565b61184b565b3480156104c557600080fd5b50610221611921565b3480156104da57600080fd5b506104ee6104e936600461267e565b6119ae565b6040516102909493929190612850565b34801561050a57600080fd5b50610221611bbc565b34801561051f57600080fd5b506009546102b89060ff1681565b34801561053957600080fd5b5061027c7f0000000000000000000000002c37fb628b35dfdfd515d41b0caae11b542773c381565b34801561056d57600080fd5b506105b561057c36600461289b565b60408051606080820183528082526020820152600091810191909152506040805160608101825293845260208401929092529082015290565b6040516102909190612908565b3480156105ce57600080fd5b506102216105dd36600461265a565b611c53565b6102216105f036600461265a565b611d2e565b34801561060157600080fd5b5061022161061036600461267e565b611d37565b34801561062157600080fd5b506102b861063036600461275c565b805160208183018101805160088252928201919093012091525460ff1681565b34801561065c57600080fd5b50610345620f424081565b34801561067357600080fd5b5060045461027c906001600160a01b031681565b34801561069357600080fd5b506102216106a2366004612966565b611e3c565b3480156106b357600080fd5b5061027c7f000000000000000000000000b1748c79709f4ba2dd82834b8c82d4a505003f2781565b3480156106e757600080fd5b506102216106f6366004612996565b6121fe565b610703612286565b60095460ff161561074e5760405162461bcd60e51b815260206004820152601060248201526f14dd589b5a5d081a5cc81c185d5cd95960821b60448201526064015b60405180910390fd5b346000036107905760405162461bcd60e51b815260206004820152600f60248201526e043616e6e6f74207375626d6974203608c1b6044820152606401610745565b604051631a895faf60e21b81526001600160a01b0382811660048301523460248301527f0000000000000000000000002c37fb628b35dfdfd515d41b0caae11b542773c31690636a257ebc90604401600060405180830381600087803b1580156107f957600080fd5b505af115801561080d573d6000803e3d6000fd5b50505050600060065460001461085357620f42406006543461082f9190612a21565b6108399190612a40565b9050806007600082825461084d9190612a62565b90915550505b60408051348152602081018390526001600160a01b0384169133917f29b3e86ecfd94a32218997c40b051e650e4fd8c97fc7a4d266be3f7c61c5205b910160405180910390a3506108a46001600555565b50565b6000546001600160a01b031633146109195760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b6064820152608401610745565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906020015b60405180910390a150565b610976612286565b600954610100900460ff16156109ce5760405162461bcd60e51b815260206004820152601860248201527f4465706f736974696e67204554482069732070617573656400000000000000006044820152606401610745565b60006801bc16d674ec800000600754476109e89190612a75565b6109f29190612a40565b905060008111610a445760405162461bcd60e51b815260206004820152601a60248201527f4e6f7420656e6f7567682045544820696e20636f6e74726163740000000000006044820152606401610745565b806000839003610a55575080610a60565b82821115610a605750815b60005b81811015610c1257600080600080610a796122df565b9350935093509350600884604051610a919190612a88565b9081526040519081900360200190205460ff1615610af15760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f7220616c72656164792068617320333220455448000000006044820152606401610745565b6040516304512a2360e31b81526001600160a01b037f000000000000000000000000b1748c79709f4ba2dd82834b8c82d4a505003f2716906322895118906801bc16d674ec80000090610b4e908890889088908890600401612850565b6000604051808303818588803b158015610b6757600080fd5b505af1158015610b7b573d6000803e3d6000fd5b50505050506001600885604051610b929190612a88565b908152604051908190036020018120805492151560ff1990931692909217909155610bbe908590612a88565b60405180910390207f4d312bd9aebc53f5bfad5cc169f41e65030288ef6b769786d43998abfb69a25084604051610bf59190612aa4565b60405180910390a25050505080610c0b90612ab7565b9050610a63565b5050506108a46001600555565b6004546001600160a01b0316331480610c4257506000546001600160a01b031633145b610c5e5760405162461bcd60e51b815260040161074590612ad0565b600060028381548110610c7357610c73612aff565b9060005260206000209060030201604051806060016040529081600082018054610c9c90612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054610cc890612b15565b8015610d155780601f10610cea57610100808354040283529160200191610d15565b820191906000526020600020905b815481529060010190602001808311610cf857829003601f168201915b50505050508152602001600182018054610d2e90612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054610d5a90612b15565b8015610da75780601f10610d7c57610100808354040283529160200191610da7565b820191906000526020600020905b815481529060010190602001808311610d8a57829003601f168201915b505050505081526020016002820154815250509050600060028381548110610dd157610dd1612aff565b9060005260206000209060030201604051806060016040529081600082018054610dfa90612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054610e2690612b15565b8015610e735780601f10610e4857610100808354040283529160200191610e73565b820191906000526020600020905b815481529060010190602001808311610e5657829003601f168201915b50505050508152602001600182018054610e8c90612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb890612b15565b8015610f055780601f10610eda57610100808354040283529160200191610f05565b820191906000526020600020905b815481529060010190602001808311610ee857829003601f168201915b5050505050815260200160028201548152505090508160028481548110610f2e57610f2e612aff565b600091825260209091208251600390920201908190610f4d9082612bb3565b5060208201516001820190610f629082612bb3565b50604082015181600201559050508060028581548110610f8457610f84612aff565b600091825260209091208251600390920201908190610fa39082612bb3565b5060208201516001820190610fb89082612bb3565b506040918201516002909101558251825191517f03f1d229173cc08c7c85f7dcd914724184489590489ed1d27b31afb31013506192610ffb929188908890612c6d565b60405180910390a150505050565b6004546001600160a01b031633148061102c57506000546001600160a01b031633145b6110485760405162461bcd60e51b815260040161074590612ad0565b600254156110985760405162461bcd60e51b815260206004820152601b60248201527f436c6561722076616c696461746f7220617272617920666972737400000000006044820152606401610745565b60036110a48282612bb3565b507f8ba040512c1273086ac3dc9e59c32b9fc104064d6df4c3747fec10e029bc3fba816040516109639190612aa4565b6004546001600160a01b03163314806110f757506000546001600160a01b031633145b6111135760405162461bcd60e51b815260040161074590612ad0565b6007548111156111715760405162461bcd60e51b815260206004820152602360248201527f4e6f7420656e6f756768207769746868656c642045544820696e20636f6e74726044820152621858dd60ea1b6064820152608401610745565b80600760008282546111839190612a75565b90915550506040516000906001600160a01b0384169083908381818185875af1925050503d80600081146111d3576040519150601f19603f3d011682016040523d82523d6000602084013e6111d8565b606091505b505090508061121c5760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b2103a3930b739b332b960811b6044820152606401610745565b826001600160a01b03167f60b677b352dc4c2f8482a85e1557d78515c38e3f3671be950a8357db6f563b9b8360405161125791815260200190565b60405180910390a2505050565b6004546001600160a01b031633148061128757506000546001600160a01b031633145b6112a35760405162461bcd60e51b815260040161074590612ad0565b6002805460018101825560009190915281906003027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace016112e48282612daf565b507f56fee40578122d6872c25c03569653f7c3535363d7c04df91aa93806113b50c190506113128280612ca6565b600360405161096393929190612e9c565b600061132e306106fb565b60405163095ea7b360e01b81526001600160a01b037f000000000000000000000000e30521fe7f3beb6ad556887b50739d6c7ca667e6811660048301523460248301527f0000000000000000000000002c37fb628b35dfdfd515d41b0caae11b542773c3169063095ea7b3906044016020604051808303816000875af11580156113bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e09190612f56565b50604051636e553f6560e01b81523460048201526001600160a01b0383811660248301526000917f000000000000000000000000e30521fe7f3beb6ad556887b50739d6c7ca667e690911690636e553f65906044016020604051808303816000875af1158015611454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114789190612f73565b9050600081116114ca5760405162461bcd60e51b815260206004820152601760248201527f4e6f2073667278455448207761732072657475726e65640000000000000000006044820152606401610745565b92915050565b6114d9336106fb565b565b6001546001600160a01b031633146115535760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610745565b600054600154604080516001600160a01b0393841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6004546001600160a01b03163314806115e857506000546001600160a01b031633145b6116045760405162461bcd60e51b815260040161074590612ad0565b60005460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb906044016020604051808303816000875af1158015611657573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167b9190612f56565b6116c75760405162461bcd60e51b815260206004820152601d60248201527f7265636f76657245524332303a205472616e73666572206661696c65640000006044820152606401610745565b604080516001600160a01b0384168152602081018390527f2178cd1256ad9200080414ad733212aa6401e6a74954264b7654e671db074f5691015b60405180910390a15050565b6004546001600160a01b031633148061173157506000546001600160a01b031633145b61174d5760405162461bcd60e51b815260040161074590612ad0565b6117596002600061259f565b6040517fbf5f94bdb8a562775e85a1990f734d669663e8de3b240d56ec4b1f71ca66b00790600090a1565b6004546001600160a01b03163314806117a757506000546001600160a01b031633145b6117c35760405162461bcd60e51b815260040161074590612ad0565b620f42408111156118165760405162461bcd60e51b815260206004820152601960248201527f526174696f2063616e6e6f7420737572706173732031303025000000000000006044820152606401610745565b60068190556040518181527f9d9f4a1fa43ffde666e23300e98e21e37dccd7f33bb238071f5341a53f346f9390602001610963565b6004546001600160a01b031633148061186e57506000546001600160a01b031633145b61188a5760405162461bcd60e51b815260040161074590612ad0565b60005b818110156118f05760028054806118a6576118a6612f8c565b600082815260208120600019909201916003830201906118c682826125c0565b6118d46001830160006125c0565b5060006002919091015590556118e981612ab7565b905061188d565b506040518181527f03ed6e686bcf321d69427b429b8e18745c96afc0ba4e6c7eb1f3aefaff088cf390602001610963565b6004546001600160a01b031633148061194457506000546001600160a01b031633145b6119605760405162461bcd60e51b815260040161074590612ad0565b6009805460ff8082161560ff1990921682179092556040519116151581527f4aff1af3f32e78f88c86566e6b50fe05d6ba3d9c7374e042ac17e5191c5fac56906020015b60405180910390a1565b6060806060600080600286815481106119c9576119c9612aff565b90600052602060002090600302016040518060600160405290816000820180546119f290612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054611a1e90612b15565b8015611a6b5780601f10611a4057610100808354040283529160200191611a6b565b820191906000526020600020905b815481529060010190602001808311611a4e57829003601f168201915b50505050508152602001600182018054611a8490612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054611ab090612b15565b8015611afd5780601f10611ad257610100808354040283529160200191611afd565b820191906000526020600020905b815481529060010190602001808311611ae057829003601f168201915b5050505050815260200160028201548152505090508060000151945060038054611b2690612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054611b5290612b15565b8015611b9f5780601f10611b7457610100808354040283529160200191611b9f565b820191906000526020600020905b815481529060010190602001808311611b8257829003601f168201915b505050505093508060200151925080604001519150509193509193565b6004546001600160a01b0316331480611bdf57506000546001600160a01b031633145b611bfb5760405162461bcd60e51b815260040161074590612ad0565b6009805460ff610100808304821615810261ff001990931692909217928390556040517fcead0025c428cc6485390ecd2b3213d7a3d44d3f190a3b880ba9025521365706936119a49390049091161515815260200190565b6004546001600160a01b0316331480611c7657506000546001600160a01b031633145b611c925760405162461bcd60e51b815260040161074590612ad0565b6001600160a01b038116611ce05760405162461bcd60e51b815260206004820152601560248201527416995c9bc81859191c995cdcc819195d1958dd1959605a1b6044820152606401610745565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527ff02fdf7b40fb25784d39342249bbb15cee2bc0288f75ded1cf8ad2e63d4d91aa90602001610963565b6108a4816106fb565b6004546001600160a01b0316331480611d5a57506000546001600160a01b031633145b611d765760405162461bcd60e51b815260040161074590612ad0565b600080546040516001600160a01b039091169083908381818185875af1925050503d8060008114611dc3576040519150601f19603f3d011682016040523d82523d6000602084013e611dc8565b606091505b5050905080611e0c5760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b2103a3930b739b332b960811b6044820152606401610745565b6040518281527f040130779a9eeca4469ba7b0c5223a65f424ea2a23f9b9ee336afd7905ef68b490602001611702565b6004546001600160a01b0316331480611e5f57506000546001600160a01b031633145b611e7b5760405162461bcd60e51b815260040161074590612ad0565b600060028381548110611e9057611e90612aff565b90600052602060002090600302016000018054611eac90612b15565b80601f0160208091040260200160405190810160405280929190818152602001828054611ed890612b15565b8015611f255780601f10611efa57610100808354040283529160200191611f25565b820191906000526020600020905b815481529060010190602001808311611f0857829003601f168201915b505050505090508115611f9757600254611f4790849061030390600190612a75565b6002805480611f5857611f58612f8c565b60008281526020812060001990920191600383020190611f7882826125c0565b611f866001830160006125c0565b6002820160009055505090556121be565b60006002805480602002602001604051908101604052809291908181526020016000905b8282101561211b5783829060005260206000209060030201604051806060016040529081600082018054611fee90612b15565b80601f016020809104026020016040519081016040528092919081815260200182805461201a90612b15565b80156120675780601f1061203c57610100808354040283529160200191612067565b820191906000526020600020905b81548152906001019060200180831161204a57829003601f168201915b5050505050815260200160018201805461208090612b15565b80601f01602080910402602001604051908101604052809291908181526020018280546120ac90612b15565b80156120f95780601f106120ce576101008083540402835291602001916120f9565b820191906000526020600020905b8154815290600101906020018083116120dc57829003601f168201915b5050505050815260200160028201548152505081526020019060010190611fbb565b5050505090506002600061212f919061259f565b60005b81518110156121bb578481146121ab57600282828151811061215657612156612aff565b602090810291909101810151825460018101845560009384529190922082516003909202019081906121889082612bb3565b506020820151600182019061219d9082612bb3565b506040820151816002015550505b6121b481612ab7565b9050612132565b50505b7f0d69d6651f1449a1038428f2773f275a39ef104c76bf46970cdffdbbe1496c518184846040516121f193929190612fa2565b60405180910390a1505050565b6004546001600160a01b031633148061222157506000546001600160a01b031633145b61223d5760405162461bcd60e51b815260040161074590612ad0565b8060005b818110156122805761227084848381811061225e5761225e612aff565b905060200281019061038e9190612fcc565b61227981612ab7565b9050612241565b50505050565b6002600554036122d85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610745565b6002600555565b60608060606000806122f060025490565b9050806000036123425760405162461bcd60e51b815260206004820152601860248201527f56616c696461746f7220737461636b20697320656d70747900000000000000006044820152606401610745565b60006002612351600184612a75565b8154811061236157612361612aff565b906000526020600020906003020160405180606001604052908160008201805461238a90612b15565b80601f01602080910402602001604051908101604052809291908181526020018280546123b690612b15565b80156124035780601f106123d857610100808354040283529160200191612403565b820191906000526020600020905b8154815290600101906020018083116123e657829003601f168201915b5050505050815260200160018201805461241c90612b15565b80601f016020809104026020016040519081016040528092919081815260200182805461244890612b15565b80156124955780601f1061246a57610100808354040283529160200191612495565b820191906000526020600020905b81548152906001019060200180831161247857829003601f168201915b50505050508152602001600282015481525050905060028054806124bb576124bb612f8c565b600082815260208120600019909201916003830201906124db82826125c0565b6124e96001830160006125c0565b600282016000905550509055806000015195506003805461250990612b15565b80601f016020809104026020016040519081016040528092919081815260200182805461253590612b15565b80156125825780601f1061255757610100808354040283529160200191612582565b820191906000526020600020905b81548152906001019060200180831161256557829003601f168201915b505050505094508060200151935080604001519250505090919293565b50805460008255600302906000526020600020908101906108a491906125fa565b5080546125cc90612b15565b6000825580601f106125dc575050565b601f0160209004906000526020600020908101906108a49190612630565b8082111561262c57600061260e82826125c0565b61261c6001830160006125c0565b50600060028201556003016125fa565b5090565b5b8082111561262c5760008155600101612631565b6001600160a01b03811681146108a457600080fd5b60006020828403121561266c57600080fd5b813561267781612645565b9392505050565b60006020828403121561269057600080fd5b5035919050565b600080604083850312156126aa57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126126e057600080fd5b813567ffffffffffffffff808211156126fb576126fb6126b9565b604051601f8301601f19908116603f01168101908282118183101715612723576127236126b9565b8160405283815286602085880101111561273c57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60006020828403121561276e57600080fd5b813567ffffffffffffffff81111561278557600080fd5b612791848285016126cf565b949350505050565b600080604083850312156127ac57600080fd5b82356127b781612645565b946020939093013593505050565b6000602082840312156127d757600080fd5b813567ffffffffffffffff8111156127ee57600080fd5b82016060818503121561267757600080fd5b60005b8381101561281b578181015183820152602001612803565b50506000910152565b6000815180845261283c816020860160208601612800565b601f01601f19169290920160200192915050565b6080815260006128636080830187612824565b82810360208401526128758187612824565b905082810360408401526128898186612824565b91505082606083015295945050505050565b6000806000606084860312156128b057600080fd5b833567ffffffffffffffff808211156128c857600080fd5b6128d4878388016126cf565b945060208601359150808211156128ea57600080fd5b506128f7868287016126cf565b925050604084013590509250925092565b6020815260008251606060208401526129246080840182612824565b90506020840151601f198483030160408501526129418282612824565b915050604084015160608401528091505092915050565b80151581146108a457600080fd5b6000806040838503121561297957600080fd5b82359150602083013561298b81612958565b809150509250929050565b600080602083850312156129a957600080fd5b823567ffffffffffffffff808211156129c157600080fd5b818501915085601f8301126129d557600080fd5b8135818111156129e457600080fd5b8660208260051b85010111156129f957600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612a3b57612a3b612a0b565b500290565b600082612a5d57634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156114ca576114ca612a0b565b818103818111156114ca576114ca612a0b565b60008251612a9a818460208701612800565b9190910192915050565b6020815260006126776020830184612824565b600060018201612ac957612ac9612a0b565b5060010190565b6020808252601590820152744e6f74206f776e6572206f722074696d656c6f636b60581b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600181811c90821680612b2957607f821691505b602082108103612b4957634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115612b9957600081815260208120601f850160051c81016020861015612b765750805b601f850160051c820191505b81811015612b9557828155600101612b82565b5050505b505050565b600019600383901b1c191660019190911b1790565b815167ffffffffffffffff811115612bcd57612bcd6126b9565b612be181612bdb8454612b15565b84612b4f565b602080601f831160018114612c105760008415612bfe5750858301515b612c088582612b9e565b865550612b95565b600085815260208120601f198616915b82811015612c3f57888601518255948401946001909101908401612c20565b5085821015612c5d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608081526000612c806080830187612824565b8281036020840152612c928187612824565b604084019590955250506060015292915050565b6000808335601e19843603018112612cbd57600080fd5b83018035915067ffffffffffffffff821115612cd857600080fd5b602001915036819003821315612ced57600080fd5b9250929050565b67ffffffffffffffff831115612d0c57612d0c6126b9565b612d2083612d1a8354612b15565b83612b4f565b6000601f841160018114612d4e5760008515612d3c5750838201355b612d468682612b9e565b845550612da8565b600083815260209020601f19861690835b82811015612d7f5786850135825560209485019460019092019101612d5f565b5086821015612d9c5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b612db98283612ca6565b67ffffffffffffffff811115612dd157612dd16126b9565b612de581612ddf8554612b15565b85612b4f565b6000601f821160018114612e135760008315612e015750838201355b612e0b8482612b9e565b865550612e6d565b600085815260209020601f19841690835b82811015612e445786850135825560209485019460019092019101612e24565b5084821015612e615760001960f88660031b161c19848701351681555b505060018360011b0185555b50505050612e7e6020830183612ca6565b612e8c818360018601612cf4565b5050604082013560028201555050565b60408152826040820152828460608301376000606084830101526000601f19601f850116820160206060848303018185015260008554612edb81612b15565b8060608601526080600180841660008114612efd5760018114612f1757612f45565b60ff1985168884015283151560051b880183019550612f45565b8a6000528660002060005b85811015612f3d5781548a8201860152908301908801612f22565b890184019650505b50939b9a5050505050505050505050565b600060208284031215612f6857600080fd5b815161267781612958565b600060208284031215612f8557600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b606081526000612fb56060830186612824565b602083019490945250901515604090910152919050565b60008235605e19833603018112612a9a57600080fdfea26469706673582212201949e249f47d5b13c9d780365e79bd871f01ab1b94020f1f47096d1d9871857e64736f6c63430008100033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000b1748c79709f4ba2dd82834b8c82d4a505003f270000000000000000000000002c37fb628b35dfdfd515d41b0caae11b542773c3000000000000000000000000e30521fe7f3beb6ad556887b50739d6c7ca667e6000000000000000000000000b1748c79709f4ba2dd82834b8c82d4a505003f270000000000000000000000008412ebf45bac1b340bbe8f318b928c466c4e39ca00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020010000000000000000000000b1748c79709f4ba2dd82834b8c82d4a505003f27
-----Decoded View---------------
Arg [0] : depositContractAddress (address): 0xB1748C79709f4Ba2Dd82834B8c82D4a505003f27
Arg [1] : frxETHAddress (address): 0x2C37fb628b35dfdFD515d41B0cAAe11B542773C3
Arg [2] : sfrxETHAddress (address): 0xE30521fe7f3bEB6Ad556887b50739d6C7CA667E6
Arg [3] : _owner (address): 0xB1748C79709f4Ba2Dd82834B8c82D4a505003f27
Arg [4] : _timelock_address (address): 0x8412ebf45bAC1B340BbE8F318b928C466c4E39CA
Arg [5] : _withdrawalCredential (bytes): 0x010000000000000000000000b1748c79709f4ba2dd82834b8c82d4a505003f27
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 000000000000000000000000b1748c79709f4ba2dd82834b8c82d4a505003f27
Arg [1] : 0000000000000000000000002c37fb628b35dfdfd515d41b0caae11b542773c3
Arg [2] : 000000000000000000000000e30521fe7f3beb6ad556887b50739d6c7ca667e6
Arg [3] : 000000000000000000000000b1748c79709f4ba2dd82834b8c82d4a505003f27
Arg [4] : 0000000000000000000000008412ebf45bac1b340bbe8f318b928c466c4e39ca
Arg [5] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [7] : 010000000000000000000000b1748c79709f4ba2dd82834b8c82d4a505003f27
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
POL | 100.00% | $3.89 | 0.9967 | $3.88 |
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.