diff --git a/contracts/v2/core/SharedDepositMinterV2.sol b/contracts/v2/core/SharedDepositMinterV2.sol index ea2c601..8566706 100644 --- a/contracts/v2/core/SharedDepositMinterV2.sol +++ b/contracts/v2/core/SharedDepositMinterV2.sol @@ -31,6 +31,11 @@ import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {ETH2DepositWithdrawalCredentials} from "../lib/ETH2DepositWithdrawalCredentials.sol"; +/// @title SharedDepositMinterV2 +/// @author ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org +/// @notice Mints LSD tokens for ETH deposited to the contract. Handles the depositing of ETH to the ETH2 deposit contract and validator creation +/// @dev Deployment params: +/// - addresses : [feeCalc, sgeth, wsgeth, gov] contract SharedDepositMinterV2 is AccessControl, Pausable, ReentrancyGuard, ETH2DepositWithdrawalCredentials { /* ========== STATE VARIABLES ========== */ uint256 public adminFee; diff --git a/contracts/v2/core/WithdrawalQueue.sol b/contracts/v2/core/WithdrawalQueue.sol index edba5bd..d2e836c 100644 --- a/contracts/v2/core/WithdrawalQueue.sol +++ b/contracts/v2/core/WithdrawalQueue.sol @@ -35,7 +35,7 @@ import {SharedDepositMinterV2} from "./SharedDepositMinterV2.sol"; * 3. Fulfill any remaining redeemRequests i.e. totalPendingRequest, * for all RedeemRequest events from requestsFulfilled to requestsCreated */ -contract WithdrawalQueue is AccessControl, GranularPause, ReentrancyGuard, FIFOQueue, OperatorSettable { +contract WithdrawalQueue is AccessControl, ReentrancyGuard, GranularPause, FIFOQueue, OperatorSettable { using Address for address payable; struct Request { diff --git a/contracts/v2/periphery/FeeCalc.sol b/contracts/v2/periphery/FeeCalc.sol index 879a739..35a81b8 100644 --- a/contracts/v2/periphery/FeeCalc.sol +++ b/contracts/v2/periphery/FeeCalc.sol @@ -41,7 +41,7 @@ contract FeeCalc is Ownable2Step { config.adminFee = amount; } - function processDeposit(uint256 value, address sender) external view returns (uint256 amt, uint256 fee) { + function processDeposit(uint256 value, address _sender) external view returns (uint256 amt, uint256 fee) { // TODO: semder is currently unsused but can be used later to calculate a fee reduction based on token holdings if (config.chargeOnDeposit) { fee = (value * adminFee) / BIPS; @@ -49,7 +49,7 @@ contract FeeCalc is Ownable2Step { } } - function processWithdraw(uint256 value, address sender) external view returns (uint256 amt, uint256 fee) { + function processWithdraw(uint256 value, address _sender) external view returns (uint256 amt, uint256 fee) { // TODO: semder is currently unsused but can be used later to calculate a fee reduction based on token holdings if (config.refundFeesOnWithdraw) { fee = (value * adminFee) / BIPS; diff --git a/deploy/03_paymentSplitter.ts b/deploy/03_paymentSplitter.ts index 55c3c23..9594ce3 100644 --- a/deploy/03_paymentSplitter.ts +++ b/deploy/03_paymentSplitter.ts @@ -10,7 +10,7 @@ const func: DeployFunction = async hre => { const multiSig = hre.network.tags.hardhat ? accounts.multiSig.address : "0x610c92c70eb55dfeafe8970513d13771da79f2e0"; const splitterAddresses = [accounts.deployer.address, multiSig, wsgEth.target]; - const splitterValues = [6, 3, 31]; + const splitterValues = [60, 30, 910]; // deploy splitter, with 1k total shares. 9% total fees - 6% for deployer, 3% for multisig, 91% for stakers. await deploy(PaymentSplitter__factory, { args: [splitterAddresses, splitterValues], diff --git a/deploy/04_minter.ts b/deploy/04_minter.ts index a745759..aa3b66e 100644 --- a/deploy/04_minter.ts +++ b/deploy/04_minter.ts @@ -1,6 +1,16 @@ import {DeployFunction} from "hardhat-deploy/types"; import Ship from "../utils/ship"; -import {SgETH, SgETH__factory, SharedDepositMinterV2__factory, WSGETH, WSGETH__factory} from "../types"; +import { + SgETH, + SgETH__factory, + SharedDepositMinterV2__factory, + WSGETH, + WSGETH__factory, + DepositContract, + DepositContract__factory, + FeeCalc, + FeeCalc__factory, +} from "../types"; import {ZeroAddress} from "ethers"; const func: DeployFunction = async hre => { @@ -8,6 +18,17 @@ const func: DeployFunction = async hre => { const sgEth = (await connect(SgETH__factory)) as SgETH; const wsgEth = (await connect(WSGETH__factory)) as WSGETH; + const feeCalc = (await connect(FeeCalc__factory)) as FeeCalc; + + let chainId = await hre.getChainId(); + + let depositContractAddr; + if (chainId != "1") { + let depositContract = (await connect(DepositContract__factory)) as DepositContract; + depositContractAddr = depositContract.target; + } else { + depositContractAddr = "0x00000000219ab540356cBB839Cbe05303d7705Fa"; + } const numValidators = 1000; const adminFee = 0; @@ -19,12 +40,12 @@ const func: DeployFunction = async hre => { // await feeCalc.deployed(); const addresses = [ - ZeroAddress, - //feeCalc.address, // fee splitter + // ZeroAddress, + feeCalc.target, // fee splitter sgEth.target, // sgETH address wsgEth.target, // wsgETH address multiSig, // government address - ZeroAddress, // deposit contract address - can't find deposit contract - using dummy address + depositContractAddr, // deposit contract address - can't find deposit contract - using dummy address ]; const minter = await deploy(SharedDepositMinterV2__factory, { @@ -40,4 +61,4 @@ const func: DeployFunction = async hre => { export default func; func.tags = ["minter"]; -func.dependencies = ["sgEth", "wsgEth"]; +func.dependencies = ["sgEth", "wsgEth", "depositContract", "feeCalc"]; diff --git a/deploy/04a_depositContract.ts b/deploy/04a_depositContract.ts new file mode 100644 index 0000000..45634ca --- /dev/null +++ b/deploy/04a_depositContract.ts @@ -0,0 +1,20 @@ +import {DeployFunction} from "hardhat-deploy/types"; +import Ship from "../utils/ship"; +import {DepositContract__factory} from "../types"; + +/** + * + * This only needs to be deployed on testnets like sepolia which do not have a deposit contract. + * Do not deploy on mainnet + */ +const func: DeployFunction = async hre => { + const {deploy} = await Ship.init(hre); + + const dc = await deploy(DepositContract__factory, { + args: [], + }); +}; + +export default func; +func.tags = ["depositContract"]; +func.dependencies = []; diff --git a/deploy/04b_feeCalc.ts b/deploy/04b_feeCalc.ts new file mode 100644 index 0000000..ea0f771 --- /dev/null +++ b/deploy/04b_feeCalc.ts @@ -0,0 +1,27 @@ +import {DeployFunction} from "hardhat-deploy/types"; +import Ship from "../utils/ship"; +import {FeeCalc__factory} from "../types"; + +/** + * + * This only needs to be deployed on testnets like sepolia which do not have a deposit contract. + */ +const func: DeployFunction = async hre => { + const {deploy} = await Ship.init(hre); + + const fc = await deploy(FeeCalc__factory, { + args: [ + { + adminFee: 10, + exitFee: 0, + refundFeesOnWithdraw: true, + chargeOnDeposit: true, + chargeOnExit: false, + }, + ], + }); +}; + +export default func; +func.tags = ["feeCalc"]; +func.dependencies = []; diff --git a/deploy/06_rewardsReceiver.ts b/deploy/06_rewardsReceiver.ts index 5cbfcca..5e7b603 100644 --- a/deploy/06_rewardsReceiver.ts +++ b/deploy/06_rewardsReceiver.ts @@ -3,6 +3,7 @@ import Ship from "../utils/ship"; import { PaymentSplitter, PaymentSplitter__factory, + RewardsReceiver, RewardsReceiver__factory, SgETH, SgETH__factory, @@ -14,6 +15,17 @@ import { WithdrawalQueue__factory, } from "../types"; +function makeWithdrawalCred(params: any) { + // see https://github.com/ethereum/consensus-specs/pull/2149/files & https://github.com/stakewise/contracts/blob/0e51a35e58676491060df84d665e7ebb0e735d17/test/pool/depositDataMerkleRoot.js#L140 + // pubkey is 0x01 + (11 bytes?) 20 0s + eth1 addr 20 bytes (40 characters) ? = final length 66 + // + let withdrawalCredsPrefix = `0x010000000000000000000000`; + let eth1Withdraw = `${withdrawalCredsPrefix}${params.split("x")[1]}`; + console.log(`setWithdrawalCredential ${eth1Withdraw}`); + + return eth1Withdraw; +} + const func: DeployFunction = async hre => { const {deploy, connect} = await Ship.init(hre); @@ -26,6 +38,9 @@ const func: DeployFunction = async hre => { await deploy(RewardsReceiver__factory, { args: [withdrawalQueue.target, [sgEth.target, wsgEth.target, paymentSplitter.target, minter.target]], }); + + let rr = (await connect(RewardsReceiver__factory)) as RewardsReceiver; + await minter.setWithdrawalCredential(makeWithdrawalCred(rr.target)); }; export default func; diff --git a/deploy_log.md b/deploy_log.md index 5ec9446..eb5b4a8 100644 --- a/deploy_log.md +++ b/deploy_log.md @@ -2,6 +2,19 @@ - sepolia +-- deployed with new hardhat deploy tooling, see deployment log for deets +{ +SgETH: '0xCF4831EBE785437DC54a90018b1b410Bd16c8533', +WSGETH: '0x514dfd2d10eC6775f030BA2abcf7A2445C0CA6Fb', +SharedDepositMinterV2: '0x36c2F00cC7D02be7Df0BC9be2a8e08b74C4f2E56', +PaymentSplitter: '0x38E86964A811Ee66D1139CD97C838B713F63779B', +WithdrawalQueue: '0x93Ec5A17176336C95Bfb537A71130d6eEA6eF73D', +RewardsReceiver: '0xAeBD9A9b883f539894A28CBCD866d50ca34000FD', +MockDepositContract: '0xEb9e7570f8D5ac7D0Abfbed902A784E84dF16a78' +} + +-- deployed with old pipeline + { SgETH: '0xA3A244Db2C07061E159090BB8b354ae4662fB0C3', WSGETH: '0xc8BD8F8AC1410e6f59a5EeAf7be00703232EcD56', diff --git a/deployments/localhost/.chainId b/deployments/localhost/.chainId new file mode 100644 index 0000000..bd8d1cd --- /dev/null +++ b/deployments/localhost/.chainId @@ -0,0 +1 @@ +11155111 \ No newline at end of file diff --git a/deployments/localhost/DepositContract.json b/deployments/localhost/DepositContract.json new file mode 100644 index 0000000..9fd5507 --- /dev/null +++ b/deployments/localhost/DepositContract.json @@ -0,0 +1,265 @@ +{ + "address": "0xD9b3fB168D5B100d9d7c7b753092F3b86e723138", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "withdrawal_credentials", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "amount", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "signature", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "index", + "type": "bytes" + } + ], + "name": "DepositEvent", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "withdrawal_credentials", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "deposit_data_root", + "type": "bytes32" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "get_deposit_count", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "get_deposit_root", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rug", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0xdb3b24019f274cc64eaf83224cbe4e1eee8fab2f75f8e6d2791590c1af76ce4e", + "receipt": { + "to": null, + "from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "contractAddress": "0xD9b3fB168D5B100d9d7c7b753092F3b86e723138", + "transactionIndex": 0, + "gasUsed": "1227961", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x5eba40a828d00c0ee3e3f4eb4d28d4c8b29f3b10094640b5dc150e8ffc3680b9", + "transactionHash": "0xdb3b24019f274cc64eaf83224cbe4e1eee8fab2f75f8e6d2791590c1af76ce4e", + "logs": [], + "blockNumber": 6233285, + "cumulativeGasUsed": "1227961", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "ed3d37b1608de0df300eb7ef8fcf97be", + "metadata": "{\"compiler\":{\"version\":\"0.6.11+commit.5ef660b1\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"withdrawal_credentials\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"amount\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"index\",\"type\":\"bytes\"}],\"name\":\"DepositEvent\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"withdrawal_credentials\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"deposit_data_root\",\"type\":\"bytes32\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"get_deposit_count\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"get_deposit_root\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rug\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"deposit(bytes,bytes,bytes,bytes32)\":{\"params\":{\"deposit_data_root\":\"The SHA-256 hash of the SSZ-encoded DepositData object. Used as a protection against malformed input.\",\"pubkey\":\"A BLS12-381 public key.\",\"signature\":\"A BLS12-381 signature.\",\"withdrawal_credentials\":\"Commitment to a public key for withdrawals.\"}},\"get_deposit_count()\":{\"returns\":{\"_0\":\"The deposit count encoded as a little endian 64-bit number.\"}},\"get_deposit_root()\":{\"returns\":{\"_0\":\"The deposit root hash.\"}},\"supportsInterface(bytes4)\":{\"details\":\"Interface identification is specified in ERC-165. This function uses less than 30,000 gas.\",\"params\":{\"interfaceId\":\"The interface identifier, as specified in ERC-165\"},\"returns\":{\"_0\":\"`true` if the contract implements `interfaceId` and `interfaceId` is not 0xffffffff, `false` otherwise\"}}},\"version\":1},\"userdoc\":{\"events\":{\"DepositEvent(bytes,bytes,bytes,bytes,bytes)\":{\"notice\":\"A processed deposit event.\"}},\"kind\":\"user\",\"methods\":{\"deposit(bytes,bytes,bytes,bytes32)\":{\"notice\":\"Submit a Phase 0 DepositData object.\"},\"get_deposit_count()\":{\"notice\":\"Query the current deposit count.\"},\"get_deposit_root()\":{\"notice\":\"Query the current deposit root hash.\"},\"supportsInterface(bytes4)\":{\"notice\":\"Query if a contract implements an interface\"}},\"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\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/mocks/DepositContract.sol\":\"DepositContract\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/mocks/DepositContract.sol\":{\"content\":\"// \\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u250f\\u2513\\u2501\\u250f\\u2513\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\n// \\u2503\\u250f\\u2501\\u2501\\u251b\\u250f\\u251b\\u2517\\u2513\\u2503\\u2503\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2517\\u2513\\u250f\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\n// \\u2503\\u2517\\u2501\\u2501\\u2513\\u2517\\u2513\\u250f\\u251b\\u2503\\u2517\\u2501\\u2513\\u2517\\u251b\\u250f\\u251b\\u2503\\u2501\\u2501\\u2503\\u2503\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2503\\u2503\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2513\\u2517\\u2513\\u250f\\u251b\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u2517\\u251b\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2513\\u2501\\u2517\\u2513\\u250f\\u251b\\u250f\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u2501\\u250f\\u2501\\u2501\\u2513\\u2517\\u2513\\u250f\\u251b\\n// \\u2503\\u250f\\u2501\\u2501\\u251b\\u2501\\u2503\\u2503\\u2501\\u2503\\u250f\\u2513\\u2503\\u250f\\u2501\\u251b\\u250f\\u251b\\u2501\\u2501\\u2503\\u2503\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2503\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u2501\\u2501\\u252b\\u2523\\u252b\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u250f\\u2513\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2513\\u2501\\u2503\\u2503\\u2501\\u2503\\u250f\\u251b\\u2517\\u2501\\u2513\\u2503\\u2501\\u2503\\u250f\\u2501\\u251b\\u2501\\u2503\\u2503\\u2501\\n// \\u2503\\u2517\\u2501\\u2501\\u2513\\u2501\\u2503\\u2517\\u2513\\u2503\\u2503\\u2503\\u2503\\u2503\\u2503\\u2517\\u2501\\u2513\\u250f\\u2513\\u2503\\u2517\\u2501\\u251b\\u2503\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u251b\\u2503\\u2503\\u2503\\u2501\\u252b\\u2503\\u2517\\u251b\\u2503\\u2503\\u2517\\u251b\\u2503\\u2523\\u2501\\u2501\\u2503\\u2503\\u2503\\u2501\\u2503\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2503\\u2517\\u2501\\u251b\\u2503\\u2503\\u2517\\u251b\\u2503\\u2503\\u2503\\u2503\\u2503\\u2501\\u2503\\u2517\\u2513\\u2503\\u2503\\u2501\\u2503\\u2517\\u251b\\u2517\\u2513\\u2503\\u2517\\u2501\\u2513\\u2501\\u2503\\u2517\\u2513\\n// \\u2517\\u2501\\u2501\\u2501\\u251b\\u2501\\u2517\\u2501\\u251b\\u2517\\u251b\\u2517\\u251b\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u251b\\u2517\\u2501\\u2501\\u2501\\u251b\\u2501\\u2501\\u2501\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2503\\u250f\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u251b\\u2501\\u2501\\u2501\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2501\\u2517\\u2501\\u251b\\n// \\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\n// \\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2517\\u251b\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\n\\n// SPDX-License-Identifier: CC0-1.0\\n\\npragma solidity 0.6.11;\\n\\n// This interface is designed to be compatible with the Vyper version.\\n/// @notice This is the Ethereum 2.0 deposit contract interface.\\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\\ninterface IDepositContract {\\n /// @notice A processed deposit event.\\n event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);\\n\\n /// @notice Submit a Phase 0 DepositData object.\\n /// @param pubkey A BLS12-381 public key.\\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\\n /// @param signature A BLS12-381 signature.\\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\\n /// Used as a protection against malformed input.\\n function deposit(\\n bytes calldata pubkey,\\n bytes calldata withdrawal_credentials,\\n bytes calldata signature,\\n bytes32 deposit_data_root\\n ) external payable;\\n\\n /// @notice Query the current deposit root hash.\\n /// @return The deposit root hash.\\n function get_deposit_root() external view returns (bytes32);\\n\\n /// @notice Query the current deposit count.\\n /// @return The deposit count encoded as a little endian 64-bit number.\\n function get_deposit_count() external view returns (bytes memory);\\n}\\n\\n// Based on official specification in https://eips.ethereum.org/EIPS/eip-165\\ninterface ERC165 {\\n /// @notice Query if a contract implements an interface\\n /// @param interfaceId The interface identifier, as specified in ERC-165\\n /// @dev Interface identification is specified in ERC-165. This function\\n /// uses less than 30,000 gas.\\n /// @return `true` if the contract implements `interfaceId` and\\n /// `interfaceId` is not 0xffffffff, `false` otherwise\\n function supportsInterface(bytes4 interfaceId) external pure returns (bool);\\n}\\n\\n// This is a rewrite of the Vyper Eth2.0 deposit contract in Solidity.\\n// It tries to stay as close as possible to the original source code.\\n/// @notice This is the Ethereum 2.0 deposit contract interface.\\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\\ncontract DepositContract is IDepositContract, ERC165 {\\n uint constant DEPOSIT_CONTRACT_TREE_DEPTH = 4; // changed to make it cheaper for testing - chimera\\n // NOTE: this also ensures `deposit_count` will fit into 64-bits\\n uint constant MAX_DEPOSIT_COUNT = 2 ** DEPOSIT_CONTRACT_TREE_DEPTH - 1;\\n\\n bytes32[DEPOSIT_CONTRACT_TREE_DEPTH] branch;\\n uint256 deposit_count;\\n\\n bytes32[DEPOSIT_CONTRACT_TREE_DEPTH] zero_hashes;\\n\\n // added for testing\\n address private owner;\\n\\n constructor() public {\\n owner = msg.sender;\\n // Compute hashes in empty sparse Merkle tree\\n for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH - 1; height++)\\n zero_hashes[height + 1] = sha256(abi.encodePacked(zero_hashes[height], zero_hashes[height]));\\n }\\n\\n function get_deposit_root() external view override returns (bytes32) {\\n bytes32 node;\\n uint size = deposit_count;\\n for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH; height++) {\\n if ((size & 1) == 1) node = sha256(abi.encodePacked(branch[height], node));\\n else node = sha256(abi.encodePacked(node, zero_hashes[height]));\\n size /= 2;\\n }\\n return sha256(abi.encodePacked(node, to_little_endian_64(uint64(deposit_count)), bytes24(0)));\\n }\\n\\n function get_deposit_count() external view override returns (bytes memory) {\\n return to_little_endian_64(uint64(deposit_count));\\n }\\n\\n function deposit(\\n bytes calldata pubkey,\\n bytes calldata withdrawal_credentials,\\n bytes calldata signature,\\n bytes32 deposit_data_root\\n ) external payable override {\\n // Extended ABI length checks since dynamic types are used.\\n require(pubkey.length == 48, \\\"DepositContract: invalid pubkey length\\\");\\n require(withdrawal_credentials.length == 32, \\\"DepositContract: invalid withdrawal_credentials length\\\");\\n require(signature.length == 96, \\\"DepositContract: invalid signature length\\\");\\n\\n // Check deposit amount\\n require(msg.value >= 1 ether, \\\"DepositContract: deposit value too low\\\");\\n require(msg.value % 1 gwei == 0, \\\"DepositContract: deposit value not multiple of gwei\\\");\\n uint deposit_amount = msg.value / 1 gwei;\\n require(deposit_amount <= type(uint64).max, \\\"DepositContract: deposit value too high\\\");\\n\\n // Emit `DepositEvent` log\\n bytes memory amount = to_little_endian_64(uint64(deposit_amount));\\n emit DepositEvent(\\n pubkey,\\n withdrawal_credentials,\\n amount,\\n signature,\\n to_little_endian_64(uint64(deposit_count))\\n );\\n\\n // Compute deposit data root (`DepositData` hash tree root)\\n bytes32 pubkey_root = sha256(abi.encodePacked(pubkey, bytes16(0)));\\n bytes32 signature_root = sha256(\\n abi.encodePacked(\\n sha256(abi.encodePacked(signature[:64])),\\n sha256(abi.encodePacked(signature[64:], bytes32(0)))\\n )\\n );\\n bytes32 node = sha256(\\n abi.encodePacked(\\n sha256(abi.encodePacked(pubkey_root, withdrawal_credentials)),\\n sha256(abi.encodePacked(amount, bytes24(0), signature_root))\\n )\\n );\\n\\n // Verify computed and expected deposit data roots match\\n require(\\n node == deposit_data_root,\\n \\\"DepositContract: reconstructed DepositData does not match supplied deposit_data_root\\\"\\n );\\n\\n // Avoid overflowing the Merkle tree (and prevent edge case in computing `branch`)\\n require(deposit_count < MAX_DEPOSIT_COUNT, \\\"DepositContract: merkle tree full\\\");\\n\\n // Add deposit data root to Merkle tree (update a single `branch` node)\\n deposit_count += 1;\\n uint size = deposit_count;\\n for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH; height++) {\\n if ((size & 1) == 1) {\\n branch[height] = node;\\n return;\\n }\\n node = sha256(abi.encodePacked(branch[height], node));\\n size /= 2;\\n }\\n // As the loop should always end prematurely with the `return` statement,\\n // this code should be unreachable. We assert `false` just to be safe.\\n assert(false);\\n }\\n\\n // added for testing\\n function rug() external {\\n payable(owner).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {\\n return interfaceId == type(ERC165).interfaceId || interfaceId == type(IDepositContract).interfaceId;\\n }\\n\\n function to_little_endian_64(uint64 value) internal pure returns (bytes memory ret) {\\n ret = new bytes(8);\\n bytes8 bytesValue = bytes8(value);\\n // Byteswapping during copying to bytes.\\n ret[0] = bytesValue[7];\\n ret[1] = bytesValue[6];\\n ret[2] = bytesValue[5];\\n ret[3] = bytesValue[4];\\n ret[4] = bytesValue[3];\\n ret[5] = bytesValue[2];\\n ret[6] = bytesValue[1];\\n ret[7] = bytesValue[0];\\n }\\n}\\n\",\"keccak256\":\"0xa3964d32d8509399e675008e860026f00499e40e97672f04b456968a7ade08c3\",\"license\":\"CC0-1.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50600980546001600160a01b0319163317905560005b60038110156101145760026005826004811061003e57fe5b01546005836004811061004d57fe5b015460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b602083106100a45780518252601f199092019160209182019101610085565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156100e3573d6000803e3d6000fd5b5050506040513d60208110156100f857600080fd5b50516005600183016004811061010a57fe5b0155600101610026565b5061137b806101246000396000f3fe60806040526004361061004a5760003560e01c806301ffc9a71461004f5780632289511814610097578063621fd130146101ad578063c5f2892f14610237578063e9be02aa1461025e575b600080fd5b34801561005b57600080fd5b506100836004803603602081101561007257600080fd5b50356001600160e01b031916610273565b604080519115158252519081900360200190f35b6101ab600480360360808110156100ad57600080fd5b8101906020810181356401000000008111156100c857600080fd5b8201836020820111156100da57600080fd5b803590602001918460018302840111640100000000831117156100fc57600080fd5b91939092909160208101903564010000000081111561011a57600080fd5b82018360208201111561012c57600080fd5b8035906020019184600183028401116401000000008311171561014e57600080fd5b91939092909160208101903564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b9193509150356102aa565b005b3480156101b957600080fd5b506101c2610d03565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101fc5781810151838201526020016101e4565b50505050905090810190601f1680156102295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561024357600080fd5b5061024c610d15565b60408051918252519081900360200190f35b34801561026a57600080fd5b506101ab610fe3565b60006001600160e01b031982166301ffc9a760e01b14806102a457506001600160e01b03198216638564090760e01b145b92915050565b603086146102e95760405162461bcd60e51b81526004018080602001828103825260268152602001806112aa6026913960400191505060405180910390fd5b602084146103285760405162461bcd60e51b81526004018080602001828103825260368152602001806112416036913960400191505060405180910390fd5b606082146103675760405162461bcd60e51b815260040180806020018281038252602981526020018061131d6029913960400191505060405180910390fd5b670de0b6b3a76400003410156103ae5760405162461bcd60e51b81526004018080602001828103825260268152602001806112f76026913960400191505060405180910390fd5b633b9aca003406156103f15760405162461bcd60e51b81526004018080602001828103825260338152602001806112776033913960400191505060405180910390fd5b633b9aca00340467ffffffffffffffff81111561043f5760405162461bcd60e51b81526004018080602001828103825260278152602001806112d06027913960400191505060405180910390fd5b606061044a8261101f565b90507f649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c589898989858a8a61047f60045461101f565b6040805160a0808252810189905290819060208201908201606083016080840160c085018e8e80828437600083820152601f01601f191690910187810386528c815260200190508c8c808284376000838201819052601f909101601f191690920188810386528c5181528c51602091820193918e019250908190849084905b838110156105165781810151838201526020016104fe565b50505050905090810190601f1680156105435780820380516001836020036101000a031916815260200191505b5086810383528881526020018989808284376000838201819052601f909101601f19169092018881038452895181528951602091820193918b019250908190849084905b8381101561059f578181015183820152602001610587565b50505050905090810190601f1680156105cc5780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390a1600060028a8a600060801b604051602001808484808284376fffffffffffffffffffffffffffffffff199094169190930190815260408051600f19818403018152601090920190819052815191955093508392506020850191508083835b602083106106615780518252601f199092019160209182019101610642565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156106a0573d6000803e3d6000fd5b5050506040513d60208110156106b557600080fd5b5051905060006002806106cb6040848a8c6111a3565b6040516020018083838082843780830192505050925050506040516020818303038152906040526040518082805190602001908083835b602083106107215780518252601f199092019160209182019101610702565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610760573d6000803e3d6000fd5b5050506040513d602081101561077557600080fd5b50516002610786896040818d6111a3565b60405160009060200180848480828437919091019283525050604080518083038152602092830191829052805190945090925082918401908083835b602083106107e15780518252601f1990920191602091820191016107c2565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610820573d6000803e3d6000fd5b5050506040513d602081101561083557600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b6020831061088b5780518252601f19909201916020918201910161086c565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156108ca573d6000803e3d6000fd5b5050506040513d60208110156108df57600080fd5b50516040805160208101858152929350600092600292839287928f928f92018383808284378083019250505093505050506040516020818303038152906040526040518082805190602001908083835b6020831061094e5780518252601f19909201916020918201910161092f565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa15801561098d573d6000803e3d6000fd5b5050506040513d60208110156109a257600080fd5b50516040518651600291889160009188916020918201918291908601908083835b602083106109e25780518252601f1990920191602091820191016109c3565b6001836020036101000a0380198251168184511680821785525050505050509050018367ffffffffffffffff191667ffffffffffffffff1916815260180182815260200193505050506040516020818303038152906040526040518082805190602001908083835b60208310610a695780518252601f199092019160209182019101610a4a565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610aa8573d6000803e3d6000fd5b5050506040513d6020811015610abd57600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610b135780518252601f199092019160209182019101610af4565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610b52573d6000803e3d6000fd5b5050506040513d6020811015610b6757600080fd5b50519050858114610ba95760405162461bcd60e51b81526004018080602001828103825260548152602001806111ed6054913960600191505060405180910390fd5b600454600f11610bea5760405162461bcd60e51b81526004018080602001828103825260218152602001806111cc6021913960400191505060405180910390fd5b600480546001019081905560005b6004811015610cf7578160011660011415610c2a578260008260048110610c1b57fe5b015550610cfa95505050505050565b600260008260048110610c3957fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610c915780518252601f199092019160209182019101610c72565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610cd0573d6000803e3d6000fd5b5050506040513d6020811015610ce557600080fd5b50519250600282049150600101610bf8565b50fe5b50505050505050565b6060610d1060045461101f565b905090565b6004546000908190815b6004811015610ec6578160011660011415610df857600260008260048110610d4357fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610d9b5780518252601f199092019160209182019101610d7c565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610dda573d6000803e3d6000fd5b5050506040513d6020811015610def57600080fd5b50519250610eb8565b60028360058360048110610e0857fe5b015460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610e5f5780518252601f199092019160209182019101610e40565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610e9e573d6000803e3d6000fd5b5050506040513d6020811015610eb357600080fd5b505192505b600282049150600101610d1f565b50600282610ed560045461101f565b600060401b6040516020018084815260200183805190602001908083835b60208310610f125780518252601f199092019160209182019101610ef3565b51815160209384036101000a600019018019909216911617905267ffffffffffffffff199590951692019182525060408051808303600719018152601890920190819052815191955093508392850191508083835b60208310610f865780518252601f199092019160209182019101610f67565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610fc5573d6000803e3d6000fd5b5050506040513d6020811015610fda57600080fd5b50519250505090565b6009546040516001600160a01b03909116904780156108fc02916000818181858888f1935050505015801561101c573d6000803e3d6000fd5b50565b60408051600880825281830190925260609160208201818036833701905050905060c082901b8060071a60f81b8260008151811061105957fe5b60200101906001600160f81b031916908160001a9053508060061a60f81b8260018151811061108457fe5b60200101906001600160f81b031916908160001a9053508060051a60f81b826002815181106110af57fe5b60200101906001600160f81b031916908160001a9053508060041a60f81b826003815181106110da57fe5b60200101906001600160f81b031916908160001a9053508060031a60f81b8260048151811061110557fe5b60200101906001600160f81b031916908160001a9053508060021a60f81b8260058151811061113057fe5b60200101906001600160f81b031916908160001a9053508060011a60f81b8260068151811061115b57fe5b60200101906001600160f81b031916908160001a9053508060001a60f81b8260078151811061118657fe5b60200101906001600160f81b031916908160001a90535050919050565b600080858511156111b2578182fd5b838611156111be578182fd5b505082019391909203915056fe4465706f736974436f6e74726163743a206d65726b6c6520747265652066756c6c4465706f736974436f6e74726163743a207265636f6e7374727563746564204465706f7369744461746120646f6573206e6f74206d6174636820737570706c696564206465706f7369745f646174615f726f6f744465706f736974436f6e74726163743a20696e76616c6964207769746864726177616c5f63726564656e7469616c73206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c7565206e6f74206d756c7469706c65206f6620677765694465706f736974436f6e74726163743a20696e76616c6964207075626b6579206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f20686967684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f206c6f774465706f736974436f6e74726163743a20696e76616c6964207369676e6174757265206c656e677468a26469706673582212202c129760663b656657fc34d4063461c51b947fdb8b098dab4a4b4335dfa8c2b964736f6c634300060b0033", + "deployedBytecode": "0x60806040526004361061004a5760003560e01c806301ffc9a71461004f5780632289511814610097578063621fd130146101ad578063c5f2892f14610237578063e9be02aa1461025e575b600080fd5b34801561005b57600080fd5b506100836004803603602081101561007257600080fd5b50356001600160e01b031916610273565b604080519115158252519081900360200190f35b6101ab600480360360808110156100ad57600080fd5b8101906020810181356401000000008111156100c857600080fd5b8201836020820111156100da57600080fd5b803590602001918460018302840111640100000000831117156100fc57600080fd5b91939092909160208101903564010000000081111561011a57600080fd5b82018360208201111561012c57600080fd5b8035906020019184600183028401116401000000008311171561014e57600080fd5b91939092909160208101903564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b9193509150356102aa565b005b3480156101b957600080fd5b506101c2610d03565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101fc5781810151838201526020016101e4565b50505050905090810190601f1680156102295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561024357600080fd5b5061024c610d15565b60408051918252519081900360200190f35b34801561026a57600080fd5b506101ab610fe3565b60006001600160e01b031982166301ffc9a760e01b14806102a457506001600160e01b03198216638564090760e01b145b92915050565b603086146102e95760405162461bcd60e51b81526004018080602001828103825260268152602001806112aa6026913960400191505060405180910390fd5b602084146103285760405162461bcd60e51b81526004018080602001828103825260368152602001806112416036913960400191505060405180910390fd5b606082146103675760405162461bcd60e51b815260040180806020018281038252602981526020018061131d6029913960400191505060405180910390fd5b670de0b6b3a76400003410156103ae5760405162461bcd60e51b81526004018080602001828103825260268152602001806112f76026913960400191505060405180910390fd5b633b9aca003406156103f15760405162461bcd60e51b81526004018080602001828103825260338152602001806112776033913960400191505060405180910390fd5b633b9aca00340467ffffffffffffffff81111561043f5760405162461bcd60e51b81526004018080602001828103825260278152602001806112d06027913960400191505060405180910390fd5b606061044a8261101f565b90507f649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c589898989858a8a61047f60045461101f565b6040805160a0808252810189905290819060208201908201606083016080840160c085018e8e80828437600083820152601f01601f191690910187810386528c815260200190508c8c808284376000838201819052601f909101601f191690920188810386528c5181528c51602091820193918e019250908190849084905b838110156105165781810151838201526020016104fe565b50505050905090810190601f1680156105435780820380516001836020036101000a031916815260200191505b5086810383528881526020018989808284376000838201819052601f909101601f19169092018881038452895181528951602091820193918b019250908190849084905b8381101561059f578181015183820152602001610587565b50505050905090810190601f1680156105cc5780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390a1600060028a8a600060801b604051602001808484808284376fffffffffffffffffffffffffffffffff199094169190930190815260408051600f19818403018152601090920190819052815191955093508392506020850191508083835b602083106106615780518252601f199092019160209182019101610642565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156106a0573d6000803e3d6000fd5b5050506040513d60208110156106b557600080fd5b5051905060006002806106cb6040848a8c6111a3565b6040516020018083838082843780830192505050925050506040516020818303038152906040526040518082805190602001908083835b602083106107215780518252601f199092019160209182019101610702565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610760573d6000803e3d6000fd5b5050506040513d602081101561077557600080fd5b50516002610786896040818d6111a3565b60405160009060200180848480828437919091019283525050604080518083038152602092830191829052805190945090925082918401908083835b602083106107e15780518252601f1990920191602091820191016107c2565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610820573d6000803e3d6000fd5b5050506040513d602081101561083557600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b6020831061088b5780518252601f19909201916020918201910161086c565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156108ca573d6000803e3d6000fd5b5050506040513d60208110156108df57600080fd5b50516040805160208101858152929350600092600292839287928f928f92018383808284378083019250505093505050506040516020818303038152906040526040518082805190602001908083835b6020831061094e5780518252601f19909201916020918201910161092f565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa15801561098d573d6000803e3d6000fd5b5050506040513d60208110156109a257600080fd5b50516040518651600291889160009188916020918201918291908601908083835b602083106109e25780518252601f1990920191602091820191016109c3565b6001836020036101000a0380198251168184511680821785525050505050509050018367ffffffffffffffff191667ffffffffffffffff1916815260180182815260200193505050506040516020818303038152906040526040518082805190602001908083835b60208310610a695780518252601f199092019160209182019101610a4a565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610aa8573d6000803e3d6000fd5b5050506040513d6020811015610abd57600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610b135780518252601f199092019160209182019101610af4565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610b52573d6000803e3d6000fd5b5050506040513d6020811015610b6757600080fd5b50519050858114610ba95760405162461bcd60e51b81526004018080602001828103825260548152602001806111ed6054913960600191505060405180910390fd5b600454600f11610bea5760405162461bcd60e51b81526004018080602001828103825260218152602001806111cc6021913960400191505060405180910390fd5b600480546001019081905560005b6004811015610cf7578160011660011415610c2a578260008260048110610c1b57fe5b015550610cfa95505050505050565b600260008260048110610c3957fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610c915780518252601f199092019160209182019101610c72565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610cd0573d6000803e3d6000fd5b5050506040513d6020811015610ce557600080fd5b50519250600282049150600101610bf8565b50fe5b50505050505050565b6060610d1060045461101f565b905090565b6004546000908190815b6004811015610ec6578160011660011415610df857600260008260048110610d4357fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610d9b5780518252601f199092019160209182019101610d7c565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610dda573d6000803e3d6000fd5b5050506040513d6020811015610def57600080fd5b50519250610eb8565b60028360058360048110610e0857fe5b015460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610e5f5780518252601f199092019160209182019101610e40565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610e9e573d6000803e3d6000fd5b5050506040513d6020811015610eb357600080fd5b505192505b600282049150600101610d1f565b50600282610ed560045461101f565b600060401b6040516020018084815260200183805190602001908083835b60208310610f125780518252601f199092019160209182019101610ef3565b51815160209384036101000a600019018019909216911617905267ffffffffffffffff199590951692019182525060408051808303600719018152601890920190819052815191955093508392850191508083835b60208310610f865780518252601f199092019160209182019101610f67565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610fc5573d6000803e3d6000fd5b5050506040513d6020811015610fda57600080fd5b50519250505090565b6009546040516001600160a01b03909116904780156108fc02916000818181858888f1935050505015801561101c573d6000803e3d6000fd5b50565b60408051600880825281830190925260609160208201818036833701905050905060c082901b8060071a60f81b8260008151811061105957fe5b60200101906001600160f81b031916908160001a9053508060061a60f81b8260018151811061108457fe5b60200101906001600160f81b031916908160001a9053508060051a60f81b826002815181106110af57fe5b60200101906001600160f81b031916908160001a9053508060041a60f81b826003815181106110da57fe5b60200101906001600160f81b031916908160001a9053508060031a60f81b8260048151811061110557fe5b60200101906001600160f81b031916908160001a9053508060021a60f81b8260058151811061113057fe5b60200101906001600160f81b031916908160001a9053508060011a60f81b8260068151811061115b57fe5b60200101906001600160f81b031916908160001a9053508060001a60f81b8260078151811061118657fe5b60200101906001600160f81b031916908160001a90535050919050565b600080858511156111b2578182fd5b838611156111be578182fd5b505082019391909203915056fe4465706f736974436f6e74726163743a206d65726b6c6520747265652066756c6c4465706f736974436f6e74726163743a207265636f6e7374727563746564204465706f7369744461746120646f6573206e6f74206d6174636820737570706c696564206465706f7369745f646174615f726f6f744465706f736974436f6e74726163743a20696e76616c6964207769746864726177616c5f63726564656e7469616c73206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c7565206e6f74206d756c7469706c65206f6620677765694465706f736974436f6e74726163743a20696e76616c6964207075626b6579206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f20686967684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f206c6f774465706f736974436f6e74726163743a20696e76616c6964207369676e6174757265206c656e677468a26469706673582212202c129760663b656657fc34d4063461c51b947fdb8b098dab4a4b4335dfa8c2b964736f6c634300060b0033", + "devdoc": { + "kind": "dev", + "methods": { + "deposit(bytes,bytes,bytes,bytes32)": { + "params": { + "deposit_data_root": "The SHA-256 hash of the SSZ-encoded DepositData object. Used as a protection against malformed input.", + "pubkey": "A BLS12-381 public key.", + "signature": "A BLS12-381 signature.", + "withdrawal_credentials": "Commitment to a public key for withdrawals." + } + }, + "get_deposit_count()": { + "returns": { + "_0": "The deposit count encoded as a little endian 64-bit number." + } + }, + "get_deposit_root()": { + "returns": { + "_0": "The deposit root hash." + } + }, + "supportsInterface(bytes4)": { + "details": "Interface identification is specified in ERC-165. This function uses less than 30,000 gas.", + "params": { + "interfaceId": "The interface identifier, as specified in ERC-165" + }, + "returns": { + "_0": "`true` if the contract implements `interfaceId` and `interfaceId` is not 0xffffffff, `false` otherwise" + } + } + }, + "version": 1 + }, + "userdoc": { + "events": { + "DepositEvent(bytes,bytes,bytes,bytes,bytes)": { + "notice": "A processed deposit event." + } + }, + "kind": "user", + "methods": { + "deposit(bytes,bytes,bytes,bytes32)": { + "notice": "Submit a Phase 0 DepositData object." + }, + "get_deposit_count()": { + "notice": "Query the current deposit count." + }, + "get_deposit_root()": { + "notice": "Query the current deposit root hash." + }, + "supportsInterface(bytes4)": { + "notice": "Query if a contract implements an interface" + } + }, + "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", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 68, + "contract": "contracts/mocks/DepositContract.sol:DepositContract", + "label": "branch", + "offset": 0, + "slot": "0", + "type": "t_array(t_bytes32)4_storage" + }, + { + "astId": 70, + "contract": "contracts/mocks/DepositContract.sol:DepositContract", + "label": "deposit_count", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 74, + "contract": "contracts/mocks/DepositContract.sol:DepositContract", + "label": "zero_hashes", + "offset": 0, + "slot": "5", + "type": "t_array(t_bytes32)4_storage" + }, + { + "astId": 76, + "contract": "contracts/mocks/DepositContract.sol:DepositContract", + "label": "owner", + "offset": 0, + "slot": "9", + "type": "t_address" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)4_storage": { + "base": "t_bytes32", + "encoding": "inplace", + "label": "bytes32[4]", + "numberOfBytes": "128" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/localhost/FeeCalc.json b/deployments/localhost/FeeCalc.json new file mode 100644 index 0000000..fe6ef0f --- /dev/null +++ b/deployments/localhost/FeeCalc.json @@ -0,0 +1,476 @@ +{ + "address": "0x16888a69bDfb3Adcf8CB1F3d24Ac1Ee320e4A7e8", + "abi": [ + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "adminFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exitFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "refundFeesOnWithdraw", + "type": "bool" + }, + { + "internalType": "bool", + "name": "chargeOnDeposit", + "type": "bool" + }, + { + "internalType": "bool", + "name": "chargeOnExit", + "type": "bool" + } + ], + "internalType": "struct FeeCalc.Settings", + "name": "_settings", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "adminFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "costPerValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_sender", + "type": "address" + } + ], + "name": "processDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "amt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_sender", + "type": "address" + } + ], + "name": "processWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "amt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "adminFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exitFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "refundFeesOnWithdraw", + "type": "bool" + }, + { + "internalType": "bool", + "name": "chargeOnDeposit", + "type": "bool" + }, + { + "internalType": "bool", + "name": "chargeOnExit", + "type": "bool" + } + ], + "internalType": "struct FeeCalc.Settings", + "name": "newSettings", + "type": "tuple" + } + ], + "name": "set", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "setAdminFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_exitFee", + "type": "uint256" + } + ], + "name": "setExitFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_refundFeesOnWithdraw", + "type": "bool" + } + ], + "name": "setRefundFeesOnWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x6d1f43464ef85d370566311bfbe47385ea031a77c548c1fe03a39fa43f88eee7", + "receipt": { + "to": null, + "from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "contractAddress": "0x16888a69bDfb3Adcf8CB1F3d24Ac1Ee320e4A7e8", + "transactionIndex": 0, + "gasUsed": "566029", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000800000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000100000800000000000000000000000200000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000002000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x8de09debbc71f72cb29f06bd415101351352dc0faac8b741a4f9a81bf53f712e", + "transactionHash": "0x6d1f43464ef85d370566311bfbe47385ea031a77c548c1fe03a39fa43f88eee7", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 6233286, + "transactionHash": "0x6d1f43464ef85d370566311bfbe47385ea031a77c548c1fe03a39fa43f88eee7", + "address": "0x16888a69bDfb3Adcf8CB1F3d24Ac1Ee320e4A7e8", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x8de09debbc71f72cb29f06bd415101351352dc0faac8b741a4f9a81bf53f712e" + } + ], + "blockNumber": 6233286, + "cumulativeGasUsed": "566029", + "status": 1, + "byzantium": true + }, + "args": [ + { + "adminFee": 10, + "exitFee": 0, + "refundFeesOnWithdraw": true, + "chargeOnDeposit": true, + "chargeOnExit": false + } + ], + "numDeployments": 1, + "solcInputHash": "d5c4e8b77fe999241905bb33844ed6ed", + "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"adminFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"exitFee\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"refundFeesOnWithdraw\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"chargeOnDeposit\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"chargeOnExit\",\"type\":\"bool\"}],\"internalType\":\"struct FeeCalc.Settings\",\"name\":\"_settings\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"costPerValidator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"}],\"name\":\"processDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"}],\"name\":\"processWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"adminFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"exitFee\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"refundFeesOnWithdraw\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"chargeOnDeposit\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"chargeOnExit\",\"type\":\"bool\"}],\"internalType\":\"struct FeeCalc.Settings\",\"name\":\"newSettings\",\"type\":\"tuple\"}],\"name\":\"set\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"setAdminFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_exitFee\",\"type\":\"uint256\"}],\"name\":\"setExitFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_refundFeesOnWithdraw\",\"type\":\"bool\"}],\"name\":\"setRefundFeesOnWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/v2/periphery/FeeCalc.sol\":\"FeeCalc\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable2Step.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Ownable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\n *\\n * This module is used through inheritance. It will make available all functions\\n * from parent (Ownable).\\n */\\nabstract contract Ownable2Step is Ownable {\\n address private _pendingOwner;\\n\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Returns the address of the pending owner.\\n */\\n function pendingOwner() public view virtual returns (address) {\\n return _pendingOwner;\\n }\\n\\n /**\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\n _pendingOwner = newOwner;\\n emit OwnershipTransferStarted(owner(), newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual override {\\n delete _pendingOwner;\\n super._transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev The new owner accepts the ownership transfer.\\n */\\n function acceptOwnership() public virtual {\\n address sender = _msgSender();\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\n _transferOwnership(sender);\\n }\\n}\\n\",\"keccak256\":\"0xde231558366826d7cb61725af8147965a61c53b77a352cc8c9af38fc5a92ac3c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"contracts/v2/periphery/FeeCalc.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.20;\\n\\nimport {Ownable2Step} from \\\"@openzeppelin/contracts/access/Ownable2Step.sol\\\";\\n\\ncontract FeeCalc is Ownable2Step {\\n struct Settings {\\n uint256 adminFee;\\n uint256 exitFee;\\n bool refundFeesOnWithdraw;\\n bool chargeOnDeposit;\\n bool chargeOnExit;\\n }\\n Settings private config;\\n uint256 public adminFee;\\n uint256 public costPerValidator;\\n\\n uint256 private immutable BIPS = 10000;\\n constructor(Settings memory _settings) Ownable2Step() {\\n // admin fee in bips (10000 = 100%)\\n adminFee = _settings.adminFee;\\n config = _settings;\\n costPerValidator = ((32 + (32 * adminFee)) * 1 ether) / BIPS;\\n }\\n\\n function set(Settings calldata newSettings) external onlyOwner {\\n config = newSettings;\\n adminFee = newSettings.adminFee;\\n }\\n\\n function setRefundFeesOnWithdraw(bool _refundFeesOnWithdraw) external onlyOwner {\\n config.refundFeesOnWithdraw = _refundFeesOnWithdraw;\\n }\\n\\n function setExitFee(uint256 _exitFee) external onlyOwner {\\n config.exitFee = _exitFee;\\n }\\n\\n function setAdminFee(uint256 amount) external onlyOwner {\\n adminFee = amount;\\n config.adminFee = amount;\\n }\\n\\n function processDeposit(uint256 value, address _sender) external view returns (uint256 amt, uint256 fee) {\\n // TODO: semder is currently unsused but can be used later to calculate a fee reduction based on token holdings\\n if (config.chargeOnDeposit) {\\n fee = (value * adminFee) / BIPS;\\n amt = value - fee;\\n }\\n }\\n\\n function processWithdraw(uint256 value, address _sender) external view returns (uint256 amt, uint256 fee) {\\n // TODO: semder is currently unsused but can be used later to calculate a fee reduction based on token holdings\\n if (config.refundFeesOnWithdraw) {\\n fee = (value * adminFee) / BIPS;\\n amt = value + fee;\\n } else if (config.chargeOnExit) {\\n fee = (value * config.exitFee) / BIPS;\\n amt = value - fee;\\n } else {\\n fee = 0;\\n amt = value;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1b91581b9fe0fa69fd4faa2ad01b3edb66cc35e4ab26831b57e169f214bd6c0\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x60a060405261271060805234801561001657600080fd5b5060405161097038038061097083398101604081905261003591610154565b61003e336100d3565b80516005819055600281905560208083015160035560408301516004805460608601516080808801511515620100000262ff0000199215156101000261ff00199615159690961661ffff1990941693909317949094171617905551916100a3916101f9565b6100ae906020610216565b6100c090670de0b6b3a76400006101f9565b6100ca9190610229565b6006555061024b565b600180546001600160a01b03191690556100ec816100ef565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8051801515811461014f57600080fd5b919050565b600060a0828403121561016657600080fd5b60405160a081016001600160401b038111828210171561019657634e487b7160e01b600052604160045260246000fd5b806040525082518152602083015160208201526101b56040840161013f565b60408201526101c66060840161013f565b60608201526101d76080840161013f565b60808201529392505050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610210576102106101e3565b92915050565b80820180821115610210576102106101e3565b60008261024657634e487b7160e01b600052601260045260246000fd5b500490565b6080516106fc610274600039600081816101ed0152818161024d01526102b201526106fc6000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063a0be06f91161008c578063e30c397811610066578063e30c39781461019b578063e5a583a9146101ac578063eb52f3ae146101bf578063f2fde38b146101c857600080fd5b8063a0be06f91461015e578063c0f7056c14610175578063dc5df6391461018857600080fd5b806301e41bba146100d45780633b3436f614610101578063715018a61461011457806379ba50971461011e5780638beb60b6146101265780638da5cb5b14610139575b600080fd5b6100e76100e2366004610533565b6101db565b604080519283526020830191909152015b60405180910390f35b6100e761010f366004610533565b61029b565b61011c6102fe565b005b61011c610312565b61011c61013436600461055f565b610391565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100f8565b61016760055481565b6040519081526020016100f8565b61011c610183366004610586565b6103a3565b61011c6101963660046105aa565b6103be565b6001546001600160a01b0316610146565b61011c6101ba36600461055f565b6103db565b61016760065481565b61011c6101d63660046105c2565b6103e8565b600454600090819060ff1615610237577f00000000000000000000000000000000000000000000000000000000000000006005548561021a91906105f3565b6102249190610610565b90506102308185610632565b9150610294565b60045462010000900460ff161561028d576003547f00000000000000000000000000000000000000000000000000000000000000009061027790866105f3565b6102819190610610565b90506102308185610645565b5082905060005b9250929050565b6004546000908190610100900460ff1615610294577f0000000000000000000000000000000000000000000000000000000000000000600554856102df91906105f3565b6102e99190610610565b90506102f58185610645565b91509250929050565b610306610459565b61031060006104b3565b565b60015433906001600160a01b031681146103855760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61038e816104b3565b50565b610399610459565b6005819055600255565b6103ab610459565b6004805460ff1916911515919091179055565b6103c6610459565b8060026103d38282610658565b505035600555565b6103e3610459565b600355565b6103f0610459565b600180546001600160a01b0383166001600160a01b031990911681179091556104216000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000546001600160a01b031633146103105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161037c565b600180546001600160a01b031916905561038e81600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461052e57600080fd5b919050565b6000806040838503121561054657600080fd5b8235915061055660208401610517565b90509250929050565b60006020828403121561057157600080fd5b5035919050565b801515811461038e57600080fd5b60006020828403121561059857600080fd5b81356105a381610578565b9392505050565b600060a082840312156105bc57600080fd5b50919050565b6000602082840312156105d457600080fd5b6105a382610517565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761060a5761060a6105dd565b92915050565b60008261062d57634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561060a5761060a6105dd565b8181038181111561060a5761060a6105dd565b813581556020820135600182015560028101604083013561067881610578565b8154606085013561068881610578565b608086013561069681610578565b90151560081b61ff001662ffffff199290921692151560ff16929092171790151560101b62ff000016179055505056fea2646970667358221220bdc567f6334ce9beba3b91889cbecbee765da27667efa047e2a55c1981541f4464736f6c63430008140033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063a0be06f91161008c578063e30c397811610066578063e30c39781461019b578063e5a583a9146101ac578063eb52f3ae146101bf578063f2fde38b146101c857600080fd5b8063a0be06f91461015e578063c0f7056c14610175578063dc5df6391461018857600080fd5b806301e41bba146100d45780633b3436f614610101578063715018a61461011457806379ba50971461011e5780638beb60b6146101265780638da5cb5b14610139575b600080fd5b6100e76100e2366004610533565b6101db565b604080519283526020830191909152015b60405180910390f35b6100e761010f366004610533565b61029b565b61011c6102fe565b005b61011c610312565b61011c61013436600461055f565b610391565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100f8565b61016760055481565b6040519081526020016100f8565b61011c610183366004610586565b6103a3565b61011c6101963660046105aa565b6103be565b6001546001600160a01b0316610146565b61011c6101ba36600461055f565b6103db565b61016760065481565b61011c6101d63660046105c2565b6103e8565b600454600090819060ff1615610237577f00000000000000000000000000000000000000000000000000000000000000006005548561021a91906105f3565b6102249190610610565b90506102308185610632565b9150610294565b60045462010000900460ff161561028d576003547f00000000000000000000000000000000000000000000000000000000000000009061027790866105f3565b6102819190610610565b90506102308185610645565b5082905060005b9250929050565b6004546000908190610100900460ff1615610294577f0000000000000000000000000000000000000000000000000000000000000000600554856102df91906105f3565b6102e99190610610565b90506102f58185610645565b91509250929050565b610306610459565b61031060006104b3565b565b60015433906001600160a01b031681146103855760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61038e816104b3565b50565b610399610459565b6005819055600255565b6103ab610459565b6004805460ff1916911515919091179055565b6103c6610459565b8060026103d38282610658565b505035600555565b6103e3610459565b600355565b6103f0610459565b600180546001600160a01b0383166001600160a01b031990911681179091556104216000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000546001600160a01b031633146103105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161037c565b600180546001600160a01b031916905561038e81600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461052e57600080fd5b919050565b6000806040838503121561054657600080fd5b8235915061055660208401610517565b90509250929050565b60006020828403121561057157600080fd5b5035919050565b801515811461038e57600080fd5b60006020828403121561059857600080fd5b81356105a381610578565b9392505050565b600060a082840312156105bc57600080fd5b50919050565b6000602082840312156105d457600080fd5b6105a382610517565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761060a5761060a6105dd565b92915050565b60008261062d57634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561060a5761060a6105dd565b8181038181111561060a5761060a6105dd565b813581556020820135600182015560028101604083013561067881610578565b8154606085013561068881610578565b608086013561069681610578565b90151560081b61ff001662ffffff199290921692151560ff16929092171790151560101b62ff000016179055505056fea2646970667358221220bdc567f6334ce9beba3b91889cbecbee765da27667efa047e2a55c1981541f4464736f6c63430008140033", + "devdoc": { + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 4000, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 4113, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "_pendingOwner", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 18311, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "config", + "offset": 0, + "slot": "2", + "type": "t_struct(Settings)18308_storage" + }, + { + "astId": 18313, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "adminFee", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 18315, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "costPerValidator", + "offset": 0, + "slot": "6", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(Settings)18308_storage": { + "encoding": "inplace", + "label": "struct FeeCalc.Settings", + "members": [ + { + "astId": 18299, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "adminFee", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 18301, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "exitFee", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 18303, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "refundFeesOnWithdraw", + "offset": 0, + "slot": "2", + "type": "t_bool" + }, + { + "astId": 18305, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "chargeOnDeposit", + "offset": 1, + "slot": "2", + "type": "t_bool" + }, + { + "astId": 18307, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "chargeOnExit", + "offset": 2, + "slot": "2", + "type": "t_bool" + } + ], + "numberOfBytes": "96" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/localhost/PaymentSplitter.json b/deployments/localhost/PaymentSplitter.json new file mode 100644 index 0000000..3c50c29 --- /dev/null +++ b/deployments/localhost/PaymentSplitter.json @@ -0,0 +1,530 @@ +{ + "address": "0xAEE735021836c891f041141E1B18aa58fe58F611", + "abi": [ + { + "inputs": [ + { + "internalType": "address[]", + "name": "payees", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "shares_", + "type": "uint256[]" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ERC20PaymentReleased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "PayeeAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "PaymentReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "PaymentReleased", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "payee", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "releasable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "releasable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "account", + "type": "address" + } + ], + "name": "release", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "release", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "released", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "released", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "shares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + } + ], + "name": "totalReleased", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalReleased", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xda4a6009946f259b75180fd0e499e2b8a510c516954f63e86c338043c34fc437", + "receipt": { + "to": null, + "from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "contractAddress": "0xAEE735021836c891f041141E1B18aa58fe58F611", + "transactionIndex": 0, + "gasUsed": "929121", + "logsBloom": "0x00000000000000000000000000000000000000000200000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000001000000000000000000020000000000000000000000000000000000000000000000000000", + "blockHash": "0x60512b6acfcc37f8edac4b750a9cce07d55f4842d7d729a0422bc6fc4c04acae", + "transactionHash": "0xda4a6009946f259b75180fd0e499e2b8a510c516954f63e86c338043c34fc437", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 6233284, + "transactionHash": "0xda4a6009946f259b75180fd0e499e2b8a510c516954f63e86c338043c34fc437", + "address": "0xAEE735021836c891f041141E1B18aa58fe58F611", + "topics": [ + "0x40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac" + ], + "data": "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000000000000000000000000000000000000000003c", + "logIndex": 0, + "blockHash": "0x60512b6acfcc37f8edac4b750a9cce07d55f4842d7d729a0422bc6fc4c04acae" + }, + { + "transactionIndex": 0, + "blockNumber": 6233284, + "transactionHash": "0xda4a6009946f259b75180fd0e499e2b8a510c516954f63e86c338043c34fc437", + "address": "0xAEE735021836c891f041141E1B18aa58fe58F611", + "topics": [ + "0x40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac" + ], + "data": "0x000000000000000000000000610c92c70eb55dfeafe8970513d13771da79f2e0000000000000000000000000000000000000000000000000000000000000001e", + "logIndex": 1, + "blockHash": "0x60512b6acfcc37f8edac4b750a9cce07d55f4842d7d729a0422bc6fc4c04acae" + }, + { + "transactionIndex": 0, + "blockNumber": 6233284, + "transactionHash": "0xda4a6009946f259b75180fd0e499e2b8a510c516954f63e86c338043c34fc437", + "address": "0xAEE735021836c891f041141E1B18aa58fe58F611", + "topics": [ + "0x40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac" + ], + "data": "0x00000000000000000000000061a89bf0ed0c2d1c365db15660880c3d227a05d3000000000000000000000000000000000000000000000000000000000000038e", + "logIndex": 2, + "blockHash": "0x60512b6acfcc37f8edac4b750a9cce07d55f4842d7d729a0422bc6fc4c04acae" + } + ], + "blockNumber": 6233284, + "cumulativeGasUsed": "929121", + "status": 1, + "byzantium": true + }, + "args": [ + [ + "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "0x610c92c70eb55dfeafe8970513d13771da79f2e0", + "0x61A89BF0Ed0c2d1c365Db15660880C3d227A05D3" + ], + [ + 60, + 30, + 910 + ] + ], + "numDeployments": 1, + "solcInputHash": "d5c4e8b77fe999241905bb33844ed6ed", + "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"payees\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"shares_\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ERC20PaymentReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"PayeeAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"PaymentReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"PaymentReleased\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"payee\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"releasable\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"releasable\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"release\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"release\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"released\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"released\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"shares\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"totalReleased\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalReleased\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalShares\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware that the Ether will be split in this way, since it is handled transparently by the contract. The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the time of contract deployment and can't be updated thereafter. `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} function. NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you to run tests before sending real value to this contract.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at the matching position in the `shares` array. All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no duplicates in `payees`.\"},\"payee(uint256)\":{\"details\":\"Getter for the address of the payee number `index`.\"},\"releasable(address)\":{\"details\":\"Getter for the amount of payee's releasable Ether.\"},\"releasable(address,address)\":{\"details\":\"Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an IERC20 contract.\"},\"release(address)\":{\"details\":\"Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the total shares and their previous withdrawals.\"},\"release(address,address)\":{\"details\":\"Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 contract.\"},\"released(address)\":{\"details\":\"Getter for the amount of Ether already released to a payee.\"},\"released(address,address)\":{\"details\":\"Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an IERC20 contract.\"},\"shares(address)\":{\"details\":\"Getter for the amount of shares held by an account.\"},\"totalReleased()\":{\"details\":\"Getter for the total amount of Ether already released.\"},\"totalReleased(address)\":{\"details\":\"Getter for the total amount of `token` already released. `token` should be the address of an IERC20 contract.\"},\"totalShares()\":{\"details\":\"Getter for the total shares held by payees.\"}},\"title\":\"PaymentSplitter\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/v2/lib/PaymentSplitter.sol\":\"PaymentSplitter\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n *\\n * ==== Security Considerations\\n *\\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\\n * generally recommended is:\\n *\\n * ```solidity\\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\\n * doThing(..., value);\\n * }\\n *\\n * function doThing(..., uint256 value) public {\\n * token.safeTransferFrom(msg.sender, address(this), value);\\n * ...\\n * }\\n * ```\\n *\\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\\n * {SafeERC20-safeTransferFrom}).\\n *\\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\\n * contracts should have entry points that don't rely on permit.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n *\\n * CAUTION: See Security Considerations above.\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xb264c03a3442eb37a68ad620cefd1182766b58bee6cec40343480392d6b14d69\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n * to be set to zero before setting it to a non-zero value, such as USDT.\\n */\\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n * Revert on invalid signature.\\n */\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0xabefac93435967b4d36a4fabcbdbb918d1f0b7ae3c3d85bc30923b326c927ed1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"contracts/v2/lib/PaymentSplitter.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n// OZ paymentsplitter with minor changes\\n// private function _addPayee made internal for better inheritance flow\\n// 0 payee chck in constructor removed to allow empty setup\\n\\n// OpenZeppelin Contracts (last updated v4.8.0) (finance/PaymentSplitter.sol)\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Context.sol\\\";\\n\\n/**\\n * @title PaymentSplitter\\n * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware\\n * that the Ether will be split in this way, since it is handled transparently by the contract.\\n *\\n * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each\\n * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim\\n * an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the\\n * time of contract deployment and can't be updated thereafter.\\n *\\n * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the\\n * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}\\n * function.\\n *\\n * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and\\n * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you\\n * to run tests before sending real value to this contract.\\n */\\ncontract PaymentSplitter is Context {\\n event PayeeAdded(address account, uint256 shares);\\n event PaymentReleased(address to, uint256 amount);\\n event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount);\\n event PaymentReceived(address from, uint256 amount);\\n\\n uint256 private _totalShares;\\n uint256 private _totalReleased;\\n\\n mapping(address => uint256) private _shares;\\n mapping(address => uint256) private _released;\\n address[] internal _payees;\\n\\n mapping(IERC20 => uint256) private _erc20TotalReleased;\\n mapping(IERC20 => mapping(address => uint256)) private _erc20Released;\\n\\n /**\\n * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at\\n * the matching position in the `shares` array.\\n *\\n * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no\\n * duplicates in `payees`.\\n */\\n constructor(address[] memory payees, uint256[] memory shares_) payable {\\n require(payees.length == shares_.length, \\\"PaymentSplitter: payees and shares length mismatch\\\");\\n // require(payees.length > 0, \\\"PaymentSplitter: no payees\\\");\\n\\n for (uint256 i = 0; i < payees.length; i++) {\\n _addPayee(payees[i], shares_[i]);\\n }\\n }\\n\\n /**\\n * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully\\n * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the\\n * reliability of the events, and not the actual splitting of Ether.\\n *\\n * To learn more about this see the Solidity documentation for\\n * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback\\n * functions].\\n */\\n receive() external payable virtual {\\n emit PaymentReceived(_msgSender(), msg.value);\\n }\\n\\n /**\\n * @dev Getter for the total shares held by payees.\\n */\\n function totalShares() public view returns (uint256) {\\n return _totalShares;\\n }\\n\\n /**\\n * @dev Getter for the total amount of Ether already released.\\n */\\n function totalReleased() public view returns (uint256) {\\n return _totalReleased;\\n }\\n\\n /**\\n * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20\\n * contract.\\n */\\n function totalReleased(IERC20 token) public view returns (uint256) {\\n return _erc20TotalReleased[token];\\n }\\n\\n /**\\n * @dev Getter for the amount of shares held by an account.\\n */\\n function shares(address account) public view returns (uint256) {\\n return _shares[account];\\n }\\n\\n /**\\n * @dev Getter for the amount of Ether already released to a payee.\\n */\\n function released(address account) public view returns (uint256) {\\n return _released[account];\\n }\\n\\n /**\\n * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an\\n * IERC20 contract.\\n */\\n function released(IERC20 token, address account) public view returns (uint256) {\\n return _erc20Released[token][account];\\n }\\n\\n /**\\n * @dev Getter for the address of the payee number `index`.\\n */\\n function payee(uint256 index) public view returns (address) {\\n return _payees[index];\\n }\\n\\n /**\\n * @dev Getter for the amount of payee's releasable Ether.\\n */\\n function releasable(address account) public view returns (uint256) {\\n uint256 totalReceived = address(this).balance + totalReleased();\\n return _pendingPayment(account, totalReceived, released(account));\\n }\\n\\n /**\\n * @dev Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an\\n * IERC20 contract.\\n */\\n function releasable(IERC20 token, address account) public view returns (uint256) {\\n uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token);\\n return _pendingPayment(account, totalReceived, released(token, account));\\n }\\n\\n /**\\n * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the\\n * total shares and their previous withdrawals.\\n */\\n function release(address payable account) public virtual {\\n require(_shares[account] > 0, \\\"PaymentSplitter: account has no shares\\\");\\n\\n uint256 payment = releasable(account);\\n\\n require(payment != 0, \\\"PaymentSplitter: account is not due payment\\\");\\n\\n // _totalReleased is the sum of all values in _released.\\n // If \\\"_totalReleased += payment\\\" does not overflow, then \\\"_released[account] += payment\\\" cannot overflow.\\n _totalReleased += payment;\\n unchecked {\\n _released[account] += payment;\\n }\\n\\n Address.sendValue(account, payment);\\n emit PaymentReleased(account, payment);\\n }\\n\\n /**\\n * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their\\n * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20\\n * contract.\\n */\\n function release(IERC20 token, address account) public virtual {\\n require(_shares[account] > 0, \\\"PaymentSplitter: account has no shares\\\");\\n\\n uint256 payment = releasable(token, account);\\n\\n require(payment != 0, \\\"PaymentSplitter: account is not due payment\\\");\\n\\n // _erc20TotalReleased[token] is the sum of all values in _erc20Released[token].\\n // If \\\"_erc20TotalReleased[token] += payment\\\" does not overflow, then \\\"_erc20Released[token][account] += payment\\\"\\n // cannot overflow.\\n _erc20TotalReleased[token] += payment;\\n unchecked {\\n _erc20Released[token][account] += payment;\\n }\\n\\n SafeERC20.safeTransfer(token, account, payment);\\n emit ERC20PaymentReleased(token, account, payment);\\n }\\n\\n /**\\n * @dev internal logic for computing the pending payment of an `account` given the token historical balances and\\n * already released amounts.\\n */\\n function _pendingPayment(\\n address account,\\n uint256 totalReceived,\\n uint256 alreadyReleased\\n ) private view returns (uint256) {\\n return (totalReceived * _shares[account]) / _totalShares - alreadyReleased;\\n }\\n\\n /**\\n * @dev Add a new payee to the contract.\\n * @param account The address of the payee to add.\\n * @param shares_ The number of shares owned by the payee.\\n */\\n function _addPayee(address account, uint256 shares_) internal {\\n require(account != address(0), \\\"PaymentSplitter: account is the zero address\\\");\\n require(shares_ > 0, \\\"PaymentSplitter: shares are 0\\\");\\n require(_shares[account] == 0, \\\"PaymentSplitter: account already has shares\\\");\\n\\n _payees.push(account);\\n _shares[account] = shares_;\\n _totalShares = _totalShares + shares_;\\n emit PayeeAdded(account, shares_);\\n }\\n}\",\"keccak256\":\"0x207135cb5400c3e0dab804834382d66ebd6e45670f8c167f1e4aa86f1757bef0\",\"license\":\"BUSL-1.1\"}},\"version\":1}", + "bytecode": "0x608060405260405162001146380380620011468339810160408190526200002691620003db565b8051825114620000985760405162461bcd60e51b815260206004820152603260248201527f5061796d656e7453706c69747465723a2070617965657320616e6420736861726044820152710cae640d8cadccee8d040dad2e6dac2e8c6d60731b60648201526084015b60405180910390fd5b60005b82518110156200010457620000ef838281518110620000be57620000be620004b9565b6020026020010151838381518110620000db57620000db620004b9565b60200260200101516200010d60201b60201c565b80620000fb81620004e5565b9150506200009b565b5050506200051d565b6001600160a01b0382166200017a5760405162461bcd60e51b815260206004820152602c60248201527f5061796d656e7453706c69747465723a206163636f756e74206973207468652060448201526b7a65726f206164647265737360a01b60648201526084016200008f565b60008111620001cc5760405162461bcd60e51b815260206004820152601d60248201527f5061796d656e7453706c69747465723a2073686172657320617265203000000060448201526064016200008f565b6001600160a01b03821660009081526002602052604090205415620002485760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e7420616c726561647960448201526a206861732073686172657360a81b60648201526084016200008f565b60048054600181019091557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b038416908117909155600090815260026020526040812082905554620002b090829062000501565b600055604080516001600160a01b0384168152602081018390527f40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac910160405180910390a15050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200033a576200033a620002f9565b604052919050565b60006001600160401b038211156200035e576200035e620002f9565b5060051b60200190565b600082601f8301126200037a57600080fd5b81516020620003936200038d8362000342565b6200030f565b82815260059290921b84018101918181019086841115620003b357600080fd5b8286015b84811015620003d05780518352918301918301620003b7565b509695505050505050565b60008060408385031215620003ef57600080fd5b82516001600160401b03808211156200040757600080fd5b818501915085601f8301126200041c57600080fd5b815160206200042f6200038d8362000342565b82815260059290921b840181019181810190898411156200044f57600080fd5b948201945b83861015620004865785516001600160a01b0381168114620004765760008081fd5b8252948201949082019062000454565b91880151919650909350505080821115620004a057600080fd5b50620004af8582860162000368565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201620004fa57620004fa620004cf565b5060010190565b80820180821115620005175762000517620004cf565b92915050565b610c19806200052d6000396000f3fe6080604052600436106100a05760003560e01c80639852595c116100645780639852595c146101ac578063a3f8eace146101e2578063c45ac05014610202578063ce7c2ac214610222578063d79779b214610258578063e33b7de31461028e57600080fd5b806319165587146100ee5780633a98ef3914610110578063406072a91461013457806348b75044146101545780638b83209b1461017457600080fd5b366100e9577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b3480156100fa57600080fd5b5061010e6101093660046109aa565b6102a3565b005b34801561011c57600080fd5b506000545b6040519081526020015b60405180910390f35b34801561014057600080fd5b5061012161014f3660046109c7565b610393565b34801561016057600080fd5b5061010e61016f3660046109c7565b6103c0565b34801561018057600080fd5b5061019461018f366004610a00565b6104d1565b6040516001600160a01b03909116815260200161012b565b3480156101b857600080fd5b506101216101c73660046109aa565b6001600160a01b031660009081526003602052604090205490565b3480156101ee57600080fd5b506101216101fd3660046109aa565b610501565b34801561020e57600080fd5b5061012161021d3660046109c7565b610549565b34801561022e57600080fd5b5061012161023d3660046109aa565b6001600160a01b031660009081526002602052604090205490565b34801561026457600080fd5b506101216102733660046109aa565b6001600160a01b031660009081526005602052604090205490565b34801561029a57600080fd5b50600154610121565b6001600160a01b0381166000908152600260205260409020546102e15760405162461bcd60e51b81526004016102d890610a19565b60405180910390fd5b60006102ec82610501565b90508060000361030e5760405162461bcd60e51b81526004016102d890610a5f565b80600160008282546103209190610ac0565b90915550506001600160a01b038216600090815260036020526040902080548201905561034d82826105ef565b604080516001600160a01b0384168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a15050565b6001600160a01b038083166000908152600660209081526040808320938516835292905220545b92915050565b6001600160a01b0381166000908152600260205260409020546103f55760405162461bcd60e51b81526004016102d890610a19565b60006104018383610549565b9050806000036104235760405162461bcd60e51b81526004016102d890610a5f565b6001600160a01b0383166000908152600560205260408120805483929061044b908490610ac0565b90915550506001600160a01b03808416600090815260066020908152604080832093861683529290522080548201905561048683838361070d565b604080516001600160a01b038481168252602082018490528516917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a910160405180910390a2505050565b6000600482815481106104e6576104e6610ad3565b6000918252602090912001546001600160a01b031692915050565b60008061050d60015490565b6105179047610ac0565b9050610542838261053d866001600160a01b031660009081526003602052604090205490565b61075f565b9392505050565b6001600160a01b03821660009081526005602052604081205481906040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa1580156105a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cc9190610ae9565b6105d69190610ac0565b90506105e7838261053d8787610393565b949350505050565b8047101561063f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016102d8565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461068c576040519150601f19603f3d011682016040523d82523d6000602084013e610691565b606091505b50509050806107085760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016102d8565b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261070890849061079a565b600080546001600160a01b0385168252600260205260408220548391906107869086610b02565b6107909190610b19565b6105e79190610b3b565b60006107ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661086f9092919063ffffffff16565b90508051600014806108105750808060200190518101906108109190610b4e565b6107085760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016102d8565b60606105e7848460008585600080866001600160a01b031685876040516108969190610b94565b60006040518083038185875af1925050503d80600081146108d3576040519150601f19603f3d011682016040523d82523d6000602084013e6108d8565b606091505b50915091506108e9878383876108f4565b979650505050505050565b6060831561096357825160000361095c576001600160a01b0385163b61095c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102d8565b50816105e7565b6105e783838151156109785781518083602001fd5b8060405162461bcd60e51b81526004016102d89190610bb0565b6001600160a01b03811681146109a757600080fd5b50565b6000602082840312156109bc57600080fd5b813561054281610992565b600080604083850312156109da57600080fd5b82356109e581610992565b915060208301356109f581610992565b809150509250929050565b600060208284031215610a1257600080fd5b5035919050565b60208082526026908201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060408201526573686172657360d01b606082015260800190565b6020808252602b908201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060408201526a191d59481c185e5b595b9d60aa1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b808201808211156103ba576103ba610aaa565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610afb57600080fd5b5051919050565b80820281158282048414176103ba576103ba610aaa565b600082610b3657634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156103ba576103ba610aaa565b600060208284031215610b6057600080fd5b8151801515811461054257600080fd5b60005b83811015610b8b578181015183820152602001610b73565b50506000910152565b60008251610ba6818460208701610b70565b9190910192915050565b6020815260008251806020840152610bcf816040850160208701610b70565b601f01601f1916919091016040019291505056fea26469706673582212208be624c251a1534de17eebd46432b8dec3ab4f3dc212a89b82f54ee2e11be0c764736f6c63430008140033", + "deployedBytecode": "0x6080604052600436106100a05760003560e01c80639852595c116100645780639852595c146101ac578063a3f8eace146101e2578063c45ac05014610202578063ce7c2ac214610222578063d79779b214610258578063e33b7de31461028e57600080fd5b806319165587146100ee5780633a98ef3914610110578063406072a91461013457806348b75044146101545780638b83209b1461017457600080fd5b366100e9577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b3480156100fa57600080fd5b5061010e6101093660046109aa565b6102a3565b005b34801561011c57600080fd5b506000545b6040519081526020015b60405180910390f35b34801561014057600080fd5b5061012161014f3660046109c7565b610393565b34801561016057600080fd5b5061010e61016f3660046109c7565b6103c0565b34801561018057600080fd5b5061019461018f366004610a00565b6104d1565b6040516001600160a01b03909116815260200161012b565b3480156101b857600080fd5b506101216101c73660046109aa565b6001600160a01b031660009081526003602052604090205490565b3480156101ee57600080fd5b506101216101fd3660046109aa565b610501565b34801561020e57600080fd5b5061012161021d3660046109c7565b610549565b34801561022e57600080fd5b5061012161023d3660046109aa565b6001600160a01b031660009081526002602052604090205490565b34801561026457600080fd5b506101216102733660046109aa565b6001600160a01b031660009081526005602052604090205490565b34801561029a57600080fd5b50600154610121565b6001600160a01b0381166000908152600260205260409020546102e15760405162461bcd60e51b81526004016102d890610a19565b60405180910390fd5b60006102ec82610501565b90508060000361030e5760405162461bcd60e51b81526004016102d890610a5f565b80600160008282546103209190610ac0565b90915550506001600160a01b038216600090815260036020526040902080548201905561034d82826105ef565b604080516001600160a01b0384168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a15050565b6001600160a01b038083166000908152600660209081526040808320938516835292905220545b92915050565b6001600160a01b0381166000908152600260205260409020546103f55760405162461bcd60e51b81526004016102d890610a19565b60006104018383610549565b9050806000036104235760405162461bcd60e51b81526004016102d890610a5f565b6001600160a01b0383166000908152600560205260408120805483929061044b908490610ac0565b90915550506001600160a01b03808416600090815260066020908152604080832093861683529290522080548201905561048683838361070d565b604080516001600160a01b038481168252602082018490528516917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a910160405180910390a2505050565b6000600482815481106104e6576104e6610ad3565b6000918252602090912001546001600160a01b031692915050565b60008061050d60015490565b6105179047610ac0565b9050610542838261053d866001600160a01b031660009081526003602052604090205490565b61075f565b9392505050565b6001600160a01b03821660009081526005602052604081205481906040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa1580156105a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cc9190610ae9565b6105d69190610ac0565b90506105e7838261053d8787610393565b949350505050565b8047101561063f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016102d8565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461068c576040519150601f19603f3d011682016040523d82523d6000602084013e610691565b606091505b50509050806107085760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016102d8565b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261070890849061079a565b600080546001600160a01b0385168252600260205260408220548391906107869086610b02565b6107909190610b19565b6105e79190610b3b565b60006107ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661086f9092919063ffffffff16565b90508051600014806108105750808060200190518101906108109190610b4e565b6107085760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016102d8565b60606105e7848460008585600080866001600160a01b031685876040516108969190610b94565b60006040518083038185875af1925050503d80600081146108d3576040519150601f19603f3d011682016040523d82523d6000602084013e6108d8565b606091505b50915091506108e9878383876108f4565b979650505050505050565b6060831561096357825160000361095c576001600160a01b0385163b61095c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102d8565b50816105e7565b6105e783838151156109785781518083602001fd5b8060405162461bcd60e51b81526004016102d89190610bb0565b6001600160a01b03811681146109a757600080fd5b50565b6000602082840312156109bc57600080fd5b813561054281610992565b600080604083850312156109da57600080fd5b82356109e581610992565b915060208301356109f581610992565b809150509250929050565b600060208284031215610a1257600080fd5b5035919050565b60208082526026908201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060408201526573686172657360d01b606082015260800190565b6020808252602b908201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060408201526a191d59481c185e5b595b9d60aa1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b808201808211156103ba576103ba610aaa565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610afb57600080fd5b5051919050565b80820281158282048414176103ba576103ba610aaa565b600082610b3657634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156103ba576103ba610aaa565b600060208284031215610b6057600080fd5b8151801515811461054257600080fd5b60005b83811015610b8b578181015183820152602001610b73565b50506000910152565b60008251610ba6818460208701610b70565b9190910192915050565b6020815260008251806020840152610bcf816040850160208701610b70565b601f01601f1916919091016040019291505056fea26469706673582212208be624c251a1534de17eebd46432b8dec3ab4f3dc212a89b82f54ee2e11be0c764736f6c63430008140033", + "devdoc": { + "details": "This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware that the Ether will be split in this way, since it is handled transparently by the contract. The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the time of contract deployment and can't be updated thereafter. `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} function. NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you to run tests before sending real value to this contract.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at the matching position in the `shares` array. All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no duplicates in `payees`." + }, + "payee(uint256)": { + "details": "Getter for the address of the payee number `index`." + }, + "releasable(address)": { + "details": "Getter for the amount of payee's releasable Ether." + }, + "releasable(address,address)": { + "details": "Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an IERC20 contract." + }, + "release(address)": { + "details": "Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the total shares and their previous withdrawals." + }, + "release(address,address)": { + "details": "Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 contract." + }, + "released(address)": { + "details": "Getter for the amount of Ether already released to a payee." + }, + "released(address,address)": { + "details": "Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an IERC20 contract." + }, + "shares(address)": { + "details": "Getter for the amount of shares held by an account." + }, + "totalReleased()": { + "details": "Getter for the total amount of Ether already released." + }, + "totalReleased(address)": { + "details": "Getter for the total amount of `token` already released. `token` should be the address of an IERC20 contract." + }, + "totalShares()": { + "details": "Getter for the total shares held by payees." + } + }, + "title": "PaymentSplitter", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 17286, + "contract": "contracts/v2/lib/PaymentSplitter.sol:PaymentSplitter", + "label": "_totalShares", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 17288, + "contract": "contracts/v2/lib/PaymentSplitter.sol:PaymentSplitter", + "label": "_totalReleased", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 17292, + "contract": "contracts/v2/lib/PaymentSplitter.sol:PaymentSplitter", + "label": "_shares", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 17296, + "contract": "contracts/v2/lib/PaymentSplitter.sol:PaymentSplitter", + "label": "_released", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 17299, + "contract": "contracts/v2/lib/PaymentSplitter.sol:PaymentSplitter", + "label": "_payees", + "offset": 0, + "slot": "4", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 17304, + "contract": "contracts/v2/lib/PaymentSplitter.sol:PaymentSplitter", + "label": "_erc20TotalReleased", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_contract(IERC20)5493,t_uint256)" + }, + { + "astId": 17311, + "contract": "contracts/v2/lib/PaymentSplitter.sol:PaymentSplitter", + "label": "_erc20Released", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_contract(IERC20)5493,t_mapping(t_address,t_uint256))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_contract(IERC20)5493": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_contract(IERC20)5493,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_contract(IERC20)5493", + "label": "mapping(contract IERC20 => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_contract(IERC20)5493,t_uint256)": { + "encoding": "mapping", + "key": "t_contract(IERC20)5493", + "label": "mapping(contract IERC20 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/localhost/RewardsReceiver.json b/deployments/localhost/RewardsReceiver.json new file mode 100644 index 0000000..811bbe8 --- /dev/null +++ b/deployments/localhost/RewardsReceiver.json @@ -0,0 +1,293 @@ +{ + "address": "0xb72e1ba65714A682F8e96E396E97F0ACa3657E12", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_withdrawalAddr", + "type": "address" + }, + { + "internalType": "address[]", + "name": "yieldDirectorAddresses", + "type": "address[]" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "MINTER", + "outputs": [ + { + "internalType": "contract ISharedDeposit", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SGETH", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WITHDRAWALS", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WSGETH", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeSplitter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "flipState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeSplitter", + "type": "address" + } + ], + "name": "setDAOFeeSplitter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "state", + "outputs": [ + { + "internalType": "enum RewardsReceiver.State", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "work", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x52085c5fca426786ead95fd693663582a75b55cda03aaceacf82daf8688ef15b", + "receipt": { + "to": null, + "from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "contractAddress": "0xb72e1ba65714A682F8e96E396E97F0ACa3657E12", + "transactionIndex": 0, + "gasUsed": "720506", + "logsBloom": "0x00000040000000000000000020000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001001000000000000000000000000000000000020000000000000100000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000002000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x3eb2bfbab67b5ce3379628a95a218a80789d49da664bda414bcb474f53ddc77a", + "transactionHash": "0x52085c5fca426786ead95fd693663582a75b55cda03aaceacf82daf8688ef15b", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 6233290, + "transactionHash": "0x52085c5fca426786ead95fd693663582a75b55cda03aaceacf82daf8688ef15b", + "address": "0xb72e1ba65714A682F8e96E396E97F0ACa3657E12", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x3eb2bfbab67b5ce3379628a95a218a80789d49da664bda414bcb474f53ddc77a" + } + ], + "blockNumber": 6233290, + "cumulativeGasUsed": "720506", + "status": 1, + "byzantium": true + }, + "args": [ + "0x9fa2d3eEa3b22B86AD8dCCBa8392E13180962f36", + [ + "0x31e7d36377c664BeAAb967fB46E38c59069996eC", + "0x61A89BF0Ed0c2d1c365Db15660880C3d227A05D3", + "0xAEE735021836c891f041141E1B18aa58fe58F611", + "0x06d889F4678058D95058Ef431035b2f5d4A27B1a" + ] + ], + "numDeployments": 1, + "solcInputHash": "d5c4e8b77fe999241905bb33844ed6ed", + "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_withdrawalAddr\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"yieldDirectorAddresses\",\"type\":\"address[]\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"MINTER\",\"outputs\":[{\"internalType\":\"contract ISharedDeposit\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SGETH\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WITHDRAWALS\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WSGETH\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeSplitter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"flipState\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_feeSplitter\",\"type\":\"address\"}],\"name\":\"setDAOFeeSplitter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state\",\"outputs\":[{\"internalType\":\"enum RewardsReceiver.State\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"work\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"@ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com\",\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"RewardsReceiver - Rewards receiver contract for ETH2 CL + RL rewards\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/v2/core/RewardsReceiver.sol\":\"RewardsReceiver\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n *\\n * ==== Security Considerations\\n *\\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\\n * generally recommended is:\\n *\\n * ```solidity\\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\\n * doThing(..., value);\\n * }\\n *\\n * function doThing(..., uint256 value) public {\\n * token.safeTransferFrom(msg.sender, address(this), value);\\n * ...\\n * }\\n * ```\\n *\\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\\n * {SafeERC20-safeTransferFrom}).\\n *\\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\\n * contracts should have entry points that don't rely on permit.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n *\\n * CAUTION: See Security Considerations above.\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xb264c03a3442eb37a68ad620cefd1182766b58bee6cec40343480392d6b14d69\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n * to be set to zero before setting it to a non-zero value, such as USDT.\\n */\\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n * Revert on invalid signature.\\n */\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0xabefac93435967b4d36a4fabcbdbb918d1f0b7ae3c3d85bc30923b326c927ed1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"contracts/v2/core/RewardsReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.20;\\n\\n// Rewards receiver contract for ETH2 CL + RL rewards\\n// Acts as withdrawals address\\n// Sends recieved ETH to Deposits when system is healthy and buffer can process withdrawals\\n// Sends all recieved ETH to withdrawals contract when system is shutting down and validators are being exited\\n// normal deposit contract is ETH2sgETHYR to autocompound rewards\\n// call work() to process ETH\\n// DAO is set as owner. must call acceptOwnership. can call flipState\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {YieldDirectorBase} from \\\"../lib/YieldDirectorBase.sol\\\";\\n\\n/// @title RewardsReceiver - Rewards receiver contract for ETH2 CL + RL rewards\\n/// @author @ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com\\ncontract RewardsReceiver is Ownable, YieldDirectorBase {\\n enum State {\\n Deposits,\\n Withdrawals\\n }\\n State public state;\\n address payable public immutable WITHDRAWALS;\\n\\n constructor(\\n address _withdrawalAddr,\\n address[] memory yieldDirectorAddresses\\n ) payable Ownable() YieldDirectorBase(yieldDirectorAddresses) {\\n WITHDRAWALS = payable(_withdrawalAddr);\\n state = State.Deposits;\\n }\\n\\n function work() external payable {\\n if (state == State.Deposits) {\\n _convertToSgETHAndTransfer();\\n } else if (state == State.Withdrawals) {\\n WITHDRAWALS.transfer(address(this).balance);\\n }\\n }\\n\\n function flipState() external onlyOwner {\\n if (state == State.Deposits) {\\n state = State.Withdrawals;\\n } else if (state == State.Withdrawals) {\\n state = State.Deposits;\\n }\\n }\\n\\n // Allows upgrading/ changing the downstream DAO fee splitter only for easier fee tier changes in the future\\n function setDAOFeeSplitter(address _feeSplitter) external onlyOwner {\\n feeSplitter = _feeSplitter;\\n }\\n\\n receive() external payable {} // solhint-disable-line\\n\\n fallback() external payable {} // solhint-disable-line\\n}\\n\",\"keccak256\":\"0xef922c5ecd80eee86f24bb754f5921b4a31744da7deaca6d7238666739b744ca\",\"license\":\"BUSL-1.1\"},\"contracts/v2/interfaces/ISharedDeposit.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\ninterface ISharedDeposit {\\n function withdraw(uint256 amount) external;\\n function withdraw(uint256 amount, address dest) external;\\n\\n function deposit() external payable;\\n\\n function remainingSpaceInEpoch() external;\\n function depositAndStakeFor(address dest) external payable;\\n}\\n\",\"keccak256\":\"0x5ddc9847caef44cdf368df4f340c8c58b11fc32f0b4327271e365db23782f250\",\"license\":\"UNLICENSED\"},\"contracts/v2/lib/YieldDirectorBase.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\n\\n// Acts as the deposit contract for the reward receiver during normal functioning\\n// 100% of recieved ETH from rewards is auto-compounded back into sgETH\\n// 60% is immutably always transfered to wsgETH for staker rewards\\n// 40% is transferred to a splitter the DAO can modulate for nor payments and other use cases\\n\\n// call work() to process eth\\npragma solidity ^0.8.20;\\n\\nimport {ISharedDeposit} from \\\"../interfaces/ISharedDeposit.sol\\\";\\nimport {IERC20, SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\ncontract YieldDirectorBase {\\n IERC20 public immutable SGETH;\\n address public immutable WSGETH;\\n address public feeSplitter;\\n ISharedDeposit public immutable MINTER;\\n\\n constructor(address[] memory _addrs) payable {\\n SGETH = IERC20(_addrs[0]);\\n WSGETH = _addrs[1];\\n feeSplitter = _addrs[2];\\n MINTER = ISharedDeposit(_addrs[3]);\\n }\\n\\n function _convertToSgETHAndTransfer() internal {\\n // convert eth 2 sgETH\\n MINTER.deposit{value: address(this).balance}();\\n\\n // Calc static split\\n uint256 bal = SGETH.balanceOf(address(this));\\n uint256 part1 = (bal * 40) / 100; // upto 40% for DAO direction. most reflected back\\n uint256 part2 = bal - part1;\\n\\n // Send tokens\\n SafeERC20.safeTransfer(SGETH, feeSplitter, part1);\\n SafeERC20.safeTransfer(SGETH, WSGETH, part2);\\n }\\n}\\n\",\"keccak256\":\"0xd2edccd75827a38988e4abccd305d09509c930d24dcf0d28f0742fa2bea75b80\",\"license\":\"BUSL-1.1\"}},\"version\":1}", + "bytecode": "0x61010060405260405162000e1c38038062000e1c8339810160408190526200002791620001b3565b80620000333362000130565b806000815181106200004957620000496200029c565b60200260200101516001600160a01b03166080816001600160a01b031681525050806001815181106200008057620000806200029c565b60200260200101516001600160a01b031660a0816001600160a01b03168152505080600281518110620000b757620000b76200029c565b6020026020010151600160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600381518110620000fb57620000fb6200029c565b60209081029190910101516001600160a01b0390811660c0529290921660e05250506001805460ff60a01b19169055620002b2565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200019857600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215620001c757600080fd5b620001d28362000180565b602084810151919350906001600160401b0380821115620001f257600080fd5b818601915086601f8301126200020757600080fd5b8151818111156200021c576200021c6200019d565b8060051b604051601f19603f830116810181811085821117156200024457620002446200019d565b6040529182528482019250838101850191898311156200026357600080fd5b938501935b828510156200028c576200027c8562000180565b8452938501939285019262000268565b8096505050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c05160e051610b07620003156000396000818160c001526102d901526000818161025701526104520152600081816101a101526105d9015260008181610203015281816104da0152818161058401526105b80152610b076000f3fe6080604052600436106100a55760003560e01c80639e660663116100615780639e6606631461016f578063b8902ff71461018f578063c19d93fb146101c3578063cf36fd24146101f1578063f2fde38b14610225578063fe6d81241461024557005b80632b3d9215146100ae578063322e9f04146100ff5780636052970c14610107578063715018a6146101275780638da5cb5b1461013c5780638e9203511461015a57005b366100ac57005b005b3480156100ba57600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100ac610279565b34801561011357600080fd5b506001546100e2906001600160a01b031681565b34801561013357600080fd5b506100ac610324565b34801561014857600080fd5b506000546001600160a01b03166100e2565b34801561016657600080fd5b506100ac610336565b34801561017b57600080fd5b506100ac61018a36600461094d565b6103ab565b34801561019b57600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b3480156101cf57600080fd5b506001546101e490600160a01b900460ff1681565b6040516100f69190610993565b3480156101fd57600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b34801561023157600080fd5b506100ac61024036600461094d565b6103d5565b34801561025157600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b600060018054600160a01b900460ff16908111156102995761029961097d565b036102a8576102a6610450565b565b6001808054600160a01b900460ff16908111156102c7576102c761097d565b036102a6576040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016904780156108fc02916000818181858888f19350505050158015610321573d6000803e3d6000fd5b50565b61032c610603565b6102a6600061065d565b61033e610603565b600060018054600160a01b900460ff169081111561035e5761035e61097d565b03610378576001805460ff60a01b1916600160a01b179055565b6001808054600160a01b900460ff16908111156103975761039761097d565b036102a6576001805460ff60a01b19169055565b6103b3610603565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6103dd610603565b6001600160a01b0381166104475760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6103218161065d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b1580156104ab57600080fd5b505af11580156104bf573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600093507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506370a082319150602401602060405180830381865afa15801561052b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054f91906109bb565b9050600060646105608360286109ea565b61056a9190610a07565b905060006105788284610a29565b6001549091506105b3907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0316846106ad565b6105fe7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000836106ad565b505050565b6000546001600160a01b031633146102a65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161043e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663a9059cbb60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908401526105fe9286929160009161073d9185169084906107bd565b905080516000148061075e57508080602001905181019061075e9190610a3c565b6105fe5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161043e565b60606107cc84846000856107d4565b949350505050565b6060824710156108355760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161043e565b600080866001600160a01b031685876040516108519190610a82565b60006040518083038185875af1925050503d806000811461088e576040519150601f19603f3d011682016040523d82523d6000602084013e610893565b606091505b50915091506108a4878383876108af565b979650505050505050565b6060831561091e578251600003610917576001600160a01b0385163b6109175760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161043e565b50816107cc565b6107cc83838151156109335781518083602001fd5b8060405162461bcd60e51b815260040161043e9190610a9e565b60006020828403121561095f57600080fd5b81356001600160a01b038116811461097657600080fd5b9392505050565b634e487b7160e01b600052602160045260246000fd5b60208101600283106109b557634e487b7160e01b600052602160045260246000fd5b91905290565b6000602082840312156109cd57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610a0157610a016109d4565b92915050565b600082610a2457634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610a0157610a016109d4565b600060208284031215610a4e57600080fd5b8151801515811461097657600080fd5b60005b83811015610a79578181015183820152602001610a61565b50506000910152565b60008251610a94818460208701610a5e565b9190910192915050565b6020815260008251806020840152610abd816040850160208701610a5e565b601f01601f1916919091016040019291505056fea2646970667358221220f6de4d88e3bc6d2ca51b6f1e7b40859479bd8484236871633984ba2c5626010964736f6c63430008140033", + "deployedBytecode": "0x6080604052600436106100a55760003560e01c80639e660663116100615780639e6606631461016f578063b8902ff71461018f578063c19d93fb146101c3578063cf36fd24146101f1578063f2fde38b14610225578063fe6d81241461024557005b80632b3d9215146100ae578063322e9f04146100ff5780636052970c14610107578063715018a6146101275780638da5cb5b1461013c5780638e9203511461015a57005b366100ac57005b005b3480156100ba57600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100ac610279565b34801561011357600080fd5b506001546100e2906001600160a01b031681565b34801561013357600080fd5b506100ac610324565b34801561014857600080fd5b506000546001600160a01b03166100e2565b34801561016657600080fd5b506100ac610336565b34801561017b57600080fd5b506100ac61018a36600461094d565b6103ab565b34801561019b57600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b3480156101cf57600080fd5b506001546101e490600160a01b900460ff1681565b6040516100f69190610993565b3480156101fd57600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b34801561023157600080fd5b506100ac61024036600461094d565b6103d5565b34801561025157600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b600060018054600160a01b900460ff16908111156102995761029961097d565b036102a8576102a6610450565b565b6001808054600160a01b900460ff16908111156102c7576102c761097d565b036102a6576040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016904780156108fc02916000818181858888f19350505050158015610321573d6000803e3d6000fd5b50565b61032c610603565b6102a6600061065d565b61033e610603565b600060018054600160a01b900460ff169081111561035e5761035e61097d565b03610378576001805460ff60a01b1916600160a01b179055565b6001808054600160a01b900460ff16908111156103975761039761097d565b036102a6576001805460ff60a01b19169055565b6103b3610603565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6103dd610603565b6001600160a01b0381166104475760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6103218161065d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b1580156104ab57600080fd5b505af11580156104bf573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600093507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506370a082319150602401602060405180830381865afa15801561052b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054f91906109bb565b9050600060646105608360286109ea565b61056a9190610a07565b905060006105788284610a29565b6001549091506105b3907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0316846106ad565b6105fe7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000836106ad565b505050565b6000546001600160a01b031633146102a65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161043e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663a9059cbb60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908401526105fe9286929160009161073d9185169084906107bd565b905080516000148061075e57508080602001905181019061075e9190610a3c565b6105fe5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161043e565b60606107cc84846000856107d4565b949350505050565b6060824710156108355760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161043e565b600080866001600160a01b031685876040516108519190610a82565b60006040518083038185875af1925050503d806000811461088e576040519150601f19603f3d011682016040523d82523d6000602084013e610893565b606091505b50915091506108a4878383876108af565b979650505050505050565b6060831561091e578251600003610917576001600160a01b0385163b6109175760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161043e565b50816107cc565b6107cc83838151156109335781518083602001fd5b8060405162461bcd60e51b815260040161043e9190610a9e565b60006020828403121561095f57600080fd5b81356001600160a01b038116811461097657600080fd5b9392505050565b634e487b7160e01b600052602160045260246000fd5b60208101600283106109b557634e487b7160e01b600052602160045260246000fd5b91905290565b6000602082840312156109cd57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610a0157610a016109d4565b92915050565b600082610a2457634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610a0157610a016109d4565b600060208284031215610a4e57600080fd5b8151801515811461097657600080fd5b60005b83811015610a79578181015183820152602001610a61565b50506000910152565b60008251610a94818460208701610a5e565b9190910192915050565b6020815260008251806020840152610abd816040850160208701610a5e565b601f01601f1916919091016040019291505056fea2646970667358221220f6de4d88e3bc6d2ca51b6f1e7b40859479bd8484236871633984ba2c5626010964736f6c63430008140033", + "devdoc": { + "author": "@ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com", + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "title": "RewardsReceiver - Rewards receiver contract for ETH2 CL + RL rewards", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 4000, + "contract": "contracts/v2/core/RewardsReceiver.sol:RewardsReceiver", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 17953, + "contract": "contracts/v2/core/RewardsReceiver.sol:RewardsReceiver", + "label": "feeSplitter", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 14629, + "contract": "contracts/v2/core/RewardsReceiver.sol:RewardsReceiver", + "label": "state", + "offset": 20, + "slot": "1", + "type": "t_enum(State)14626" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_enum(State)14626": { + "encoding": "inplace", + "label": "enum RewardsReceiver.State", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/localhost/SgETH.json b/deployments/localhost/SgETH.json new file mode 100644 index 0000000..669712c --- /dev/null +++ b/deployments/localhost/SgETH.json @@ -0,0 +1,1088 @@ +{ + "address": "0x31e7d36377c664BeAAb967fB46E38c59069996eC", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINTER", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "minterAddress", + "type": "address" + } + ], + "name": "addMinter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amt", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amt", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amt", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "minterAddress", + "type": "address" + } + ], + "name": "removeMinter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x544a0349a51aaeee950df43663670502607101fca499c91f96d11d1ba1328109", + "receipt": { + "to": null, + "from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "contractAddress": "0x31e7d36377c664BeAAb967fB46E38c59069996eC", + "transactionIndex": 0, + "gasUsed": "1775033", + "logsBloom": "0x00000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000020000000000000100000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000001000000000000000000000000000200000000000000000000000002000000100000000000020000000000000000000000000000000020000000000000000000000000000000000", + "blockHash": "0x51c34287f94b1d25bf7eda038617b4b083c87cca4774f65e9dc18a6c9313c361", + "transactionHash": "0x544a0349a51aaeee950df43663670502607101fca499c91f96d11d1ba1328109", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 6233282, + "transactionHash": "0x544a0349a51aaeee950df43663670502607101fca499c91f96d11d1ba1328109", + "address": "0x31e7d36377c664BeAAb967fB46E38c59069996eC", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266", + "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x51c34287f94b1d25bf7eda038617b4b083c87cca4774f65e9dc18a6c9313c361" + } + ], + "blockNumber": 6233282, + "cumulativeGasUsed": "1775033", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "d5c4e8b77fe999241905bb33844ed6ed", + "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidShortString\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"str\",\"type\":\"string\"}],\"name\":\"StringTooLong\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINTER\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minterAddress\",\"type\":\"address\"}],\"name\":\"addMinter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amt\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amt\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amt\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minterAddress\",\"type\":\"address\"}],\"name\":\"removeMinter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"@ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"}},\"kind\":\"dev\",\"methods\":{\"DOMAIN_SEPARATOR()\":{\"details\":\"Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\"},\"allowance(address,address)\":{\"details\":\"See {IERC20-allowance}.\"},\"approve(address,uint256)\":{\"details\":\"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.\"},\"balanceOf(address)\":{\"details\":\"See {IERC20-balanceOf}.\"},\"burn(uint256)\":{\"details\":\"Destroys `amount` tokens from the caller. See {ERC20-_burn}.\"},\"burnFrom(address,uint256)\":{\"params\":{\"addr\":\"The address to burn from\",\"amt\":\"The amount to burn\"}},\"decimals()\":{\"details\":\"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.\"},\"decreaseAllowance(address,uint256)\":{\"details\":\"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`.\"},\"eip712Domain()\":{\"details\":\"See {EIP-5267}. _Available since v4.9._\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"increaseAllowance(address,uint256)\":{\"details\":\"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.\"},\"mint(address,uint256)\":{\"params\":{\"addr\":\"The address to mint to \",\"amt\":\"The amount to mint \"}},\"name()\":{\"details\":\"Returns the name of the token.\"},\"nonces(address)\":{\"details\":\"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.\"},\"permit(address,address,uint256,uint256,uint8,bytes32,bytes32)\":{\"details\":\"Sets `value` as the allowance of `spender` over ``owner``'s tokens, given ``owner``'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also apply here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address. - `deadline` must be a timestamp in the future. - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments. - the signature must use ``owner``'s current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token, usually a shorter version of the name.\"},\"totalSupply()\":{\"details\":\"See {IERC20-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"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`.\"}},\"title\":\"SgETH - SharedStake Governed Staked Ether\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"burnFrom(address,uint256)\":{\"notice\":\"burnFrom Used by minters when user redeems\"},\"mint(address,uint256)\":{\"notice\":\"mint This function is what other minters will call to mint new tokens\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/v2/core/SgETH.sol\":\"SgETH\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(account),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0dd6e52cb394d7f5abe5dca2d4908a6be40417914720932de757de34a99ab87f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC5267.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC5267 {\\n /**\\n * @dev MAY be emitted to signal that the domain could have changed.\\n */\\n event EIP712DomainChanged();\\n\\n /**\\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\\n * signature.\\n */\\n function eip712Domain()\\n external\\n view\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n );\\n}\\n\",\"keccak256\":\"0xac6c2efc64baccbde4904ae18ed45139c9aa8cff96d6888344d1e4d2eb8b659f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * The default value of {decimals} is 18. To change this, you should override\\n * this function so it returns a different value.\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the default value returned by this function, unless\\n * it's overridden.\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _transfer(owner, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Requirements:\\n *\\n * - `from` and `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``from``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(from, spender, amount);\\n _transfer(from, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, allowance(owner, spender) + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n uint256 currentAllowance = allowance(owner, spender);\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `from` to `to`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n */\\n function _transfer(address from, address to, uint256 amount) internal virtual {\\n require(from != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\\n // decrementing then incrementing.\\n _balances[to] += amount;\\n }\\n\\n emit Transfer(from, to, amount);\\n\\n _afterTokenTransfer(from, to, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n unchecked {\\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\\n _balances[account] += amount;\\n }\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n // Overflow not possible: amount <= accountBalance <= totalSupply.\\n _totalSupply -= amount;\\n }\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(address owner, address spender, uint256 amount) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {Approval} event.\\n */\\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC20: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\\n}\\n\",\"keccak256\":\"0xa56ca923f70c1748830700250b19c61b70db9a683516dc5e216694a50445d99c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC20.sol\\\";\\nimport \\\"../../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\\n * tokens and those that they have an allowance for, in a way that can be\\n * recognized off-chain (via event analysis).\\n */\\nabstract contract ERC20Burnable is Context, ERC20 {\\n /**\\n * @dev Destroys `amount` tokens from the caller.\\n *\\n * See {ERC20-_burn}.\\n */\\n function burn(uint256 amount) public virtual {\\n _burn(_msgSender(), amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, deducting from the caller's\\n * allowance.\\n *\\n * See {ERC20-_burn} and {ERC20-allowance}.\\n *\\n * Requirements:\\n *\\n * - the caller must have allowance for ``accounts``'s tokens of at least\\n * `amount`.\\n */\\n function burnFrom(address account, uint256 amount) public virtual {\\n _spendAllowance(account, _msgSender(), amount);\\n _burn(account, amount);\\n }\\n}\\n\",\"keccak256\":\"0x0d19410453cda55960a818e02bd7c18952a5c8fe7a3036e81f0d599f34487a7b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/ERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20Permit.sol\\\";\\nimport \\\"../ERC20.sol\\\";\\nimport \\\"../../../utils/cryptography/ECDSA.sol\\\";\\nimport \\\"../../../utils/cryptography/EIP712.sol\\\";\\nimport \\\"../../../utils/Counters.sol\\\";\\n\\n/**\\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n *\\n * _Available since v3.4._\\n */\\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {\\n using Counters for Counters.Counter;\\n\\n mapping(address => Counters.Counter) private _nonces;\\n\\n // solhint-disable-next-line var-name-mixedcase\\n bytes32 private constant _PERMIT_TYPEHASH =\\n keccak256(\\\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\\\");\\n /**\\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\\n * However, to ensure consistency with the upgradeable transpiler, we will continue\\n * to reserve a slot.\\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\\n */\\n // solhint-disable-next-line var-name-mixedcase\\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\\n\\n /**\\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\\\"1\\\"`.\\n *\\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\\n */\\n constructor(string memory name) EIP712(name, \\\"1\\\") {}\\n\\n /**\\n * @inheritdoc IERC20Permit\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) public virtual override {\\n require(block.timestamp <= deadline, \\\"ERC20Permit: expired deadline\\\");\\n\\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\\n\\n bytes32 hash = _hashTypedDataV4(structHash);\\n\\n address signer = ECDSA.recover(hash, v, r, s);\\n require(signer == owner, \\\"ERC20Permit: invalid signature\\\");\\n\\n _approve(owner, spender, value);\\n }\\n\\n /**\\n * @inheritdoc IERC20Permit\\n */\\n function nonces(address owner) public view virtual override returns (uint256) {\\n return _nonces[owner].current();\\n }\\n\\n /**\\n * @inheritdoc IERC20Permit\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\\n return _domainSeparatorV4();\\n }\\n\\n /**\\n * @dev \\\"Consume a nonce\\\": return the current value and increment.\\n *\\n * _Available since v4.1._\\n */\\n function _useNonce(address owner) internal virtual returns (uint256 current) {\\n Counters.Counter storage nonce = _nonces[owner];\\n current = nonce.current();\\n nonce.increment();\\n }\\n}\\n\",\"keccak256\":\"0xbb16110ffe0b625944fe7dd97adcf1158e514185c956a5628bc09be90d606174\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n *\\n * ==== Security Considerations\\n *\\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\\n * generally recommended is:\\n *\\n * ```solidity\\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\\n * doThing(..., value);\\n * }\\n *\\n * function doThing(..., uint256 value) public {\\n * token.safeTransferFrom(msg.sender, address(this), value);\\n * ...\\n * }\\n * ```\\n *\\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\\n * {SafeERC20-safeTransferFrom}).\\n *\\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\\n * contracts should have entry points that don't rely on permit.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n *\\n * CAUTION: See Security Considerations above.\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xb264c03a3442eb37a68ad620cefd1182766b58bee6cec40343480392d6b14d69\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Counters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Counters\\n * @author Matt Condon (@shrugs)\\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\\n *\\n * Include with `using Counters for Counters.Counter;`\\n */\\nlibrary Counters {\\n struct Counter {\\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\\n // this feature: see https://github.com/ethereum/solidity/issues/4637\\n uint256 _value; // default: 0\\n }\\n\\n function current(Counter storage counter) internal view returns (uint256) {\\n return counter._value;\\n }\\n\\n function increment(Counter storage counter) internal {\\n unchecked {\\n counter._value += 1;\\n }\\n }\\n\\n function decrement(Counter storage counter) internal {\\n uint256 value = counter._value;\\n require(value > 0, \\\"Counter: decrement overflow\\\");\\n unchecked {\\n counter._value = value - 1;\\n }\\n }\\n\\n function reset(Counter storage counter) internal {\\n counter._value = 0;\\n }\\n}\\n\",\"keccak256\":\"0xf0018c2440fbe238dd3a8732fa8e17a0f9dce84d31451dc8a32f6d62b349c9f1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/ShortStrings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)\\n\\npragma solidity ^0.8.8;\\n\\nimport \\\"./StorageSlot.sol\\\";\\n\\n// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |\\n// | length | 0x BB |\\ntype ShortString is bytes32;\\n\\n/**\\n * @dev This library provides functions to convert short memory strings\\n * into a `ShortString` type that can be used as an immutable variable.\\n *\\n * Strings of arbitrary length can be optimized using this library if\\n * they are short enough (up to 31 bytes) by packing them with their\\n * length (1 byte) in a single EVM word (32 bytes). Additionally, a\\n * fallback mechanism can be used for every other case.\\n *\\n * Usage example:\\n *\\n * ```solidity\\n * contract Named {\\n * using ShortStrings for *;\\n *\\n * ShortString private immutable _name;\\n * string private _nameFallback;\\n *\\n * constructor(string memory contractName) {\\n * _name = contractName.toShortStringWithFallback(_nameFallback);\\n * }\\n *\\n * function name() external view returns (string memory) {\\n * return _name.toStringWithFallback(_nameFallback);\\n * }\\n * }\\n * ```\\n */\\nlibrary ShortStrings {\\n // Used as an identifier for strings longer than 31 bytes.\\n bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;\\n\\n error StringTooLong(string str);\\n error InvalidShortString();\\n\\n /**\\n * @dev Encode a string of at most 31 chars into a `ShortString`.\\n *\\n * This will trigger a `StringTooLong` error is the input string is too long.\\n */\\n function toShortString(string memory str) internal pure returns (ShortString) {\\n bytes memory bstr = bytes(str);\\n if (bstr.length > 31) {\\n revert StringTooLong(str);\\n }\\n return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\\n }\\n\\n /**\\n * @dev Decode a `ShortString` back to a \\\"normal\\\" string.\\n */\\n function toString(ShortString sstr) internal pure returns (string memory) {\\n uint256 len = byteLength(sstr);\\n // using `new string(len)` would work locally but is not memory safe.\\n string memory str = new string(32);\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(str, len)\\n mstore(add(str, 0x20), sstr)\\n }\\n return str;\\n }\\n\\n /**\\n * @dev Return the length of a `ShortString`.\\n */\\n function byteLength(ShortString sstr) internal pure returns (uint256) {\\n uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\\n if (result > 31) {\\n revert InvalidShortString();\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.\\n */\\n function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {\\n if (bytes(value).length < 32) {\\n return toShortString(value);\\n } else {\\n StorageSlot.getStringSlot(store).value = value;\\n return ShortString.wrap(_FALLBACK_SENTINEL);\\n }\\n }\\n\\n /**\\n * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\\n */\\n function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {\\n if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {\\n return toString(value);\\n } else {\\n return store;\\n }\\n }\\n\\n /**\\n * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\\n *\\n * WARNING: This will return the \\\"byte length\\\" of the string. This may not reflect the actual length in terms of\\n * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.\\n */\\n function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {\\n if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {\\n return byteLength(value);\\n } else {\\n return bytes(store).length;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc0e310c163edf15db45d4ff938113ab357f94fa86e61ea8e790853c4d2e13256\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```solidity\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\\n * _Available since v4.9 for `string`, `bytes`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n struct StringSlot {\\n string value;\\n }\\n\\n struct BytesSlot {\\n bytes value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\\n */\\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\\n */\\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\\n */\\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\\n */\\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf09e68aa0dc6722a25bc46490e8d48ed864466d17313b8a0b254c36b54e49899\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/EIP712.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.8;\\n\\nimport \\\"./ECDSA.sol\\\";\\nimport \\\"../ShortStrings.sol\\\";\\nimport \\\"../../interfaces/IERC5267.sol\\\";\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\\n *\\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\\n *\\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\\n * ({_hashTypedDataV4}).\\n *\\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\\n * the chain id to protect against replay attacks on an eventual fork of the chain.\\n *\\n * NOTE: This contract implements the version of the encoding known as \\\"v4\\\", as implemented by the JSON RPC method\\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\\n *\\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\\n *\\n * _Available since v3.4._\\n *\\n * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\\n */\\nabstract contract EIP712 is IERC5267 {\\n using ShortStrings for *;\\n\\n bytes32 private constant _TYPE_HASH =\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\");\\n\\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\\n // invalidate the cached domain separator if the chain id changes.\\n bytes32 private immutable _cachedDomainSeparator;\\n uint256 private immutable _cachedChainId;\\n address private immutable _cachedThis;\\n\\n bytes32 private immutable _hashedName;\\n bytes32 private immutable _hashedVersion;\\n\\n ShortString private immutable _name;\\n ShortString private immutable _version;\\n string private _nameFallback;\\n string private _versionFallback;\\n\\n /**\\n * @dev Initializes the domain separator and parameter caches.\\n *\\n * The meaning of `name` and `version` is specified in\\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\\n *\\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\\n * - `version`: the current major version of the signing domain.\\n *\\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\\n * contract upgrade].\\n */\\n constructor(string memory name, string memory version) {\\n _name = name.toShortStringWithFallback(_nameFallback);\\n _version = version.toShortStringWithFallback(_versionFallback);\\n _hashedName = keccak256(bytes(name));\\n _hashedVersion = keccak256(bytes(version));\\n\\n _cachedChainId = block.chainid;\\n _cachedDomainSeparator = _buildDomainSeparator();\\n _cachedThis = address(this);\\n }\\n\\n /**\\n * @dev Returns the domain separator for the current chain.\\n */\\n function _domainSeparatorV4() internal view returns (bytes32) {\\n if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\\n return _cachedDomainSeparator;\\n } else {\\n return _buildDomainSeparator();\\n }\\n }\\n\\n function _buildDomainSeparator() private view returns (bytes32) {\\n return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));\\n }\\n\\n /**\\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\\n * function returns the hash of the fully encoded EIP712 message for this domain.\\n *\\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\\n *\\n * ```solidity\\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\\n * keccak256(\\\"Mail(address to,string contents)\\\"),\\n * mailTo,\\n * keccak256(bytes(mailContents))\\n * )));\\n * address signer = ECDSA.recover(digest, signature);\\n * ```\\n */\\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n\\n /**\\n * @dev See {EIP-5267}.\\n *\\n * _Available since v4.9._\\n */\\n function eip712Domain()\\n public\\n view\\n virtual\\n override\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n )\\n {\\n return (\\n hex\\\"0f\\\", // 01111\\n _name.toStringWithFallback(_nameFallback),\\n _version.toStringWithFallback(_versionFallback),\\n block.chainid,\\n address(this),\\n bytes32(0),\\n new uint256[](0)\\n );\\n }\\n}\\n\",\"keccak256\":\"0x8432884527a7ad91e6eed1cfc5a0811ae2073e5bca107bd0ca442e9236b03dbd\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/v2/core/SgETH.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.20;\\nimport {ERC20MintableBurnableByMinter} from \\\"../lib/ERC20MintableBurnableByMinter.sol\\\";\\nimport {Errors} from \\\"../lib/Errors.sol\\\";\\n\\n/// @title SgETH - SharedStake Governed Staked Ether\\n/// @author @ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com\\ncontract SgETH is ERC20MintableBurnableByMinter {\\n constructor() ERC20MintableBurnableByMinter(\\\"SharedStake Governed Staked Ether\\\", \\\"sgETH\\\") {\\n // Set the admin of the minter role; this causes the grant and revole role fns to gaurd to this admin role\\n _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);\\n }\\n\\n // Adds whitelisted minters - only callable by DEFAULT_ADMIN_ROLE enforced in OZ dep\\n function addMinter(address minterAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n if (minterAddress != address(0)) {\\n grantRole(MINTER, minterAddress);\\n } else {\\n revert Errors.ZeroAddress();\\n }\\n }\\n\\n // Remove a minter - only callable by DEFAULT_ADMIN_ROLE enforced internally\\n function removeMinter(address minterAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n // oz uses maps so 0 address will return true but does not break anything\\n revokeRole(MINTER, minterAddress);\\n }\\n\\n // Transfer ownership of who can add/rm minters\\n function transferOwnership(address newOwner) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n grantRole(DEFAULT_ADMIN_ROLE, newOwner);\\n renounceRole(DEFAULT_ADMIN_ROLE, msg.sender); // permission gaurded via revert if called lacks role\\n }\\n}\\n\",\"keccak256\":\"0xd7c0b4f3bde7b8dfc35d08f1e9cc45bc413542cc8d81a3a1caa663bb7011a7b3\",\"license\":\"BUSL-1.1\"},\"contracts/v2/lib/ERC20MintableBurnableByMinter.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\n\\nimport {ERC20Burnable} from \\\"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\\\";\\nimport {AccessControl} from\\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {ERC20, ERC20Permit} from \\\"@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol\\\";\\n\\n/// @title Parent contract for sgETH.sol\\n/** @notice Based on ERC20PermitPermissionedMint - base contract for frxETH. \\n Changed to reduce code footprint and rely on OZ primitives instead\\n Using ownable and OZ AccessControl for minter management and standard underlying events instead of extra custom events\\n Also includes a list of authorized minters \\n Steps: 1. Deploy it. 2. Set new sgETH minter 3. Transfer ownership to multisig timelock 4. confirm accept ownership from timelock */\\n/// @dev Adheres to EIP-712/EIP-2612 and can use permits\\ncontract ERC20MintableBurnableByMinter is ERC20Burnable, ERC20Permit, AccessControl {\\n bytes32 public constant MINTER = keccak256(\\\"MINTER\\\");\\n\\n /* ========== CONSTRUCTOR ========== */\\n constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) ERC20Permit(_name) AccessControl() {}\\n\\n /* ========== RESTRICTED FUNCTIONS ========== */\\n /// @notice burnFrom Used by minters when user redeems\\n /// @param addr The address to burn from\\n /// @param amt The amount to burn\\n function burnFrom(address addr, uint256 amt) public override onlyRole(MINTER) {\\n super.burnFrom(addr, amt);\\n }\\n\\n function burn(address addr, uint256 amt) public onlyRole(MINTER) {\\n super._burn(addr, amt);\\n }\\n\\n /// @notice mint This function is what other minters will call to mint new tokens\\n /// @param addr The address to mint to \\n /// @param amt The amount to mint \\n function mint(address addr, uint256 amt) public onlyRole(MINTER) {\\n _mint(addr, amt);\\n }\\n}\\n\",\"keccak256\":\"0x30a9fefb6dd3abbb5a18b97e010ef5d5ff32036705cb47eca608510ae3ce49eb\",\"license\":\"BUSL-1.1\"},\"contracts/v2/lib/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\n\\n/**\\n * @title Errors\\n * @author Sharedstake\\n * @notice Contains all the custom errors\\n */\\nlibrary Errors {\\n error ZeroAddress();\\n error InvalidAmount();\\n error PermissionDenied();\\n error InsufficientBalance();\\n error TooEarly();\\n error FailedCall();\\n}\\n\",\"keccak256\":\"0x5fd673f73b02e0db4a39a9fb8c1aeecc7e88d24cdf895cdee6a40c8e728be75a\",\"license\":\"BUSL-1.1\"}},\"version\":1}", + "bytecode": "0x6101606040523480156200001257600080fd5b506040518060600160405280602181526020016200205460219139604051806040016040528060058152602001640e6ce8aa8960db1b8152508180604051806040016040528060018152602001603160f81b815250848481600390816200007a91906200032a565b5060046200008982826200032a565b506200009b915083905060056200015b565b61012052620000ac8160066200015b565b61014052815160208084019190912060e052815190820120610100524660a0526200013a60e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c05250620001559150600090503362000194565b6200046b565b60006020835110156200017b57620001738362000239565b90506200018e565b816200018884826200032a565b5060ff90505b92915050565b60008281526009602090815260408083206001600160a01b038516845290915290205460ff16620002355760008281526009602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620001f43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600080829050601f8151111562000270578260405163305a27a960e01b8152600401620002679190620003f6565b60405180910390fd5b80516200027d8262000446565b179392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620002b057607f821691505b602082108103620002d157634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200032557600081815260208120601f850160051c81016020861015620003005750805b601f850160051c820191505b8181101562000321578281556001016200030c565b5050505b505050565b81516001600160401b0381111562000346576200034662000285565b6200035e816200035784546200029b565b84620002d7565b602080601f8311600181146200039657600084156200037d5750858301515b600019600386901b1c1916600185901b17855562000321565b600085815260208120601f198616915b82811015620003c757888601518255948401946001909101908401620003a6565b5085821015620003e65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208083528351808285015260005b81811015620004255785810183015185820160400152820162000407565b506000604082860101526040601f19601f8301168501019250505092915050565b80516020808301519190811015620002d15760001960209190910360031b1b16919050565b60805160a05160c05160e051610100516101205161014051611b8e620004c660003960006106ea015260006106bf01526000610eeb01526000610ec301526000610e1e01526000610e4801526000610e720152611b8e6000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c806379cc679011610104578063a217fddf116100a2578063d547741f11610071578063d547741f146103ee578063dd62ed3e14610401578063f2fde38b14610414578063fe6d81241461042757600080fd5b8063a217fddf146103ad578063a457c2d7146103b5578063a9059cbb146103c8578063d505accf146103db57600080fd5b806391d14854116100de57806391d148541461036c57806395d89b411461037f578063983b2d56146103875780639dc29fac1461039a57600080fd5b806379cc67901461032b5780637ecebe001461033e57806384b0196e1461035157600080fd5b80633092afd51161017c578063395093511161014b57806339509351146102c957806340c10f19146102dc57806342966c68146102ef57806370a082311461030257600080fd5b80633092afd51461028c578063313ce5671461029f5780633644e515146102ae57806336568abe146102b657600080fd5b806318160ddd116101b857806318160ddd1461022f57806323b872dd14610241578063248a9ca3146102545780632f2ff15d1461027757600080fd5b806301ffc9a7146101df57806306fdde0314610207578063095ea7b31461021c575b600080fd5b6101f26101ed366004611754565b61043c565b60405190151581526020015b60405180910390f35b61020f610473565b6040516101fe91906117ce565b6101f261022a3660046117fd565b610505565b6002545b6040519081526020016101fe565b6101f261024f366004611827565b61051d565b610233610262366004611863565b60009081526009602052604090206001015490565b61028a61028536600461187c565b610541565b005b61028a61029a3660046118a8565b61056b565b604051601281526020016101fe565b610233610592565b61028a6102c436600461187c565b6105a1565b6101f26102d73660046117fd565b610620565b61028a6102ea3660046117fd565b610642565b61028a6102fd366004611863565b610664565b6102336103103660046118a8565b6001600160a01b031660009081526020819052604090205490565b61028a6103393660046117fd565b610671565b61023361034c3660046118a8565b610693565b6103596106b1565b6040516101fe97969594939291906118c3565b6101f261037a36600461187c565b61073a565b61020f610765565b61028a6103953660046118a8565b610774565b61028a6103a83660046117fd565b6107bf565b610233600081565b6101f26103c33660046117fd565b6107e1565b6101f26103d63660046117fd565b61085c565b61028a6103e9366004611959565b61086a565b61028a6103fc36600461187c565b6109ce565b61023361040f3660046119cc565b6109f3565b61028a6104223660046118a8565b610a1e565b610233600080516020611b3983398151915281565b60006001600160e01b03198216637965db0b60e01b148061046d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060038054610482906119f6565b80601f01602080910402602001604051908101604052809291908181526020018280546104ae906119f6565b80156104fb5780601f106104d0576101008083540402835291602001916104fb565b820191906000526020600020905b8154815290600101906020018083116104de57829003601f168201915b5050505050905090565b600033610513818585610a3f565b5060019392505050565b60003361052b858285610b63565b610536858585610bdd565b506001949350505050565b60008281526009602052604090206001015461055c81610d81565b6105668383610d8b565b505050565b600061057681610d81565b61058e600080516020611b39833981519152836109ce565b5050565b600061059c610e11565b905090565b6001600160a01b03811633146106165760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61058e8282610f3c565b60003361051381858561063383836109f3565b61063d9190611a40565b610a3f565b600080516020611b3983398151915261065a81610d81565b6105668383610fa3565b61066e3382611062565b50565b600080516020611b3983398151915261068981610d81565b6105668383611194565b6001600160a01b03811660009081526007602052604081205461046d565b6000606080828080836106e57f000000000000000000000000000000000000000000000000000000000000000060056111a9565b6107107f000000000000000000000000000000000000000000000000000000000000000060066111a9565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60009182526009602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060048054610482906119f6565b600061077f81610d81565b6001600160a01b038216156107a65761058e600080516020611b3983398151915283610541565b60405163d92e233d60e01b815260040160405180910390fd5b600080516020611b398339815191526107d781610d81565b6105668383611062565b600033816107ef82866109f3565b90508381101561084f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161060d565b6105368286868403610a3f565b600033610513818585610bdd565b834211156108ba5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161060d565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886108e98c611254565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006109448261127c565b90506000610954828787876112a9565b9050896001600160a01b0316816001600160a01b0316146109b75760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161060d565b6109c28a8a8a610a3f565b50505050505050505050565b6000828152600960205260409020600101546109e981610d81565b6105668383610f3c565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6000610a2981610d81565b610a34600083610541565b61058e6000336105a1565b6001600160a01b038316610aa15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161060d565b6001600160a01b038216610b025760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161060d565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610b6f84846109f3565b90506000198114610bd75781811015610bca5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161060d565b610bd78484848403610a3f565b50505050565b6001600160a01b038316610c415760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161060d565b6001600160a01b038216610ca35760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161060d565b6001600160a01b03831660009081526020819052604090205481811015610d1b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161060d565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610bd7565b61066e81336112d1565b610d95828261073a565b61058e5760008281526009602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610dcd3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015610e6a57507f000000000000000000000000000000000000000000000000000000000000000046145b15610e9457507f000000000000000000000000000000000000000000000000000000000000000090565b61059c604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b610f46828261073a565b1561058e5760008281526009602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b038216610ff95760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161060d565b806002600082825461100b9190611a40565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166110c25760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161060d565b6001600160a01b038216600090815260208190526040902054818110156111365760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161060d565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b61119f823383610b63565b61058e8282611062565b606060ff83146111c3576111bc8361132a565b905061046d565b8180546111cf906119f6565b80601f01602080910402602001604051908101604052809291908181526020018280546111fb906119f6565b80156112485780601f1061121d57610100808354040283529160200191611248565b820191906000526020600020905b81548152906001019060200180831161122b57829003601f168201915b5050505050905061046d565b6001600160a01b03811660009081526007602052604090208054600181018255905b50919050565b600061046d611289610e11565b8360405161190160f01b8152600281019290925260228201526042902090565b60008060006112ba87878787611369565b915091506112c78161142d565b5095945050505050565b6112db828261073a565b61058e576112e881611577565b6112f3836020611589565b604051602001611304929190611a69565b60408051601f198184030181529082905262461bcd60e51b825261060d916004016117ce565b606060006113378361172c565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156113a05750600090506003611424565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156113f4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661141d57600060019250925050611424565b9150600090505b94509492505050565b600081600481111561144157611441611ade565b036114495750565b600181600481111561145d5761145d611ade565b036114aa5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161060d565b60028160048111156114be576114be611ade565b0361150b5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161060d565b600381600481111561151f5761151f611ade565b0361066e5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161060d565b606061046d6001600160a01b03831660145b60606000611598836002611af4565b6115a3906002611a40565b67ffffffffffffffff8111156115bb576115bb611a53565b6040519080825280601f01601f1916602001820160405280156115e5576020820181803683370190505b509050600360fc1b8160008151811061160057611600611b0b565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061162f5761162f611b0b565b60200101906001600160f81b031916908160001a9053506000611653846002611af4565b61165e906001611a40565b90505b60018111156116d6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061169257611692611b0b565b1a60f81b8282815181106116a8576116a8611b0b565b60200101906001600160f81b031916908160001a90535060049490941c936116cf81611b21565b9050611661565b5083156117255760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161060d565b9392505050565b600060ff8216601f81111561046d57604051632cd44ac360e21b815260040160405180910390fd5b60006020828403121561176657600080fd5b81356001600160e01b03198116811461172557600080fd5b60005b83811015611799578181015183820152602001611781565b50506000910152565b600081518084526117ba81602086016020860161177e565b601f01601f19169290920160200192915050565b60208152600061172560208301846117a2565b80356001600160a01b03811681146117f857600080fd5b919050565b6000806040838503121561181057600080fd5b611819836117e1565b946020939093013593505050565b60008060006060848603121561183c57600080fd5b611845846117e1565b9250611853602085016117e1565b9150604084013590509250925092565b60006020828403121561187557600080fd5b5035919050565b6000806040838503121561188f57600080fd5b8235915061189f602084016117e1565b90509250929050565b6000602082840312156118ba57600080fd5b611725826117e1565b60ff60f81b881681526000602060e0818401526118e360e084018a6117a2565b83810360408501526118f5818a6117a2565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b818110156119475783518352928401929184019160010161192b565b50909c9b505050505050505050505050565b600080600080600080600060e0888a03121561197457600080fd5b61197d886117e1565b965061198b602089016117e1565b95506040880135945060608801359350608088013560ff811681146119af57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156119df57600080fd5b6119e8836117e1565b915061189f602084016117e1565b600181811c90821680611a0a57607f821691505b60208210810361127657634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561046d5761046d611a2a565b634e487b7160e01b600052604160045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611aa181601785016020880161177e565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611ad281602884016020880161177e565b01602801949350505050565b634e487b7160e01b600052602160045260246000fd5b808202811582820484141761046d5761046d611a2a565b634e487b7160e01b600052603260045260246000fd5b600081611b3057611b30611a2a565b50600019019056fef0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9a26469706673582212208718c50e1c1832b8c7f743600cc89ea892359634875f2b67a250b224f2977b1364736f6c634300081400335368617265645374616b6520476f7665726e6564205374616b6564204574686572", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101da5760003560e01c806379cc679011610104578063a217fddf116100a2578063d547741f11610071578063d547741f146103ee578063dd62ed3e14610401578063f2fde38b14610414578063fe6d81241461042757600080fd5b8063a217fddf146103ad578063a457c2d7146103b5578063a9059cbb146103c8578063d505accf146103db57600080fd5b806391d14854116100de57806391d148541461036c57806395d89b411461037f578063983b2d56146103875780639dc29fac1461039a57600080fd5b806379cc67901461032b5780637ecebe001461033e57806384b0196e1461035157600080fd5b80633092afd51161017c578063395093511161014b57806339509351146102c957806340c10f19146102dc57806342966c68146102ef57806370a082311461030257600080fd5b80633092afd51461028c578063313ce5671461029f5780633644e515146102ae57806336568abe146102b657600080fd5b806318160ddd116101b857806318160ddd1461022f57806323b872dd14610241578063248a9ca3146102545780632f2ff15d1461027757600080fd5b806301ffc9a7146101df57806306fdde0314610207578063095ea7b31461021c575b600080fd5b6101f26101ed366004611754565b61043c565b60405190151581526020015b60405180910390f35b61020f610473565b6040516101fe91906117ce565b6101f261022a3660046117fd565b610505565b6002545b6040519081526020016101fe565b6101f261024f366004611827565b61051d565b610233610262366004611863565b60009081526009602052604090206001015490565b61028a61028536600461187c565b610541565b005b61028a61029a3660046118a8565b61056b565b604051601281526020016101fe565b610233610592565b61028a6102c436600461187c565b6105a1565b6101f26102d73660046117fd565b610620565b61028a6102ea3660046117fd565b610642565b61028a6102fd366004611863565b610664565b6102336103103660046118a8565b6001600160a01b031660009081526020819052604090205490565b61028a6103393660046117fd565b610671565b61023361034c3660046118a8565b610693565b6103596106b1565b6040516101fe97969594939291906118c3565b6101f261037a36600461187c565b61073a565b61020f610765565b61028a6103953660046118a8565b610774565b61028a6103a83660046117fd565b6107bf565b610233600081565b6101f26103c33660046117fd565b6107e1565b6101f26103d63660046117fd565b61085c565b61028a6103e9366004611959565b61086a565b61028a6103fc36600461187c565b6109ce565b61023361040f3660046119cc565b6109f3565b61028a6104223660046118a8565b610a1e565b610233600080516020611b3983398151915281565b60006001600160e01b03198216637965db0b60e01b148061046d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060038054610482906119f6565b80601f01602080910402602001604051908101604052809291908181526020018280546104ae906119f6565b80156104fb5780601f106104d0576101008083540402835291602001916104fb565b820191906000526020600020905b8154815290600101906020018083116104de57829003601f168201915b5050505050905090565b600033610513818585610a3f565b5060019392505050565b60003361052b858285610b63565b610536858585610bdd565b506001949350505050565b60008281526009602052604090206001015461055c81610d81565b6105668383610d8b565b505050565b600061057681610d81565b61058e600080516020611b39833981519152836109ce565b5050565b600061059c610e11565b905090565b6001600160a01b03811633146106165760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61058e8282610f3c565b60003361051381858561063383836109f3565b61063d9190611a40565b610a3f565b600080516020611b3983398151915261065a81610d81565b6105668383610fa3565b61066e3382611062565b50565b600080516020611b3983398151915261068981610d81565b6105668383611194565b6001600160a01b03811660009081526007602052604081205461046d565b6000606080828080836106e57f000000000000000000000000000000000000000000000000000000000000000060056111a9565b6107107f000000000000000000000000000000000000000000000000000000000000000060066111a9565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60009182526009602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060048054610482906119f6565b600061077f81610d81565b6001600160a01b038216156107a65761058e600080516020611b3983398151915283610541565b60405163d92e233d60e01b815260040160405180910390fd5b600080516020611b398339815191526107d781610d81565b6105668383611062565b600033816107ef82866109f3565b90508381101561084f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161060d565b6105368286868403610a3f565b600033610513818585610bdd565b834211156108ba5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161060d565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886108e98c611254565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006109448261127c565b90506000610954828787876112a9565b9050896001600160a01b0316816001600160a01b0316146109b75760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161060d565b6109c28a8a8a610a3f565b50505050505050505050565b6000828152600960205260409020600101546109e981610d81565b6105668383610f3c565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6000610a2981610d81565b610a34600083610541565b61058e6000336105a1565b6001600160a01b038316610aa15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161060d565b6001600160a01b038216610b025760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161060d565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610b6f84846109f3565b90506000198114610bd75781811015610bca5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161060d565b610bd78484848403610a3f565b50505050565b6001600160a01b038316610c415760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161060d565b6001600160a01b038216610ca35760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161060d565b6001600160a01b03831660009081526020819052604090205481811015610d1b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161060d565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610bd7565b61066e81336112d1565b610d95828261073a565b61058e5760008281526009602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610dcd3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015610e6a57507f000000000000000000000000000000000000000000000000000000000000000046145b15610e9457507f000000000000000000000000000000000000000000000000000000000000000090565b61059c604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b610f46828261073a565b1561058e5760008281526009602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b038216610ff95760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161060d565b806002600082825461100b9190611a40565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166110c25760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161060d565b6001600160a01b038216600090815260208190526040902054818110156111365760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161060d565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b61119f823383610b63565b61058e8282611062565b606060ff83146111c3576111bc8361132a565b905061046d565b8180546111cf906119f6565b80601f01602080910402602001604051908101604052809291908181526020018280546111fb906119f6565b80156112485780601f1061121d57610100808354040283529160200191611248565b820191906000526020600020905b81548152906001019060200180831161122b57829003601f168201915b5050505050905061046d565b6001600160a01b03811660009081526007602052604090208054600181018255905b50919050565b600061046d611289610e11565b8360405161190160f01b8152600281019290925260228201526042902090565b60008060006112ba87878787611369565b915091506112c78161142d565b5095945050505050565b6112db828261073a565b61058e576112e881611577565b6112f3836020611589565b604051602001611304929190611a69565b60408051601f198184030181529082905262461bcd60e51b825261060d916004016117ce565b606060006113378361172c565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156113a05750600090506003611424565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156113f4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661141d57600060019250925050611424565b9150600090505b94509492505050565b600081600481111561144157611441611ade565b036114495750565b600181600481111561145d5761145d611ade565b036114aa5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161060d565b60028160048111156114be576114be611ade565b0361150b5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161060d565b600381600481111561151f5761151f611ade565b0361066e5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161060d565b606061046d6001600160a01b03831660145b60606000611598836002611af4565b6115a3906002611a40565b67ffffffffffffffff8111156115bb576115bb611a53565b6040519080825280601f01601f1916602001820160405280156115e5576020820181803683370190505b509050600360fc1b8160008151811061160057611600611b0b565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061162f5761162f611b0b565b60200101906001600160f81b031916908160001a9053506000611653846002611af4565b61165e906001611a40565b90505b60018111156116d6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061169257611692611b0b565b1a60f81b8282815181106116a8576116a8611b0b565b60200101906001600160f81b031916908160001a90535060049490941c936116cf81611b21565b9050611661565b5083156117255760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161060d565b9392505050565b600060ff8216601f81111561046d57604051632cd44ac360e21b815260040160405180910390fd5b60006020828403121561176657600080fd5b81356001600160e01b03198116811461172557600080fd5b60005b83811015611799578181015183820152602001611781565b50506000910152565b600081518084526117ba81602086016020860161177e565b601f01601f19169290920160200192915050565b60208152600061172560208301846117a2565b80356001600160a01b03811681146117f857600080fd5b919050565b6000806040838503121561181057600080fd5b611819836117e1565b946020939093013593505050565b60008060006060848603121561183c57600080fd5b611845846117e1565b9250611853602085016117e1565b9150604084013590509250925092565b60006020828403121561187557600080fd5b5035919050565b6000806040838503121561188f57600080fd5b8235915061189f602084016117e1565b90509250929050565b6000602082840312156118ba57600080fd5b611725826117e1565b60ff60f81b881681526000602060e0818401526118e360e084018a6117a2565b83810360408501526118f5818a6117a2565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b818110156119475783518352928401929184019160010161192b565b50909c9b505050505050505050505050565b600080600080600080600060e0888a03121561197457600080fd5b61197d886117e1565b965061198b602089016117e1565b95506040880135945060608801359350608088013560ff811681146119af57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156119df57600080fd5b6119e8836117e1565b915061189f602084016117e1565b600181811c90821680611a0a57607f821691505b60208210810361127657634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561046d5761046d611a2a565b634e487b7160e01b600052604160045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611aa181601785016020880161177e565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611ad281602884016020880161177e565b01602801949350505050565b634e487b7160e01b600052602160045260246000fd5b808202811582820484141761046d5761046d611a2a565b634e487b7160e01b600052603260045260246000fd5b600081611b3057611b30611a2a565b50600019019056fef0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9a26469706673582212208718c50e1c1832b8c7f743600cc89ea892359634875f2b67a250b224f2977b1364736f6c63430008140033", + "devdoc": { + "author": "@ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com", + "events": { + "Approval(address,address,uint256)": { + "details": "Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance." + }, + "EIP712DomainChanged()": { + "details": "MAY be emitted to signal that the domain could have changed." + }, + "RoleAdminChanged(bytes32,bytes32,bytes32)": { + "details": "Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._" + }, + "RoleGranted(bytes32,address,address)": { + "details": "Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}." + }, + "RoleRevoked(bytes32,address,address)": { + "details": "Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)" + }, + "Transfer(address,address,uint256)": { + "details": "Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero." + } + }, + "kind": "dev", + "methods": { + "DOMAIN_SEPARATOR()": { + "details": "Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}." + }, + "allowance(address,address)": { + "details": "See {IERC20-allowance}." + }, + "approve(address,uint256)": { + "details": "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." + }, + "balanceOf(address)": { + "details": "See {IERC20-balanceOf}." + }, + "burn(uint256)": { + "details": "Destroys `amount` tokens from the caller. See {ERC20-_burn}." + }, + "burnFrom(address,uint256)": { + "params": { + "addr": "The address to burn from", + "amt": "The amount to burn" + } + }, + "decimals()": { + "details": "Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}." + }, + "decreaseAllowance(address,uint256)": { + "details": "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`." + }, + "eip712Domain()": { + "details": "See {EIP-5267}. _Available since v4.9._" + }, + "getRoleAdmin(bytes32)": { + "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." + }, + "grantRole(bytes32,address)": { + "details": "Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event." + }, + "hasRole(bytes32,address)": { + "details": "Returns `true` if `account` has been granted `role`." + }, + "increaseAllowance(address,uint256)": { + "details": "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." + }, + "mint(address,uint256)": { + "params": { + "addr": "The address to mint to ", + "amt": "The amount to mint " + } + }, + "name()": { + "details": "Returns the name of the token." + }, + "nonces(address)": { + "details": "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." + }, + "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)": { + "details": "Sets `value` as the allowance of `spender` over ``owner``'s tokens, given ``owner``'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also apply here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address. - `deadline` must be a timestamp in the future. - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments. - the signature must use ``owner``'s current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above." + }, + "renounceRole(bytes32,address)": { + "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event." + }, + "revokeRole(bytes32,address)": { + "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event." + }, + "supportsInterface(bytes4)": { + "details": "See {IERC165-supportsInterface}." + }, + "symbol()": { + "details": "Returns the symbol of the token, usually a shorter version of the name." + }, + "totalSupply()": { + "details": "See {IERC20-totalSupply}." + }, + "transfer(address,uint256)": { + "details": "See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`." + }, + "transferFrom(address,address,uint256)": { + "details": "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`." + } + }, + "title": "SgETH - SharedStake Governed Staked Ether", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "burnFrom(address,uint256)": { + "notice": "burnFrom Used by minters when user redeems" + }, + "mint(address,uint256)": { + "notice": "mint This function is what other minters will call to mint new tokens" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 4844, + "contract": "contracts/v2/core/SgETH.sol:SgETH", + "label": "_balances", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 4850, + "contract": "contracts/v2/core/SgETH.sol:SgETH", + "label": "_allowances", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 4852, + "contract": "contracts/v2/core/SgETH.sol:SgETH", + "label": "_totalSupply", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 4854, + "contract": "contracts/v2/core/SgETH.sol:SgETH", + "label": "_name", + "offset": 0, + "slot": "3", + "type": "t_string_storage" + }, + { + "astId": 4856, + "contract": "contracts/v2/core/SgETH.sol:SgETH", + "label": "_symbol", + "offset": 0, + "slot": "4", + "type": "t_string_storage" + }, + { + "astId": 9744, + "contract": "contracts/v2/core/SgETH.sol:SgETH", + "label": "_nameFallback", + "offset": 0, + "slot": "5", + "type": "t_string_storage" + }, + { + "astId": 9746, + "contract": "contracts/v2/core/SgETH.sol:SgETH", + "label": "_versionFallback", + "offset": 0, + "slot": "6", + "type": "t_string_storage" + }, + { + "astId": 5560, + "contract": "contracts/v2/core/SgETH.sol:SgETH", + "label": "_nonces", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_address,t_struct(Counter)8722_storage)" + }, + { + "astId": 5568, + "contract": "contracts/v2/core/SgETH.sol:SgETH", + "label": "_PERMIT_TYPEHASH_DEPRECATED_SLOT", + "offset": 0, + "slot": "8", + "type": "t_bytes32" + }, + { + "astId": 3628, + "contract": "contracts/v2/core/SgETH.sol:SgETH", + "label": "_roles", + "offset": 0, + "slot": "9", + "type": "t_mapping(t_bytes32,t_struct(RoleData)3623_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_struct(Counter)8722_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct Counters.Counter)", + "numberOfBytes": "32", + "value": "t_struct(Counter)8722_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_bytes32,t_struct(RoleData)3623_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct AccessControl.RoleData)", + "numberOfBytes": "32", + "value": "t_struct(RoleData)3623_storage" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Counter)8722_storage": { + "encoding": "inplace", + "label": "struct Counters.Counter", + "members": [ + { + "astId": 8721, + "contract": "contracts/v2/core/SgETH.sol:SgETH", + "label": "_value", + "offset": 0, + "slot": "0", + "type": "t_uint256" + } + ], + "numberOfBytes": "32" + }, + "t_struct(RoleData)3623_storage": { + "encoding": "inplace", + "label": "struct AccessControl.RoleData", + "members": [ + { + "astId": 3620, + "contract": "contracts/v2/core/SgETH.sol:SgETH", + "label": "members", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 3622, + "contract": "contracts/v2/core/SgETH.sol:SgETH", + "label": "adminRole", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/localhost/SharedDepositMinterV2.json b/deployments/localhost/SharedDepositMinterV2.json new file mode 100644 index 0000000..7b0d9e2 --- /dev/null +++ b/deployments/localhost/SharedDepositMinterV2.json @@ -0,0 +1,1000 @@ +{ + "address": "0x06d889F4678058D95058Ef431035b2f5d4A27B1a", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_numValidators", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_adminFee", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AmountTooHigh", + "type": "error" + }, + { + "inputs": [], + "name": "NoValidators", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "_withdrawalCredential", + "type": "bytes" + } + ], + "name": "WithdrawalCredentialSet", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEPOSIT_CONTRACT", + "outputs": [ + { + "internalType": "contract IDepositContract", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "adminFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "adminFeeTotal", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "pubkeys", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "signatures", + "type": "bytes[]" + }, + { + "internalType": "bytes32[]", + "name": "depositDataRoots", + "type": "bytes32[]" + } + ], + "name": "batchDepositToEth2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "buffer", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "costPerValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "curValidatorShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "depositAndStake", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dest", + "type": "address" + } + ], + "name": "depositAndStakeFor", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dest", + "type": "address" + } + ], + "name": "depositFor", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "donate", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxValidatorShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "migrateShares", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "numValidators", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "refundFeesOnWithdraw", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "remainingSpaceInEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeCalculatorAddr", + "type": "address" + } + ], + "name": "setFeeCalc", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_numValidators", + "type": "uint256" + } + ], + "name": "setNumValidators", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_newWithdrawalCreds", + "type": "bytes" + } + ], + "name": "setWithdrawalCredential", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amt", + "type": "uint256" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "togglePause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "toggleWithdrawRefund", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "dest", + "type": "address" + } + ], + "name": "unstakeAndWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "validatorsCreated", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawAdminFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "dest", + "type": "address" + } + ], + "name": "withdrawTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawalPubKey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xeeba4ee2d5070aa36eedc89f733c87205f3f474af8b0bf73f436248bceb216fa", + "receipt": { + "to": null, + "from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "contractAddress": "0x06d889F4678058D95058Ef431035b2f5d4A27B1a", + "transactionIndex": 0, + "gasUsed": "1986504", + "logsBloom": "0x00080004000000000000000000000000000000400000000000000000000000000000000000008000000000000000000010000000000000000000000000200000000000000000000000000000000000000000000000000100000040000000000000000000000000000000000104000000100000000800000000000000000000000000000000000000000000000000000000800000000000000000000001000000020010000000000000000000000000480000000000000006001000000000000000000000000000200000000000000000000000002000010100000000400000000010000000020000000000000000020000000000000000000004000000000000", + "blockHash": "0xc33a934e35b05dd424e60d56b82b94b75281a3d2eff9bb38ae5a08a5fc0274a9", + "transactionHash": "0xeeba4ee2d5070aa36eedc89f733c87205f3f474af8b0bf73f436248bceb216fa", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 6233287, + "transactionHash": "0xeeba4ee2d5070aa36eedc89f733c87205f3f474af8b0bf73f436248bceb216fa", + "address": "0x31e7d36377c664BeAAb967fB46E38c59069996eC", + "topics": [ + "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "0x00000000000000000000000006d889f4678058d95058ef431035b2f5d4a27b1a", + "0x00000000000000000000000061a89bf0ed0c2d1c365db15660880c3d227a05d3" + ], + "data": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "logIndex": 0, + "blockHash": "0xc33a934e35b05dd424e60d56b82b94b75281a3d2eff9bb38ae5a08a5fc0274a9" + }, + { + "transactionIndex": 0, + "blockNumber": 6233287, + "transactionHash": "0xeeba4ee2d5070aa36eedc89f733c87205f3f474af8b0bf73f436248bceb216fa", + "address": "0x06d889F4678058D95058Ef431035b2f5d4A27B1a", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea", + "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266", + "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0xc33a934e35b05dd424e60d56b82b94b75281a3d2eff9bb38ae5a08a5fc0274a9" + }, + { + "transactionIndex": 0, + "blockNumber": 6233287, + "transactionHash": "0xeeba4ee2d5070aa36eedc89f733c87205f3f474af8b0bf73f436248bceb216fa", + "address": "0x06d889F4678058D95058Ef431035b2f5d4A27B1a", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf", + "0x000000000000000000000000610c92c70eb55dfeafe8970513d13771da79f2e0", + "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" + ], + "data": "0x", + "logIndex": 2, + "blockHash": "0xc33a934e35b05dd424e60d56b82b94b75281a3d2eff9bb38ae5a08a5fc0274a9" + } + ], + "blockNumber": 6233287, + "cumulativeGasUsed": "1986504", + "status": 1, + "byzantium": true + }, + "args": [ + 1000, + 0, + [ + "0x16888a69bDfb3Adcf8CB1F3d24Ac1Ee320e4A7e8", + "0x31e7d36377c664BeAAb967fB46E38c59069996eC", + "0x61A89BF0Ed0c2d1c365Db15660880C3d227A05D3", + "0x610c92c70eb55dfeafe8970513d13771da79f2e0", + "0xD9b3fB168D5B100d9d7c7b753092F3b86e723138" + ] + ], + "numDeployments": 1, + "solcInputHash": "d5c4e8b77fe999241905bb33844ed6ed", + "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numValidators\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_adminFee\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"addresses\",\"type\":\"address[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AmountTooHigh\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoValidators\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_withdrawalCredential\",\"type\":\"bytes\"}],\"name\":\"WithdrawalCredentialSet\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEPOSIT_CONTRACT\",\"outputs\":[{\"internalType\":\"contract IDepositContract\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GOV\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminFeeTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"pubkeys\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"signatures\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"depositDataRoots\",\"type\":\"bytes32[]\"}],\"name\":\"batchDepositToEth2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"buffer\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"costPerValidator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"curValidatorShares\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositAndStake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"dest\",\"type\":\"address\"}],\"name\":\"depositAndStakeFor\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"dest\",\"type\":\"address\"}],\"name\":\"depositFor\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"donate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxValidatorShares\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"migrateShares\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numValidators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"refundFeesOnWithdraw\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"remainingSpaceInEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_feeCalculatorAddr\",\"type\":\"address\"}],\"name\":\"setFeeCalc\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numValidators\",\"type\":\"uint256\"}],\"name\":\"setNumValidators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_newWithdrawalCreds\",\"type\":\"bytes\"}],\"name\":\"setWithdrawalCredential\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amt\",\"type\":\"uint256\"}],\"name\":\"slash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"togglePause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"toggleWithdrawRefund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"dest\",\"type\":\"address\"}],\"name\":\"unstakeAndWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorsCreated\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawAdminFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"dest\",\"type\":\"address\"}],\"name\":\"withdrawTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawalPubKey\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\",\"details\":\"Deployment params: - addresses : [feeCalc, sgeth, wsgeth, gov]\",\"events\":{\"Paused(address)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"},\"Unpaused(address)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"title\":\"SharedDepositMinterV2\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Mints LSD tokens for ETH deposited to the contract. Handles the depositing of ETH to the ETH2 deposit contract and validator creation\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/v2/core/SharedDepositMinterV2.sol\":\"SharedDepositMinterV2\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(account),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0dd6e52cb394d7f5abe5dca2d4908a6be40417914720932de757de34a99ab87f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\nimport \\\"../token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n *\\n * _Available since v4.7._\\n */\\ninterface IERC4626 is IERC20, IERC20Metadata {\\n event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed sender,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n *\\n * - MUST be an ERC-20 token contract.\\n * - MUST NOT revert.\\n */\\n function asset() external view returns (address assetTokenAddress);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n *\\n * - SHOULD include any compounding that occurs from yield.\\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT revert.\\n */\\n function totalAssets() external view returns (uint256 totalManagedAssets);\\n\\n /**\\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToShares(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n * through a deposit call.\\n *\\n * - MUST return a limited value if receiver is subject to some deposit limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n * - MUST NOT revert.\\n */\\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\\n * in the same transaction.\\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * deposit execution, and are accounted for during deposit.\\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\\n * - MUST return a limited value if receiver is subject to some mint limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n * - MUST NOT revert.\\n */\\n function maxMint(address receiver) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\\n * same transaction.\\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\\n * would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\\n */\\n function previewMint(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\\n * execution, and are accounted for during mint.\\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0x5a173dcd1c1f0074e4df6a9cdab3257e17f2e64f7b8f30ca9e17a8c5ea250e1c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract Pausable is Context {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n constructor() {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n _requireNotPaused();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n _requirePaused();\\n _;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Throws if the contract is paused.\\n */\\n function _requireNotPaused() internal view virtual {\\n require(!paused(), \\\"Pausable: paused\\\");\\n }\\n\\n /**\\n * @dev Throws if the contract is not paused.\\n */\\n function _requirePaused() internal view virtual {\\n require(paused(), \\\"Pausable: not paused\\\");\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n}\\n\",\"keccak256\":\"0x0849d93b16c9940beb286a7864ed02724b248b93e0d80ef6355af5ef15c64773\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == _ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/v2/core/SharedDepositMinterV2.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.20;\\n\\n/// @title SharedDepositMinterV2 - minter for ETH LSD\\n/// @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\\n// v1 sharedstake veth2 minter with some code removed\\n// user deposits eth to get minted token\\n// The contract cannot move user ETH outside unless\\n// 1. the user redeems 1:1\\n// 2. the depositToEth2 or depositToEth2Batch fns are called which allow moving ETH to the mainnet deposit contract only\\n// 3. The contract allows permissioned external actors to supply validator public keys\\n// 4. Who's allowed to deposit how many validators is governed outside this contract\\n// 5. The ability to provision validators for user ETH is portioned out by the DAO\\n\\n// Changes\\n/**\\n- Custom errors instead of revert strings\\n- Granular management via AccessControl with GOV and NOR roles. Node operator can only deploy validators\\n- Refactored to allow users to specify destination address for fns - for zaps\\n- Added deposit+stake/unstake+withdraw combo convenience routes\\n- Refactored fee calc out to external contract\\n*/\\nimport {IFeeCalc} from \\\"../interfaces/IFeeCalc.sol\\\";\\nimport {IERC20MintableBurnable} from \\\"../interfaces/IERC20MintableBurnable.sol\\\";\\nimport {IERC4626} from \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\n\\nimport {AccessControl} from \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {Pausable} from \\\"@openzeppelin/contracts/security/Pausable.sol\\\";\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport {ETH2DepositWithdrawalCredentials} from \\\"../lib/ETH2DepositWithdrawalCredentials.sol\\\";\\n\\n/// @title SharedDepositMinterV2\\n/// @author ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\\n/// @notice Mints LSD tokens for ETH deposited to the contract. Handles the depositing of ETH to the ETH2 deposit contract and validator creation\\n/// @dev Deployment params: \\n/// - addresses : [feeCalc, sgeth, wsgeth, gov]\\ncontract SharedDepositMinterV2 is AccessControl, Pausable, ReentrancyGuard, ETH2DepositWithdrawalCredentials {\\n /* ========== STATE VARIABLES ========== */\\n uint256 public adminFee;\\n uint256 public numValidators;\\n uint256 public costPerValidator;\\n\\n // The validator shares created by this shared stake contract. 1 share costs >= 1 eth\\n uint256 public curValidatorShares; //initialized to 0\\n\\n // The number of times the deposit to eth2 contract has been called to create validators\\n uint256 public validatorsCreated; //initialized to 0\\n\\n // Total accrued admin fee\\n uint256 public adminFeeTotal; //initialized to 0\\n\\n // Its hard to exactly hit the max deposit amount with small shares. this allows a small bit of overflow room\\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token via a user withdraw\\n uint256 public buffer;\\n\\n // Flash loan tokenomic protection in case of changes in admin fee with future lots\\n bool public refundFeesOnWithdraw; //initialized to false\\n\\n // NEW\\n IERC20MintableBurnable private immutable _SGETH;\\n IERC4626 private immutable _WSGETH;\\n IFeeCalc private _feeCalc;\\n\\n bytes32 public constant NOR = keccak256(\\\"NOR\\\"); // Node operator for deploying validators\\n bytes32 public constant GOV = keccak256(\\\"GOV\\\"); // Governance for settings - normally timelock controlled by multisig\\n\\n //errors\\n error AmountTooHigh();\\n error NoValidators();\\n\\n constructor(\\n uint256 _numValidators,\\n uint256 _adminFee,\\n address[] memory addresses\\n ) AccessControl() Pausable() ReentrancyGuard() ETH2DepositWithdrawalCredentials(addresses[4]) {\\n _feeCalc = IFeeCalc(addresses[0]);\\n _SGETH = IERC20MintableBurnable(addresses[1]);\\n _WSGETH = IERC4626(addresses[2]);\\n\\n _SGETH.approve(address(_WSGETH), 2 ** 256 - 1); // max approve wsgeth for deposit and stake\\n\\n adminFee = _adminFee; // Admin and infra fees\\n numValidators = _numValidators; // The number of validators to create in this lot. Sets a max limit on deposits\\n\\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token\\n buffer = 10 * 1e18; // roughly equal to 10 eth.\\n\\n costPerValidator = (32 * 1e18) + adminFee;\\n\\n _grantRole(NOR, msg.sender);\\n _grantRole(GOV, addresses[3]); // deployer will need it to set withdrawal creds. since the non-custodial withdrawal path depends on the minter.\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n DEPOSIT/WITHDRAWAL LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n // USER INTERACTIONS\\n /*\\n Shares minted = Z\\n Principal deposit input = P\\n AdminFee = a\\n costPerValidator = 32 + a\\n AdminFee as percent in 1e18 = a% = (a / costPerValidator) * 1e18\\n AdminFee on tx in 1e18 = (P * a% / 1e18)\\n\\n on deposit:\\n P - (P * a%) = Z\\n\\n on withdraw with admin fee refund:\\n P = Z / (1 - a%)\\n P = Z - Z*a%\\n */\\n\\n function deposit() external payable {\\n _deposit(msg.sender);\\n }\\n\\n function depositFor(address dest) external payable {\\n _deposit(dest);\\n }\\n\\n function depositAndStake() external payable {\\n _WSGETH.deposit(_deposit(address(this)), msg.sender);\\n }\\n\\n function depositAndStakeFor(address dest) external payable {\\n _WSGETH.deposit(_deposit(address(this)), dest);\\n }\\n\\n function withdraw(uint256 amount) external {\\n _withdraw(amount, msg.sender, msg.sender);\\n }\\n\\n function withdrawTo(uint256 amount, address dest) external {\\n _withdraw(amount, msg.sender, dest);\\n }\\n\\n function unstakeAndWithdraw(uint256 amount, address dest) external {\\n _withdraw(_WSGETH.redeem(amount, address(this), msg.sender), address(this), dest);\\n }\\n\\n // migration function to accept old monies and copy over state\\n // users should not use this as it just donates the money without minting veth or tracking donations\\n function donate() external payable {} // solhint-disable-line\\n\\n /*//////////////////////////////////////////////////////////////\\n ADMIN LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n // Batch deposit eth to the eth2 contract with preset creds\\n // Data needs to be verified offchain to save gas\\n function batchDepositToEth2(\\n bytes[] calldata pubkeys,\\n bytes[] calldata signatures,\\n bytes32[] calldata depositDataRoots\\n ) external onlyRole(NOR) {\\n if (address(this).balance < (_depositAmount * pubkeys.length)) {\\n revert AmountTooHigh(); // Not enough bal in contract to deploy all validators\\n }\\n _batchDeposit(pubkeys, signatures, depositDataRoots);\\n validatorsCreated = validatorsCreated + pubkeys.length;\\n }\\n\\n function setWithdrawalCredential(bytes memory _newWithdrawalCreds) external onlyRole(NOR) {\\n // can only be called once\\n _setWithdrawalCredential(_newWithdrawalCreds);\\n }\\n\\n // Slashes the onchain staked sgETH to mirror CL validator slashings\\n // modifies wsgeth virtual price\\n function slash(uint256 amt) external onlyRole(GOV) {\\n if (amt > curValidatorShares) {\\n revert AmountTooHigh(); // Cannot slash more than minted\\n }\\n _SGETH.burn(address(_WSGETH), amt);\\n }\\n\\n // Set fee calc address. if addr = 0 then fees are assumed to be 0\\n function setFeeCalc(address _feeCalculatorAddr) external onlyRole(GOV) {\\n _feeCalc = IFeeCalc(_feeCalculatorAddr);\\n }\\n\\n function togglePause() external onlyRole(GOV) {\\n bool paused = paused();\\n if (paused) {\\n _unpause();\\n } else {\\n _pause();\\n }\\n }\\n\\n // Used to migrate state over to new contract\\n function migrateShares(uint256 shares) external onlyRole(GOV) {\\n curValidatorShares = shares;\\n }\\n\\n function toggleWithdrawRefund() external onlyRole(GOV) {\\n refundFeesOnWithdraw = !refundFeesOnWithdraw;\\n }\\n\\n function setNumValidators(uint256 _numValidators) external onlyRole(GOV) {\\n if (_numValidators > 0) {\\n numValidators = _numValidators;\\n } else {\\n revert NoValidators();\\n }\\n }\\n\\n function withdrawAdminFee(uint256 amount) external onlyRole(GOV) {\\n address payable sender = payable(msg.sender);\\n if (amount == 0) {\\n amount = adminFeeTotal;\\n }\\n if (amount > adminFeeTotal) {\\n revert AmountTooHigh();\\n }\\n adminFeeTotal = adminFeeTotal - amount;\\n Address.sendValue(sender, amount);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ACCOUNTING LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function remainingSpaceInEpoch() external view returns (uint256) {\\n // Helpful view function to gauge how much the user can send to the contract when it is near full\\n uint256 remainingShares = maxValidatorShares() - curValidatorShares;\\n uint256 valBeforeAdmin = (remainingShares * 1e18) / (((1 * 1e18) - (adminFee * 1e18) / costPerValidator));\\n return valBeforeAdmin;\\n }\\n\\n function maxValidatorShares() public view returns (uint256) {\\n return 32 * 1e18 * numValidators;\\n }\\n\\n function _depositAccounting() internal returns (uint256 value) {\\n // input is whole, not / 1e18 , i.e. in 1 = 1 eth send when from etherscan\\n value = msg.value;\\n uint256 fee;\\n\\n if (address(_feeCalc) != address(0)) {\\n (value, fee) = _feeCalc.processDeposit(value, msg.sender);\\n adminFeeTotal = adminFeeTotal + fee;\\n }\\n\\n uint256 newShareTotal = curValidatorShares + value;\\n\\n if (newShareTotal > buffer + maxValidatorShares()) {\\n revert AmountTooHigh();\\n }\\n curValidatorShares = newShareTotal;\\n }\\n\\n function _withdrawAccounting(uint256 amount) internal returns (uint256) {\\n uint256 fee;\\n if (address(_feeCalc) != address(0)) {\\n (amount, fee) = _feeCalc.processWithdraw(amount, msg.sender);\\n if (refundFeesOnWithdraw) {\\n adminFeeTotal = adminFeeTotal - fee;\\n } else {\\n adminFeeTotal = adminFeeTotal + fee;\\n }\\n }\\n if (address(this).balance < (amount + adminFeeTotal)) {\\n revert AmountTooHigh();\\n }\\n\\n curValidatorShares = curValidatorShares - amount;\\n return amount;\\n }\\n\\n function _deposit(address dest) internal nonReentrant whenNotPaused returns (uint256 amt) {\\n amt = _depositAccounting();\\n _SGETH.mint(dest, amt);\\n }\\n\\n function _withdraw(uint256 amount, address origin, address dest) internal nonReentrant whenNotPaused {\\n _SGETH.burn(origin, amount); // reverts if amount is too high\\n uint256 assets = _withdrawAccounting(amount);\\n\\n address payable recv = payable(dest);\\n Address.sendValue(recv, assets);\\n }\\n\\n receive() external payable {} // solhint-disable-line\\n\\n fallback() external payable {} // solhint-disable-line\\n}\\n\",\"keccak256\":\"0x1ad67e5f7bb03182702d6d249923c1e2c89d84e8071b537814e1f6c79ee7279d\",\"license\":\"BUSL-1.1\"},\"contracts/v2/interfaces/IDepositContract.sol\":{\"content\":\"pragma solidity ^0.8.0;\\n\\n// \\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u250f\\u2513\\u2501\\u250f\\u2513\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\n// \\u2503\\u250f\\u2501\\u2501\\u251b\\u250f\\u251b\\u2517\\u2513\\u2503\\u2503\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2517\\u2513\\u250f\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\n// \\u2503\\u2517\\u2501\\u2501\\u2513\\u2517\\u2513\\u250f\\u251b\\u2503\\u2517\\u2501\\u2513\\u2517\\u251b\\u250f\\u251b\\u2503\\u2501\\u2501\\u2503\\u2503\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2503\\u2503\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2513\\u2517\\u2513\\u250f\\u251b\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u2517\\u251b\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2513\\u2501\\u2517\\u2513\\u250f\\u251b\\u250f\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u2501\\u250f\\u2501\\u2501\\u2513\\u2517\\u2513\\u250f\\u251b\\n// \\u2503\\u250f\\u2501\\u2501\\u251b\\u2501\\u2503\\u2503\\u2501\\u2503\\u250f\\u2513\\u2503\\u250f\\u2501\\u251b\\u250f\\u251b\\u2501\\u2501\\u2503\\u2503\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2503\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u2501\\u2501\\u252b\\u2523\\u252b\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u250f\\u2513\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2513\\u2501\\u2503\\u2503\\u2501\\u2503\\u250f\\u251b\\u2517\\u2501\\u2513\\u2503\\u2501\\u2503\\u250f\\u2501\\u251b\\u2501\\u2503\\u2503\\u2501\\n// \\u2503\\u2517\\u2501\\u2501\\u2513\\u2501\\u2503\\u2517\\u2513\\u2503\\u2503\\u2503\\u2503\\u2503\\u2503\\u2517\\u2501\\u2513\\u250f\\u2513\\u2503\\u2517\\u2501\\u251b\\u2503\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u251b\\u2503\\u2503\\u2503\\u2501\\u252b\\u2503\\u2517\\u251b\\u2503\\u2503\\u2517\\u251b\\u2503\\u2523\\u2501\\u2501\\u2503\\u2503\\u2503\\u2501\\u2503\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2503\\u2517\\u2501\\u251b\\u2503\\u2503\\u2517\\u251b\\u2503\\u2503\\u2503\\u2503\\u2503\\u2501\\u2503\\u2517\\u2513\\u2503\\u2503\\u2501\\u2503\\u2517\\u251b\\u2517\\u2513\\u2503\\u2517\\u2501\\u2513\\u2501\\u2503\\u2517\\u2513\\n// \\u2517\\u2501\\u2501\\u2501\\u251b\\u2501\\u2517\\u2501\\u251b\\u2517\\u251b\\u2517\\u251b\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u251b\\u2517\\u2501\\u2501\\u2501\\u251b\\u2501\\u2501\\u2501\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2503\\u250f\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u251b\\u2501\\u2501\\u2501\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2501\\u2517\\u2501\\u251b\\n// \\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\n// \\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2517\\u251b\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\n\\n// SPDX-License-Identifier: CC0-1.0\\n\\n// This interface is designed to be compatible with the Vyper version.\\n/// @notice This is the Ethereum 2.0 deposit contract interface.\\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\\ninterface IDepositContract {\\n /// @notice A processed deposit event.\\n event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);\\n\\n /// @notice Submit a Phase 0 DepositData object.\\n /// @param pubkey A BLS12-381 public key.\\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\\n /// @param signature A BLS12-381 signature.\\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\\n /// Used as a protection against malformed input.\\n function deposit(\\n bytes calldata pubkey,\\n bytes calldata withdrawal_credentials,\\n bytes calldata signature,\\n bytes32 deposit_data_root\\n ) external payable;\\n\\n /// @notice Query the current deposit root hash.\\n /// @return The deposit root hash.\\n function get_deposit_root() external view returns (bytes32);\\n\\n /// @notice Query the current deposit count.\\n /// @return The deposit count encoded as a little endian 64-bit number.\\n function get_deposit_count() external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xe2089e69dbf1fb4940e4dffcdb10524418a40b6e9529b72cb83f2e921fb08e3f\",\"license\":\"CC0-1.0\"},\"contracts/v2/interfaces/IERC20MintableBurnable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\ninterface IERC20MintableBurnable {\\n function mintingAllowedAfter() external view returns (uint256);\\n\\n /**\\n * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`\\n * @param account The address of the account holding the funds\\n * @param spender The address of the account spending the funds\\n * @return The number of tokens approved\\n */\\n function allowance(address account, address spender) external view returns (uint256);\\n\\n /**\\n * @notice Get the number of tokens held by the `account`\\n * @param account The address of the account to get the balance of\\n * @return The number of tokens held\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @notice Approve `spender` to transfer up to `amount` from `src`\\n * @dev This will overwrite the approval amount for `spender`\\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\\n * @param spender The address of the account which may transfer tokens\\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\\n * @return Whether or not the approval succeeded\\n */\\n function approve(address spender, uint256 rawAmount) external returns (bool);\\n\\n /**\\n * @notice Triggers an approval from owner to spends\\n * @param owner The address to approve from\\n * @param spender The address to be approved\\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\\n * @param deadline The time at which to expire the signature\\n * @param v The recovery byte of the signature\\n * @param r Half of the ECDSA signature pair\\n * @param s Half of the ECDSA signature pair\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 rawAmount,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\\n * @param dst The address of the destination account\\n * @param rawAmount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n function transfer(address dst, uint256 rawAmount) external returns (bool);\\n\\n /**\\n * @notice Transfer `amount` tokens from `src` to `dst`\\n * @param src The address of the source account\\n * @param dst The address of the destination account\\n * @param rawAmount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n function transferFrom(address src, address dst, uint256 rawAmount) external returns (bool);\\n\\n /**\\n * @notice Mint new tokens\\n * @param dst The address of the destination account\\n * @param rawAmount The number of tokens to be minted\\n */\\n function mint(address dst, uint256 rawAmount) external;\\n\\n function burn(address src, uint256 rawAmount) external;\\n function setMinter(address minter_) external;\\n}\\n\",\"keccak256\":\"0x2fcd50fd565019546be3412013205df119fe96fdca5bb152229b70fb4ec1169b\",\"license\":\"UNLICENSED\"},\"contracts/v2/interfaces/IFeeCalc.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\ninterface IFeeCalc {\\n function processDeposit(uint256 amt, address who) external view returns (uint256, uint256);\\n\\n function processWithdraw(uint256 amt, address who) external view returns (uint256, uint256);\\n}\\n\",\"keccak256\":\"0x2391271eeaf9baaa39edf4dc69b057824db52b0b87474680ca0b71c25a6b0550\",\"license\":\"UNLICENSED\"},\"contracts/v2/lib/ETH2DepositWithdrawalCredentials.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\n\\nimport {IDepositContract} from \\\"../interfaces/IDepositContract.sol\\\";\\n\\n/// @title A contract for holding a eth2 validator withrawal pubkey\\n/// @author @chimeraDefi\\n/// @notice A contract for holding a eth2 validator withrawal pubkey\\n/// @dev Downstream contract needs to implement who can set the withdrawal address and set it\\ncontract ETH2DepositWithdrawalCredentials {\\n uint256 internal constant _depositAmount = 32 ether;\\n IDepositContract public immutable DEPOSIT_CONTRACT;\\n bytes public withdrawalPubKey; // Pubkey for ETH 2.0 withdrawal creds\\n\\n event WithdrawalCredentialSet(bytes _withdrawalCredential);\\n\\n constructor(address _dc) {\\n DEPOSIT_CONTRACT = IDepositContract(_dc);\\n }\\n\\n /// @notice A more streamlined variant of batch deposit for use with preset withdrawal addresses\\n /// Submit index-matching arrays that form Phase 0 DepositData objects.\\n /// Will create a deposit transaction per index of the arrays submitted.\\n ///\\n /// @param pubkeys - An array of BLS12-381 public keys.\\n /// @param signatures - An array of BLS12-381 signatures.\\n /// @param depositDataRoots - An array of the SHA-256 hash of the SSZ-encoded DepositData object.\\n function _batchDeposit(\\n bytes[] calldata pubkeys,\\n bytes[] calldata signatures,\\n bytes32[] calldata depositDataRoots\\n ) internal {\\n // optimizations https://ethereum.stackexchange.com/questions/113221/what-is-the-purpose-of-unchecked-in-solidity\\n // https://medium.com/@bloqarl/solidity-gas-optimization-tips-with-assembly-you-havent-heard-yet-1381c77ff078\\n // 30m gas / block roughly, say 10m max used so 100 validators a batch max \\n // each deposit call costs roughly 128k https://etherscan.io/tx/0xa2acf6e6bde99b532125cc8026cd88eea345f296968ce732556945ab4705d03e\\n uint256 i = pubkeys.length;\\n uint256 _amt = _depositAmount;\\n bytes memory wpk = withdrawalPubKey;\\n\\n while (i > 0) {\\n unchecked {\\n // While loop check prevents underflow.\\n // --i is cheaper than i--\\n // reverse while loop cheapest compared to while or for \\n // Since we set the upper loop bound to the arr len, we decr 1st to not hit out of bounds\\n --i;\\n\\n DEPOSIT_CONTRACT.deposit{value: _amt}(\\n pubkeys[i],\\n wpk,\\n signatures[i],\\n depositDataRoots[i]\\n );\\n }\\n }\\n }\\n\\n /// @notice sets curr_withdrawal_pubkey to be used when deploying validators\\n function _setWithdrawalCredential(bytes memory newPk) internal {\\n withdrawalPubKey = newPk;\\n\\n emit WithdrawalCredentialSet(newPk);\\n }\\n}\\n\",\"keccak256\":\"0x0ebea7361fe05b3b8eb90b0dde098d2d93a994e54d9e498dcba951735de53a56\",\"license\":\"BUSL-1.1\"}},\"version\":1}", + "bytecode": "0x60e06040523480156200001157600080fd5b50604051620023f5380380620023f5833981016040819052620000349162000327565b806004815181106200004a576200004a62000410565b60209081029190910101516001805460ff191681556002556001600160a01b03166080528051819060009062000084576200008462000410565b6020026020010151600b60016101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600181518110620000c857620000c862000410565b60200260200101516001600160a01b031660a0816001600160a01b03168152505080600281518110620000ff57620000ff62000410565b60209081029190910101516001600160a01b0390811660c081905260a05160405163095ea7b360e01b8152600481019290925260001960248301529091169063095ea7b3906044016020604051808303816000875af115801562000167573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018d919062000426565b5060048290556005839055678ac7230489e80000600a55620001b9826801bc16d674ec80000062000451565b600655620001e87f6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea3362000240565b620002377f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf8260038151811062000223576200022362000410565b60200260200101516200024060201b60201c565b50505062000473565b6200024c8282620002c9565b620002c5576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620002843390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff165b92915050565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b03811681146200032257600080fd5b919050565b6000806000606084860312156200033d57600080fd5b835160208086015160408701519295509350906001600160401b03808211156200036657600080fd5b818701915087601f8301126200037b57600080fd5b815181811115620003905762000390620002f4565b8060051b604051601f19603f83011681018181108582111715620003b857620003b8620002f4565b60405291825284820192508381018501918a831115620003d757600080fd5b938501935b828510156200040057620003f0856200030a565b84529385019392850192620003dc565b8096505050505050509250925092565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156200043957600080fd5b815180151581146200044a57600080fd5b9392505050565b80820180821115620002ee57634e487b7160e01b600052601160045260246000fd5b60805160a05160c051611f28620004cd6000396000818161091f01528181610a2401528181610b490152610c8901526000818161094e01528181610f50015261114301526000818161040e01526112660152611f286000f3fe60806040526004361061021c5760003560e01c806391d1485411610122578063c86283c8116100a5578063ed88c68e1161006c578063ed88c68e14610223578063edaafe2014610621578063f26b342f14610637578063f317229f14610651578063ffd2ffb91461067157005b8063c86283c8146105ae578063cacda096146105ce578063d0e30db0146105e3578063d547741f146105eb578063eb52f3ae1461060b57005b8063b1b54567116100e9578063b1b5456714610519578063b8027e8314610539578063bef989d81461056d578063c4ae316814610583578063c6fe82871461059857005b806391d148541461049b578063a0be06f9146104bb578063a217fddf146104d1578063aa67c919146104e6578063acc2216a146104f957005b80633683c204116101aa57806366519bd61161017157806366519bd6146103f45780636b96736b146103fc5780636ebf9f9e1461044857806382e48a83146104685780638c1077991461047b57005b80633683c2041461037157806345bc4d10146103915780634d327025146103b15780635c975abb146103c65780635d593f8d146103de57005b8063248a9ca3116101ee578063248a9ca3146102cc5780632e1a7d4d146102fc5780632e6ea0cf1461031c5780632f2ff15d1461033157806336568abe1461035157005b806301ffc9a7146102255780630eec46311461025a578063180cb47f1461027c5780631efdfe6e146102ac57005b3661022357005b005b34801561023157600080fd5b506102456102403660046118ce565b610687565b60405190151581526020015b60405180910390f35b34801561026657600080fd5b5061026f6106be565b6040516102519190611948565b34801561028857600080fd5b5061029e600080516020611ed383398151915281565b604051908152602001610251565b3480156102b857600080fd5b506102236102c736600461195b565b61074c565b3480156102d857600080fd5b5061029e6102e736600461195b565b60009081526020819052604090206001015490565b34801561030857600080fd5b5061022361031736600461195b565b6107b7565b34801561032857600080fd5b506102236107c5565b34801561033d57600080fd5b5061022361034c36600461198b565b6107f2565b34801561035d57600080fd5b5061022361036c36600461198b565b610817565b34801561037d57600080fd5b5061022361038c3660046119cd565b61089a565b34801561039d57600080fd5b506102236103ac36600461195b565b6108cd565b3480156103bd57600080fd5b5061029e6109ae565b3480156103d257600080fd5b5060015460ff16610245565b3480156103ea57600080fd5b5061029e60055481565b610223610a22565b34801561040857600080fd5b506104307f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610251565b34801561045457600080fd5b50610223610463366004611aca565b610ac2565b610223610476366004611b64565b610b47565b34801561048757600080fd5b50610223610496366004611b64565b610bf0565b3480156104a757600080fd5b506102456104b636600461198b565b610c31565b3480156104c757600080fd5b5061029e60045481565b3480156104dd57600080fd5b5061029e600081565b6102236104f4366004611b64565b610c5a565b34801561050557600080fd5b5061022361051436600461198b565b610c63565b34801561052557600080fd5b5061022361053436600461195b565b610d05565b34801561054557600080fd5b5061029e7f6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea81565b34801561057957600080fd5b5061029e60085481565b34801561058f57600080fd5b50610223610d23565b3480156105a457600080fd5b5061029e60095481565b3480156105ba57600080fd5b506102236105c936600461198b565b610d61565b3480156105da57600080fd5b5061029e610d6c565b610223610d8a565b3480156105f757600080fd5b5061022361060636600461198b565b610d93565b34801561061757600080fd5b5061029e60065481565b34801561062d57600080fd5b5061029e600a5481565b34801561064357600080fd5b50600b546102459060ff1681565b34801561065d57600080fd5b5061022361066c36600461195b565b610dba565b34801561067d57600080fd5b5061029e60075481565b60006001600160e01b03198216637965db0b60e01b14806106b857506301ffc9a760e01b6001600160e01b03198316145b92915050565b600380546106cb90611b7f565b80601f01602080910402602001604051908101604052809291908181526020018280546106f790611b7f565b80156107445780601f1061071957610100808354040283529160200191610744565b820191906000526020600020905b81548152906001019060200180831161072757829003601f168201915b505050505081565b600080516020611ed383398151915261076481610df7565b3360008390036107745760095492505b6009548311156107975760405163fd7850ad60e01b815260040160405180910390fd5b826009546107a59190611bcf565b6009556107b28184610e01565b505050565b6107c2813333610f1a565b50565b600080516020611ed38339815191526107dd81610df7565b50600b805460ff19811660ff90911615179055565b60008281526020819052604090206001015461080d81610df7565b6107b28383610fd0565b6001600160a01b038116331461088c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6108968282611054565b5050565b7f6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea6108c481610df7565b610896826110b9565b600080516020611ed38339815191526108e581610df7565b6007548211156109085760405163fd7850ad60e01b815260040160405180910390fd5b604051632770a7eb60e21b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018490527f00000000000000000000000000000000000000000000000000000000000000001690639dc29fac90604401600060405180830381600087803b15801561099257600080fd5b505af11580156109a6573d6000803e3d6000fd5b505050505050565b6000806007546109bc610d6c565b6109c69190611bcf565b90506000600654600454670de0b6b3a76400006109e39190611be2565b6109ed9190611bf9565b6109ff90670de0b6b3a7640000611bcf565b610a1183670de0b6b3a7640000611be2565b610a1b9190611bf9565b9392505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636e553f65610a5a30611100565b6040516001600160e01b031960e084901b16815260048101919091523360248201526044016020604051808303816000875af1158015610a9e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c29190611c1b565b7f6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea610aec81610df7565b610aff866801bc16d674ec800000611be2565b471015610b1f5760405163fd7850ad60e01b815260040160405180910390fd5b610b2d8787878787876111b0565b600854610b3b908790611c34565b60085550505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636e553f65610b7f30611100565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b03841660248201526044016020604051808303816000875af1158015610bcc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108969190611c1b565b600080516020611ed3833981519152610c0881610df7565b50600b80546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61089681611100565b604051635d043b2960e11b815260048101839052306024820152336044820152610896907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ba087652906064016020604051808303816000875af1158015610cda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cfe9190611c1b565b3083610f1a565b600080516020611ed3833981519152610d1d81610df7565b50600755565b600080516020611ed3833981519152610d3b81610df7565b6000610d4960015460ff1690565b90508015610d5957610896611351565b6108966113a3565b610896823383610f1a565b60006005546801bc16d674ec800000610d859190611be2565b905090565b6107c233611100565b600082815260208190526040902060010154610dae81610df7565b6107b28383611054565b565b600080516020611ed3833981519152610dd281610df7565b8115610dde5750600555565b6040516313f8a3a760e31b815260040160405180910390fd5b6107c281336113de565b80471015610e515760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610883565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610e9e576040519150601f19603f3d011682016040523d82523d6000602084013e610ea3565b606091505b50509050806107b25760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610883565b610f22611437565b610f2a61148e565b604051632770a7eb60e21b81526001600160a01b038381166004830152602482018590527f00000000000000000000000000000000000000000000000000000000000000001690639dc29fac90604401600060405180830381600087803b158015610f9457600080fd5b505af1158015610fa8573d6000803e3d6000fd5b505050506000610fb7846114d4565b905081610fc48183610e01565b50506107b26001600255565b610fda8282610c31565b610896576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556110103390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61105e8282610c31565b15610896576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60036110c58282611c8d565b507f8ba040512c1273086ac3dc9e59c32b9fc104064d6df4c3747fec10e029bc3fba816040516110f59190611948565b60405180910390a150565b600061110a611437565b61111261148e565b61111a6115e1565b6040516340c10f1960e01b81526001600160a01b038481166004830152602482018390529192507f0000000000000000000000000000000000000000000000000000000000000000909116906340c10f1990604401600060405180830381600087803b15801561118957600080fd5b505af115801561119d573d6000803e3d6000fd5b505050506111ab6001600255565b919050565b6003805486916801bc16d674ec80000091600091906111ce90611b7f565b80601f01602080910402602001604051908101604052809291908181526020018280546111fa90611b7f565b80156112475780601f1061121c57610100808354040283529160200191611247565b820191906000526020600020905b81548152906001019060200180831161122a57829003601f168201915b505050505090505b821561134657600019909201916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166322895118838b8b8781811061129e5761129e611d4d565b90506020028101906112b09190611d63565b858c8c8a8181106112c3576112c3611d4d565b90506020028101906112d59190611d63565b8c8c8c8181106112e7576112e7611d4d565b905060200201356040518863ffffffff1660e01b815260040161130f96959493929190611dd3565b6000604051808303818588803b15801561132857600080fd5b505af115801561133c573d6000803e3d6000fd5b505050505061124f565b505050505050505050565b6113596116d7565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6113ab61148e565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611386565b6113e88282610c31565b610896576113f581611720565b611400836020611732565b604051602001611411929190611e22565b60408051601f198184030181529082905262461bcd60e51b825261088391600401611948565b60028054036114885760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610883565b60028055565b60015460ff1615610db85760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610883565b600b54600090819061010090046001600160a01b03161561159c57600b5460405162f20ddd60e11b8152600481018590523360248201526101009091046001600160a01b0316906301e41bba906044016040805180830381865afa158015611540573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115649190611e97565b600b54919450915060ff161561158a57806009546115829190611bcf565b60095561159c565b806009546115989190611c34565b6009555b6009546115a99084611c34565b4710156115c95760405163fd7850ad60e01b815260040160405180910390fd5b826007546115d79190611bcf565b6007555090919050565b600b54349060009061010090046001600160a01b03161561168957600b54604051631d9a1b7b60e11b8152600481018490523360248201526101009091046001600160a01b031690633b3436f6906044016040805180830381865afa15801561164e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116729190611e97565b6009549193509150611685908290611c34565b6009555b6000826007546116999190611c34565b90506116a3610d6c565b600a546116b09190611c34565b8111156116d05760405163fd7850ad60e01b815260040160405180910390fd5b6007555090565b60015460ff16610db85760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610883565b60606106b86001600160a01b03831660145b60606000611741836002611be2565b61174c906002611c34565b67ffffffffffffffff811115611764576117646119b7565b6040519080825280601f01601f19166020018201604052801561178e576020820181803683370190505b509050600360fc1b816000815181106117a9576117a9611d4d565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106117d8576117d8611d4d565b60200101906001600160f81b031916908160001a90535060006117fc846002611be2565b611807906001611c34565b90505b600181111561187f576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061183b5761183b611d4d565b1a60f81b82828151811061185157611851611d4d565b60200101906001600160f81b031916908160001a90535060049490941c9361187881611ebb565b905061180a565b508315610a1b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610883565b6000602082840312156118e057600080fd5b81356001600160e01b031981168114610a1b57600080fd5b60005b838110156119135781810151838201526020016118fb565b50506000910152565b600081518084526119348160208601602086016118f8565b601f01601f19169290920160200192915050565b602081526000610a1b602083018461191c565b60006020828403121561196d57600080fd5b5035919050565b80356001600160a01b03811681146111ab57600080fd5b6000806040838503121561199e57600080fd5b823591506119ae60208401611974565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156119df57600080fd5b813567ffffffffffffffff808211156119f757600080fd5b818401915084601f830112611a0b57600080fd5b813581811115611a1d57611a1d6119b7565b604051601f8201601f19908116603f01168101908382118183101715611a4557611a456119b7565b81604052828152876020848701011115611a5e57600080fd5b826020860160208301376000928101602001929092525095945050505050565b60008083601f840112611a9057600080fd5b50813567ffffffffffffffff811115611aa857600080fd5b6020830191508360208260051b8501011115611ac357600080fd5b9250929050565b60008060008060008060608789031215611ae357600080fd5b863567ffffffffffffffff80821115611afb57600080fd5b611b078a838b01611a7e565b90985096506020890135915080821115611b2057600080fd5b611b2c8a838b01611a7e565b90965094506040890135915080821115611b4557600080fd5b50611b5289828a01611a7e565b979a9699509497509295939492505050565b600060208284031215611b7657600080fd5b610a1b82611974565b600181811c90821680611b9357607f821691505b602082108103611bb357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106b8576106b8611bb9565b80820281158282048414176106b8576106b8611bb9565b600082611c1657634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215611c2d57600080fd5b5051919050565b808201808211156106b8576106b8611bb9565b601f8211156107b257600081815260208120601f850160051c81016020861015611c6e5750805b601f850160051c820191505b818110156109a657828155600101611c7a565b815167ffffffffffffffff811115611ca757611ca76119b7565b611cbb81611cb58454611b7f565b84611c47565b602080601f831160018114611cf05760008415611cd85750858301515b600019600386901b1c1916600185901b1785556109a6565b600085815260208120601f198616915b82811015611d1f57888601518255948401946001909101908401611d00565b5085821015611d3d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112611d7a57600080fd5b83018035915067ffffffffffffffff821115611d9557600080fd5b602001915036819003821315611ac357600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b608081526000611de760808301888a611daa565b8281036020840152611df9818861191c565b90508281036040840152611e0e818688611daa565b915050826060830152979650505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611e5a8160178501602088016118f8565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611e8b8160288401602088016118f8565b01602801949350505050565b60008060408385031215611eaa57600080fd5b505080516020909101519092909150565b600081611eca57611eca611bb9565b50600019019056fe8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecfa264697066735822122023c5f342fde36aaa48be5d55354ffdd91b350b804eea1d5c2a191d6b212b613064736f6c63430008140033", + "deployedBytecode": "0x60806040526004361061021c5760003560e01c806391d1485411610122578063c86283c8116100a5578063ed88c68e1161006c578063ed88c68e14610223578063edaafe2014610621578063f26b342f14610637578063f317229f14610651578063ffd2ffb91461067157005b8063c86283c8146105ae578063cacda096146105ce578063d0e30db0146105e3578063d547741f146105eb578063eb52f3ae1461060b57005b8063b1b54567116100e9578063b1b5456714610519578063b8027e8314610539578063bef989d81461056d578063c4ae316814610583578063c6fe82871461059857005b806391d148541461049b578063a0be06f9146104bb578063a217fddf146104d1578063aa67c919146104e6578063acc2216a146104f957005b80633683c204116101aa57806366519bd61161017157806366519bd6146103f45780636b96736b146103fc5780636ebf9f9e1461044857806382e48a83146104685780638c1077991461047b57005b80633683c2041461037157806345bc4d10146103915780634d327025146103b15780635c975abb146103c65780635d593f8d146103de57005b8063248a9ca3116101ee578063248a9ca3146102cc5780632e1a7d4d146102fc5780632e6ea0cf1461031c5780632f2ff15d1461033157806336568abe1461035157005b806301ffc9a7146102255780630eec46311461025a578063180cb47f1461027c5780631efdfe6e146102ac57005b3661022357005b005b34801561023157600080fd5b506102456102403660046118ce565b610687565b60405190151581526020015b60405180910390f35b34801561026657600080fd5b5061026f6106be565b6040516102519190611948565b34801561028857600080fd5b5061029e600080516020611ed383398151915281565b604051908152602001610251565b3480156102b857600080fd5b506102236102c736600461195b565b61074c565b3480156102d857600080fd5b5061029e6102e736600461195b565b60009081526020819052604090206001015490565b34801561030857600080fd5b5061022361031736600461195b565b6107b7565b34801561032857600080fd5b506102236107c5565b34801561033d57600080fd5b5061022361034c36600461198b565b6107f2565b34801561035d57600080fd5b5061022361036c36600461198b565b610817565b34801561037d57600080fd5b5061022361038c3660046119cd565b61089a565b34801561039d57600080fd5b506102236103ac36600461195b565b6108cd565b3480156103bd57600080fd5b5061029e6109ae565b3480156103d257600080fd5b5060015460ff16610245565b3480156103ea57600080fd5b5061029e60055481565b610223610a22565b34801561040857600080fd5b506104307f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610251565b34801561045457600080fd5b50610223610463366004611aca565b610ac2565b610223610476366004611b64565b610b47565b34801561048757600080fd5b50610223610496366004611b64565b610bf0565b3480156104a757600080fd5b506102456104b636600461198b565b610c31565b3480156104c757600080fd5b5061029e60045481565b3480156104dd57600080fd5b5061029e600081565b6102236104f4366004611b64565b610c5a565b34801561050557600080fd5b5061022361051436600461198b565b610c63565b34801561052557600080fd5b5061022361053436600461195b565b610d05565b34801561054557600080fd5b5061029e7f6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea81565b34801561057957600080fd5b5061029e60085481565b34801561058f57600080fd5b50610223610d23565b3480156105a457600080fd5b5061029e60095481565b3480156105ba57600080fd5b506102236105c936600461198b565b610d61565b3480156105da57600080fd5b5061029e610d6c565b610223610d8a565b3480156105f757600080fd5b5061022361060636600461198b565b610d93565b34801561061757600080fd5b5061029e60065481565b34801561062d57600080fd5b5061029e600a5481565b34801561064357600080fd5b50600b546102459060ff1681565b34801561065d57600080fd5b5061022361066c36600461195b565b610dba565b34801561067d57600080fd5b5061029e60075481565b60006001600160e01b03198216637965db0b60e01b14806106b857506301ffc9a760e01b6001600160e01b03198316145b92915050565b600380546106cb90611b7f565b80601f01602080910402602001604051908101604052809291908181526020018280546106f790611b7f565b80156107445780601f1061071957610100808354040283529160200191610744565b820191906000526020600020905b81548152906001019060200180831161072757829003601f168201915b505050505081565b600080516020611ed383398151915261076481610df7565b3360008390036107745760095492505b6009548311156107975760405163fd7850ad60e01b815260040160405180910390fd5b826009546107a59190611bcf565b6009556107b28184610e01565b505050565b6107c2813333610f1a565b50565b600080516020611ed38339815191526107dd81610df7565b50600b805460ff19811660ff90911615179055565b60008281526020819052604090206001015461080d81610df7565b6107b28383610fd0565b6001600160a01b038116331461088c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6108968282611054565b5050565b7f6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea6108c481610df7565b610896826110b9565b600080516020611ed38339815191526108e581610df7565b6007548211156109085760405163fd7850ad60e01b815260040160405180910390fd5b604051632770a7eb60e21b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018490527f00000000000000000000000000000000000000000000000000000000000000001690639dc29fac90604401600060405180830381600087803b15801561099257600080fd5b505af11580156109a6573d6000803e3d6000fd5b505050505050565b6000806007546109bc610d6c565b6109c69190611bcf565b90506000600654600454670de0b6b3a76400006109e39190611be2565b6109ed9190611bf9565b6109ff90670de0b6b3a7640000611bcf565b610a1183670de0b6b3a7640000611be2565b610a1b9190611bf9565b9392505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636e553f65610a5a30611100565b6040516001600160e01b031960e084901b16815260048101919091523360248201526044016020604051808303816000875af1158015610a9e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c29190611c1b565b7f6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea610aec81610df7565b610aff866801bc16d674ec800000611be2565b471015610b1f5760405163fd7850ad60e01b815260040160405180910390fd5b610b2d8787878787876111b0565b600854610b3b908790611c34565b60085550505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636e553f65610b7f30611100565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b03841660248201526044016020604051808303816000875af1158015610bcc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108969190611c1b565b600080516020611ed3833981519152610c0881610df7565b50600b80546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61089681611100565b604051635d043b2960e11b815260048101839052306024820152336044820152610896907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ba087652906064016020604051808303816000875af1158015610cda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cfe9190611c1b565b3083610f1a565b600080516020611ed3833981519152610d1d81610df7565b50600755565b600080516020611ed3833981519152610d3b81610df7565b6000610d4960015460ff1690565b90508015610d5957610896611351565b6108966113a3565b610896823383610f1a565b60006005546801bc16d674ec800000610d859190611be2565b905090565b6107c233611100565b600082815260208190526040902060010154610dae81610df7565b6107b28383611054565b565b600080516020611ed3833981519152610dd281610df7565b8115610dde5750600555565b6040516313f8a3a760e31b815260040160405180910390fd5b6107c281336113de565b80471015610e515760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610883565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610e9e576040519150601f19603f3d011682016040523d82523d6000602084013e610ea3565b606091505b50509050806107b25760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610883565b610f22611437565b610f2a61148e565b604051632770a7eb60e21b81526001600160a01b038381166004830152602482018590527f00000000000000000000000000000000000000000000000000000000000000001690639dc29fac90604401600060405180830381600087803b158015610f9457600080fd5b505af1158015610fa8573d6000803e3d6000fd5b505050506000610fb7846114d4565b905081610fc48183610e01565b50506107b26001600255565b610fda8282610c31565b610896576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556110103390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61105e8282610c31565b15610896576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60036110c58282611c8d565b507f8ba040512c1273086ac3dc9e59c32b9fc104064d6df4c3747fec10e029bc3fba816040516110f59190611948565b60405180910390a150565b600061110a611437565b61111261148e565b61111a6115e1565b6040516340c10f1960e01b81526001600160a01b038481166004830152602482018390529192507f0000000000000000000000000000000000000000000000000000000000000000909116906340c10f1990604401600060405180830381600087803b15801561118957600080fd5b505af115801561119d573d6000803e3d6000fd5b505050506111ab6001600255565b919050565b6003805486916801bc16d674ec80000091600091906111ce90611b7f565b80601f01602080910402602001604051908101604052809291908181526020018280546111fa90611b7f565b80156112475780601f1061121c57610100808354040283529160200191611247565b820191906000526020600020905b81548152906001019060200180831161122a57829003601f168201915b505050505090505b821561134657600019909201916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166322895118838b8b8781811061129e5761129e611d4d565b90506020028101906112b09190611d63565b858c8c8a8181106112c3576112c3611d4d565b90506020028101906112d59190611d63565b8c8c8c8181106112e7576112e7611d4d565b905060200201356040518863ffffffff1660e01b815260040161130f96959493929190611dd3565b6000604051808303818588803b15801561132857600080fd5b505af115801561133c573d6000803e3d6000fd5b505050505061124f565b505050505050505050565b6113596116d7565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6113ab61148e565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611386565b6113e88282610c31565b610896576113f581611720565b611400836020611732565b604051602001611411929190611e22565b60408051601f198184030181529082905262461bcd60e51b825261088391600401611948565b60028054036114885760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610883565b60028055565b60015460ff1615610db85760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610883565b600b54600090819061010090046001600160a01b03161561159c57600b5460405162f20ddd60e11b8152600481018590523360248201526101009091046001600160a01b0316906301e41bba906044016040805180830381865afa158015611540573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115649190611e97565b600b54919450915060ff161561158a57806009546115829190611bcf565b60095561159c565b806009546115989190611c34565b6009555b6009546115a99084611c34565b4710156115c95760405163fd7850ad60e01b815260040160405180910390fd5b826007546115d79190611bcf565b6007555090919050565b600b54349060009061010090046001600160a01b03161561168957600b54604051631d9a1b7b60e11b8152600481018490523360248201526101009091046001600160a01b031690633b3436f6906044016040805180830381865afa15801561164e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116729190611e97565b6009549193509150611685908290611c34565b6009555b6000826007546116999190611c34565b90506116a3610d6c565b600a546116b09190611c34565b8111156116d05760405163fd7850ad60e01b815260040160405180910390fd5b6007555090565b60015460ff16610db85760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610883565b60606106b86001600160a01b03831660145b60606000611741836002611be2565b61174c906002611c34565b67ffffffffffffffff811115611764576117646119b7565b6040519080825280601f01601f19166020018201604052801561178e576020820181803683370190505b509050600360fc1b816000815181106117a9576117a9611d4d565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106117d8576117d8611d4d565b60200101906001600160f81b031916908160001a90535060006117fc846002611be2565b611807906001611c34565b90505b600181111561187f576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061183b5761183b611d4d565b1a60f81b82828151811061185157611851611d4d565b60200101906001600160f81b031916908160001a90535060049490941c9361187881611ebb565b905061180a565b508315610a1b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610883565b6000602082840312156118e057600080fd5b81356001600160e01b031981168114610a1b57600080fd5b60005b838110156119135781810151838201526020016118fb565b50506000910152565b600081518084526119348160208601602086016118f8565b601f01601f19169290920160200192915050565b602081526000610a1b602083018461191c565b60006020828403121561196d57600080fd5b5035919050565b80356001600160a01b03811681146111ab57600080fd5b6000806040838503121561199e57600080fd5b823591506119ae60208401611974565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156119df57600080fd5b813567ffffffffffffffff808211156119f757600080fd5b818401915084601f830112611a0b57600080fd5b813581811115611a1d57611a1d6119b7565b604051601f8201601f19908116603f01168101908382118183101715611a4557611a456119b7565b81604052828152876020848701011115611a5e57600080fd5b826020860160208301376000928101602001929092525095945050505050565b60008083601f840112611a9057600080fd5b50813567ffffffffffffffff811115611aa857600080fd5b6020830191508360208260051b8501011115611ac357600080fd5b9250929050565b60008060008060008060608789031215611ae357600080fd5b863567ffffffffffffffff80821115611afb57600080fd5b611b078a838b01611a7e565b90985096506020890135915080821115611b2057600080fd5b611b2c8a838b01611a7e565b90965094506040890135915080821115611b4557600080fd5b50611b5289828a01611a7e565b979a9699509497509295939492505050565b600060208284031215611b7657600080fd5b610a1b82611974565b600181811c90821680611b9357607f821691505b602082108103611bb357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106b8576106b8611bb9565b80820281158282048414176106b8576106b8611bb9565b600082611c1657634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215611c2d57600080fd5b5051919050565b808201808211156106b8576106b8611bb9565b601f8211156107b257600081815260208120601f850160051c81016020861015611c6e5750805b601f850160051c820191505b818110156109a657828155600101611c7a565b815167ffffffffffffffff811115611ca757611ca76119b7565b611cbb81611cb58454611b7f565b84611c47565b602080601f831160018114611cf05760008415611cd85750858301515b600019600386901b1c1916600185901b1785556109a6565b600085815260208120601f198616915b82811015611d1f57888601518255948401946001909101908401611d00565b5085821015611d3d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112611d7a57600080fd5b83018035915067ffffffffffffffff821115611d9557600080fd5b602001915036819003821315611ac357600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b608081526000611de760808301888a611daa565b8281036020840152611df9818861191c565b90508281036040840152611e0e818688611daa565b915050826060830152979650505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611e5a8160178501602088016118f8565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611e8b8160288401602088016118f8565b01602801949350505050565b60008060408385031215611eaa57600080fd5b505080516020909101519092909150565b600081611eca57611eca611bb9565b50600019019056fe8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecfa264697066735822122023c5f342fde36aaa48be5d55354ffdd91b350b804eea1d5c2a191d6b212b613064736f6c63430008140033", + "devdoc": { + "author": "ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org", + "details": "Deployment params: - addresses : [feeCalc, sgeth, wsgeth, gov]", + "events": { + "Paused(address)": { + "details": "Emitted when the pause is triggered by `account`." + }, + "RoleAdminChanged(bytes32,bytes32,bytes32)": { + "details": "Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._" + }, + "RoleGranted(bytes32,address,address)": { + "details": "Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}." + }, + "RoleRevoked(bytes32,address,address)": { + "details": "Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)" + }, + "Unpaused(address)": { + "details": "Emitted when the pause is lifted by `account`." + } + }, + "kind": "dev", + "methods": { + "getRoleAdmin(bytes32)": { + "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." + }, + "grantRole(bytes32,address)": { + "details": "Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event." + }, + "hasRole(bytes32,address)": { + "details": "Returns `true` if `account` has been granted `role`." + }, + "paused()": { + "details": "Returns true if the contract is paused, and false otherwise." + }, + "renounceRole(bytes32,address)": { + "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event." + }, + "revokeRole(bytes32,address)": { + "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event." + }, + "supportsInterface(bytes4)": { + "details": "See {IERC165-supportsInterface}." + } + }, + "title": "SharedDepositMinterV2", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "notice": "Mints LSD tokens for ETH deposited to the contract. Handles the depositing of ETH to the ETH2 deposit contract and validator creation", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3628, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "_roles", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_struct(RoleData)3623_storage)" + }, + { + "astId": 4673, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "_paused", + "offset": 0, + "slot": "1", + "type": "t_bool" + }, + { + "astId": 4774, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "_status", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 16740, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "withdrawalPubKey", + "offset": 0, + "slot": "3", + "type": "t_bytes_storage" + }, + { + "astId": 14920, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "adminFee", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 14922, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "numValidators", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 14924, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "costPerValidator", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 14926, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "curValidatorShares", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 14928, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "validatorsCreated", + "offset": 0, + "slot": "8", + "type": "t_uint256" + }, + { + "astId": 14930, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "adminFeeTotal", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 14932, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "buffer", + "offset": 0, + "slot": "10", + "type": "t_uint256" + }, + { + "astId": 14934, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "refundFeesOnWithdraw", + "offset": 0, + "slot": "11", + "type": "t_bool" + }, + { + "astId": 14943, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "_feeCalc", + "offset": 1, + "slot": "11", + "type": "t_contract(IFeeCalc)16516" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(IFeeCalc)16516": { + "encoding": "inplace", + "label": "contract IFeeCalc", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_bytes32,t_struct(RoleData)3623_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct AccessControl.RoleData)", + "numberOfBytes": "32", + "value": "t_struct(RoleData)3623_storage" + }, + "t_struct(RoleData)3623_storage": { + "encoding": "inplace", + "label": "struct AccessControl.RoleData", + "members": [ + { + "astId": 3620, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "members", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 3622, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "adminRole", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/localhost/WSGETH.json b/deployments/localhost/WSGETH.json new file mode 100644 index 0000000..47a9d3d --- /dev/null +++ b/deployments/localhost/WSGETH.json @@ -0,0 +1,1071 @@ +{ + "address": "0x61A89BF0Ed0c2d1c365Db15660880C3d227A05D3", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ERC20", + "name": "_underlying", + "type": "address" + }, + { + "internalType": "uint32", + "name": "_rewardsCycleLength", + "type": "uint32" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "SyncError", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "cycleEnd", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardAmount", + "type": "uint256" + } + ], + "name": "NewRewardsCycle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "asset", + "outputs": [ + { + "internalType": "contract ERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "convertToAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "convertToShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "approveMax", + "type": "bool" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "depositWithSignature", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lastRewardAmount", + "outputs": [ + { + "internalType": "uint192", + "name": "", + "type": "uint192" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastSync", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "maxDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "maxMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "maxRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "maxWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "previewDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "previewMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "previewRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "previewWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pricePerShare", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsCycleEnd", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsCycleLength", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "syncRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x89bafee10267ae6c4858abd80ec76a3f87047a5d09cc8beda41c4d77bed1e61a", + "receipt": { + "to": null, + "from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "contractAddress": "0x61A89BF0Ed0c2d1c365Db15660880C3d227A05D3", + "transactionIndex": 0, + "gasUsed": "1745344", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe63f55e56f11f6af6f7e5f655d7df9b05f7f55af959a958683de91328bb64733", + "transactionHash": "0x89bafee10267ae6c4858abd80ec76a3f87047a5d09cc8beda41c4d77bed1e61a", + "logs": [], + "blockNumber": 6233283, + "cumulativeGasUsed": "1745344", + "status": 1, + "byzantium": true + }, + "args": [ + "0x31e7d36377c664BeAAb967fB46E38c59069996eC", + 86400 + ], + "numDeployments": 1, + "solcInputHash": "d5c4e8b77fe999241905bb33844ed6ed", + "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ERC20\",\"name\":\"_underlying\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"_rewardsCycleLength\",\"type\":\"uint32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"SyncError\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"cycleEnd\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardAmount\",\"type\":\"uint256\"}],\"name\":\"NewRewardsCycle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"asset\",\"outputs\":[{\"internalType\":\"contract ERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"convertToAssets\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"convertToShares\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"deposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"approveMax\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"depositWithSignature\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastRewardAmount\",\"outputs\":[{\"internalType\":\"uint192\",\"name\":\"\",\"type\":\"uint192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastSync\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"maxDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"maxMint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"maxRedeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"maxWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"previewDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"previewMint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"previewRedeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"previewWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pricePerShare\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"redeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsCycleEnd\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsCycleLength\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"syncRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalAssets\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"withdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Exchange rate between sgETH and ssgETH floats, you can convert your ssgETH for more sgETH over time. Exchange rate increases as validator rewardSplitter mints new sgETH corresponding to the staking yield and drops it into this vault (ssgETH contract). There is a short time period, \\u201ccycles\\u201d which the exchange rate increases linearly over. This is to prevent gaming the exchange rate (MEV). The cycles are constant length, but calling syncRewards slightly into a would-be cycle keeps the same would-be endpoint (so cycle ends are every X seconds). Someone must call syncRewards, which queues any new ssgETH in the contract to be added to the redeemable amount. Mint vs Deposit mint() - deposit targeting a specific number of ssgETH out deposit() - deposit knowing a specific number of ssgETH in \",\"errors\":{\"SyncError()\":[{\"details\":\"thrown when syncing before cycle ends.\"}]},\"events\":{\"NewRewardsCycle(uint32,uint256)\":{\"details\":\"emit every time a new rewards cycle starts\"}},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deposit(uint256,address)\":{\"notice\":\"inlines syncRewards with deposits when able\"},\"depositWithSignature(uint256,address,uint256,bool,uint8,bytes32,bytes32)\":{\"notice\":\"Approve and deposit() in one transaction\"},\"lastRewardAmount()\":{\"notice\":\"the amount of rewards distributed in a the most recent cycle.\"},\"lastSync()\":{\"notice\":\"the effective start of the current cycle\"},\"mint(uint256,address)\":{\"notice\":\"inlines syncRewards with mints when able\"},\"pricePerShare()\":{\"notice\":\"How much sgETH is 1E18 ssgETH worth. Price is in ETH, not USD\"},\"redeem(uint256,address,address)\":{\"notice\":\"inlines syncRewards with redemptions when able\"},\"rewardsCycleEnd()\":{\"notice\":\"the end of the current cycle. Will always be evenly divisible by `rewardsCycleLength`.\"},\"rewardsCycleLength()\":{\"notice\":\"the maximum length of a rewards cycle\"},\"syncRewards()\":{\"notice\":\"Distributes rewards to xERC4626 holders. All surplus `asset` balance of the contract over the internal balance becomes queued for the next cycle.\"},\"totalAssets()\":{\"notice\":\"Compute the amount of tokens available to share holders. Increases linearly during a reward distribution period from the sync call, not the cycle start.\"},\"withdraw(uint256,address,address)\":{\"notice\":\"inlines syncRewards with withdrawals when able\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/v2/core/WSGEth.sol\":\"WSGETH\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == _ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"contracts/v2/core/WSGEth.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.20;\\n\\nimport {ERC4626, xERC4626} from \\\"../lib/xERC4626.sol\\\";\\nimport {ERC20} from \\\"solmate/src/mixins/ERC4626.sol\\\";\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\n\\n/// @title ssgETH - Vault token for staked sgETH. ERC20 + ERC4626\\n/// @author @ChimeraDefi - sharedstake.org - based on sfrxETH\\n/// @notice Is a vault that takes sgETH and gives you ssgETH erc20 tokens\\n/** @dev Exchange rate between sgETH and ssgETH floats, you can convert your ssgETH for more sgETH over time.\\n Exchange rate increases as validator rewardSplitter mints new sgETH corresponding to the staking yield and drops it into this vault (ssgETH contract).\\n There is a short time period, \\u201ccycles\\u201d which the exchange rate increases linearly over. This is to prevent gaming the exchange rate (MEV).\\n The cycles are constant length, but calling syncRewards slightly into a would-be cycle keeps the same would-be endpoint (so cycle ends are every X seconds).\\n Someone must call syncRewards, which queues any new ssgETH in the contract to be added to the redeemable amount.\\n Mint vs Deposit\\n mint() - deposit targeting a specific number of ssgETH out\\n deposit() - deposit knowing a specific number of ssgETH in */\\ncontract WSGETH is xERC4626, ReentrancyGuard {\\n modifier andSync() {\\n if (block.timestamp >= rewardsCycleEnd) {\\n syncRewards();\\n }\\n _;\\n }\\n\\n /* ========== CONSTRUCTOR ========== */\\n constructor(\\n ERC20 _underlying,\\n uint32 _rewardsCycleLength\\n ) ERC4626(_underlying, \\\"Wrapped SharedStake Governed Ether\\\", \\\"wsgETH\\\") xERC4626(_rewardsCycleLength) {} // solhint-disable-line\\n\\n /// @notice Approve and deposit() in one transaction\\n function depositWithSignature(\\n uint256 assets,\\n address receiver,\\n uint256 deadline,\\n bool approveMax,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external returns (uint256 shares) {\\n uint256 amount = approveMax ? type(uint256).max : assets;\\n asset.permit(msg.sender, address(this), amount, deadline, v, r, s);\\n return (deposit(assets, receiver));\\n }\\n\\n /// @notice inlines syncRewards with deposits when able\\n function deposit(uint256 assets, address receiver) public override nonReentrant andSync returns (uint256 shares) {\\n return super.deposit(assets, receiver);\\n }\\n\\n /// @notice inlines syncRewards with mints when able\\n function mint(uint256 shares, address receiver) public override nonReentrant andSync returns (uint256 assets) {\\n return super.mint(shares, receiver);\\n }\\n\\n /// @notice inlines syncRewards with withdrawals when able\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) public override nonReentrant andSync returns (uint256 shares) {\\n return super.withdraw(assets, receiver, owner);\\n }\\n\\n /// @notice inlines syncRewards with redemptions when able\\n function redeem(uint256 shares, address receiver, address owner) public override andSync returns (uint256 assets) {\\n return super.redeem(shares, receiver, owner);\\n }\\n\\n /// @notice How much sgETH is 1E18 ssgETH worth. Price is in ETH, not USD\\n function pricePerShare() public view returns (uint256) {\\n return convertToAssets(1e18);\\n }\\n}\\n\",\"keccak256\":\"0xa67bcf20433ffa25c195a4b58aa4ebfabb48a465412498b4b5f1318b11896226\",\"license\":\"BUSL-1.1\"},\"contracts/v2/interfaces/IxERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// Cloned from fei/rari ERC4626 impl https://github.com/fei-protocol/ERC4626/blob/main/src/interfaces/IxERC4626.sol\\n// @ChimeraDefi Jun 2023\\n\\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/** \\n @title An xERC4626 Single Staking Contract Interface\\n @notice This contract allows users to autocompound rewards denominated in an underlying reward token. \\n It is fully compatible with [ERC4626](https://eips.ethereum.org/EIPS/eip-4626) allowing for DeFi composability.\\n It maintains balances using internal accounting to prevent instantaneous changes in the exchange rate.\\n NOTE: an exception is at contract creation, when a reward cycle begins before the first deposit. After the first deposit, exchange rate updates smoothly.\\n\\n Operates on \\\"cycles\\\" which distribute the rewards surplus over the internal balance to users linearly over the remainder of the cycle window.\\n*/\\ninterface IxERC4626 {\\n /*////////////////////////////////////////////////////////\\n Custom Errors\\n ////////////////////////////////////////////////////////*/\\n\\n /// @dev thrown when syncing before cycle ends.\\n error SyncError();\\n\\n /*////////////////////////////////////////////////////////\\n Events\\n ////////////////////////////////////////////////////////*/\\n\\n /// @dev emit every time a new rewards cycle starts\\n event NewRewardsCycle(uint32 indexed cycleEnd, uint256 rewardAmount);\\n\\n /*////////////////////////////////////////////////////////\\n View Methods\\n ////////////////////////////////////////////////////////*/\\n\\n /// @notice the maximum length of a rewards cycle\\n function rewardsCycleLength() external view returns (uint32);\\n\\n /// @notice the effective start of the current cycle\\n /// NOTE: This will likely be after `rewardsCycleEnd - rewardsCycleLength` as this is set as block.timestamp of the last `syncRewards` call.\\n function lastSync() external view returns (uint32);\\n\\n /// @notice the end of the current cycle. Will always be evenly divisible by `rewardsCycleLength`.\\n function rewardsCycleEnd() external view returns (uint32);\\n\\n /// @notice the amount of rewards distributed in a the most recent cycle\\n function lastRewardAmount() external view returns (uint192);\\n\\n /*////////////////////////////////////////////////////////\\n State Changing Methods\\n ////////////////////////////////////////////////////////*/\\n\\n /// @notice Distributes rewards to xERC4626 holders.\\n /// All surplus `asset` balance of the contract over the internal balance becomes queued for the next cycle.\\n function syncRewards() external;\\n}\\n\",\"keccak256\":\"0xc8f1178f922c26f8ddb0fce2b2a097a73949818a7a6400df5ef0a4b3f9dbedc3\",\"license\":\"MIT\"},\"contracts/v2/lib/xERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// Cloned from fei/rari ERC4626 impl https://github.com/fei-protocol/ERC4626/blob/main/src/interfaces/IxERC4626.sol\\n// In use by sfrxeth https://etherscan.io/address/0xac3e018457b222d93114458476f3e3416abbe38f#code\\n// @ChimeraDefi Jun 2023\\n\\npragma solidity ^0.8.20;\\n\\nimport {ERC4626} from \\\"solmate/src/mixins/ERC4626.sol\\\";\\nimport {SafeCastLib} from \\\"solmate/src/utils/SafeCastLib.sol\\\";\\nimport {IxERC4626} from \\\"../interfaces/IxERC4626.sol\\\";\\n\\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)\\n\\n/**\\n@title An xERC4626 Single Staking Contract\\n@notice This contract allows users to autocompound rewards denominated in an underlying reward token.\\n It is fully compatible with [ERC4626](https://eips.ethereum.org/EIPS/eip-4626) allowing for DeFi composability.\\n It maintains balances using internal accounting to prevent instantaneous changes in the exchange rate.\\n NOTE: an exception is at contract creation, when a reward cycle begins before the first deposit. After the first deposit, exchange rate updates smoothly.\\n\\n Operates on \\\"cycles\\\" which distribute the rewards surplus over the internal balance to users linearly over the remainder of the cycle window.\\n*/\\nabstract contract xERC4626 is IxERC4626, ERC4626 {\\n using SafeCastLib for *;\\n\\n /// @notice the maximum length of a rewards cycle\\n uint32 public immutable rewardsCycleLength;\\n\\n /// @notice the effective start of the current cycle\\n uint32 public lastSync;\\n\\n /// @notice the end of the current cycle. Will always be evenly divisible by `rewardsCycleLength`.\\n uint32 public rewardsCycleEnd;\\n\\n /// @notice the amount of rewards distributed in a the most recent cycle.\\n uint192 public lastRewardAmount;\\n\\n uint256 internal storedTotalAssets;\\n\\n constructor(uint32 _rewardsCycleLength) {\\n rewardsCycleLength = _rewardsCycleLength;\\n // seed initial rewardsCycleEnd\\n rewardsCycleEnd = (block.timestamp.safeCastTo32() / rewardsCycleLength) * rewardsCycleLength;\\n }\\n\\n /// @notice Compute the amount of tokens available to share holders.\\n /// Increases linearly during a reward distribution period from the sync call, not the cycle start.\\n function totalAssets() public view override returns (uint256) {\\n // cache global vars\\n uint256 storedTotalAssets_ = storedTotalAssets;\\n uint192 lastRewardAmount_ = lastRewardAmount;\\n uint32 rewardsCycleEnd_ = rewardsCycleEnd;\\n uint32 lastSync_ = lastSync;\\n\\n if (block.timestamp >= rewardsCycleEnd_) {\\n // no rewards or rewards fully unlocked\\n // entire reward amount is available\\n return storedTotalAssets_ + lastRewardAmount_;\\n }\\n\\n // rewards not fully unlocked\\n // add unlocked rewards to stored total\\n uint256 unlockedRewards = (lastRewardAmount_ * (block.timestamp - lastSync_)) / (rewardsCycleEnd_ - lastSync_);\\n return storedTotalAssets_ + unlockedRewards;\\n }\\n\\n // Update storedTotalAssets on withdraw/redeem\\n function beforeWithdraw(uint256 amount, uint256 shares) internal virtual override {\\n super.beforeWithdraw(amount, shares);\\n storedTotalAssets -= amount;\\n }\\n\\n // Update storedTotalAssets on deposit/mint\\n function afterDeposit(uint256 amount, uint256 shares) internal virtual override {\\n storedTotalAssets += amount;\\n super.afterDeposit(amount, shares);\\n }\\n\\n /// @notice Distributes rewards to xERC4626 holders.\\n /// All surplus `asset` balance of the contract over the internal balance becomes queued for the next cycle.\\n function syncRewards() public virtual {\\n uint192 lastRewardAmount_ = lastRewardAmount;\\n uint32 timestamp = block.timestamp.safeCastTo32();\\n\\n if (timestamp < rewardsCycleEnd) revert SyncError();\\n\\n uint256 storedTotalAssets_ = storedTotalAssets;\\n uint256 nextRewards = asset.balanceOf(address(this)) - storedTotalAssets_ - lastRewardAmount_;\\n\\n storedTotalAssets = storedTotalAssets_ + lastRewardAmount_; // SSTORE\\n\\n uint32 end = ((timestamp + rewardsCycleLength) / rewardsCycleLength) * rewardsCycleLength;\\n\\n if (end - timestamp < rewardsCycleLength / 20) {\\n end += rewardsCycleLength;\\n }\\n\\n // Combined single SSTORE\\n lastRewardAmount = nextRewards.safeCastTo192();\\n lastSync = timestamp;\\n rewardsCycleEnd = end;\\n\\n emit NewRewardsCycle(end, nextRewards);\\n }\\n}\\n\",\"keccak256\":\"0x89e895b144d1a28dbf96aec81e7601b8b5c9abfb4bf6bcb2a17eb7c40d7b7c79\",\"license\":\"MIT\"},\"solmate/src/mixins/ERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport {ERC20} from \\\"../tokens/ERC20.sol\\\";\\nimport {SafeTransferLib} from \\\"../utils/SafeTransferLib.sol\\\";\\nimport {FixedPointMathLib} from \\\"../utils/FixedPointMathLib.sol\\\";\\n\\n/// @notice Minimal ERC4626 tokenized Vault implementation.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/mixins/ERC4626.sol)\\nabstract contract ERC4626 is ERC20 {\\n using SafeTransferLib for ERC20;\\n using FixedPointMathLib for uint256;\\n\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed caller,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /*//////////////////////////////////////////////////////////////\\n IMMUTABLES\\n //////////////////////////////////////////////////////////////*/\\n\\n ERC20 public immutable asset;\\n\\n constructor(\\n ERC20 _asset,\\n string memory _name,\\n string memory _symbol\\n ) ERC20(_name, _symbol, _asset.decimals()) {\\n asset = _asset;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n DEPOSIT/WITHDRAWAL LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function deposit(uint256 assets, address receiver) public virtual returns (uint256 shares) {\\n // Check for rounding error since we round down in previewDeposit.\\n require((shares = previewDeposit(assets)) != 0, \\\"ZERO_SHARES\\\");\\n\\n // Need to transfer before minting or ERC777s could reenter.\\n asset.safeTransferFrom(msg.sender, address(this), assets);\\n\\n _mint(receiver, shares);\\n\\n emit Deposit(msg.sender, receiver, assets, shares);\\n\\n afterDeposit(assets, shares);\\n }\\n\\n function mint(uint256 shares, address receiver) public virtual returns (uint256 assets) {\\n assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.\\n\\n // Need to transfer before minting or ERC777s could reenter.\\n asset.safeTransferFrom(msg.sender, address(this), assets);\\n\\n _mint(receiver, shares);\\n\\n emit Deposit(msg.sender, receiver, assets, shares);\\n\\n afterDeposit(assets, shares);\\n }\\n\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) public virtual returns (uint256 shares) {\\n shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.\\n\\n if (msg.sender != owner) {\\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\\n\\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\\n }\\n\\n beforeWithdraw(assets, shares);\\n\\n _burn(owner, shares);\\n\\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\\n\\n asset.safeTransfer(receiver, assets);\\n }\\n\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address owner\\n ) public virtual returns (uint256 assets) {\\n if (msg.sender != owner) {\\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\\n\\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\\n }\\n\\n // Check for rounding error since we round down in previewRedeem.\\n require((assets = previewRedeem(shares)) != 0, \\\"ZERO_ASSETS\\\");\\n\\n beforeWithdraw(assets, shares);\\n\\n _burn(owner, shares);\\n\\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\\n\\n asset.safeTransfer(receiver, assets);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ACCOUNTING LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function totalAssets() public view virtual returns (uint256);\\n\\n function convertToShares(uint256 assets) public view virtual returns (uint256) {\\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\\n\\n return supply == 0 ? assets : assets.mulDivDown(supply, totalAssets());\\n }\\n\\n function convertToAssets(uint256 shares) public view virtual returns (uint256) {\\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\\n\\n return supply == 0 ? shares : shares.mulDivDown(totalAssets(), supply);\\n }\\n\\n function previewDeposit(uint256 assets) public view virtual returns (uint256) {\\n return convertToShares(assets);\\n }\\n\\n function previewMint(uint256 shares) public view virtual returns (uint256) {\\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\\n\\n return supply == 0 ? shares : shares.mulDivUp(totalAssets(), supply);\\n }\\n\\n function previewWithdraw(uint256 assets) public view virtual returns (uint256) {\\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\\n\\n return supply == 0 ? assets : assets.mulDivUp(supply, totalAssets());\\n }\\n\\n function previewRedeem(uint256 shares) public view virtual returns (uint256) {\\n return convertToAssets(shares);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n DEPOSIT/WITHDRAWAL LIMIT LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function maxDeposit(address) public view virtual returns (uint256) {\\n return type(uint256).max;\\n }\\n\\n function maxMint(address) public view virtual returns (uint256) {\\n return type(uint256).max;\\n }\\n\\n function maxWithdraw(address owner) public view virtual returns (uint256) {\\n return convertToAssets(balanceOf[owner]);\\n }\\n\\n function maxRedeem(address owner) public view virtual returns (uint256) {\\n return balanceOf[owner];\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n INTERNAL HOOKS LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {}\\n\\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {}\\n}\\n\",\"keccak256\":\"0xa404f6f45bd53f24a90cc5ffe95e16b52e3f2dfd88f0d7a1edcb35f815919a7b\",\"license\":\"AGPL-3.0-only\"},\"solmate/src/tokens/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\\nabstract contract ERC20 {\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n\\n /*//////////////////////////////////////////////////////////////\\n METADATA STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n string public name;\\n\\n string public symbol;\\n\\n uint8 public immutable decimals;\\n\\n /*//////////////////////////////////////////////////////////////\\n ERC20 STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 public totalSupply;\\n\\n mapping(address => uint256) public balanceOf;\\n\\n mapping(address => mapping(address => uint256)) public allowance;\\n\\n /*//////////////////////////////////////////////////////////////\\n EIP-2612 STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 internal immutable INITIAL_CHAIN_ID;\\n\\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\\n\\n mapping(address => uint256) public nonces;\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n string memory _name,\\n string memory _symbol,\\n uint8 _decimals\\n ) {\\n name = _name;\\n symbol = _symbol;\\n decimals = _decimals;\\n\\n INITIAL_CHAIN_ID = block.chainid;\\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ERC20 LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function approve(address spender, uint256 amount) public virtual returns (bool) {\\n allowance[msg.sender][spender] = amount;\\n\\n emit Approval(msg.sender, spender, amount);\\n\\n return true;\\n }\\n\\n function transfer(address to, uint256 amount) public virtual returns (bool) {\\n balanceOf[msg.sender] -= amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(msg.sender, to, amount);\\n\\n return true;\\n }\\n\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) public virtual returns (bool) {\\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\\n\\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\\n\\n balanceOf[from] -= amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(from, to, amount);\\n\\n return true;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n EIP-2612 LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) public virtual {\\n require(deadline >= block.timestamp, \\\"PERMIT_DEADLINE_EXPIRED\\\");\\n\\n // Unchecked because the only math done is incrementing\\n // the owner's nonce which cannot realistically overflow.\\n unchecked {\\n address recoveredAddress = ecrecover(\\n keccak256(\\n abi.encodePacked(\\n \\\"\\\\x19\\\\x01\\\",\\n DOMAIN_SEPARATOR(),\\n keccak256(\\n abi.encode(\\n keccak256(\\n \\\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\\\"\\n ),\\n owner,\\n spender,\\n value,\\n nonces[owner]++,\\n deadline\\n )\\n )\\n )\\n ),\\n v,\\n r,\\n s\\n );\\n\\n require(recoveredAddress != address(0) && recoveredAddress == owner, \\\"INVALID_SIGNER\\\");\\n\\n allowance[recoveredAddress][spender] = value;\\n }\\n\\n emit Approval(owner, spender, value);\\n }\\n\\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\\n }\\n\\n function computeDomainSeparator() internal view virtual returns (bytes32) {\\n return\\n keccak256(\\n abi.encode(\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"),\\n keccak256(bytes(name)),\\n keccak256(\\\"1\\\"),\\n block.chainid,\\n address(this)\\n )\\n );\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n INTERNAL MINT/BURN LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function _mint(address to, uint256 amount) internal virtual {\\n totalSupply += amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(address(0), to, amount);\\n }\\n\\n function _burn(address from, uint256 amount) internal virtual {\\n balanceOf[from] -= amount;\\n\\n // Cannot underflow because a user's balance\\n // will never be larger than the total supply.\\n unchecked {\\n totalSupply -= amount;\\n }\\n\\n emit Transfer(from, address(0), amount);\\n }\\n}\\n\",\"keccak256\":\"0xcdfd8db76b2a3415620e4d18cc5545f3d50de792dbf2c3dd5adb40cbe6f94b10\",\"license\":\"AGPL-3.0-only\"},\"solmate/src/utils/FixedPointMathLib.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Arithmetic library with operations for fixed-point numbers.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)\\n/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)\\nlibrary FixedPointMathLib {\\n /*//////////////////////////////////////////////////////////////\\n SIMPLIFIED FIXED POINT OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 internal constant MAX_UINT256 = 2**256 - 1;\\n\\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\\n\\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\\n }\\n\\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\\n }\\n\\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\\n }\\n\\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n LOW LEVEL FIXED POINT OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function mulDivDown(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 z) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\\n if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\\n revert(0, 0)\\n }\\n\\n // Divide x * y by the denominator.\\n z := div(mul(x, y), denominator)\\n }\\n }\\n\\n function mulDivUp(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 z) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\\n if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\\n revert(0, 0)\\n }\\n\\n // If x * y modulo the denominator is strictly greater than 0,\\n // 1 is added to round up the division of x * y by the denominator.\\n z := add(gt(mod(mul(x, y), denominator), 0), div(mul(x, y), denominator))\\n }\\n }\\n\\n function rpow(\\n uint256 x,\\n uint256 n,\\n uint256 scalar\\n ) internal pure returns (uint256 z) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n switch x\\n case 0 {\\n switch n\\n case 0 {\\n // 0 ** 0 = 1\\n z := scalar\\n }\\n default {\\n // 0 ** n = 0\\n z := 0\\n }\\n }\\n default {\\n switch mod(n, 2)\\n case 0 {\\n // If n is even, store scalar in z for now.\\n z := scalar\\n }\\n default {\\n // If n is odd, store x in z for now.\\n z := x\\n }\\n\\n // Shifting right by 1 is like dividing by 2.\\n let half := shr(1, scalar)\\n\\n for {\\n // Shift n right by 1 before looping to halve it.\\n n := shr(1, n)\\n } n {\\n // Shift n right by 1 each iteration to halve it.\\n n := shr(1, n)\\n } {\\n // Revert immediately if x ** 2 would overflow.\\n // Equivalent to iszero(eq(div(xx, x), x)) here.\\n if shr(128, x) {\\n revert(0, 0)\\n }\\n\\n // Store x squared.\\n let xx := mul(x, x)\\n\\n // Round to the nearest number.\\n let xxRound := add(xx, half)\\n\\n // Revert if xx + half overflowed.\\n if lt(xxRound, xx) {\\n revert(0, 0)\\n }\\n\\n // Set x to scaled xxRound.\\n x := div(xxRound, scalar)\\n\\n // If n is even:\\n if mod(n, 2) {\\n // Compute z * x.\\n let zx := mul(z, x)\\n\\n // If z * x overflowed:\\n if iszero(eq(div(zx, x), z)) {\\n // Revert if x is non-zero.\\n if iszero(iszero(x)) {\\n revert(0, 0)\\n }\\n }\\n\\n // Round to the nearest number.\\n let zxRound := add(zx, half)\\n\\n // Revert if zx + half overflowed.\\n if lt(zxRound, zx) {\\n revert(0, 0)\\n }\\n\\n // Return properly scaled zxRound.\\n z := div(zxRound, scalar)\\n }\\n }\\n }\\n }\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n GENERAL NUMBER UTILITIES\\n //////////////////////////////////////////////////////////////*/\\n\\n function sqrt(uint256 x) internal pure returns (uint256 z) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let y := x // We start y at x, which will help us make our initial estimate.\\n\\n z := 181 // The \\\"correct\\\" value is 1, but this saves a multiplication later.\\n\\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\\n\\n // We check y >= 2^(k + 8) but shift right by k bits\\n // each branch to ensure that if x >= 256, then y >= 256.\\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\\n y := shr(128, y)\\n z := shl(64, z)\\n }\\n if iszero(lt(y, 0x1000000000000000000)) {\\n y := shr(64, y)\\n z := shl(32, z)\\n }\\n if iszero(lt(y, 0x10000000000)) {\\n y := shr(32, y)\\n z := shl(16, z)\\n }\\n if iszero(lt(y, 0x1000000)) {\\n y := shr(16, y)\\n z := shl(8, z)\\n }\\n\\n // Goal was to get z*z*y within a small factor of x. More iterations could\\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\\n\\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\\n\\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\\n\\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\\n\\n // There is no overflow risk here since y < 2^136 after the first branch above.\\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\\n\\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n\\n // If x+1 is a perfect square, the Babylonian method cycles between\\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\\n z := sub(z, lt(div(x, z), z))\\n }\\n }\\n\\n function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Mod x by y. Note this will return\\n // 0 instead of reverting if y is zero.\\n z := mod(x, y)\\n }\\n }\\n\\n function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Divide x by y. Note this will return\\n // 0 instead of reverting if y is zero.\\n r := div(x, y)\\n }\\n }\\n\\n function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Add 1 to x * y if x % y > 0. Note this will\\n // return 0 instead of reverting if y is zero.\\n z := add(gt(mod(x, y), 0), div(x, y))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1b62af9baf5b8e991ed7531bc87f45550ba9d61e8dbff5caf237ccaf3a3fd843\",\"license\":\"AGPL-3.0-only\"},\"solmate/src/utils/SafeCastLib.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Safe unsigned integer casting library that reverts on overflow.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeCastLib.sol)\\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeCast.sol)\\nlibrary SafeCastLib {\\n function safeCastTo248(uint256 x) internal pure returns (uint248 y) {\\n require(x < 1 << 248);\\n\\n y = uint248(x);\\n }\\n\\n function safeCastTo224(uint256 x) internal pure returns (uint224 y) {\\n require(x < 1 << 224);\\n\\n y = uint224(x);\\n }\\n\\n function safeCastTo192(uint256 x) internal pure returns (uint192 y) {\\n require(x < 1 << 192);\\n\\n y = uint192(x);\\n }\\n\\n function safeCastTo160(uint256 x) internal pure returns (uint160 y) {\\n require(x < 1 << 160);\\n\\n y = uint160(x);\\n }\\n\\n function safeCastTo128(uint256 x) internal pure returns (uint128 y) {\\n require(x < 1 << 128);\\n\\n y = uint128(x);\\n }\\n\\n function safeCastTo96(uint256 x) internal pure returns (uint96 y) {\\n require(x < 1 << 96);\\n\\n y = uint96(x);\\n }\\n\\n function safeCastTo64(uint256 x) internal pure returns (uint64 y) {\\n require(x < 1 << 64);\\n\\n y = uint64(x);\\n }\\n\\n function safeCastTo32(uint256 x) internal pure returns (uint32 y) {\\n require(x < 1 << 32);\\n\\n y = uint32(x);\\n }\\n\\n function safeCastTo24(uint256 x) internal pure returns (uint24 y) {\\n require(x < 1 << 24);\\n\\n y = uint24(x);\\n }\\n\\n function safeCastTo16(uint256 x) internal pure returns (uint16 y) {\\n require(x < 1 << 16);\\n\\n y = uint16(x);\\n }\\n\\n function safeCastTo8(uint256 x) internal pure returns (uint8 y) {\\n require(x < 1 << 8);\\n\\n y = uint8(x);\\n }\\n}\\n\",\"keccak256\":\"0xb784a14411858036491124e677aecde6d500e695b7a70c74aa8f1001bda2ccab\",\"license\":\"AGPL-3.0-only\"},\"solmate/src/utils/SafeTransferLib.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport {ERC20} from \\\"../tokens/ERC20.sol\\\";\\n\\n/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)\\n/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.\\n/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.\\nlibrary SafeTransferLib {\\n /*//////////////////////////////////////////////////////////////\\n ETH OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function safeTransferETH(address to, uint256 amount) internal {\\n bool success;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Transfer the ETH and store if it succeeded or not.\\n success := call(gas(), to, amount, 0, 0, 0, 0)\\n }\\n\\n require(success, \\\"ETH_TRANSFER_FAILED\\\");\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ERC20 OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function safeTransferFrom(\\n ERC20 token,\\n address from,\\n address to,\\n uint256 amount\\n ) internal {\\n bool success;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Get a pointer to some free memory.\\n let freeMemoryPointer := mload(0x40)\\n\\n // Write the abi-encoded calldata into memory, beginning with the function selector.\\n mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\\n mstore(add(freeMemoryPointer, 4), from) // Append the \\\"from\\\" argument.\\n mstore(add(freeMemoryPointer, 36), to) // Append the \\\"to\\\" argument.\\n mstore(add(freeMemoryPointer, 68), amount) // Append the \\\"amount\\\" argument.\\n\\n success := and(\\n // Set success to whether the call reverted, if not we check it either\\n // returned exactly 1 (can't just be non-zero data), or had no return data.\\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\\n // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.\\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\\n // Counterintuitively, this call must be positioned second to the or() call in the\\n // surrounding and() call or else returndatasize() will be zero during the computation.\\n call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)\\n )\\n }\\n\\n require(success, \\\"TRANSFER_FROM_FAILED\\\");\\n }\\n\\n function safeTransfer(\\n ERC20 token,\\n address to,\\n uint256 amount\\n ) internal {\\n bool success;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Get a pointer to some free memory.\\n let freeMemoryPointer := mload(0x40)\\n\\n // Write the abi-encoded calldata into memory, beginning with the function selector.\\n mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\\n mstore(add(freeMemoryPointer, 4), to) // Append the \\\"to\\\" argument.\\n mstore(add(freeMemoryPointer, 36), amount) // Append the \\\"amount\\\" argument.\\n\\n success := and(\\n // Set success to whether the call reverted, if not we check it either\\n // returned exactly 1 (can't just be non-zero data), or had no return data.\\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\\n // Counterintuitively, this call must be positioned second to the or() call in the\\n // surrounding and() call or else returndatasize() will be zero during the computation.\\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\\n )\\n }\\n\\n require(success, \\\"TRANSFER_FAILED\\\");\\n }\\n\\n function safeApprove(\\n ERC20 token,\\n address to,\\n uint256 amount\\n ) internal {\\n bool success;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Get a pointer to some free memory.\\n let freeMemoryPointer := mload(0x40)\\n\\n // Write the abi-encoded calldata into memory, beginning with the function selector.\\n mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)\\n mstore(add(freeMemoryPointer, 4), to) // Append the \\\"to\\\" argument.\\n mstore(add(freeMemoryPointer, 36), amount) // Append the \\\"amount\\\" argument.\\n\\n success := and(\\n // Set success to whether the call reverted, if not we check it either\\n // returned exactly 1 (can't just be non-zero data), or had no return data.\\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\\n // Counterintuitively, this call must be positioned second to the or() call in the\\n // surrounding and() call or else returndatasize() will be zero during the computation.\\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\\n )\\n }\\n\\n require(success, \\\"APPROVE_FAILED\\\");\\n }\\n}\\n\",\"keccak256\":\"0xbadf3d708cf532b12f75f78a1d423135954b63774a6d4ba15914a551d348db8a\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x6101206040523480156200001257600080fd5b506040516200217e3803806200217e833981016040819052620000359162000239565b80826040518060600160405280602281526020016200215c60229139604051806040016040528060068152602001650eee6ce8aa8960d31b8152508181846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000b1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d791906200028b565b6000620000e584826200035c565b506001620000f483826200035c565b5060ff81166080524660a0526200010a62000185565b60c0525050506001600160a01b0390921660e052505063ffffffff811661010081905280620001394262000221565b62000145919062000428565b6200015191906200045a565b6006805463ffffffff929092166401000000000263ffffffff60201b1990921691909117905550506001600855506200050f565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051620001b9919062000491565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600064010000000082106200023557600080fd5b5090565b600080604083850312156200024d57600080fd5b82516001600160a01b03811681146200026557600080fd5b602084015190925063ffffffff811681146200028057600080fd5b809150509250929050565b6000602082840312156200029e57600080fd5b815160ff81168114620002b057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620002e257607f821691505b6020821081036200030357634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200035757600081815260208120601f850160051c81016020861015620003325750805b601f850160051c820191505b8181101562000353578281556001016200033e565b5050505b505050565b81516001600160401b03811115620003785762000378620002b7565b6200039081620003898454620002cd565b8462000309565b602080601f831160018114620003c85760008415620003af5750858301515b600019600386901b1c1916600185901b17855562000353565b600085815260208120601f198616915b82811015620003f957888601518255948401946001909101908401620003d8565b5085821015620004185787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600063ffffffff808416806200044e57634e487b7160e01b600052601260045260246000fd5b92169190910492915050565b63ffffffff8181168382160280821691908281146200048957634e487b7160e01b600052601160045260246000fd5b505092915050565b6000808354620004a181620002cd565b60018281168015620004bc5760018114620004d25762000503565b60ff198416875282151583028701945062000503565b8760005260208060002060005b85811015620004fa5781548a820152908401908201620004df565b50505082870194505b50929695505050505050565b60805160a05160c05160e05161010051611bc96200059360003960008181610390015281816109f801528181610a3f0152610a840152600081816102f10152818161095501528181610b850152818161116f015281816112330152818161139c01526114e80152600061086d01526000610838015260006102b00152611bc96000f3fe608060405234801561001057600080fd5b50600436106102115760003560e01c806375e077c311610125578063bafedcaa116100ad578063d505accf1161007c578063d505accf146104d6578063d905777e146104e9578063dd62ed3e14610512578063e7ff69f11461053d578063ef8b30f71461055457600080fd5b8063bafedcaa1461047e578063c63d75b61461032b578063c6e6f592146104b0578063ce96cb77146104c357600080fd5b806399530b06116100f457806399530b061461042a578063a9059cbb14610432578063b3d7f6b914610445578063b460af9414610458578063ba0876521461046b57600080fd5b806375e077c3146103dc5780637ecebe00146103ef57806394bf804d1461040f57806395d89b411461042257600080fd5b80633644e515116101a85780636917516b116101775780636917516b146103535780636e553f65146103785780636fcf5e5f1461038b57806370a08231146103b257806372c0c211146103d257600080fd5b80633644e515146102e457806338d52e0f146102ec578063402d267d1461032b5780634cdad5061461034057600080fd5b80630a28a477116101e45780630a28a4771461027c57806318160ddd1461028f57806323b872dd14610298578063313ce567146102ab57600080fd5b806301e1d1141461021657806306fdde031461023157806307a2d13a14610246578063095ea7b314610259575b600080fd5b61021e610567565b6040519081526020015b60405180910390f35b61023961060c565b6040516102289190611712565b61021e610254366004611760565b61069a565b61026c610267366004611795565b6106c7565b6040519015158152602001610228565b61021e61028a366004611760565b610734565b61021e60025481565b61026c6102a63660046117bf565b610754565b6102d27f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff9091168152602001610228565b61021e610834565b6103137f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610228565b61021e6103393660046117fb565b5060001990565b61021e61034e366004611760565b61088f565b6006546103639063ffffffff1681565b60405163ffffffff9091168152602001610228565b61021e610386366004611816565b61089a565b6103637f000000000000000000000000000000000000000000000000000000000000000081565b61021e6103c03660046117fb565b60036020526000908152604090205481565b6103da6108d8565b005b61021e6103ea366004611853565b610b30565b61021e6103fd3660046117fb565b60056020526000908152604090205481565b61021e61041d366004611816565b610c00565b610239610c32565b61021e610c3f565b61026c610440366004611795565b610c52565b61021e610453366004611760565b610cb8565b61021e6104663660046118c4565b610cd7565b61021e6104793660046118c4565b610d16565b60065461049890600160401b90046001600160c01b031681565b6040516001600160c01b039091168152602001610228565b61021e6104be366004611760565b610d4a565b61021e6104d13660046117fb565b610d6a565b6103da6104e4366004611900565b610d8c565b61021e6104f73660046117fb565b6001600160a01b031660009081526003602052604090205490565b61021e61052036600461194e565b600460209081526000928352604080842090915290825290205481565b60065461036390600160201b900463ffffffff1681565b61021e610562366004611760565b610fd5565b600754600654600091906001600160c01b03600160401b8204169063ffffffff600160201b8204811691164282116105b5576105ac6001600160c01b0384168561198e565b94505050505090565b60006105c182846119a1565b63ffffffff168263ffffffff16426105d991906119c5565b6105ec906001600160c01b0387166119d8565b6105f69190611a05565b9050610602818661198e565b9550505050505090565b6000805461061990611a19565b80601f016020809104026020016040519081016040528092919081815260200182805461064590611a19565b80156106925780601f1061066757610100808354040283529160200191610692565b820191906000526020600020905b81548152906001019060200180831161067557829003601f168201915b505050505081565b60025460009080156106be576106b96106b1610567565b849083610fe0565b6106c0565b825b9392505050565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107229086815260200190565b60405180910390a35060015b92915050565b60025460009080156106be576106b98161074c610567565b859190610ffe565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146107b05761078b83826119c5565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906107d89084906119c5565b90915550506001600160a01b0380851660008181526003602052604090819020805487019055519091871690600080516020611b74833981519152906108219087815260200190565b60405180910390a3506001949350505050565b60007f0000000000000000000000000000000000000000000000000000000000000000461461086a57610865611024565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b600061072e8261069a565b60006108a46110be565b600654600160201b900463ffffffff1642106108c2576108c26108d8565b6108cc8383611117565b905061072e6001600855565b600654600160401b90046001600160c01b031660006108f6426111f1565b60065490915063ffffffff600160201b9091048116908216101561092d5760405163127d33e760e21b815260040160405180910390fd5b6007546040516370a0823160e01b81523060048201526000906001600160c01b0385169083907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156109a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c89190611a53565b6109d291906119c5565b6109dc91906119c5565b90506109f16001600160c01b0385168361198e565b60075560007f000000000000000000000000000000000000000000000000000000000000000080610a228187611a6c565b610a2c9190611a89565b610a369190611aac565b9050610a6360147f0000000000000000000000000000000000000000000000000000000000000000611a89565b63ffffffff16610a7385836119a1565b63ffffffff161015610aac57610aa97f000000000000000000000000000000000000000000000000000000000000000082611a6c565b90505b610ab582611207565b63ffffffff828116600160201b81026001600160c01b0393909316600160401b0267ffffffffffffffff191691871691909117919091176006556040517f2fa39aac60d1c94cda4ab0e86ae9c0ffab5b926e5b827a4ccba1d9b5b2ef596e90610b219085815260200190565b60405180910390a25050505050565b60008085610b3e5788610b42565b6000195b60405163d505accf60e01b8152336004820152306024820152604481018290526064810189905260ff8716608482015260a4810186905260c481018590529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d505accf9060e401600060405180830381600087803b158015610bd157600080fd5b505af1158015610be5573d6000803e3d6000fd5b50505050610bf3898961089a565b9998505050505050505050565b6000610c0a6110be565b600654600160201b900463ffffffff164210610c2857610c286108d8565b6108cc8383611219565b6001805461061990611a19565b6000610865670de0b6b3a764000061069a565b33600090815260036020526040812080548391908390610c739084906119c5565b90915550506001600160a01b03831660008181526003602052604090819020805485019055513390600080516020611b74833981519152906107229086815260200190565b60025460009080156106be576106b9610ccf610567565b849083610ffe565b6000610ce16110be565b600654600160201b900463ffffffff164210610cff57610cff6108d8565b610d0a8484846112b5565b90506106c06001600855565b600654600090600160201b900463ffffffff164210610d3757610d376108d8565b610d428484846113c3565b949350505050565b60025460009080156106be576106b981610d62610567565b859190610fe0565b6001600160a01b03811660009081526003602052604081205461072e9061069a565b42841015610de15760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b60006001610ded610834565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610ef9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590610f2f5750876001600160a01b0316816001600160a01b0316145b610f6c5760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b6044820152606401610dd8565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b600061072e82610d4a565b6000826000190484118302158202610ff757600080fd5b5091020490565b600082600019048411830215820261101557600080fd5b50910281810615159190040190565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516110569190611ad4565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6002600854036111105760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610dd8565b6002600855565b600061112283610fd5565b9050806000036111625760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f53484152455360a81b6044820152606401610dd8565b6111976001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308661150f565b6111a18282611599565b60408051848152602081018390526001600160a01b0384169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a361072e83826115f3565b6000600160201b821061120357600080fd5b5090565b6000600160c01b821061120357600080fd5b600061122483610cb8565b905061125b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308461150f565b6112658284611599565b60408051828152602081018590526001600160a01b0384169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a361072e81846115f3565b60006112c084610734565b9050336001600160a01b03831614611330576001600160a01b0382166000908152600460209081526040808320338452909152902054600019811461132e5761130982826119c5565b6001600160a01b03841660009081526004602090815260408083203384529091529020555b505b61133a8482611617565b6113448282611632565b60408051858152602081018390526001600160a01b03808516929086169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a46106c06001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168486611694565b6000336001600160a01b03831614611433576001600160a01b038216600090815260046020908152604080832033845290915290205460001981146114315761140c85826119c5565b6001600160a01b03841660009081526004602090815260408083203384529091529020555b505b61143c8461088f565b90508060000361147c5760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f41535345545360a81b6044820152606401610dd8565b6114868185611617565b6114908285611632565b60408051828152602081018690526001600160a01b03808516929086169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a46106c06001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168483611694565b60006040516323b872dd60e01b81528460048201528360248201528260448201526020600060648360008a5af13d15601f3d11600160005114161716915050806115925760405162461bcd60e51b81526020600482015260146024820152731514905394d1915497d19493d357d1905253115160621b6044820152606401610dd8565b5050505050565b80600260008282546115ab919061198e565b90915550506001600160a01b038216600081815260036020908152604080832080548601905551848152600080516020611b7483398151915291015b60405180910390a35050565b8160076000828254611605919061198e565b909155506116139050828282565b5050565b816007600082825461162991906119c5565b90915550505050565b6001600160a01b0382166000908152600360205260408120805483929061165a9084906119c5565b90915550506002805482900390556040518181526000906001600160a01b03841690600080516020611b74833981519152906020016115e7565b600060405163a9059cbb60e01b8152836004820152826024820152602060006044836000895af13d15601f3d116001600051141617169150508061170c5760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610dd8565b50505050565b600060208083528351808285015260005b8181101561173f57858101830151858201604001528201611723565b506000604082860101526040601f19601f8301168501019250505092915050565b60006020828403121561177257600080fd5b5035919050565b80356001600160a01b038116811461179057600080fd5b919050565b600080604083850312156117a857600080fd5b6117b183611779565b946020939093013593505050565b6000806000606084860312156117d457600080fd5b6117dd84611779565b92506117eb60208501611779565b9150604084013590509250925092565b60006020828403121561180d57600080fd5b6106c082611779565b6000806040838503121561182957600080fd5b8235915061183960208401611779565b90509250929050565b803560ff8116811461179057600080fd5b600080600080600080600060e0888a03121561186e57600080fd5b8735965061187e60208901611779565b9550604088013594506060880135801515811461189a57600080fd5b93506118a860808901611842565b925060a0880135915060c0880135905092959891949750929550565b6000806000606084860312156118d957600080fd5b833592506118e960208501611779565b91506118f760408501611779565b90509250925092565b600080600080600080600060e0888a03121561191b57600080fd5b61192488611779565b965061193260208901611779565b955060408801359450606088013593506118a860808901611842565b6000806040838503121561196157600080fd5b61196a83611779565b915061183960208401611779565b634e487b7160e01b600052601160045260246000fd5b8082018082111561072e5761072e611978565b63ffffffff8281168282160390808211156119be576119be611978565b5092915050565b8181038181111561072e5761072e611978565b808202811582820484141761072e5761072e611978565b634e487b7160e01b600052601260045260246000fd5b600082611a1457611a146119ef565b500490565b600181811c90821680611a2d57607f821691505b602082108103611a4d57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611a6557600080fd5b5051919050565b63ffffffff8181168382160190808211156119be576119be611978565b600063ffffffff80841680611aa057611aa06119ef565b92169190910492915050565b63ffffffff818116838216028082169190828114611acc57611acc611978565b505092915050565b600080835481600182811c915080831680611af057607f831692505b60208084108203611b0f57634e487b7160e01b86526022600452602486fd5b818015611b235760018114611b3857611b65565b60ff1986168952841515850289019650611b65565b60008a81526020902060005b86811015611b5d5781548b820152908501908301611b44565b505084890196505b50949897505050505050505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212205d4f6ebc66ef8259072bf32a7ff810facb55707c9e0d95b850db77239cb316e364736f6c6343000814003357726170706564205368617265645374616b6520476f7665726e6564204574686572", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102115760003560e01c806375e077c311610125578063bafedcaa116100ad578063d505accf1161007c578063d505accf146104d6578063d905777e146104e9578063dd62ed3e14610512578063e7ff69f11461053d578063ef8b30f71461055457600080fd5b8063bafedcaa1461047e578063c63d75b61461032b578063c6e6f592146104b0578063ce96cb77146104c357600080fd5b806399530b06116100f457806399530b061461042a578063a9059cbb14610432578063b3d7f6b914610445578063b460af9414610458578063ba0876521461046b57600080fd5b806375e077c3146103dc5780637ecebe00146103ef57806394bf804d1461040f57806395d89b411461042257600080fd5b80633644e515116101a85780636917516b116101775780636917516b146103535780636e553f65146103785780636fcf5e5f1461038b57806370a08231146103b257806372c0c211146103d257600080fd5b80633644e515146102e457806338d52e0f146102ec578063402d267d1461032b5780634cdad5061461034057600080fd5b80630a28a477116101e45780630a28a4771461027c57806318160ddd1461028f57806323b872dd14610298578063313ce567146102ab57600080fd5b806301e1d1141461021657806306fdde031461023157806307a2d13a14610246578063095ea7b314610259575b600080fd5b61021e610567565b6040519081526020015b60405180910390f35b61023961060c565b6040516102289190611712565b61021e610254366004611760565b61069a565b61026c610267366004611795565b6106c7565b6040519015158152602001610228565b61021e61028a366004611760565b610734565b61021e60025481565b61026c6102a63660046117bf565b610754565b6102d27f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff9091168152602001610228565b61021e610834565b6103137f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610228565b61021e6103393660046117fb565b5060001990565b61021e61034e366004611760565b61088f565b6006546103639063ffffffff1681565b60405163ffffffff9091168152602001610228565b61021e610386366004611816565b61089a565b6103637f000000000000000000000000000000000000000000000000000000000000000081565b61021e6103c03660046117fb565b60036020526000908152604090205481565b6103da6108d8565b005b61021e6103ea366004611853565b610b30565b61021e6103fd3660046117fb565b60056020526000908152604090205481565b61021e61041d366004611816565b610c00565b610239610c32565b61021e610c3f565b61026c610440366004611795565b610c52565b61021e610453366004611760565b610cb8565b61021e6104663660046118c4565b610cd7565b61021e6104793660046118c4565b610d16565b60065461049890600160401b90046001600160c01b031681565b6040516001600160c01b039091168152602001610228565b61021e6104be366004611760565b610d4a565b61021e6104d13660046117fb565b610d6a565b6103da6104e4366004611900565b610d8c565b61021e6104f73660046117fb565b6001600160a01b031660009081526003602052604090205490565b61021e61052036600461194e565b600460209081526000928352604080842090915290825290205481565b60065461036390600160201b900463ffffffff1681565b61021e610562366004611760565b610fd5565b600754600654600091906001600160c01b03600160401b8204169063ffffffff600160201b8204811691164282116105b5576105ac6001600160c01b0384168561198e565b94505050505090565b60006105c182846119a1565b63ffffffff168263ffffffff16426105d991906119c5565b6105ec906001600160c01b0387166119d8565b6105f69190611a05565b9050610602818661198e565b9550505050505090565b6000805461061990611a19565b80601f016020809104026020016040519081016040528092919081815260200182805461064590611a19565b80156106925780601f1061066757610100808354040283529160200191610692565b820191906000526020600020905b81548152906001019060200180831161067557829003601f168201915b505050505081565b60025460009080156106be576106b96106b1610567565b849083610fe0565b6106c0565b825b9392505050565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107229086815260200190565b60405180910390a35060015b92915050565b60025460009080156106be576106b98161074c610567565b859190610ffe565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146107b05761078b83826119c5565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906107d89084906119c5565b90915550506001600160a01b0380851660008181526003602052604090819020805487019055519091871690600080516020611b74833981519152906108219087815260200190565b60405180910390a3506001949350505050565b60007f0000000000000000000000000000000000000000000000000000000000000000461461086a57610865611024565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b600061072e8261069a565b60006108a46110be565b600654600160201b900463ffffffff1642106108c2576108c26108d8565b6108cc8383611117565b905061072e6001600855565b600654600160401b90046001600160c01b031660006108f6426111f1565b60065490915063ffffffff600160201b9091048116908216101561092d5760405163127d33e760e21b815260040160405180910390fd5b6007546040516370a0823160e01b81523060048201526000906001600160c01b0385169083907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156109a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c89190611a53565b6109d291906119c5565b6109dc91906119c5565b90506109f16001600160c01b0385168361198e565b60075560007f000000000000000000000000000000000000000000000000000000000000000080610a228187611a6c565b610a2c9190611a89565b610a369190611aac565b9050610a6360147f0000000000000000000000000000000000000000000000000000000000000000611a89565b63ffffffff16610a7385836119a1565b63ffffffff161015610aac57610aa97f000000000000000000000000000000000000000000000000000000000000000082611a6c565b90505b610ab582611207565b63ffffffff828116600160201b81026001600160c01b0393909316600160401b0267ffffffffffffffff191691871691909117919091176006556040517f2fa39aac60d1c94cda4ab0e86ae9c0ffab5b926e5b827a4ccba1d9b5b2ef596e90610b219085815260200190565b60405180910390a25050505050565b60008085610b3e5788610b42565b6000195b60405163d505accf60e01b8152336004820152306024820152604481018290526064810189905260ff8716608482015260a4810186905260c481018590529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d505accf9060e401600060405180830381600087803b158015610bd157600080fd5b505af1158015610be5573d6000803e3d6000fd5b50505050610bf3898961089a565b9998505050505050505050565b6000610c0a6110be565b600654600160201b900463ffffffff164210610c2857610c286108d8565b6108cc8383611219565b6001805461061990611a19565b6000610865670de0b6b3a764000061069a565b33600090815260036020526040812080548391908390610c739084906119c5565b90915550506001600160a01b03831660008181526003602052604090819020805485019055513390600080516020611b74833981519152906107229086815260200190565b60025460009080156106be576106b9610ccf610567565b849083610ffe565b6000610ce16110be565b600654600160201b900463ffffffff164210610cff57610cff6108d8565b610d0a8484846112b5565b90506106c06001600855565b600654600090600160201b900463ffffffff164210610d3757610d376108d8565b610d428484846113c3565b949350505050565b60025460009080156106be576106b981610d62610567565b859190610fe0565b6001600160a01b03811660009081526003602052604081205461072e9061069a565b42841015610de15760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b60006001610ded610834565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610ef9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590610f2f5750876001600160a01b0316816001600160a01b0316145b610f6c5760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b6044820152606401610dd8565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b600061072e82610d4a565b6000826000190484118302158202610ff757600080fd5b5091020490565b600082600019048411830215820261101557600080fd5b50910281810615159190040190565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516110569190611ad4565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6002600854036111105760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610dd8565b6002600855565b600061112283610fd5565b9050806000036111625760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f53484152455360a81b6044820152606401610dd8565b6111976001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308661150f565b6111a18282611599565b60408051848152602081018390526001600160a01b0384169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a361072e83826115f3565b6000600160201b821061120357600080fd5b5090565b6000600160c01b821061120357600080fd5b600061122483610cb8565b905061125b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308461150f565b6112658284611599565b60408051828152602081018590526001600160a01b0384169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a361072e81846115f3565b60006112c084610734565b9050336001600160a01b03831614611330576001600160a01b0382166000908152600460209081526040808320338452909152902054600019811461132e5761130982826119c5565b6001600160a01b03841660009081526004602090815260408083203384529091529020555b505b61133a8482611617565b6113448282611632565b60408051858152602081018390526001600160a01b03808516929086169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a46106c06001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168486611694565b6000336001600160a01b03831614611433576001600160a01b038216600090815260046020908152604080832033845290915290205460001981146114315761140c85826119c5565b6001600160a01b03841660009081526004602090815260408083203384529091529020555b505b61143c8461088f565b90508060000361147c5760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f41535345545360a81b6044820152606401610dd8565b6114868185611617565b6114908285611632565b60408051828152602081018690526001600160a01b03808516929086169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a46106c06001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168483611694565b60006040516323b872dd60e01b81528460048201528360248201528260448201526020600060648360008a5af13d15601f3d11600160005114161716915050806115925760405162461bcd60e51b81526020600482015260146024820152731514905394d1915497d19493d357d1905253115160621b6044820152606401610dd8565b5050505050565b80600260008282546115ab919061198e565b90915550506001600160a01b038216600081815260036020908152604080832080548601905551848152600080516020611b7483398151915291015b60405180910390a35050565b8160076000828254611605919061198e565b909155506116139050828282565b5050565b816007600082825461162991906119c5565b90915550505050565b6001600160a01b0382166000908152600360205260408120805483929061165a9084906119c5565b90915550506002805482900390556040518181526000906001600160a01b03841690600080516020611b74833981519152906020016115e7565b600060405163a9059cbb60e01b8152836004820152826024820152602060006044836000895af13d15601f3d116001600051141617169150508061170c5760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610dd8565b50505050565b600060208083528351808285015260005b8181101561173f57858101830151858201604001528201611723565b506000604082860101526040601f19601f8301168501019250505092915050565b60006020828403121561177257600080fd5b5035919050565b80356001600160a01b038116811461179057600080fd5b919050565b600080604083850312156117a857600080fd5b6117b183611779565b946020939093013593505050565b6000806000606084860312156117d457600080fd5b6117dd84611779565b92506117eb60208501611779565b9150604084013590509250925092565b60006020828403121561180d57600080fd5b6106c082611779565b6000806040838503121561182957600080fd5b8235915061183960208401611779565b90509250929050565b803560ff8116811461179057600080fd5b600080600080600080600060e0888a03121561186e57600080fd5b8735965061187e60208901611779565b9550604088013594506060880135801515811461189a57600080fd5b93506118a860808901611842565b925060a0880135915060c0880135905092959891949750929550565b6000806000606084860312156118d957600080fd5b833592506118e960208501611779565b91506118f760408501611779565b90509250925092565b600080600080600080600060e0888a03121561191b57600080fd5b61192488611779565b965061193260208901611779565b955060408801359450606088013593506118a860808901611842565b6000806040838503121561196157600080fd5b61196a83611779565b915061183960208401611779565b634e487b7160e01b600052601160045260246000fd5b8082018082111561072e5761072e611978565b63ffffffff8281168282160390808211156119be576119be611978565b5092915050565b8181038181111561072e5761072e611978565b808202811582820484141761072e5761072e611978565b634e487b7160e01b600052601260045260246000fd5b600082611a1457611a146119ef565b500490565b600181811c90821680611a2d57607f821691505b602082108103611a4d57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611a6557600080fd5b5051919050565b63ffffffff8181168382160190808211156119be576119be611978565b600063ffffffff80841680611aa057611aa06119ef565b92169190910492915050565b63ffffffff818116838216028082169190828114611acc57611acc611978565b505092915050565b600080835481600182811c915080831680611af057607f831692505b60208084108203611b0f57634e487b7160e01b86526022600452602486fd5b818015611b235760018114611b3857611b65565b60ff1986168952841515850289019650611b65565b60008a81526020902060005b86811015611b5d5781548b820152908501908301611b44565b505084890196505b50949897505050505050505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212205d4f6ebc66ef8259072bf32a7ff810facb55707c9e0d95b850db77239cb316e364736f6c63430008140033", + "devdoc": { + "details": "Exchange rate between sgETH and ssgETH floats, you can convert your ssgETH for more sgETH over time. Exchange rate increases as validator rewardSplitter mints new sgETH corresponding to the staking yield and drops it into this vault (ssgETH contract). There is a short time period, “cycles” which the exchange rate increases linearly over. This is to prevent gaming the exchange rate (MEV). The cycles are constant length, but calling syncRewards slightly into a would-be cycle keeps the same would-be endpoint (so cycle ends are every X seconds). Someone must call syncRewards, which queues any new ssgETH in the contract to be added to the redeemable amount. Mint vs Deposit mint() - deposit targeting a specific number of ssgETH out deposit() - deposit knowing a specific number of ssgETH in ", + "errors": { + "SyncError()": [ + { + "details": "thrown when syncing before cycle ends." + } + ] + }, + "events": { + "NewRewardsCycle(uint32,uint256)": { + "details": "emit every time a new rewards cycle starts" + } + }, + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "deposit(uint256,address)": { + "notice": "inlines syncRewards with deposits when able" + }, + "depositWithSignature(uint256,address,uint256,bool,uint8,bytes32,bytes32)": { + "notice": "Approve and deposit() in one transaction" + }, + "lastRewardAmount()": { + "notice": "the amount of rewards distributed in a the most recent cycle." + }, + "lastSync()": { + "notice": "the effective start of the current cycle" + }, + "mint(uint256,address)": { + "notice": "inlines syncRewards with mints when able" + }, + "pricePerShare()": { + "notice": "How much sgETH is 1E18 ssgETH worth. Price is in ETH, not USD" + }, + "redeem(uint256,address,address)": { + "notice": "inlines syncRewards with redemptions when able" + }, + "rewardsCycleEnd()": { + "notice": "the end of the current cycle. Will always be evenly divisible by `rewardsCycleLength`." + }, + "rewardsCycleLength()": { + "notice": "the maximum length of a rewards cycle" + }, + "syncRewards()": { + "notice": "Distributes rewards to xERC4626 holders. All surplus `asset` balance of the contract over the internal balance becomes queued for the next cycle." + }, + "totalAssets()": { + "notice": "Compute the amount of tokens available to share holders. Increases linearly during a reward distribution period from the sync call, not the cycle start." + }, + "withdraw(uint256,address,address)": { + "notice": "inlines syncRewards with withdrawals when able" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 19389, + "contract": "contracts/v2/core/WSGEth.sol:WSGETH", + "label": "name", + "offset": 0, + "slot": "0", + "type": "t_string_storage" + }, + { + "astId": 19391, + "contract": "contracts/v2/core/WSGEth.sol:WSGETH", + "label": "symbol", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 19395, + "contract": "contracts/v2/core/WSGEth.sol:WSGETH", + "label": "totalSupply", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 19399, + "contract": "contracts/v2/core/WSGEth.sol:WSGETH", + "label": "balanceOf", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 19405, + "contract": "contracts/v2/core/WSGEth.sol:WSGETH", + "label": "allowance", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 19413, + "contract": "contracts/v2/core/WSGEth.sol:WSGETH", + "label": "nonces", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 18069, + "contract": "contracts/v2/core/WSGEth.sol:WSGETH", + "label": "lastSync", + "offset": 0, + "slot": "6", + "type": "t_uint32" + }, + { + "astId": 18072, + "contract": "contracts/v2/core/WSGEth.sol:WSGETH", + "label": "rewardsCycleEnd", + "offset": 4, + "slot": "6", + "type": "t_uint32" + }, + { + "astId": 18075, + "contract": "contracts/v2/core/WSGEth.sol:WSGETH", + "label": "lastRewardAmount", + "offset": 8, + "slot": "6", + "type": "t_uint192" + }, + { + "astId": 18077, + "contract": "contracts/v2/core/WSGEth.sol:WSGETH", + "label": "storedTotalAssets", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 4774, + "contract": "contracts/v2/core/WSGEth.sol:WSGETH", + "label": "_status", + "offset": 0, + "slot": "8", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint192": { + "encoding": "inplace", + "label": "uint192", + "numberOfBytes": "24" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + } + } + } +} \ No newline at end of file diff --git a/deployments/localhost/WithdrawalQueue.json b/deployments/localhost/WithdrawalQueue.json new file mode 100644 index 0000000..7dbd35d --- /dev/null +++ b/deployments/localhost/WithdrawalQueue.json @@ -0,0 +1,1099 @@ +{ + "address": "0x9fa2d3eEa3b22B86AD8dCCBa8392E13180962f36", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_minter", + "type": "address" + }, + { + "internalType": "address", + "name": "_wsgEth", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_epochLength", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "IsNotPaused", + "type": "error" + }, + { + "inputs": [], + "name": "IsPaused", + "type": "error" + }, + { + "inputs": [], + "name": "PermissionDenied", + "type": "error" + }, + { + "inputs": [], + "name": "TooEarly", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "value", + "type": "bool" + } + ], + "name": "OperatorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "item", + "type": "uint16" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "requester", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "requester", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "RedeemRequest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "item", + "type": "uint16" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINTER", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WSGETH", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "balanceOfSelf", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountToWithdraw", + "type": "uint256" + } + ], + "name": "_checkWithdraw", + "outputs": [ + { + "internalType": "bool", + "name": "withdrawalAllowed", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "balanceOfSelf", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountToWithdraw", + "type": "uint256" + } + ], + "name": "_isWithdrawalAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "claimableRedeemRequest", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epochLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "requester", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isOperator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "pendingRedeemRequest", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "requester", + "type": "address" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "redeemRequests", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "requester", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "requestRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "setEpochLength", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setOperator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "func", + "type": "uint16" + } + ], + "name": "togglePause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssetsOut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userEntries", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blocknum", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x8a0b153825aea3340a345696bc9dc66aa5a133348fd513494e9d127003038218", + "receipt": { + "to": null, + "from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "contractAddress": "0x9fa2d3eEa3b22B86AD8dCCBa8392E13180962f36", + "transactionIndex": 0, + "gasUsed": "1512469", + "logsBloom": "0x00000004040040000000000000000000000000000000000000000000000000000000000000008000000000000000000010020000000000000000000000200000000000400000000000000000000000000000100200000000000000000000000000000000000000010000000104000000000000000800000000000000000000000000000000000000000000000000040000040000000000000000000000000000020000000000000000000000000000000000000000000002001000000000000000000000000000200000000000000000000000002000000100000000000000000010000000000000000000000000000000000000000000000004000000000000", + "blockHash": "0x70ded0ce7ef8ff326f3e4150d50528775c80d0ed743a7ff0be3b6ccd07cf35fd", + "transactionHash": "0x8a0b153825aea3340a345696bc9dc66aa5a133348fd513494e9d127003038218", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 6233289, + "transactionHash": "0x8a0b153825aea3340a345696bc9dc66aa5a133348fd513494e9d127003038218", + "address": "0x61A89BF0Ed0c2d1c365Db15660880C3d227A05D3", + "topics": [ + "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "0x0000000000000000000000009fa2d3eea3b22b86ad8dccba8392e13180962f36", + "0x00000000000000000000000006d889f4678058d95058ef431035b2f5d4a27b1a" + ], + "data": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "logIndex": 0, + "blockHash": "0x70ded0ce7ef8ff326f3e4150d50528775c80d0ed743a7ff0be3b6ccd07cf35fd" + }, + { + "transactionIndex": 0, + "blockNumber": 6233289, + "transactionHash": "0x8a0b153825aea3340a345696bc9dc66aa5a133348fd513494e9d127003038218", + "address": "0x9fa2d3eEa3b22B86AD8dCCBa8392E13180962f36", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf", + "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266", + "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0x70ded0ce7ef8ff326f3e4150d50528775c80d0ed743a7ff0be3b6ccd07cf35fd" + } + ], + "blockNumber": 6233289, + "cumulativeGasUsed": "1512469", + "status": 1, + "byzantium": true + }, + "args": [ + "0x06d889F4678058D95058Ef431035b2f5d4A27B1a", + "0x61A89BF0Ed0c2d1c365Db15660880C3d227A05D3", + 1 + ], + "numDeployments": 1, + "solcInputHash": "5216db61c74af7c383b71388fa6b77a7", + "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_minter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wsgEth\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_epochLength\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IsNotPaused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IsPaused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PermissionDenied\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooEarly\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"value\",\"type\":\"bool\"}],\"name\":\"OperatorSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"item\",\"type\":\"uint16\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"Redeem\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"RedeemRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"item\",\"type\":\"uint16\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GOV\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINTER\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WSGETH\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"balanceOfSelf\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"_checkWithdraw\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"withdrawalAllowed\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"balanceOfSelf\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"_isWithdrawalAllowed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"claimableRedeemRequest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"epochLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"pendingRedeemRequest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"}],\"name\":\"redeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"redeemRequests\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"requestRedeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"setEpochLength\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"func\",\"type\":\"uint16\"}],\"name\":\"togglePause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalAssetsOut\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"userEntries\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blocknum\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"@ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\",\"details\":\"- ERC-7540 inspired withdrawal contract This contract is designed to be used with SharedDepositMinterV2 contract As a module extension that adds 7540 methods requestRedeem and redeem Example flow -> user calls requestRedeem(user, user, userShares) user calls setOperator(admin OR protocol provided keeper, true) admin can now call redeem on the users behalf if needed after epoch user calls redeem(user, user, userShares) after waiting for epoch Caveats: If the user requests another redemption, before fulfillment, this resets the epoch length clock for their request Basic upgrade path: 1. Call togglePause(1), this disables the requestRedeem fn so no new requests 2. Deploy new contract, direct users to it 3. Fulfill any remaining redeemRequests i.e. totalPendingRequest, for all RedeemRequest events from requestsFulfilled to requestsCreated\",\"events\":{\"Paused(address,uint16)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"},\"Unpaused(address,uint16)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"title\":\"WithdrawalQueue\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/v2/core/WithdrawalQueue.sol\":\"WithdrawalQueue\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(account),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0dd6e52cb394d7f5abe5dca2d4908a6be40417914720932de757de34a99ab87f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0x6ebf1944ab804b8660eb6fc52f9fe84588cee01c2566a69023e59497e7d27f45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\nimport \\\"../token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n *\\n * _Available since v4.7._\\n */\\ninterface IERC4626 is IERC20, IERC20Metadata {\\n event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed sender,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n *\\n * - MUST be an ERC-20 token contract.\\n * - MUST NOT revert.\\n */\\n function asset() external view returns (address assetTokenAddress);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n *\\n * - SHOULD include any compounding that occurs from yield.\\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT revert.\\n */\\n function totalAssets() external view returns (uint256 totalManagedAssets);\\n\\n /**\\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToShares(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n * through a deposit call.\\n *\\n * - MUST return a limited value if receiver is subject to some deposit limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n * - MUST NOT revert.\\n */\\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\\n * in the same transaction.\\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * deposit execution, and are accounted for during deposit.\\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\\n * - MUST return a limited value if receiver is subject to some mint limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n * - MUST NOT revert.\\n */\\n function maxMint(address receiver) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\\n * same transaction.\\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\\n * would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\\n */\\n function previewMint(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\\n * execution, and are accounted for during mint.\\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0x5a173dcd1c1f0074e4df6a9cdab3257e17f2e64f7b8f30ca9e17a8c5ea250e1c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract Pausable is Context {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n constructor() {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n _requireNotPaused();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n _requirePaused();\\n _;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Throws if the contract is paused.\\n */\\n function _requireNotPaused() internal view virtual {\\n require(!paused(), \\\"Pausable: paused\\\");\\n }\\n\\n /**\\n * @dev Throws if the contract is not paused.\\n */\\n function _requirePaused() internal view virtual {\\n require(paused(), \\\"Pausable: not paused\\\");\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n}\\n\",\"keccak256\":\"0x0849d93b16c9940beb286a7864ed02724b248b93e0d80ef6355af5ef15c64773\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == _ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/v2/core/SharedDepositMinterV2.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.20;\\n\\n/// @title SharedDepositMinterV2 - minter for ETH LSD\\n/// @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\\n// v1 sharedstake veth2 minter with some code removed\\n// user deposits eth to get minted token\\n// The contract cannot move user ETH outside unless\\n// 1. the user redeems 1:1\\n// 2. the depositToEth2 or depositToEth2Batch fns are called which allow moving ETH to the mainnet deposit contract only\\n// 3. The contract allows permissioned external actors to supply validator public keys\\n// 4. Who's allowed to deposit how many validators is governed outside this contract\\n// 5. The ability to provision validators for user ETH is portioned out by the DAO\\n\\n// Changes\\n/**\\n- Custom errors instead of revert strings\\n- Granular management via AccessControl with GOV and NOR roles. Node operator can only deploy validators\\n- Refactored to allow users to specify destination address for fns - for zaps\\n- Added deposit+stake/unstake+withdraw combo convenience routes\\n- Refactored fee calc out to external contract\\n*/\\nimport {IFeeCalc} from \\\"../interfaces/IFeeCalc.sol\\\";\\nimport {IERC20MintableBurnable} from \\\"../interfaces/IERC20MintableBurnable.sol\\\";\\nimport {IERC4626} from \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\n\\nimport {AccessControl} from \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {Pausable} from \\\"@openzeppelin/contracts/security/Pausable.sol\\\";\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport {ETH2DepositWithdrawalCredentials} from \\\"../lib/ETH2DepositWithdrawalCredentials.sol\\\";\\n\\n/// @title SharedDepositMinterV2\\n/// @author ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\\n/// @notice Mints LSD tokens for ETH deposited to the contract. Handles the depositing of ETH to the ETH2 deposit contract and validator creation\\n/// @dev Deployment params: \\n/// - addresses : [feeCalc, sgeth, wsgeth, gov]\\ncontract SharedDepositMinterV2 is AccessControl, Pausable, ReentrancyGuard, ETH2DepositWithdrawalCredentials {\\n /* ========== STATE VARIABLES ========== */\\n uint256 public adminFee;\\n uint256 public numValidators;\\n uint256 public costPerValidator;\\n\\n // The validator shares created by this shared stake contract. 1 share costs >= 1 eth\\n uint256 public curValidatorShares; //initialized to 0\\n\\n // The number of times the deposit to eth2 contract has been called to create validators\\n uint256 public validatorsCreated; //initialized to 0\\n\\n // Total accrued admin fee\\n uint256 public adminFeeTotal; //initialized to 0\\n\\n // Its hard to exactly hit the max deposit amount with small shares. this allows a small bit of overflow room\\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token via a user withdraw\\n uint256 public buffer;\\n\\n // Flash loan tokenomic protection in case of changes in admin fee with future lots\\n bool public refundFeesOnWithdraw; //initialized to false\\n\\n // NEW\\n IERC20MintableBurnable private immutable _SGETH;\\n IERC4626 private immutable _WSGETH;\\n IFeeCalc private _feeCalc;\\n\\n bytes32 public constant NOR = keccak256(\\\"NOR\\\"); // Node operator for deploying validators\\n bytes32 public constant GOV = keccak256(\\\"GOV\\\"); // Governance for settings - normally timelock controlled by multisig\\n\\n //errors\\n error AmountTooHigh();\\n error NoValidators();\\n\\n constructor(\\n uint256 _numValidators,\\n uint256 _adminFee,\\n address[] memory addresses\\n ) AccessControl() Pausable() ReentrancyGuard() ETH2DepositWithdrawalCredentials(addresses[4]) {\\n _feeCalc = IFeeCalc(addresses[0]);\\n _SGETH = IERC20MintableBurnable(addresses[1]);\\n _WSGETH = IERC4626(addresses[2]);\\n\\n _SGETH.approve(address(_WSGETH), 2 ** 256 - 1); // max approve wsgeth for deposit and stake\\n\\n adminFee = _adminFee; // Admin and infra fees\\n numValidators = _numValidators; // The number of validators to create in this lot. Sets a max limit on deposits\\n\\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token\\n buffer = 10 * 1e18; // roughly equal to 10 eth.\\n\\n costPerValidator = (32 * 1e18) + adminFee;\\n\\n _grantRole(NOR, msg.sender);\\n _grantRole(GOV, addresses[3]); // deployer will need it to set withdrawal creds. since the non-custodial withdrawal path depends on the minter.\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n DEPOSIT/WITHDRAWAL LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n // USER INTERACTIONS\\n /*\\n Shares minted = Z\\n Principal deposit input = P\\n AdminFee = a\\n costPerValidator = 32 + a\\n AdminFee as percent in 1e18 = a% = (a / costPerValidator) * 1e18\\n AdminFee on tx in 1e18 = (P * a% / 1e18)\\n\\n on deposit:\\n P - (P * a%) = Z\\n\\n on withdraw with admin fee refund:\\n P = Z / (1 - a%)\\n P = Z - Z*a%\\n */\\n\\n function deposit() external payable {\\n _deposit(msg.sender);\\n }\\n\\n function depositFor(address dest) external payable {\\n _deposit(dest);\\n }\\n\\n function depositAndStake() external payable {\\n _WSGETH.deposit(_deposit(address(this)), msg.sender);\\n }\\n\\n function depositAndStakeFor(address dest) external payable {\\n _WSGETH.deposit(_deposit(address(this)), dest);\\n }\\n\\n function withdraw(uint256 amount) external {\\n _withdraw(amount, msg.sender, msg.sender);\\n }\\n\\n function withdrawTo(uint256 amount, address dest) external {\\n _withdraw(amount, msg.sender, dest);\\n }\\n\\n function unstakeAndWithdraw(uint256 amount, address dest) external {\\n _withdraw(_WSGETH.redeem(amount, address(this), msg.sender), address(this), dest);\\n }\\n\\n // migration function to accept old monies and copy over state\\n // users should not use this as it just donates the money without minting veth or tracking donations\\n function donate() external payable {} // solhint-disable-line\\n\\n /*//////////////////////////////////////////////////////////////\\n ADMIN LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n // Batch deposit eth to the eth2 contract with preset creds\\n // Data needs to be verified offchain to save gas\\n function batchDepositToEth2(\\n bytes[] calldata pubkeys,\\n bytes[] calldata signatures,\\n bytes32[] calldata depositDataRoots\\n ) external onlyRole(NOR) {\\n if (address(this).balance < (_depositAmount * pubkeys.length)) {\\n revert AmountTooHigh(); // Not enough bal in contract to deploy all validators\\n }\\n _batchDeposit(pubkeys, signatures, depositDataRoots);\\n validatorsCreated = validatorsCreated + pubkeys.length;\\n }\\n\\n function setWithdrawalCredential(bytes memory _newWithdrawalCreds) external onlyRole(NOR) {\\n // can only be called once\\n _setWithdrawalCredential(_newWithdrawalCreds);\\n }\\n\\n // Slashes the onchain staked sgETH to mirror CL validator slashings\\n // modifies wsgeth virtual price\\n function slash(uint256 amt) external onlyRole(GOV) {\\n if (amt > curValidatorShares) {\\n revert AmountTooHigh(); // Cannot slash more than minted\\n }\\n _SGETH.burn(address(_WSGETH), amt);\\n }\\n\\n // Set fee calc address. if addr = 0 then fees are assumed to be 0\\n function setFeeCalc(address _feeCalculatorAddr) external onlyRole(GOV) {\\n _feeCalc = IFeeCalc(_feeCalculatorAddr);\\n }\\n\\n function togglePause() external onlyRole(GOV) {\\n bool paused = paused();\\n if (paused) {\\n _unpause();\\n } else {\\n _pause();\\n }\\n }\\n\\n // Used to migrate state over to new contract\\n function migrateShares(uint256 shares) external onlyRole(GOV) {\\n curValidatorShares = shares;\\n }\\n\\n function toggleWithdrawRefund() external onlyRole(GOV) {\\n refundFeesOnWithdraw = !refundFeesOnWithdraw;\\n }\\n\\n function setNumValidators(uint256 _numValidators) external onlyRole(GOV) {\\n if (_numValidators > 0) {\\n numValidators = _numValidators;\\n } else {\\n revert NoValidators();\\n }\\n }\\n\\n function withdrawAdminFee(uint256 amount) external onlyRole(GOV) {\\n address payable sender = payable(msg.sender);\\n if (amount == 0) {\\n amount = adminFeeTotal;\\n }\\n if (amount > adminFeeTotal) {\\n revert AmountTooHigh();\\n }\\n adminFeeTotal = adminFeeTotal - amount;\\n Address.sendValue(sender, amount);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ACCOUNTING LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function remainingSpaceInEpoch() external view returns (uint256) {\\n // Helpful view function to gauge how much the user can send to the contract when it is near full\\n uint256 remainingShares = maxValidatorShares() - curValidatorShares;\\n uint256 valBeforeAdmin = (remainingShares * 1e18) / (((1 * 1e18) - (adminFee * 1e18) / costPerValidator));\\n return valBeforeAdmin;\\n }\\n\\n function maxValidatorShares() public view returns (uint256) {\\n return 32 * 1e18 * numValidators;\\n }\\n\\n function _depositAccounting() internal returns (uint256 value) {\\n // input is whole, not / 1e18 , i.e. in 1 = 1 eth send when from etherscan\\n value = msg.value;\\n uint256 fee;\\n\\n if (address(_feeCalc) != address(0)) {\\n (value, fee) = _feeCalc.processDeposit(value, msg.sender);\\n adminFeeTotal = adminFeeTotal + fee;\\n }\\n\\n uint256 newShareTotal = curValidatorShares + value;\\n\\n if (newShareTotal > buffer + maxValidatorShares()) {\\n revert AmountTooHigh();\\n }\\n curValidatorShares = newShareTotal;\\n }\\n\\n function _withdrawAccounting(uint256 amount) internal returns (uint256) {\\n uint256 fee;\\n if (address(_feeCalc) != address(0)) {\\n (amount, fee) = _feeCalc.processWithdraw(amount, msg.sender);\\n if (refundFeesOnWithdraw) {\\n adminFeeTotal = adminFeeTotal - fee;\\n } else {\\n adminFeeTotal = adminFeeTotal + fee;\\n }\\n }\\n if (address(this).balance < (amount + adminFeeTotal)) {\\n revert AmountTooHigh();\\n }\\n\\n curValidatorShares = curValidatorShares - amount;\\n return amount;\\n }\\n\\n function _deposit(address dest) internal nonReentrant whenNotPaused returns (uint256 amt) {\\n amt = _depositAccounting();\\n _SGETH.mint(dest, amt);\\n }\\n\\n function _withdraw(uint256 amount, address origin, address dest) internal nonReentrant whenNotPaused {\\n _SGETH.burn(origin, amount); // reverts if amount is too high\\n uint256 assets = _withdrawAccounting(amount);\\n\\n address payable recv = payable(dest);\\n Address.sendValue(recv, assets);\\n }\\n\\n receive() external payable {} // solhint-disable-line\\n\\n fallback() external payable {} // solhint-disable-line\\n}\\n\",\"keccak256\":\"0x1ad67e5f7bb03182702d6d249923c1e2c89d84e8071b537814e1f6c79ee7279d\",\"license\":\"BUSL-1.1\"},\"contracts/v2/core/WithdrawalQueue.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\n\\nimport {IERC4626} from \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\nimport {AccessControl} from \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport {FIFOQueue} from \\\"../lib/FIFOQueue.sol\\\";\\nimport {Errors} from \\\"../lib/Errors.sol\\\";\\nimport {OperatorSettable} from \\\"../lib/OperatorSettable.sol\\\";\\nimport {GranularPause} from \\\"../lib/GranularPause.sol\\\";\\nimport {SharedDepositMinterV2} from \\\"./SharedDepositMinterV2.sol\\\";\\n\\n/**\\n * @title WithdrawalQueue\\n * @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\\n * @dev -\\n * ERC-7540 inspired withdrawal contract\\n * This contract is designed to be used with SharedDepositMinterV2 contract\\n * As a module extension that adds 7540 methods requestRedeem and redeem\\n * Example flow ->\\n * user calls requestRedeem(user, user, userShares)\\n * user calls setOperator(admin OR protocol provided keeper, true)\\n * admin can now call redeem on the users behalf if needed after epoch\\n * user calls redeem(user, user, userShares) after waiting for epoch\\n * Caveats:\\n * If the user requests another redemption, before fulfillment,\\n * this resets the epoch length clock for their request\\n * Basic upgrade path:\\n * 1. Call togglePause(1), this disables the requestRedeem fn so no new requests\\n * 2. Deploy new contract, direct users to it\\n * 3. Fulfill any remaining redeemRequests i.e. totalPendingRequest,\\n * for all RedeemRequest events from requestsFulfilled to requestsCreated\\n */\\ncontract WithdrawalQueue is AccessControl, ReentrancyGuard, GranularPause, FIFOQueue, OperatorSettable {\\n using Address for address payable;\\n\\n struct Request {\\n address requester;\\n uint256 shares;\\n }\\n // SharedDepositMinterV2 public immutable MINTER;\\n address public immutable MINTER;\\n address public immutable WSGETH;\\n\\n uint256 internal totalPendingRequest;\\n uint256 internal requestsCreated;\\n uint256 internal requestsFulfilled;\\n uint256 public totalAssetsOut;\\n\\n bytes32 public constant GOV = keccak256(\\\"GOV\\\"); // Governance for settings - normally timelock controlled by multisig\\n\\n mapping(uint256 => Request) internal requests;\\n mapping(address => uint256) public redeemRequests;\\n\\n event RedeemRequest(\\n address indexed requester,\\n address indexed owner,\\n uint256 indexed requestId,\\n address operator,\\n uint256 assets\\n );\\n event Redeem(address indexed requester, address indexed receiver, uint256 shares, uint256 assets);\\n\\n constructor(address _minter, address _wsgEth, uint256 _epochLength) FIFOQueue(_epochLength) {\\n MINTER = _minter;\\n WSGETH = _wsgEth;\\n\\n uint256 maxUint256 = 2 ** 256 - 1;\\n\\n IERC20(WSGETH).approve(_minter, maxUint256);\\n\\n _grantRole(GOV, msg.sender);\\n }\\n\\n function requestRedeem(\\n uint256 shares,\\n address requester,\\n address owner\\n ) external onlyOwnerOrOperator(owner) nonReentrant whenNotPaused(uint16(1)) returns (uint256 requestId) {\\n if (shares == 0) {\\n revert Errors.InvalidAmount();\\n }\\n IERC20(WSGETH).transferFrom(owner, address(this), shares); // asset here is the Vault underlying asset\\n\\n requestId = requestsCreated++;\\n requests[requestId] = Request({requester: requester, shares: shares});\\n // use assets for tracking\\n uint256 assets = IERC4626(WSGETH).previewRedeem(shares);\\n\\n _stakeForWithdrawal(owner, assets);\\n totalPendingRequest += assets;\\n redeemRequests[requester] += assets; // underflow would revert if not enough claimable shares\\n\\n emit RedeemRequest(requester, owner, requestId, msg.sender, shares);\\n }\\n\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address requester\\n ) external onlyOwnerOrOperator(requester) nonReentrant whenNotPaused(uint16(2)) returns (uint256 assets) {\\n if (shares == 0) {\\n revert Errors.InvalidAmount();\\n }\\n\\n assets = IERC4626(WSGETH).previewRedeem(shares);\\n\\n // checks if we have enough assets to fulfill the request and if epoch has passed\\n if (claimableRedeemRequest(requester) < assets) {\\n _checkWithdraw(requester, totalBalance(), assets);\\n return 0; // should never happen. previous fn will generate a rich error\\n }\\n\\n _withdraw(requester, assets);\\n // Treat everything as claimableRedeemRequest and validate here if there's adequate funds\\n redeemRequests[requester] -= assets; // underflow would revert if not enough claimable shares\\n totalPendingRequest -= assets;\\n // Track total returned\\n totalAssetsOut += assets;\\n requestsFulfilled++;\\n\\n uint256 minterBalance = MINTER.balance;\\n // This feels suboptimal, but is the easiest way to always burn the token on redemptions\\n if (assets > minterBalance) {\\n uint256 diff = assets - minterBalance;\\n // We need to use donate/transfer etc. cant deposit and mint more shares as that messes up accouting\\n payable(MINTER).transfer(diff);\\n }\\n\\n // Always burn redeemed tokens\\n SharedDepositMinterV2(payable(MINTER)).unstakeAndWithdraw(shares, receiver);\\n\\n emit Redeem(requester, receiver, shares, assets);\\n }\\n\\n function togglePause(uint16 func) external onlyRole(GOV) {\\n bool paused = paused[func];\\n if (paused) {\\n _unpause(func);\\n } else {\\n _pause(func);\\n }\\n }\\n\\n function setEpochLength(uint256 value) external onlyRole(GOV) {\\n _setEpochLength(value);\\n }\\n\\n function pendingRedeemRequest(address owner) public view returns (uint256 shares) {\\n return redeemRequests[owner];\\n }\\n\\n // claimableRedeemRequest - returns owners shares in claimable state,\\n // i.e. epoch has elapsed and sufficient funds exist\\n function claimableRedeemRequest(address owner) public view returns (uint256 shares) {\\n if (redeemRequests[owner] > 0 && _isWithdrawalAllowed(owner, totalBalance(), redeemRequests[owner])) {\\n return redeemRequests[owner];\\n } else {\\n return 0;\\n }\\n }\\n\\n function totalBalance() internal view returns (uint256) {\\n return address(this).balance + MINTER.balance;\\n }\\n\\n receive() external payable {} // solhint-disable-line\\n\\n fallback() external payable {} // solhint-disable-line\\n}\\n\",\"keccak256\":\"0xcc9b4c773b330c1942e0cac4b96809316c2e68ceb3d49a146cb4747e88afb320\",\"license\":\"BUSL-1.1\"},\"contracts/v2/interfaces/IDepositContract.sol\":{\"content\":\"pragma solidity ^0.8.0;\\n\\n// \\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u250f\\u2513\\u2501\\u250f\\u2513\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\n// \\u2503\\u250f\\u2501\\u2501\\u251b\\u250f\\u251b\\u2517\\u2513\\u2503\\u2503\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2517\\u2513\\u250f\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\n// \\u2503\\u2517\\u2501\\u2501\\u2513\\u2517\\u2513\\u250f\\u251b\\u2503\\u2517\\u2501\\u2513\\u2517\\u251b\\u250f\\u251b\\u2503\\u2501\\u2501\\u2503\\u2503\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2503\\u2503\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2513\\u2517\\u2513\\u250f\\u251b\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u2517\\u251b\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2513\\u2501\\u2517\\u2513\\u250f\\u251b\\u250f\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u2501\\u250f\\u2501\\u2501\\u2513\\u2517\\u2513\\u250f\\u251b\\n// \\u2503\\u250f\\u2501\\u2501\\u251b\\u2501\\u2503\\u2503\\u2501\\u2503\\u250f\\u2513\\u2503\\u250f\\u2501\\u251b\\u250f\\u251b\\u2501\\u2501\\u2503\\u2503\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2503\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u2501\\u2501\\u252b\\u2523\\u252b\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u250f\\u2513\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2513\\u2501\\u2503\\u2503\\u2501\\u2503\\u250f\\u251b\\u2517\\u2501\\u2513\\u2503\\u2501\\u2503\\u250f\\u2501\\u251b\\u2501\\u2503\\u2503\\u2501\\n// \\u2503\\u2517\\u2501\\u2501\\u2513\\u2501\\u2503\\u2517\\u2513\\u2503\\u2503\\u2503\\u2503\\u2503\\u2503\\u2517\\u2501\\u2513\\u250f\\u2513\\u2503\\u2517\\u2501\\u251b\\u2503\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u251b\\u2503\\u2503\\u2503\\u2501\\u252b\\u2503\\u2517\\u251b\\u2503\\u2503\\u2517\\u251b\\u2503\\u2523\\u2501\\u2501\\u2503\\u2503\\u2503\\u2501\\u2503\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2503\\u2517\\u2501\\u251b\\u2503\\u2503\\u2517\\u251b\\u2503\\u2503\\u2503\\u2503\\u2503\\u2501\\u2503\\u2517\\u2513\\u2503\\u2503\\u2501\\u2503\\u2517\\u251b\\u2517\\u2513\\u2503\\u2517\\u2501\\u2513\\u2501\\u2503\\u2517\\u2513\\n// \\u2517\\u2501\\u2501\\u2501\\u251b\\u2501\\u2517\\u2501\\u251b\\u2517\\u251b\\u2517\\u251b\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u251b\\u2517\\u2501\\u2501\\u2501\\u251b\\u2501\\u2501\\u2501\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2503\\u250f\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u251b\\u2501\\u2501\\u2501\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2501\\u2517\\u2501\\u251b\\n// \\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\n// \\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2517\\u251b\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\n\\n// SPDX-License-Identifier: CC0-1.0\\n\\n// This interface is designed to be compatible with the Vyper version.\\n/// @notice This is the Ethereum 2.0 deposit contract interface.\\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\\ninterface IDepositContract {\\n /// @notice A processed deposit event.\\n event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);\\n\\n /// @notice Submit a Phase 0 DepositData object.\\n /// @param pubkey A BLS12-381 public key.\\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\\n /// @param signature A BLS12-381 signature.\\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\\n /// Used as a protection against malformed input.\\n function deposit(\\n bytes calldata pubkey,\\n bytes calldata withdrawal_credentials,\\n bytes calldata signature,\\n bytes32 deposit_data_root\\n ) external payable;\\n\\n /// @notice Query the current deposit root hash.\\n /// @return The deposit root hash.\\n function get_deposit_root() external view returns (bytes32);\\n\\n /// @notice Query the current deposit count.\\n /// @return The deposit count encoded as a little endian 64-bit number.\\n function get_deposit_count() external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xe2089e69dbf1fb4940e4dffcdb10524418a40b6e9529b72cb83f2e921fb08e3f\",\"license\":\"CC0-1.0\"},\"contracts/v2/interfaces/IERC20MintableBurnable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\ninterface IERC20MintableBurnable {\\n function mintingAllowedAfter() external view returns (uint256);\\n\\n /**\\n * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`\\n * @param account The address of the account holding the funds\\n * @param spender The address of the account spending the funds\\n * @return The number of tokens approved\\n */\\n function allowance(address account, address spender) external view returns (uint256);\\n\\n /**\\n * @notice Get the number of tokens held by the `account`\\n * @param account The address of the account to get the balance of\\n * @return The number of tokens held\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @notice Approve `spender` to transfer up to `amount` from `src`\\n * @dev This will overwrite the approval amount for `spender`\\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\\n * @param spender The address of the account which may transfer tokens\\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\\n * @return Whether or not the approval succeeded\\n */\\n function approve(address spender, uint256 rawAmount) external returns (bool);\\n\\n /**\\n * @notice Triggers an approval from owner to spends\\n * @param owner The address to approve from\\n * @param spender The address to be approved\\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\\n * @param deadline The time at which to expire the signature\\n * @param v The recovery byte of the signature\\n * @param r Half of the ECDSA signature pair\\n * @param s Half of the ECDSA signature pair\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 rawAmount,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\\n * @param dst The address of the destination account\\n * @param rawAmount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n function transfer(address dst, uint256 rawAmount) external returns (bool);\\n\\n /**\\n * @notice Transfer `amount` tokens from `src` to `dst`\\n * @param src The address of the source account\\n * @param dst The address of the destination account\\n * @param rawAmount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n function transferFrom(address src, address dst, uint256 rawAmount) external returns (bool);\\n\\n /**\\n * @notice Mint new tokens\\n * @param dst The address of the destination account\\n * @param rawAmount The number of tokens to be minted\\n */\\n function mint(address dst, uint256 rawAmount) external;\\n\\n function burn(address src, uint256 rawAmount) external;\\n function setMinter(address minter_) external;\\n}\\n\",\"keccak256\":\"0x2fcd50fd565019546be3412013205df119fe96fdca5bb152229b70fb4ec1169b\",\"license\":\"UNLICENSED\"},\"contracts/v2/interfaces/IFeeCalc.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\ninterface IFeeCalc {\\n function processDeposit(uint256 amt, address who) external view returns (uint256, uint256);\\n\\n function processWithdraw(uint256 amt, address who) external view returns (uint256, uint256);\\n}\\n\",\"keccak256\":\"0x2391271eeaf9baaa39edf4dc69b057824db52b0b87474680ca0b71c25a6b0550\",\"license\":\"UNLICENSED\"},\"contracts/v2/lib/ETH2DepositWithdrawalCredentials.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\n\\nimport {IDepositContract} from \\\"../interfaces/IDepositContract.sol\\\";\\n\\n/// @title A contract for holding a eth2 validator withrawal pubkey\\n/// @author @chimeraDefi\\n/// @notice A contract for holding a eth2 validator withrawal pubkey\\n/// @dev Downstream contract needs to implement who can set the withdrawal address and set it\\ncontract ETH2DepositWithdrawalCredentials {\\n uint256 internal constant _depositAmount = 32 ether;\\n IDepositContract public immutable DEPOSIT_CONTRACT;\\n bytes public withdrawalPubKey; // Pubkey for ETH 2.0 withdrawal creds\\n\\n event WithdrawalCredentialSet(bytes _withdrawalCredential);\\n\\n constructor(address _dc) {\\n DEPOSIT_CONTRACT = IDepositContract(_dc);\\n }\\n\\n /// @notice A more streamlined variant of batch deposit for use with preset withdrawal addresses\\n /// Submit index-matching arrays that form Phase 0 DepositData objects.\\n /// Will create a deposit transaction per index of the arrays submitted.\\n ///\\n /// @param pubkeys - An array of BLS12-381 public keys.\\n /// @param signatures - An array of BLS12-381 signatures.\\n /// @param depositDataRoots - An array of the SHA-256 hash of the SSZ-encoded DepositData object.\\n function _batchDeposit(\\n bytes[] calldata pubkeys,\\n bytes[] calldata signatures,\\n bytes32[] calldata depositDataRoots\\n ) internal {\\n // optimizations https://ethereum.stackexchange.com/questions/113221/what-is-the-purpose-of-unchecked-in-solidity\\n // https://medium.com/@bloqarl/solidity-gas-optimization-tips-with-assembly-you-havent-heard-yet-1381c77ff078\\n // 30m gas / block roughly, say 10m max used so 100 validators a batch max \\n // each deposit call costs roughly 128k https://etherscan.io/tx/0xa2acf6e6bde99b532125cc8026cd88eea345f296968ce732556945ab4705d03e\\n uint256 i = pubkeys.length;\\n uint256 _amt = _depositAmount;\\n bytes memory wpk = withdrawalPubKey;\\n\\n while (i > 0) {\\n unchecked {\\n // While loop check prevents underflow.\\n // --i is cheaper than i--\\n // reverse while loop cheapest compared to while or for \\n // Since we set the upper loop bound to the arr len, we decr 1st to not hit out of bounds\\n --i;\\n\\n DEPOSIT_CONTRACT.deposit{value: _amt}(\\n pubkeys[i],\\n wpk,\\n signatures[i],\\n depositDataRoots[i]\\n );\\n }\\n }\\n }\\n\\n /// @notice sets curr_withdrawal_pubkey to be used when deploying validators\\n function _setWithdrawalCredential(bytes memory newPk) internal {\\n withdrawalPubKey = newPk;\\n\\n emit WithdrawalCredentialSet(newPk);\\n }\\n}\\n\",\"keccak256\":\"0x0ebea7361fe05b3b8eb90b0dde098d2d93a994e54d9e498dcba951735de53a56\",\"license\":\"BUSL-1.1\"},\"contracts/v2/lib/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\n\\n/**\\n * @title Errors\\n * @author Sharedstake\\n * @notice Contains all the custom errors\\n */\\nlibrary Errors {\\n error ZeroAddress();\\n error InvalidAmount();\\n error PermissionDenied();\\n error InsufficientBalance();\\n error TooEarly();\\n error FailedCall();\\n}\\n\",\"keccak256\":\"0x5fd673f73b02e0db4a39a9fb8c1aeecc7e88d24cdf895cdee6a40c8e728be75a\",\"license\":\"BUSL-1.1\"},\"contracts/v2/lib/FIFOQueue.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\n\\nimport {Errors} from \\\"./Errors.sol\\\";\\n\\n// Simple First in first out queue\\n// Uses a system of cascading locks based on the block number.\\n// Users need to wait a minimum of epochLength blocks before withdrawing\\n// Users past the epoch boundary can claim, allowing some time for earlier users to claim first\\nabstract contract FIFOQueue {\\n struct UserEntry {\\n uint256 amount;\\n uint256 blocknum;\\n }\\n mapping(address => UserEntry) public userEntries;\\n\\n uint256 public epochLength;\\n\\n constructor(uint256 _epochLength) {\\n epochLength = _epochLength;\\n }\\n\\n function _checkWithdraw(\\n address sender,\\n uint256 balanceOfSelf,\\n uint256 amountToWithdraw\\n ) public view returns (bool withdrawalAllowed) {\\n UserEntry memory ue = userEntries[sender];\\n\\n if (!(amountToWithdraw <= balanceOfSelf && amountToWithdraw <= ue.amount)) {\\n revert Errors.InvalidAmount();\\n }\\n\\n if (!(block.number >= ue.blocknum + epochLength)) {\\n revert Errors.TooEarly();\\n }\\n return true;\\n }\\n\\n function _isWithdrawalAllowed(\\n address sender,\\n uint256 balanceOfSelf,\\n uint256 amountToWithdraw\\n ) public view returns (bool) {\\n UserEntry memory ue = userEntries[sender];\\n\\n return (amountToWithdraw <= balanceOfSelf && amountToWithdraw <= ue.amount) && (block.number >= ue.blocknum + epochLength);\\n }\\n\\n // should be admin only or used in a constructor upstream\\n // set epoch length in blocks\\n function _setEpochLength(uint256 _value) internal {\\n if (_value == 0) {\\n revert Errors.InvalidAmount();\\n }\\n epochLength = _value;\\n }\\n\\n function _stakeForWithdrawal(address sender, uint256 amount) internal {\\n UserEntry memory ue = userEntries[sender];\\n ue.amount = ue.amount + amount;\\n ue.blocknum = block.number;\\n userEntries[sender] = ue;\\n }\\n\\n function _withdraw(address sender, uint256 amount) internal {\\n UserEntry memory ue = userEntries[sender];\\n if (amount > ue.amount) {\\n revert Errors.InvalidAmount();\\n }\\n\\n if (amount == ue.amount) {\\n delete userEntries[sender];\\n } else {\\n ue.amount = ue.amount - amount;\\n ue.blocknum = block.number;\\n userEntries[sender] = ue;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7475970bd9b373e9a671b090676a143db81e57f498352bbb9d1ac9a50d5b8d02\",\"license\":\"BUSL-1.1\"},\"contracts/v2/lib/GranularPause.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\nimport {Context} from \\\"@openzeppelin/contracts/utils/Context.sol\\\";\\n\\n/// @title GranularPause \\n/// @author ChimeraDefi - chimera_defi@protonmail.com\\n/// @notice allows more granular control of pausing functions\\n/// @dev Inherit in child contract, you need to number each function you want to pause\\n\\nabstract contract GranularPause is Context {\\n mapping(uint16 => bool) public paused;\\n\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account, uint16 item);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account, uint16 item);\\n\\n error IsPaused();\\n error IsNotPaused();\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused(uint16 _id) {\\n if (paused[_id]) {\\n revert IsPaused();\\n }\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused(uint16 _id) {\\n if (!paused[_id]) {\\n revert IsNotPaused();\\n }\\n _;\\n }\\n\\n /// @notice pauses a function\\n /// @param _id id of function to pause\\n function _pause(uint16 _id) internal virtual {\\n paused[_id] = true;\\n emit Paused(_msgSender(), _id);\\n }\\n\\n /// @notice unpauses a function\\n /// @param _id id of function to unpause\\n function _unpause(uint16 _id) internal virtual {\\n paused[_id] = false;\\n emit Unpaused(_msgSender(), _id);\\n }\\n}\\n\\n\",\"keccak256\":\"0x49069f2e183ef89b36245e2905afda4a49274f1f1d189510b80939659a6d8988\",\"license\":\"BUSL-1.1\"},\"contracts/v2/lib/OperatorSettable.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\nimport {Errors} from \\\"./Errors.sol\\\";\\n\\n/**\\n * @title OperatorSettable\\n * @author Sharedstake\\n * @notice Handles operators for ERC-7450 like contracts\\n */\\nabstract contract OperatorSettable {\\n mapping(address requester => mapping(address operator => bool)) public isOperator;\\n event OperatorSet(address indexed owner, address indexed operator, bool value);\\n\\n modifier onlyOwnerOrOperator(address owner) {\\n if (owner != msg.sender && !isOperator[owner][msg.sender]) {\\n revert Errors.PermissionDenied();\\n }\\n _;\\n }\\n\\n function setOperator(address operator, bool approved) external returns (bool) {\\n isOperator[msg.sender][operator] = approved;\\n emit OperatorSet(msg.sender, operator, approved);\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0xc45fe8bc3a1c1b2da225e27f82e4dd95b5a4143b6a291167deb45e20d72269d6\",\"license\":\"BUSL-1.1\"}},\"version\":1}", + "bytecode": "0x60c06040523480156200001157600080fd5b5060405162001b0038038062001b008339810160408190526200003491620001b8565b6001805560048181556001600160a01b03848116608081905290841660a081905260405163095ea7b360e01b815292830191909152600019602483018190529163095ea7b3906044016020604051808303816000875af11580156200009d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000c39190620001f9565b50620000f07f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf33620000fa565b5050505062000224565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000197576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001563390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b0381168114620001b357600080fd5b919050565b600080600060608486031215620001ce57600080fd5b620001d9846200019b565b9250620001e9602085016200019b565b9150604084015190509250925092565b6000602082840312156200020c57600080fd5b815180151581146200021d57600080fd5b9392505050565b60805160a0516118856200027b600039600081816104940152818161092701528181610a0b0152610c3b01526000818161054001528181610d6401528181610da901528181610e1b0152610f9c01526118856000f3fe60806040526004361061015a5760003560e01c80637a6f12ff116100c8578063a217fddf11610084578063ba08765211610061578063ba087652146104ce578063d4b825a7146104ee578063d547741f1461050e578063fe6d81241461052e57005b8063a217fddf14610432578063b6363cf214610447578063b8902ff71461048257005b80637a6f12ff146103465780637ce7eada1461035c5780637d41c86e1461037c5780638d158c2a1461039c57806391d14854146103c95780639f10a990146103e957005b806336568abe1161011757806336568abe1461027a57806353dc1dd31461029a57806354eea796146102d0578063558a7297146102f057806357d775f8146103105780636e8b2bb81461032657005b806288d3e51461016357806301ffc9a714610196578063180cb47f146101c6578063248a9ca3146101fa5780632f2ff15d1461022a5780633375ed6b1461024a57005b3661016157005b005b34801561016f57600080fd5b5061018361017e366004611512565b610562565b6040519081526020015b60405180910390f35b3480156101a257600080fd5b506101b66101b136600461152d565b6105dc565b604051901515815260200161018d565b3480156101d257600080fd5b506101837f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf81565b34801561020657600080fd5b50610183610215366004611557565b60009081526020819052604090206001015490565b34801561023657600080fd5b50610161610245366004611570565b610613565b34801561025657600080fd5b506101b661026536600461159c565b60026020526000908152604090205460ff1681565b34801561028657600080fd5b50610161610295366004611570565b61063d565b3480156102a657600080fd5b506101836102b5366004611512565b6001600160a01b03166000908152600b602052604090205490565b3480156102dc57600080fd5b506101616102eb366004611557565b6106c0565b3480156102fc57600080fd5b506101b661030b3660046115ce565b6106f3565b34801561031c57600080fd5b5061018360045481565b34801561033257600080fd5b506101b6610341366004611605565b610763565b34801561035257600080fd5b5061018360095481565b34801561036857600080fd5b5061016161037736600461159c565b6107cc565b34801561038857600080fd5b50610183610397366004611638565b610825565b3480156103a857600080fd5b506101836103b7366004611512565b600b6020526000908152604090205481565b3480156103d557600080fd5b506101b66103e4366004611570565b610b26565b3480156103f557600080fd5b5061041d610404366004611512565b6003602052600090815260409020805460019091015482565b6040805192835260208301919091520161018d565b34801561043e57600080fd5b50610183600081565b34801561045357600080fd5b506101b6610462366004611674565b600560209081526000928352604080842090915290825290205460ff1681565b34801561048e57600080fd5b506104b67f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161018d565b3480156104da57600080fd5b506101836104e9366004611638565b610b4f565b3480156104fa57600080fd5b506101b6610509366004611605565b610ecb565b34801561051a57600080fd5b50610161610529366004611570565b610f68565b34801561053a57600080fd5b506104b67f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b0381166000908152600b6020526040812054158015906105ae57506105ae82610590610f8d565b6001600160a01b0385166000908152600b6020526040902054610763565b156105cf57506001600160a01b03166000908152600b602052604090205490565b506000919050565b919050565b60006001600160e01b03198216637965db0b60e01b148061060d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60008281526020819052604090206001015461062e81610fc8565b6106388383610fd5565b505050565b6001600160a01b03811633146106b25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106bc8282611059565b5050565b7f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf6106ea81610fc8565b6106bc826110be565b3360008181526005602090815260408083206001600160a01b038716808552908352818420805460ff191687151590811790915591519182529293917fceb576d9f15e4e200fdb5096d64d5dfd667e16def20c1eefd14256d8e3faa267910160405180910390a350600192915050565b6001600160a01b038316600090815260036020908152604080832081518083019092528054825260010154918101919091528383118015906107a6575080518311155b80156107c3575060045481602001516107bf91906116b4565b4310155b95945050505050565b7f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf6107f681610fc8565b61ffff821660009081526002602052604090205460ff16801561081c57610638836110e4565b61063883611149565b6000816001600160a01b038116331480159061086557506001600160a01b038116600090815260056020908152604080832033845290915290205460ff16155b1561088357604051630782484160e21b815260040160405180910390fd5b61088b61118f565b6001600081905260026020527fe90b7bceb6e7df5418fb78d8ee546e97c83a08bbccc01a0644d599ccd2a7c2e05460ff16156108da57604051631309a56360e01b815260040160405180910390fd5b856000036108fb5760405163162908e360e11b815260040160405180910390fd5b6040516323b872dd60e01b81526001600160a01b038581166004830152306024830152604482018890527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064016020604051808303816000875af1158015610970573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099491906116c7565b50600780549060006109a5836116e4565b909155506040805180820182526001600160a01b03888116825260208083018b81526000868152600a909252848220935184546001600160a01b03191690841617845551600190930192909255915163266d6a8360e11b8152600481018a9052929550917f000000000000000000000000000000000000000000000000000000000000000090911690634cdad50690602401602060405180830381865afa158015610a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7891906116fd565b9050610a8485826111e8565b8060066000828254610a9691906116b4565b90915550506001600160a01b0386166000908152600b602052604081208054839290610ac39084906116b4565b9091555050604080513381526020810189905285916001600160a01b0380891692908a16917f1fdc681a13d8c5da54e301c7ce6542dcde4581e4725043fdab2db12ddc574506910160405180910390a45050610b1e60018055565b509392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000816001600160a01b0381163314801590610b8f57506001600160a01b038116600090815260056020908152604080832033845290915290205460ff16155b15610bad57604051630782484160e21b815260040160405180910390fd5b610bb561118f565b6002600081905260208190527f679795a0195a1b76cdebb7c51d74e058aee92919b8c3389af86ef24535e8a28c5460ff1615610c0457604051631309a56360e01b815260040160405180910390fd5b85600003610c255760405163162908e360e11b815260040160405180910390fd5b60405163266d6a8360e11b8152600481018790527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634cdad50690602401602060405180830381865afa158015610c8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cae91906116fd565b925082610cba85610562565b1015610cdc57610cd284610ccc610f8d565b85610ecb565b5060009250610ec1565b610ce68484611260565b6001600160a01b0384166000908152600b602052604081208054859290610d0e908490611716565b925050819055508260066000828254610d279190611716565b925050819055508260096000828254610d4091906116b4565b909155505060088054906000610d55836116e4565b90915550506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163180841115610df5576000610d998286611716565b6040519091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169082156108fc029083906000818181858888f19350505050158015610df2573d6000803e3d6000fd5b50505b60405163566110b560e11b8152600481018890526001600160a01b0387811660248301527f0000000000000000000000000000000000000000000000000000000000000000169063acc2216a90604401600060405180830381600087803b158015610e5f57600080fd5b505af1158015610e73573d6000803e3d6000fd5b5050604080518a8152602081018890526001600160a01b03808b169450891692507f3f693fff038bb8a046aa76d9516190ac7444f7d69cf952c4cbdc086fdef2d6fc910160405180910390a3505b50610b1e60018055565b6001600160a01b03831660009081526003602090815260408083208151808301909252805482526001015491810191909152838311801590610f0e575080518311155b610f2b5760405163162908e360e11b815260040160405180910390fd5b6004548160200151610f3d91906116b4565b431015610f5d5760405163085de62560e01b815260040160405180910390fd5b506001949350505050565b600082815260208190526040902060010154610f8381610fc8565b6106388383611059565b6000610fc36001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001631476116b4565b905090565b610fd281336112ed565b50565b610fdf8282610b26565b6106bc576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556110153390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6110638282610b26565b156106bc576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b806000036110df5760405163162908e360e11b815260040160405180910390fd5b600455565b61ffff81166000908152600260205260409020805460ff191690557ffecc441e78e32a5c28004d47baebe659faee4271cbb13a7c05457fed0c771232335b604080516001600160a01b03909216825261ffff841660208301520160405180910390a150565b61ffff81166000908152600260205260409020805460ff191660011790557f38eb43248f2146c7882ffb321eebe73c10ee8fc9fe3a42102dd07937caba4f536111223390565b6002600154036111e15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106a9565b6002600155565b6001600160a01b03821660009081526003602090815260409182902082518084019093528054808452600190910154918301919091526112299083906116b4565b81524360208083019182526001600160a01b0390941660009081526003909452604090932090518155915160019092019190915550565b6001600160a01b03821660009081526003602090815260409182902082518084019093528054808452600190910154918301919091528211156112b65760405163162908e360e11b815260040160405180910390fd5b805182036112e05750506001600160a01b0316600090815260036020526040812081815560010155565b8051611229908390611716565b6112f78282610b26565b6106bc5761130481611346565b61130f836020611358565b60405160200161132092919061174d565b60408051601f198184030181529082905262461bcd60e51b82526106a9916004016117c2565b606061060d6001600160a01b03831660145b606060006113678360026117f5565b6113729060026116b4565b67ffffffffffffffff81111561138a5761138a61180c565b6040519080825280601f01601f1916602001820160405280156113b4576020820181803683370190505b509050600360fc1b816000815181106113cf576113cf611822565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106113fe576113fe611822565b60200101906001600160f81b031916908160001a90535060006114228460026117f5565b61142d9060016116b4565b90505b60018111156114a5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061146157611461611822565b1a60f81b82828151811061147757611477611822565b60200101906001600160f81b031916908160001a90535060049490941c9361149e81611838565b9050611430565b5083156114f45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106a9565b9392505050565b80356001600160a01b03811681146105d757600080fd5b60006020828403121561152457600080fd5b6114f4826114fb565b60006020828403121561153f57600080fd5b81356001600160e01b0319811681146114f457600080fd5b60006020828403121561156957600080fd5b5035919050565b6000806040838503121561158357600080fd5b82359150611593602084016114fb565b90509250929050565b6000602082840312156115ae57600080fd5b813561ffff811681146114f457600080fd5b8015158114610fd257600080fd5b600080604083850312156115e157600080fd5b6115ea836114fb565b915060208301356115fa816115c0565b809150509250929050565b60008060006060848603121561161a57600080fd5b611623846114fb565b95602085013595506040909401359392505050565b60008060006060848603121561164d57600080fd5b8335925061165d602085016114fb565b915061166b604085016114fb565b90509250925092565b6000806040838503121561168757600080fd5b611690836114fb565b9150611593602084016114fb565b634e487b7160e01b600052601160045260246000fd5b8082018082111561060d5761060d61169e565b6000602082840312156116d957600080fd5b81516114f4816115c0565b6000600182016116f6576116f661169e565b5060010190565b60006020828403121561170f57600080fd5b5051919050565b8181038181111561060d5761060d61169e565b60005b8381101561174457818101518382015260200161172c565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611785816017850160208801611729565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516117b6816028840160208801611729565b01602801949350505050565b60208152600082518060208401526117e1816040850160208701611729565b601f01601f19169190910160400192915050565b808202811582820484141761060d5761060d61169e565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816118475761184761169e565b50600019019056fea26469706673582212203ca63bc65f8de32bff5897e3c8b52e16b293b116d23026cc2b30ba38dc9b5b9964736f6c63430008140033", + "deployedBytecode": "0x60806040526004361061015a5760003560e01c80637a6f12ff116100c8578063a217fddf11610084578063ba08765211610061578063ba087652146104ce578063d4b825a7146104ee578063d547741f1461050e578063fe6d81241461052e57005b8063a217fddf14610432578063b6363cf214610447578063b8902ff71461048257005b80637a6f12ff146103465780637ce7eada1461035c5780637d41c86e1461037c5780638d158c2a1461039c57806391d14854146103c95780639f10a990146103e957005b806336568abe1161011757806336568abe1461027a57806353dc1dd31461029a57806354eea796146102d0578063558a7297146102f057806357d775f8146103105780636e8b2bb81461032657005b806288d3e51461016357806301ffc9a714610196578063180cb47f146101c6578063248a9ca3146101fa5780632f2ff15d1461022a5780633375ed6b1461024a57005b3661016157005b005b34801561016f57600080fd5b5061018361017e366004611512565b610562565b6040519081526020015b60405180910390f35b3480156101a257600080fd5b506101b66101b136600461152d565b6105dc565b604051901515815260200161018d565b3480156101d257600080fd5b506101837f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf81565b34801561020657600080fd5b50610183610215366004611557565b60009081526020819052604090206001015490565b34801561023657600080fd5b50610161610245366004611570565b610613565b34801561025657600080fd5b506101b661026536600461159c565b60026020526000908152604090205460ff1681565b34801561028657600080fd5b50610161610295366004611570565b61063d565b3480156102a657600080fd5b506101836102b5366004611512565b6001600160a01b03166000908152600b602052604090205490565b3480156102dc57600080fd5b506101616102eb366004611557565b6106c0565b3480156102fc57600080fd5b506101b661030b3660046115ce565b6106f3565b34801561031c57600080fd5b5061018360045481565b34801561033257600080fd5b506101b6610341366004611605565b610763565b34801561035257600080fd5b5061018360095481565b34801561036857600080fd5b5061016161037736600461159c565b6107cc565b34801561038857600080fd5b50610183610397366004611638565b610825565b3480156103a857600080fd5b506101836103b7366004611512565b600b6020526000908152604090205481565b3480156103d557600080fd5b506101b66103e4366004611570565b610b26565b3480156103f557600080fd5b5061041d610404366004611512565b6003602052600090815260409020805460019091015482565b6040805192835260208301919091520161018d565b34801561043e57600080fd5b50610183600081565b34801561045357600080fd5b506101b6610462366004611674565b600560209081526000928352604080842090915290825290205460ff1681565b34801561048e57600080fd5b506104b67f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161018d565b3480156104da57600080fd5b506101836104e9366004611638565b610b4f565b3480156104fa57600080fd5b506101b6610509366004611605565b610ecb565b34801561051a57600080fd5b50610161610529366004611570565b610f68565b34801561053a57600080fd5b506104b67f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b0381166000908152600b6020526040812054158015906105ae57506105ae82610590610f8d565b6001600160a01b0385166000908152600b6020526040902054610763565b156105cf57506001600160a01b03166000908152600b602052604090205490565b506000919050565b919050565b60006001600160e01b03198216637965db0b60e01b148061060d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60008281526020819052604090206001015461062e81610fc8565b6106388383610fd5565b505050565b6001600160a01b03811633146106b25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106bc8282611059565b5050565b7f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf6106ea81610fc8565b6106bc826110be565b3360008181526005602090815260408083206001600160a01b038716808552908352818420805460ff191687151590811790915591519182529293917fceb576d9f15e4e200fdb5096d64d5dfd667e16def20c1eefd14256d8e3faa267910160405180910390a350600192915050565b6001600160a01b038316600090815260036020908152604080832081518083019092528054825260010154918101919091528383118015906107a6575080518311155b80156107c3575060045481602001516107bf91906116b4565b4310155b95945050505050565b7f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf6107f681610fc8565b61ffff821660009081526002602052604090205460ff16801561081c57610638836110e4565b61063883611149565b6000816001600160a01b038116331480159061086557506001600160a01b038116600090815260056020908152604080832033845290915290205460ff16155b1561088357604051630782484160e21b815260040160405180910390fd5b61088b61118f565b6001600081905260026020527fe90b7bceb6e7df5418fb78d8ee546e97c83a08bbccc01a0644d599ccd2a7c2e05460ff16156108da57604051631309a56360e01b815260040160405180910390fd5b856000036108fb5760405163162908e360e11b815260040160405180910390fd5b6040516323b872dd60e01b81526001600160a01b038581166004830152306024830152604482018890527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064016020604051808303816000875af1158015610970573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099491906116c7565b50600780549060006109a5836116e4565b909155506040805180820182526001600160a01b03888116825260208083018b81526000868152600a909252848220935184546001600160a01b03191690841617845551600190930192909255915163266d6a8360e11b8152600481018a9052929550917f000000000000000000000000000000000000000000000000000000000000000090911690634cdad50690602401602060405180830381865afa158015610a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7891906116fd565b9050610a8485826111e8565b8060066000828254610a9691906116b4565b90915550506001600160a01b0386166000908152600b602052604081208054839290610ac39084906116b4565b9091555050604080513381526020810189905285916001600160a01b0380891692908a16917f1fdc681a13d8c5da54e301c7ce6542dcde4581e4725043fdab2db12ddc574506910160405180910390a45050610b1e60018055565b509392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000816001600160a01b0381163314801590610b8f57506001600160a01b038116600090815260056020908152604080832033845290915290205460ff16155b15610bad57604051630782484160e21b815260040160405180910390fd5b610bb561118f565b6002600081905260208190527f679795a0195a1b76cdebb7c51d74e058aee92919b8c3389af86ef24535e8a28c5460ff1615610c0457604051631309a56360e01b815260040160405180910390fd5b85600003610c255760405163162908e360e11b815260040160405180910390fd5b60405163266d6a8360e11b8152600481018790527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634cdad50690602401602060405180830381865afa158015610c8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cae91906116fd565b925082610cba85610562565b1015610cdc57610cd284610ccc610f8d565b85610ecb565b5060009250610ec1565b610ce68484611260565b6001600160a01b0384166000908152600b602052604081208054859290610d0e908490611716565b925050819055508260066000828254610d279190611716565b925050819055508260096000828254610d4091906116b4565b909155505060088054906000610d55836116e4565b90915550506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163180841115610df5576000610d998286611716565b6040519091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169082156108fc029083906000818181858888f19350505050158015610df2573d6000803e3d6000fd5b50505b60405163566110b560e11b8152600481018890526001600160a01b0387811660248301527f0000000000000000000000000000000000000000000000000000000000000000169063acc2216a90604401600060405180830381600087803b158015610e5f57600080fd5b505af1158015610e73573d6000803e3d6000fd5b5050604080518a8152602081018890526001600160a01b03808b169450891692507f3f693fff038bb8a046aa76d9516190ac7444f7d69cf952c4cbdc086fdef2d6fc910160405180910390a3505b50610b1e60018055565b6001600160a01b03831660009081526003602090815260408083208151808301909252805482526001015491810191909152838311801590610f0e575080518311155b610f2b5760405163162908e360e11b815260040160405180910390fd5b6004548160200151610f3d91906116b4565b431015610f5d5760405163085de62560e01b815260040160405180910390fd5b506001949350505050565b600082815260208190526040902060010154610f8381610fc8565b6106388383611059565b6000610fc36001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001631476116b4565b905090565b610fd281336112ed565b50565b610fdf8282610b26565b6106bc576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556110153390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6110638282610b26565b156106bc576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b806000036110df5760405163162908e360e11b815260040160405180910390fd5b600455565b61ffff81166000908152600260205260409020805460ff191690557ffecc441e78e32a5c28004d47baebe659faee4271cbb13a7c05457fed0c771232335b604080516001600160a01b03909216825261ffff841660208301520160405180910390a150565b61ffff81166000908152600260205260409020805460ff191660011790557f38eb43248f2146c7882ffb321eebe73c10ee8fc9fe3a42102dd07937caba4f536111223390565b6002600154036111e15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106a9565b6002600155565b6001600160a01b03821660009081526003602090815260409182902082518084019093528054808452600190910154918301919091526112299083906116b4565b81524360208083019182526001600160a01b0390941660009081526003909452604090932090518155915160019092019190915550565b6001600160a01b03821660009081526003602090815260409182902082518084019093528054808452600190910154918301919091528211156112b65760405163162908e360e11b815260040160405180910390fd5b805182036112e05750506001600160a01b0316600090815260036020526040812081815560010155565b8051611229908390611716565b6112f78282610b26565b6106bc5761130481611346565b61130f836020611358565b60405160200161132092919061174d565b60408051601f198184030181529082905262461bcd60e51b82526106a9916004016117c2565b606061060d6001600160a01b03831660145b606060006113678360026117f5565b6113729060026116b4565b67ffffffffffffffff81111561138a5761138a61180c565b6040519080825280601f01601f1916602001820160405280156113b4576020820181803683370190505b509050600360fc1b816000815181106113cf576113cf611822565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106113fe576113fe611822565b60200101906001600160f81b031916908160001a90535060006114228460026117f5565b61142d9060016116b4565b90505b60018111156114a5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061146157611461611822565b1a60f81b82828151811061147757611477611822565b60200101906001600160f81b031916908160001a90535060049490941c9361149e81611838565b9050611430565b5083156114f45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106a9565b9392505050565b80356001600160a01b03811681146105d757600080fd5b60006020828403121561152457600080fd5b6114f4826114fb565b60006020828403121561153f57600080fd5b81356001600160e01b0319811681146114f457600080fd5b60006020828403121561156957600080fd5b5035919050565b6000806040838503121561158357600080fd5b82359150611593602084016114fb565b90509250929050565b6000602082840312156115ae57600080fd5b813561ffff811681146114f457600080fd5b8015158114610fd257600080fd5b600080604083850312156115e157600080fd5b6115ea836114fb565b915060208301356115fa816115c0565b809150509250929050565b60008060006060848603121561161a57600080fd5b611623846114fb565b95602085013595506040909401359392505050565b60008060006060848603121561164d57600080fd5b8335925061165d602085016114fb565b915061166b604085016114fb565b90509250925092565b6000806040838503121561168757600080fd5b611690836114fb565b9150611593602084016114fb565b634e487b7160e01b600052601160045260246000fd5b8082018082111561060d5761060d61169e565b6000602082840312156116d957600080fd5b81516114f4816115c0565b6000600182016116f6576116f661169e565b5060010190565b60006020828403121561170f57600080fd5b5051919050565b8181038181111561060d5761060d61169e565b60005b8381101561174457818101518382015260200161172c565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611785816017850160208801611729565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516117b6816028840160208801611729565b01602801949350505050565b60208152600082518060208401526117e1816040850160208701611729565b601f01601f19169190910160400192915050565b808202811582820484141761060d5761060d61169e565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816118475761184761169e565b50600019019056fea26469706673582212203ca63bc65f8de32bff5897e3c8b52e16b293b116d23026cc2b30ba38dc9b5b9964736f6c63430008140033", + "devdoc": { + "author": "@ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org", + "details": "- ERC-7540 inspired withdrawal contract This contract is designed to be used with SharedDepositMinterV2 contract As a module extension that adds 7540 methods requestRedeem and redeem Example flow -> user calls requestRedeem(user, user, userShares) user calls setOperator(admin OR protocol provided keeper, true) admin can now call redeem on the users behalf if needed after epoch user calls redeem(user, user, userShares) after waiting for epoch Caveats: If the user requests another redemption, before fulfillment, this resets the epoch length clock for their request Basic upgrade path: 1. Call togglePause(1), this disables the requestRedeem fn so no new requests 2. Deploy new contract, direct users to it 3. Fulfill any remaining redeemRequests i.e. totalPendingRequest, for all RedeemRequest events from requestsFulfilled to requestsCreated", + "events": { + "Paused(address,uint16)": { + "details": "Emitted when the pause is triggered by `account`." + }, + "RoleAdminChanged(bytes32,bytes32,bytes32)": { + "details": "Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._" + }, + "RoleGranted(bytes32,address,address)": { + "details": "Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}." + }, + "RoleRevoked(bytes32,address,address)": { + "details": "Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)" + }, + "Unpaused(address,uint16)": { + "details": "Emitted when the pause is lifted by `account`." + } + }, + "kind": "dev", + "methods": { + "getRoleAdmin(bytes32)": { + "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." + }, + "grantRole(bytes32,address)": { + "details": "Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event." + }, + "hasRole(bytes32,address)": { + "details": "Returns `true` if `account` has been granted `role`." + }, + "renounceRole(bytes32,address)": { + "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event." + }, + "revokeRole(bytes32,address)": { + "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event." + }, + "supportsInterface(bytes4)": { + "details": "See {IERC165-supportsInterface}." + } + }, + "title": "WithdrawalQueue", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 24, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "_roles", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_struct(RoleData)19_storage)" + }, + { + "astId": 678, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "_status", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 4155, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "paused", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint16,t_bool)" + }, + { + "astId": 3922, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "userEntries", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_struct(UserEntry)3917_storage)" + }, + { + "astId": 3924, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "epochLength", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 4254, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "isOperator", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 3226, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "totalPendingRequest", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 3228, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "requestsCreated", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 3230, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "requestsFulfilled", + "offset": 0, + "slot": "8", + "type": "t_uint256" + }, + { + "astId": 3232, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "totalAssetsOut", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 3242, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "requests", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_uint256,t_struct(Request)3220_storage)" + }, + { + "astId": 3246, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "redeemRequests", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_address,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_address,t_struct(UserEntry)3917_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct FIFOQueue.UserEntry)", + "numberOfBytes": "32", + "value": "t_struct(UserEntry)3917_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_bytes32,t_struct(RoleData)19_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct AccessControl.RoleData)", + "numberOfBytes": "32", + "value": "t_struct(RoleData)19_storage" + }, + "t_mapping(t_uint16,t_bool)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_uint256,t_struct(Request)3220_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct WithdrawalQueue.Request)", + "numberOfBytes": "32", + "value": "t_struct(Request)3220_storage" + }, + "t_struct(Request)3220_storage": { + "encoding": "inplace", + "label": "struct WithdrawalQueue.Request", + "members": [ + { + "astId": 3217, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "requester", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 3219, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "shares", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RoleData)19_storage": { + "encoding": "inplace", + "label": "struct AccessControl.RoleData", + "members": [ + { + "astId": 16, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "members", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 18, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "adminRole", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_struct(UserEntry)3917_storage": { + "encoding": "inplace", + "label": "struct FIFOQueue.UserEntry", + "members": [ + { + "astId": 3914, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "amount", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 3916, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "blocknum", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/localhost/solcInputs/5216db61c74af7c383b71388fa6b77a7.json b/deployments/localhost/solcInputs/5216db61c74af7c383b71388fa6b77a7.json new file mode 100644 index 0000000..6c295d6 --- /dev/null +++ b/deployments/localhost/solcInputs/5216db61c74af7c383b71388fa6b77a7.json @@ -0,0 +1,109 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(account),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed sender,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin/contracts/security/Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n" + }, + "@openzeppelin/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/v2/core/SharedDepositMinterV2.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\n\n/// @title SharedDepositMinterV2 - minter for ETH LSD\n/// @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\n// v1 sharedstake veth2 minter with some code removed\n// user deposits eth to get minted token\n// The contract cannot move user ETH outside unless\n// 1. the user redeems 1:1\n// 2. the depositToEth2 or depositToEth2Batch fns are called which allow moving ETH to the mainnet deposit contract only\n// 3. The contract allows permissioned external actors to supply validator public keys\n// 4. Who's allowed to deposit how many validators is governed outside this contract\n// 5. The ability to provision validators for user ETH is portioned out by the DAO\n\n// Changes\n/**\n- Custom errors instead of revert strings\n- Granular management via AccessControl with GOV and NOR roles. Node operator can only deploy validators\n- Refactored to allow users to specify destination address for fns - for zaps\n- Added deposit+stake/unstake+withdraw combo convenience routes\n- Refactored fee calc out to external contract\n*/\nimport {IFeeCalc} from \"../interfaces/IFeeCalc.sol\";\nimport {IERC20MintableBurnable} from \"../interfaces/IERC20MintableBurnable.sol\";\nimport {IERC4626} from \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\n\nimport {AccessControl} from \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {Pausable} from \"@openzeppelin/contracts/security/Pausable.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport {ETH2DepositWithdrawalCredentials} from \"../lib/ETH2DepositWithdrawalCredentials.sol\";\n\n/// @title SharedDepositMinterV2\n/// @author ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\n/// @notice Mints LSD tokens for ETH deposited to the contract. Handles the depositing of ETH to the ETH2 deposit contract and validator creation\n/// @dev Deployment params: \n/// - addresses : [feeCalc, sgeth, wsgeth, gov]\ncontract SharedDepositMinterV2 is AccessControl, Pausable, ReentrancyGuard, ETH2DepositWithdrawalCredentials {\n /* ========== STATE VARIABLES ========== */\n uint256 public adminFee;\n uint256 public numValidators;\n uint256 public costPerValidator;\n\n // The validator shares created by this shared stake contract. 1 share costs >= 1 eth\n uint256 public curValidatorShares; //initialized to 0\n\n // The number of times the deposit to eth2 contract has been called to create validators\n uint256 public validatorsCreated; //initialized to 0\n\n // Total accrued admin fee\n uint256 public adminFeeTotal; //initialized to 0\n\n // Its hard to exactly hit the max deposit amount with small shares. this allows a small bit of overflow room\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token via a user withdraw\n uint256 public buffer;\n\n // Flash loan tokenomic protection in case of changes in admin fee with future lots\n bool public refundFeesOnWithdraw; //initialized to false\n\n // NEW\n IERC20MintableBurnable private immutable _SGETH;\n IERC4626 private immutable _WSGETH;\n IFeeCalc private _feeCalc;\n\n bytes32 public constant NOR = keccak256(\"NOR\"); // Node operator for deploying validators\n bytes32 public constant GOV = keccak256(\"GOV\"); // Governance for settings - normally timelock controlled by multisig\n\n //errors\n error AmountTooHigh();\n error NoValidators();\n\n constructor(\n uint256 _numValidators,\n uint256 _adminFee,\n address[] memory addresses\n ) AccessControl() Pausable() ReentrancyGuard() ETH2DepositWithdrawalCredentials(addresses[4]) {\n _feeCalc = IFeeCalc(addresses[0]);\n _SGETH = IERC20MintableBurnable(addresses[1]);\n _WSGETH = IERC4626(addresses[2]);\n\n _SGETH.approve(address(_WSGETH), 2 ** 256 - 1); // max approve wsgeth for deposit and stake\n\n adminFee = _adminFee; // Admin and infra fees\n numValidators = _numValidators; // The number of validators to create in this lot. Sets a max limit on deposits\n\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token\n buffer = 10 * 1e18; // roughly equal to 10 eth.\n\n costPerValidator = (32 * 1e18) + adminFee;\n\n _grantRole(NOR, msg.sender);\n _grantRole(GOV, addresses[3]); // deployer will need it to set withdrawal creds. since the non-custodial withdrawal path depends on the minter.\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LOGIC\n //////////////////////////////////////////////////////////////*/\n\n // USER INTERACTIONS\n /*\n Shares minted = Z\n Principal deposit input = P\n AdminFee = a\n costPerValidator = 32 + a\n AdminFee as percent in 1e18 = a% = (a / costPerValidator) * 1e18\n AdminFee on tx in 1e18 = (P * a% / 1e18)\n\n on deposit:\n P - (P * a%) = Z\n\n on withdraw with admin fee refund:\n P = Z / (1 - a%)\n P = Z - Z*a%\n */\n\n function deposit() external payable {\n _deposit(msg.sender);\n }\n\n function depositFor(address dest) external payable {\n _deposit(dest);\n }\n\n function depositAndStake() external payable {\n _WSGETH.deposit(_deposit(address(this)), msg.sender);\n }\n\n function depositAndStakeFor(address dest) external payable {\n _WSGETH.deposit(_deposit(address(this)), dest);\n }\n\n function withdraw(uint256 amount) external {\n _withdraw(amount, msg.sender, msg.sender);\n }\n\n function withdrawTo(uint256 amount, address dest) external {\n _withdraw(amount, msg.sender, dest);\n }\n\n function unstakeAndWithdraw(uint256 amount, address dest) external {\n _withdraw(_WSGETH.redeem(amount, address(this), msg.sender), address(this), dest);\n }\n\n // migration function to accept old monies and copy over state\n // users should not use this as it just donates the money without minting veth or tracking donations\n function donate() external payable {} // solhint-disable-line\n\n /*//////////////////////////////////////////////////////////////\n ADMIN LOGIC\n //////////////////////////////////////////////////////////////*/\n\n // Batch deposit eth to the eth2 contract with preset creds\n // Data needs to be verified offchain to save gas\n function batchDepositToEth2(\n bytes[] calldata pubkeys,\n bytes[] calldata signatures,\n bytes32[] calldata depositDataRoots\n ) external onlyRole(NOR) {\n if (address(this).balance < (_depositAmount * pubkeys.length)) {\n revert AmountTooHigh(); // Not enough bal in contract to deploy all validators\n }\n _batchDeposit(pubkeys, signatures, depositDataRoots);\n validatorsCreated = validatorsCreated + pubkeys.length;\n }\n\n function setWithdrawalCredential(bytes memory _newWithdrawalCreds) external onlyRole(NOR) {\n // can only be called once\n _setWithdrawalCredential(_newWithdrawalCreds);\n }\n\n // Slashes the onchain staked sgETH to mirror CL validator slashings\n // modifies wsgeth virtual price\n function slash(uint256 amt) external onlyRole(GOV) {\n if (amt > curValidatorShares) {\n revert AmountTooHigh(); // Cannot slash more than minted\n }\n _SGETH.burn(address(_WSGETH), amt);\n }\n\n // Set fee calc address. if addr = 0 then fees are assumed to be 0\n function setFeeCalc(address _feeCalculatorAddr) external onlyRole(GOV) {\n _feeCalc = IFeeCalc(_feeCalculatorAddr);\n }\n\n function togglePause() external onlyRole(GOV) {\n bool paused = paused();\n if (paused) {\n _unpause();\n } else {\n _pause();\n }\n }\n\n // Used to migrate state over to new contract\n function migrateShares(uint256 shares) external onlyRole(GOV) {\n curValidatorShares = shares;\n }\n\n function toggleWithdrawRefund() external onlyRole(GOV) {\n refundFeesOnWithdraw = !refundFeesOnWithdraw;\n }\n\n function setNumValidators(uint256 _numValidators) external onlyRole(GOV) {\n if (_numValidators > 0) {\n numValidators = _numValidators;\n } else {\n revert NoValidators();\n }\n }\n\n function withdrawAdminFee(uint256 amount) external onlyRole(GOV) {\n address payable sender = payable(msg.sender);\n if (amount == 0) {\n amount = adminFeeTotal;\n }\n if (amount > adminFeeTotal) {\n revert AmountTooHigh();\n }\n adminFeeTotal = adminFeeTotal - amount;\n Address.sendValue(sender, amount);\n }\n\n /*//////////////////////////////////////////////////////////////\n ACCOUNTING LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function remainingSpaceInEpoch() external view returns (uint256) {\n // Helpful view function to gauge how much the user can send to the contract when it is near full\n uint256 remainingShares = maxValidatorShares() - curValidatorShares;\n uint256 valBeforeAdmin = (remainingShares * 1e18) / (((1 * 1e18) - (adminFee * 1e18) / costPerValidator));\n return valBeforeAdmin;\n }\n\n function maxValidatorShares() public view returns (uint256) {\n return 32 * 1e18 * numValidators;\n }\n\n function _depositAccounting() internal returns (uint256 value) {\n // input is whole, not / 1e18 , i.e. in 1 = 1 eth send when from etherscan\n value = msg.value;\n uint256 fee;\n\n if (address(_feeCalc) != address(0)) {\n (value, fee) = _feeCalc.processDeposit(value, msg.sender);\n adminFeeTotal = adminFeeTotal + fee;\n }\n\n uint256 newShareTotal = curValidatorShares + value;\n\n if (newShareTotal > buffer + maxValidatorShares()) {\n revert AmountTooHigh();\n }\n curValidatorShares = newShareTotal;\n }\n\n function _withdrawAccounting(uint256 amount) internal returns (uint256) {\n uint256 fee;\n if (address(_feeCalc) != address(0)) {\n (amount, fee) = _feeCalc.processWithdraw(amount, msg.sender);\n if (refundFeesOnWithdraw) {\n adminFeeTotal = adminFeeTotal - fee;\n } else {\n adminFeeTotal = adminFeeTotal + fee;\n }\n }\n if (address(this).balance < (amount + adminFeeTotal)) {\n revert AmountTooHigh();\n }\n\n curValidatorShares = curValidatorShares - amount;\n return amount;\n }\n\n function _deposit(address dest) internal nonReentrant whenNotPaused returns (uint256 amt) {\n amt = _depositAccounting();\n _SGETH.mint(dest, amt);\n }\n\n function _withdraw(uint256 amount, address origin, address dest) internal nonReentrant whenNotPaused {\n _SGETH.burn(origin, amount); // reverts if amount is too high\n uint256 assets = _withdrawAccounting(amount);\n\n address payable recv = payable(dest);\n Address.sendValue(recv, assets);\n }\n\n receive() external payable {} // solhint-disable-line\n\n fallback() external payable {} // solhint-disable-line\n}\n" + }, + "contracts/v2/core/WithdrawalQueue.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\nimport {IERC4626} from \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\nimport {AccessControl} from \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport {FIFOQueue} from \"../lib/FIFOQueue.sol\";\nimport {Errors} from \"../lib/Errors.sol\";\nimport {OperatorSettable} from \"../lib/OperatorSettable.sol\";\nimport {GranularPause} from \"../lib/GranularPause.sol\";\nimport {SharedDepositMinterV2} from \"./SharedDepositMinterV2.sol\";\n\n/**\n * @title WithdrawalQueue\n * @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\n * @dev -\n * ERC-7540 inspired withdrawal contract\n * This contract is designed to be used with SharedDepositMinterV2 contract\n * As a module extension that adds 7540 methods requestRedeem and redeem\n * Example flow ->\n * user calls requestRedeem(user, user, userShares)\n * user calls setOperator(admin OR protocol provided keeper, true)\n * admin can now call redeem on the users behalf if needed after epoch\n * user calls redeem(user, user, userShares) after waiting for epoch\n * Caveats:\n * If the user requests another redemption, before fulfillment,\n * this resets the epoch length clock for their request\n * Basic upgrade path:\n * 1. Call togglePause(1), this disables the requestRedeem fn so no new requests\n * 2. Deploy new contract, direct users to it\n * 3. Fulfill any remaining redeemRequests i.e. totalPendingRequest,\n * for all RedeemRequest events from requestsFulfilled to requestsCreated\n */\ncontract WithdrawalQueue is AccessControl, ReentrancyGuard, GranularPause, FIFOQueue, OperatorSettable {\n using Address for address payable;\n\n struct Request {\n address requester;\n uint256 shares;\n }\n // SharedDepositMinterV2 public immutable MINTER;\n address public immutable MINTER;\n address public immutable WSGETH;\n\n uint256 internal totalPendingRequest;\n uint256 internal requestsCreated;\n uint256 internal requestsFulfilled;\n uint256 public totalAssetsOut;\n\n bytes32 public constant GOV = keccak256(\"GOV\"); // Governance for settings - normally timelock controlled by multisig\n\n mapping(uint256 => Request) internal requests;\n mapping(address => uint256) public redeemRequests;\n\n event RedeemRequest(\n address indexed requester,\n address indexed owner,\n uint256 indexed requestId,\n address operator,\n uint256 assets\n );\n event Redeem(address indexed requester, address indexed receiver, uint256 shares, uint256 assets);\n\n constructor(address _minter, address _wsgEth, uint256 _epochLength) FIFOQueue(_epochLength) {\n MINTER = _minter;\n WSGETH = _wsgEth;\n\n uint256 maxUint256 = 2 ** 256 - 1;\n\n IERC20(WSGETH).approve(_minter, maxUint256);\n\n _grantRole(GOV, msg.sender);\n }\n\n function requestRedeem(\n uint256 shares,\n address requester,\n address owner\n ) external onlyOwnerOrOperator(owner) nonReentrant whenNotPaused(uint16(1)) returns (uint256 requestId) {\n if (shares == 0) {\n revert Errors.InvalidAmount();\n }\n IERC20(WSGETH).transferFrom(owner, address(this), shares); // asset here is the Vault underlying asset\n\n requestId = requestsCreated++;\n requests[requestId] = Request({requester: requester, shares: shares});\n // use assets for tracking\n uint256 assets = IERC4626(WSGETH).previewRedeem(shares);\n\n _stakeForWithdrawal(owner, assets);\n totalPendingRequest += assets;\n redeemRequests[requester] += assets; // underflow would revert if not enough claimable shares\n\n emit RedeemRequest(requester, owner, requestId, msg.sender, shares);\n }\n\n function redeem(\n uint256 shares,\n address receiver,\n address requester\n ) external onlyOwnerOrOperator(requester) nonReentrant whenNotPaused(uint16(2)) returns (uint256 assets) {\n if (shares == 0) {\n revert Errors.InvalidAmount();\n }\n\n assets = IERC4626(WSGETH).previewRedeem(shares);\n\n // checks if we have enough assets to fulfill the request and if epoch has passed\n if (claimableRedeemRequest(requester) < assets) {\n _checkWithdraw(requester, totalBalance(), assets);\n return 0; // should never happen. previous fn will generate a rich error\n }\n\n _withdraw(requester, assets);\n // Treat everything as claimableRedeemRequest and validate here if there's adequate funds\n redeemRequests[requester] -= assets; // underflow would revert if not enough claimable shares\n totalPendingRequest -= assets;\n // Track total returned\n totalAssetsOut += assets;\n requestsFulfilled++;\n\n uint256 minterBalance = MINTER.balance;\n // This feels suboptimal, but is the easiest way to always burn the token on redemptions\n if (assets > minterBalance) {\n uint256 diff = assets - minterBalance;\n // We need to use donate/transfer etc. cant deposit and mint more shares as that messes up accouting\n payable(MINTER).transfer(diff);\n }\n\n // Always burn redeemed tokens\n SharedDepositMinterV2(payable(MINTER)).unstakeAndWithdraw(shares, receiver);\n\n emit Redeem(requester, receiver, shares, assets);\n }\n\n function togglePause(uint16 func) external onlyRole(GOV) {\n bool paused = paused[func];\n if (paused) {\n _unpause(func);\n } else {\n _pause(func);\n }\n }\n\n function setEpochLength(uint256 value) external onlyRole(GOV) {\n _setEpochLength(value);\n }\n\n function pendingRedeemRequest(address owner) public view returns (uint256 shares) {\n return redeemRequests[owner];\n }\n\n // claimableRedeemRequest - returns owners shares in claimable state,\n // i.e. epoch has elapsed and sufficient funds exist\n function claimableRedeemRequest(address owner) public view returns (uint256 shares) {\n if (redeemRequests[owner] > 0 && _isWithdrawalAllowed(owner, totalBalance(), redeemRequests[owner])) {\n return redeemRequests[owner];\n } else {\n return 0;\n }\n }\n\n function totalBalance() internal view returns (uint256) {\n return address(this).balance + MINTER.balance;\n }\n\n receive() external payable {} // solhint-disable-line\n\n fallback() external payable {} // solhint-disable-line\n}\n" + }, + "contracts/v2/interfaces/IDepositContract.sol": { + "content": "pragma solidity ^0.8.0;\n\n// ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━\n// ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓\n// ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛\n// ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃┃━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━\n// ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓\n// ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n// SPDX-License-Identifier: CC0-1.0\n\n// This interface is designed to be compatible with the Vyper version.\n/// @notice This is the Ethereum 2.0 deposit contract interface.\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\ninterface IDepositContract {\n /// @notice A processed deposit event.\n event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);\n\n /// @notice Submit a Phase 0 DepositData object.\n /// @param pubkey A BLS12-381 public key.\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\n /// @param signature A BLS12-381 signature.\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\n /// Used as a protection against malformed input.\n function deposit(\n bytes calldata pubkey,\n bytes calldata withdrawal_credentials,\n bytes calldata signature,\n bytes32 deposit_data_root\n ) external payable;\n\n /// @notice Query the current deposit root hash.\n /// @return The deposit root hash.\n function get_deposit_root() external view returns (bytes32);\n\n /// @notice Query the current deposit count.\n /// @return The deposit count encoded as a little endian 64-bit number.\n function get_deposit_count() external view returns (bytes memory);\n}\n" + }, + "contracts/v2/interfaces/IERC20MintableBurnable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IERC20MintableBurnable {\n function mintingAllowedAfter() external view returns (uint256);\n\n /**\n * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`\n * @param account The address of the account holding the funds\n * @param spender The address of the account spending the funds\n * @return The number of tokens approved\n */\n function allowance(address account, address spender) external view returns (uint256);\n\n /**\n * @notice Get the number of tokens held by the `account`\n * @param account The address of the account to get the balance of\n * @return The number of tokens held\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(address spender, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Triggers an approval from owner to spends\n * @param owner The address to approve from\n * @param spender The address to be approved\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @param deadline The time at which to expire the signature\n * @param v The recovery byte of the signature\n * @param r Half of the ECDSA signature pair\n * @param s Half of the ECDSA signature pair\n */\n function permit(\n address owner,\n address spender,\n uint256 rawAmount,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(address dst, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(address src, address dst, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Mint new tokens\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to be minted\n */\n function mint(address dst, uint256 rawAmount) external;\n\n function burn(address src, uint256 rawAmount) external;\n function setMinter(address minter_) external;\n}\n" + }, + "contracts/v2/interfaces/IFeeCalc.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IFeeCalc {\n function processDeposit(uint256 amt, address who) external view returns (uint256, uint256);\n\n function processWithdraw(uint256 amt, address who) external view returns (uint256, uint256);\n}\n" + }, + "contracts/v2/lib/Errors.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\n/**\n * @title Errors\n * @author Sharedstake\n * @notice Contains all the custom errors\n */\nlibrary Errors {\n error ZeroAddress();\n error InvalidAmount();\n error PermissionDenied();\n error InsufficientBalance();\n error TooEarly();\n error FailedCall();\n}\n" + }, + "contracts/v2/lib/ETH2DepositWithdrawalCredentials.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\nimport {IDepositContract} from \"../interfaces/IDepositContract.sol\";\n\n/// @title A contract for holding a eth2 validator withrawal pubkey\n/// @author @chimeraDefi\n/// @notice A contract for holding a eth2 validator withrawal pubkey\n/// @dev Downstream contract needs to implement who can set the withdrawal address and set it\ncontract ETH2DepositWithdrawalCredentials {\n uint256 internal constant _depositAmount = 32 ether;\n IDepositContract public immutable DEPOSIT_CONTRACT;\n bytes public withdrawalPubKey; // Pubkey for ETH 2.0 withdrawal creds\n\n event WithdrawalCredentialSet(bytes _withdrawalCredential);\n\n constructor(address _dc) {\n DEPOSIT_CONTRACT = IDepositContract(_dc);\n }\n\n /// @notice A more streamlined variant of batch deposit for use with preset withdrawal addresses\n /// Submit index-matching arrays that form Phase 0 DepositData objects.\n /// Will create a deposit transaction per index of the arrays submitted.\n ///\n /// @param pubkeys - An array of BLS12-381 public keys.\n /// @param signatures - An array of BLS12-381 signatures.\n /// @param depositDataRoots - An array of the SHA-256 hash of the SSZ-encoded DepositData object.\n function _batchDeposit(\n bytes[] calldata pubkeys,\n bytes[] calldata signatures,\n bytes32[] calldata depositDataRoots\n ) internal {\n // optimizations https://ethereum.stackexchange.com/questions/113221/what-is-the-purpose-of-unchecked-in-solidity\n // https://medium.com/@bloqarl/solidity-gas-optimization-tips-with-assembly-you-havent-heard-yet-1381c77ff078\n // 30m gas / block roughly, say 10m max used so 100 validators a batch max \n // each deposit call costs roughly 128k https://etherscan.io/tx/0xa2acf6e6bde99b532125cc8026cd88eea345f296968ce732556945ab4705d03e\n uint256 i = pubkeys.length;\n uint256 _amt = _depositAmount;\n bytes memory wpk = withdrawalPubKey;\n\n while (i > 0) {\n unchecked {\n // While loop check prevents underflow.\n // --i is cheaper than i--\n // reverse while loop cheapest compared to while or for \n // Since we set the upper loop bound to the arr len, we decr 1st to not hit out of bounds\n --i;\n\n DEPOSIT_CONTRACT.deposit{value: _amt}(\n pubkeys[i],\n wpk,\n signatures[i],\n depositDataRoots[i]\n );\n }\n }\n }\n\n /// @notice sets curr_withdrawal_pubkey to be used when deploying validators\n function _setWithdrawalCredential(bytes memory newPk) internal {\n withdrawalPubKey = newPk;\n\n emit WithdrawalCredentialSet(newPk);\n }\n}\n" + }, + "contracts/v2/lib/FIFOQueue.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\nimport {Errors} from \"./Errors.sol\";\n\n// Simple First in first out queue\n// Uses a system of cascading locks based on the block number.\n// Users need to wait a minimum of epochLength blocks before withdrawing\n// Users past the epoch boundary can claim, allowing some time for earlier users to claim first\nabstract contract FIFOQueue {\n struct UserEntry {\n uint256 amount;\n uint256 blocknum;\n }\n mapping(address => UserEntry) public userEntries;\n\n uint256 public epochLength;\n\n constructor(uint256 _epochLength) {\n epochLength = _epochLength;\n }\n\n function _checkWithdraw(\n address sender,\n uint256 balanceOfSelf,\n uint256 amountToWithdraw\n ) public view returns (bool withdrawalAllowed) {\n UserEntry memory ue = userEntries[sender];\n\n if (!(amountToWithdraw <= balanceOfSelf && amountToWithdraw <= ue.amount)) {\n revert Errors.InvalidAmount();\n }\n\n if (!(block.number >= ue.blocknum + epochLength)) {\n revert Errors.TooEarly();\n }\n return true;\n }\n\n function _isWithdrawalAllowed(\n address sender,\n uint256 balanceOfSelf,\n uint256 amountToWithdraw\n ) public view returns (bool) {\n UserEntry memory ue = userEntries[sender];\n\n return (amountToWithdraw <= balanceOfSelf && amountToWithdraw <= ue.amount) && (block.number >= ue.blocknum + epochLength);\n }\n\n // should be admin only or used in a constructor upstream\n // set epoch length in blocks\n function _setEpochLength(uint256 _value) internal {\n if (_value == 0) {\n revert Errors.InvalidAmount();\n }\n epochLength = _value;\n }\n\n function _stakeForWithdrawal(address sender, uint256 amount) internal {\n UserEntry memory ue = userEntries[sender];\n ue.amount = ue.amount + amount;\n ue.blocknum = block.number;\n userEntries[sender] = ue;\n }\n\n function _withdraw(address sender, uint256 amount) internal {\n UserEntry memory ue = userEntries[sender];\n if (amount > ue.amount) {\n revert Errors.InvalidAmount();\n }\n\n if (amount == ue.amount) {\n delete userEntries[sender];\n } else {\n ue.amount = ue.amount - amount;\n ue.blocknum = block.number;\n userEntries[sender] = ue;\n }\n }\n}\n" + }, + "contracts/v2/lib/GranularPause.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\nimport {Context} from \"@openzeppelin/contracts/utils/Context.sol\";\n\n/// @title GranularPause \n/// @author ChimeraDefi - chimera_defi@protonmail.com\n/// @notice allows more granular control of pausing functions\n/// @dev Inherit in child contract, you need to number each function you want to pause\n\nabstract contract GranularPause is Context {\n mapping(uint16 => bool) public paused;\n\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account, uint16 item);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account, uint16 item);\n\n error IsPaused();\n error IsNotPaused();\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused(uint16 _id) {\n if (paused[_id]) {\n revert IsPaused();\n }\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused(uint16 _id) {\n if (!paused[_id]) {\n revert IsNotPaused();\n }\n _;\n }\n\n /// @notice pauses a function\n /// @param _id id of function to pause\n function _pause(uint16 _id) internal virtual {\n paused[_id] = true;\n emit Paused(_msgSender(), _id);\n }\n\n /// @notice unpauses a function\n /// @param _id id of function to unpause\n function _unpause(uint16 _id) internal virtual {\n paused[_id] = false;\n emit Unpaused(_msgSender(), _id);\n }\n}\n\n" + }, + "contracts/v2/lib/OperatorSettable.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\nimport {Errors} from \"./Errors.sol\";\n\n/**\n * @title OperatorSettable\n * @author Sharedstake\n * @notice Handles operators for ERC-7450 like contracts\n */\nabstract contract OperatorSettable {\n mapping(address requester => mapping(address operator => bool)) public isOperator;\n event OperatorSet(address indexed owner, address indexed operator, bool value);\n\n modifier onlyOwnerOrOperator(address owner) {\n if (owner != msg.sender && !isOperator[owner][msg.sender]) {\n revert Errors.PermissionDenied();\n }\n _;\n }\n\n function setOperator(address operator, bool approved) external returns (bool) {\n isOperator[msg.sender][operator] = approved;\n emit OperatorSet(msg.sender, operator, approved);\n return true;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "storageLayout" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/solcInputs/266f4835dc637e40f5c59a1cd15f5094.json b/deployments/localhost/solcInputs/d5c4e8b77fe999241905bb33844ed6ed.json similarity index 97% rename from deployments/sepolia/solcInputs/266f4835dc637e40f5c59a1cd15f5094.json rename to deployments/localhost/solcInputs/d5c4e8b77fe999241905bb33844ed6ed.json index a8964f3..0b4fdd3 100644 --- a/deployments/sepolia/solcInputs/266f4835dc637e40f5c59a1cd15f5094.json +++ b/deployments/localhost/solcInputs/d5c4e8b77fe999241905bb33844ed6ed.json @@ -254,7 +254,7 @@ "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\nimport {ERC20MintableBurnableByMinter} from \"../lib/ERC20MintableBurnableByMinter.sol\";\nimport {Errors} from \"../lib/Errors.sol\";\n\n/// @title SgETH - SharedStake Governed Staked Ether\n/// @author @ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com\ncontract SgETH is ERC20MintableBurnableByMinter {\n constructor() ERC20MintableBurnableByMinter(\"SharedStake Governed Staked Ether\", \"sgETH\") {\n // Set the admin of the minter role; this causes the grant and revole role fns to gaurd to this admin role\n _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);\n }\n\n // Adds whitelisted minters - only callable by DEFAULT_ADMIN_ROLE enforced in OZ dep\n function addMinter(address minterAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {\n if (minterAddress != address(0)) {\n grantRole(MINTER, minterAddress);\n } else {\n revert Errors.ZeroAddress();\n }\n }\n\n // Remove a minter - only callable by DEFAULT_ADMIN_ROLE enforced internally\n function removeMinter(address minterAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {\n // oz uses maps so 0 address will return true but does not break anything\n revokeRole(MINTER, minterAddress);\n }\n\n // Transfer ownership of who can add/rm minters\n function transferOwnership(address newOwner) external onlyRole(DEFAULT_ADMIN_ROLE) {\n grantRole(DEFAULT_ADMIN_ROLE, newOwner);\n renounceRole(DEFAULT_ADMIN_ROLE, msg.sender); // permission gaurded via revert if called lacks role\n }\n}\n" }, "contracts/v2/core/SharedDepositMinterV2.sol": { - "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\n\n/// @title SharedDepositMinterV2 - minter for ETH LSD\n/// @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\n// v1 sharedstake veth2 minter with some code removed\n// user deposits eth to get minted token\n// The contract cannot move user ETH outside unless\n// 1. the user redeems 1:1\n// 2. the depositToEth2 or depositToEth2Batch fns are called which allow moving ETH to the mainnet deposit contract only\n// 3. The contract allows permissioned external actors to supply validator public keys\n// 4. Who's allowed to deposit how many validators is governed outside this contract\n// 5. The ability to provision validators for user ETH is portioned out by the DAO\n\n// Changes\n/**\n- Custom errors instead of revert strings\n- Granular management via AccessControl with GOV and NOR roles. Node operator can only deploy validators\n- Refactored to allow users to specify destination address for fns - for zaps\n- Added deposit+stake/unstake+withdraw combo convenience routes\n- Refactored fee calc out to external contract\n*/\nimport {IFeeCalc} from \"../interfaces/IFeeCalc.sol\";\nimport {IERC20MintableBurnable} from \"../interfaces/IERC20MintableBurnable.sol\";\nimport {IERC4626} from \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\n\nimport {AccessControl} from \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {Pausable} from \"@openzeppelin/contracts/security/Pausable.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport {ETH2DepositWithdrawalCredentials} from \"../lib/ETH2DepositWithdrawalCredentials.sol\";\n\ncontract SharedDepositMinterV2 is AccessControl, Pausable, ReentrancyGuard, ETH2DepositWithdrawalCredentials {\n /* ========== STATE VARIABLES ========== */\n uint256 public adminFee;\n uint256 public numValidators;\n uint256 public costPerValidator;\n\n // The validator shares created by this shared stake contract. 1 share costs >= 1 eth\n uint256 public curValidatorShares; //initialized to 0\n\n // The number of times the deposit to eth2 contract has been called to create validators\n uint256 public validatorsCreated; //initialized to 0\n\n // Total accrued admin fee\n uint256 public adminFeeTotal; //initialized to 0\n\n // Its hard to exactly hit the max deposit amount with small shares. this allows a small bit of overflow room\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token via a user withdraw\n uint256 public buffer;\n\n // Flash loan tokenomic protection in case of changes in admin fee with future lots\n bool public refundFeesOnWithdraw; //initialized to false\n\n // NEW\n IERC20MintableBurnable private immutable _SGETH;\n IERC4626 private immutable _WSGETH;\n IFeeCalc private _feeCalc;\n\n bytes32 public constant NOR = keccak256(\"NOR\"); // Node operator for deploying validators\n bytes32 public constant GOV = keccak256(\"GOV\"); // Governance for settings - normally timelock controlled by multisig\n\n //errors\n error AmountTooHigh();\n error NoValidators();\n\n constructor(\n uint256 _numValidators,\n uint256 _adminFee,\n address[] memory addresses\n ) AccessControl() Pausable() ReentrancyGuard() ETH2DepositWithdrawalCredentials(addresses[4]) {\n _feeCalc = IFeeCalc(addresses[0]);\n _SGETH = IERC20MintableBurnable(addresses[1]);\n _WSGETH = IERC4626(addresses[2]);\n\n _SGETH.approve(address(_WSGETH), 2 ** 256 - 1); // max approve wsgeth for deposit and stake\n\n adminFee = _adminFee; // Admin and infra fees\n numValidators = _numValidators; // The number of validators to create in this lot. Sets a max limit on deposits\n\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token\n buffer = 10 * 1e18; // roughly equal to 10 eth.\n\n costPerValidator = (32 * 1e18) + adminFee;\n\n _grantRole(NOR, msg.sender);\n _grantRole(GOV, addresses[3]); // deployer will need it to set withdrawal creds. since the non-custodial withdrawal path depends on the minter.\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LOGIC\n //////////////////////////////////////////////////////////////*/\n\n // USER INTERACTIONS\n /*\n Shares minted = Z\n Principal deposit input = P\n AdminFee = a\n costPerValidator = 32 + a\n AdminFee as percent in 1e18 = a% = (a / costPerValidator) * 1e18\n AdminFee on tx in 1e18 = (P * a% / 1e18)\n\n on deposit:\n P - (P * a%) = Z\n\n on withdraw with admin fee refund:\n P = Z / (1 - a%)\n P = Z - Z*a%\n */\n\n function deposit() external payable {\n _deposit(msg.sender);\n }\n\n function depositFor(address dest) external payable {\n _deposit(dest);\n }\n\n function depositAndStake() external payable {\n _WSGETH.deposit(_deposit(address(this)), msg.sender);\n }\n\n function depositAndStakeFor(address dest) external payable {\n _WSGETH.deposit(_deposit(address(this)), dest);\n }\n\n function withdraw(uint256 amount) external {\n _withdraw(amount, msg.sender, msg.sender);\n }\n\n function withdrawTo(uint256 amount, address dest) external {\n _withdraw(amount, msg.sender, dest);\n }\n\n function unstakeAndWithdraw(uint256 amount, address dest) external {\n _withdraw(_WSGETH.redeem(amount, address(this), msg.sender), address(this), dest);\n }\n\n // migration function to accept old monies and copy over state\n // users should not use this as it just donates the money without minting veth or tracking donations\n function donate() external payable {} // solhint-disable-line\n\n /*//////////////////////////////////////////////////////////////\n ADMIN LOGIC\n //////////////////////////////////////////////////////////////*/\n\n // Batch deposit eth to the eth2 contract with preset creds\n // Data needs to be verified offchain to save gas\n function batchDepositToEth2(\n bytes[] calldata pubkeys,\n bytes[] calldata signatures,\n bytes32[] calldata depositDataRoots\n ) external onlyRole(NOR) {\n if (address(this).balance < (_depositAmount * pubkeys.length)) {\n revert AmountTooHigh(); // Not enough bal in contract to deploy all validators\n }\n _batchDeposit(pubkeys, signatures, depositDataRoots);\n validatorsCreated = validatorsCreated + pubkeys.length;\n }\n\n function setWithdrawalCredential(bytes memory _newWithdrawalCreds) external onlyRole(NOR) {\n // can only be called once\n _setWithdrawalCredential(_newWithdrawalCreds);\n }\n\n // Slashes the onchain staked sgETH to mirror CL validator slashings\n // modifies wsgeth virtual price\n function slash(uint256 amt) external onlyRole(GOV) {\n if (amt > curValidatorShares) {\n revert AmountTooHigh(); // Cannot slash more than minted\n }\n _SGETH.burn(address(_WSGETH), amt);\n }\n\n // Set fee calc address. if addr = 0 then fees are assumed to be 0\n function setFeeCalc(address _feeCalculatorAddr) external onlyRole(GOV) {\n _feeCalc = IFeeCalc(_feeCalculatorAddr);\n }\n\n function togglePause() external onlyRole(GOV) {\n bool paused = paused();\n if (paused) {\n _unpause();\n } else {\n _pause();\n }\n }\n\n // Used to migrate state over to new contract\n function migrateShares(uint256 shares) external onlyRole(GOV) {\n curValidatorShares = shares;\n }\n\n function toggleWithdrawRefund() external onlyRole(GOV) {\n refundFeesOnWithdraw = !refundFeesOnWithdraw;\n }\n\n function setNumValidators(uint256 _numValidators) external onlyRole(GOV) {\n if (_numValidators > 0) {\n numValidators = _numValidators;\n } else {\n revert NoValidators();\n }\n }\n\n function withdrawAdminFee(uint256 amount) external onlyRole(GOV) {\n address payable sender = payable(msg.sender);\n if (amount == 0) {\n amount = adminFeeTotal;\n }\n if (amount > adminFeeTotal) {\n revert AmountTooHigh();\n }\n adminFeeTotal = adminFeeTotal - amount;\n Address.sendValue(sender, amount);\n }\n\n /*//////////////////////////////////////////////////////////////\n ACCOUNTING LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function remainingSpaceInEpoch() external view returns (uint256) {\n // Helpful view function to gauge how much the user can send to the contract when it is near full\n uint256 remainingShares = maxValidatorShares() - curValidatorShares;\n uint256 valBeforeAdmin = (remainingShares * 1e18) / (((1 * 1e18) - (adminFee * 1e18) / costPerValidator));\n return valBeforeAdmin;\n }\n\n function maxValidatorShares() public view returns (uint256) {\n return 32 * 1e18 * numValidators;\n }\n\n function _depositAccounting() internal returns (uint256 value) {\n // input is whole, not / 1e18 , i.e. in 1 = 1 eth send when from etherscan\n value = msg.value;\n uint256 fee;\n\n if (address(_feeCalc) != address(0)) {\n (value, fee) = _feeCalc.processDeposit(value, msg.sender);\n adminFeeTotal = adminFeeTotal + fee;\n }\n\n uint256 newShareTotal = curValidatorShares + value;\n\n if (newShareTotal > buffer + maxValidatorShares()) {\n revert AmountTooHigh();\n }\n curValidatorShares = newShareTotal;\n }\n\n function _withdrawAccounting(uint256 amount) internal returns (uint256) {\n uint256 fee;\n if (address(_feeCalc) != address(0)) {\n (amount, fee) = _feeCalc.processWithdraw(amount, msg.sender);\n if (refundFeesOnWithdraw) {\n adminFeeTotal = adminFeeTotal - fee;\n } else {\n adminFeeTotal = adminFeeTotal + fee;\n }\n }\n if (address(this).balance < (amount + adminFeeTotal)) {\n revert AmountTooHigh();\n }\n\n curValidatorShares = curValidatorShares - amount;\n return amount;\n }\n\n function _deposit(address dest) internal nonReentrant whenNotPaused returns (uint256 amt) {\n amt = _depositAccounting();\n _SGETH.mint(dest, amt);\n }\n\n function _withdraw(uint256 amount, address origin, address dest) internal nonReentrant whenNotPaused {\n _SGETH.burn(origin, amount); // reverts if amount is too high\n uint256 assets = _withdrawAccounting(amount);\n\n address payable recv = payable(dest);\n Address.sendValue(recv, assets);\n }\n\n receive() external payable {} // solhint-disable-line\n\n fallback() external payable {} // solhint-disable-line\n}\n" + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\n\n/// @title SharedDepositMinterV2 - minter for ETH LSD\n/// @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\n// v1 sharedstake veth2 minter with some code removed\n// user deposits eth to get minted token\n// The contract cannot move user ETH outside unless\n// 1. the user redeems 1:1\n// 2. the depositToEth2 or depositToEth2Batch fns are called which allow moving ETH to the mainnet deposit contract only\n// 3. The contract allows permissioned external actors to supply validator public keys\n// 4. Who's allowed to deposit how many validators is governed outside this contract\n// 5. The ability to provision validators for user ETH is portioned out by the DAO\n\n// Changes\n/**\n- Custom errors instead of revert strings\n- Granular management via AccessControl with GOV and NOR roles. Node operator can only deploy validators\n- Refactored to allow users to specify destination address for fns - for zaps\n- Added deposit+stake/unstake+withdraw combo convenience routes\n- Refactored fee calc out to external contract\n*/\nimport {IFeeCalc} from \"../interfaces/IFeeCalc.sol\";\nimport {IERC20MintableBurnable} from \"../interfaces/IERC20MintableBurnable.sol\";\nimport {IERC4626} from \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\n\nimport {AccessControl} from \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {Pausable} from \"@openzeppelin/contracts/security/Pausable.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport {ETH2DepositWithdrawalCredentials} from \"../lib/ETH2DepositWithdrawalCredentials.sol\";\n\n/// @title SharedDepositMinterV2\n/// @author ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\n/// @notice Mints LSD tokens for ETH deposited to the contract. Handles the depositing of ETH to the ETH2 deposit contract and validator creation\n/// @dev Deployment params: \n/// - addresses : [feeCalc, sgeth, wsgeth, gov]\ncontract SharedDepositMinterV2 is AccessControl, Pausable, ReentrancyGuard, ETH2DepositWithdrawalCredentials {\n /* ========== STATE VARIABLES ========== */\n uint256 public adminFee;\n uint256 public numValidators;\n uint256 public costPerValidator;\n\n // The validator shares created by this shared stake contract. 1 share costs >= 1 eth\n uint256 public curValidatorShares; //initialized to 0\n\n // The number of times the deposit to eth2 contract has been called to create validators\n uint256 public validatorsCreated; //initialized to 0\n\n // Total accrued admin fee\n uint256 public adminFeeTotal; //initialized to 0\n\n // Its hard to exactly hit the max deposit amount with small shares. this allows a small bit of overflow room\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token via a user withdraw\n uint256 public buffer;\n\n // Flash loan tokenomic protection in case of changes in admin fee with future lots\n bool public refundFeesOnWithdraw; //initialized to false\n\n // NEW\n IERC20MintableBurnable private immutable _SGETH;\n IERC4626 private immutable _WSGETH;\n IFeeCalc private _feeCalc;\n\n bytes32 public constant NOR = keccak256(\"NOR\"); // Node operator for deploying validators\n bytes32 public constant GOV = keccak256(\"GOV\"); // Governance for settings - normally timelock controlled by multisig\n\n //errors\n error AmountTooHigh();\n error NoValidators();\n\n constructor(\n uint256 _numValidators,\n uint256 _adminFee,\n address[] memory addresses\n ) AccessControl() Pausable() ReentrancyGuard() ETH2DepositWithdrawalCredentials(addresses[4]) {\n _feeCalc = IFeeCalc(addresses[0]);\n _SGETH = IERC20MintableBurnable(addresses[1]);\n _WSGETH = IERC4626(addresses[2]);\n\n _SGETH.approve(address(_WSGETH), 2 ** 256 - 1); // max approve wsgeth for deposit and stake\n\n adminFee = _adminFee; // Admin and infra fees\n numValidators = _numValidators; // The number of validators to create in this lot. Sets a max limit on deposits\n\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token\n buffer = 10 * 1e18; // roughly equal to 10 eth.\n\n costPerValidator = (32 * 1e18) + adminFee;\n\n _grantRole(NOR, msg.sender);\n _grantRole(GOV, addresses[3]); // deployer will need it to set withdrawal creds. since the non-custodial withdrawal path depends on the minter.\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LOGIC\n //////////////////////////////////////////////////////////////*/\n\n // USER INTERACTIONS\n /*\n Shares minted = Z\n Principal deposit input = P\n AdminFee = a\n costPerValidator = 32 + a\n AdminFee as percent in 1e18 = a% = (a / costPerValidator) * 1e18\n AdminFee on tx in 1e18 = (P * a% / 1e18)\n\n on deposit:\n P - (P * a%) = Z\n\n on withdraw with admin fee refund:\n P = Z / (1 - a%)\n P = Z - Z*a%\n */\n\n function deposit() external payable {\n _deposit(msg.sender);\n }\n\n function depositFor(address dest) external payable {\n _deposit(dest);\n }\n\n function depositAndStake() external payable {\n _WSGETH.deposit(_deposit(address(this)), msg.sender);\n }\n\n function depositAndStakeFor(address dest) external payable {\n _WSGETH.deposit(_deposit(address(this)), dest);\n }\n\n function withdraw(uint256 amount) external {\n _withdraw(amount, msg.sender, msg.sender);\n }\n\n function withdrawTo(uint256 amount, address dest) external {\n _withdraw(amount, msg.sender, dest);\n }\n\n function unstakeAndWithdraw(uint256 amount, address dest) external {\n _withdraw(_WSGETH.redeem(amount, address(this), msg.sender), address(this), dest);\n }\n\n // migration function to accept old monies and copy over state\n // users should not use this as it just donates the money without minting veth or tracking donations\n function donate() external payable {} // solhint-disable-line\n\n /*//////////////////////////////////////////////////////////////\n ADMIN LOGIC\n //////////////////////////////////////////////////////////////*/\n\n // Batch deposit eth to the eth2 contract with preset creds\n // Data needs to be verified offchain to save gas\n function batchDepositToEth2(\n bytes[] calldata pubkeys,\n bytes[] calldata signatures,\n bytes32[] calldata depositDataRoots\n ) external onlyRole(NOR) {\n if (address(this).balance < (_depositAmount * pubkeys.length)) {\n revert AmountTooHigh(); // Not enough bal in contract to deploy all validators\n }\n _batchDeposit(pubkeys, signatures, depositDataRoots);\n validatorsCreated = validatorsCreated + pubkeys.length;\n }\n\n function setWithdrawalCredential(bytes memory _newWithdrawalCreds) external onlyRole(NOR) {\n // can only be called once\n _setWithdrawalCredential(_newWithdrawalCreds);\n }\n\n // Slashes the onchain staked sgETH to mirror CL validator slashings\n // modifies wsgeth virtual price\n function slash(uint256 amt) external onlyRole(GOV) {\n if (amt > curValidatorShares) {\n revert AmountTooHigh(); // Cannot slash more than minted\n }\n _SGETH.burn(address(_WSGETH), amt);\n }\n\n // Set fee calc address. if addr = 0 then fees are assumed to be 0\n function setFeeCalc(address _feeCalculatorAddr) external onlyRole(GOV) {\n _feeCalc = IFeeCalc(_feeCalculatorAddr);\n }\n\n function togglePause() external onlyRole(GOV) {\n bool paused = paused();\n if (paused) {\n _unpause();\n } else {\n _pause();\n }\n }\n\n // Used to migrate state over to new contract\n function migrateShares(uint256 shares) external onlyRole(GOV) {\n curValidatorShares = shares;\n }\n\n function toggleWithdrawRefund() external onlyRole(GOV) {\n refundFeesOnWithdraw = !refundFeesOnWithdraw;\n }\n\n function setNumValidators(uint256 _numValidators) external onlyRole(GOV) {\n if (_numValidators > 0) {\n numValidators = _numValidators;\n } else {\n revert NoValidators();\n }\n }\n\n function withdrawAdminFee(uint256 amount) external onlyRole(GOV) {\n address payable sender = payable(msg.sender);\n if (amount == 0) {\n amount = adminFeeTotal;\n }\n if (amount > adminFeeTotal) {\n revert AmountTooHigh();\n }\n adminFeeTotal = adminFeeTotal - amount;\n Address.sendValue(sender, amount);\n }\n\n /*//////////////////////////////////////////////////////////////\n ACCOUNTING LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function remainingSpaceInEpoch() external view returns (uint256) {\n // Helpful view function to gauge how much the user can send to the contract when it is near full\n uint256 remainingShares = maxValidatorShares() - curValidatorShares;\n uint256 valBeforeAdmin = (remainingShares * 1e18) / (((1 * 1e18) - (adminFee * 1e18) / costPerValidator));\n return valBeforeAdmin;\n }\n\n function maxValidatorShares() public view returns (uint256) {\n return 32 * 1e18 * numValidators;\n }\n\n function _depositAccounting() internal returns (uint256 value) {\n // input is whole, not / 1e18 , i.e. in 1 = 1 eth send when from etherscan\n value = msg.value;\n uint256 fee;\n\n if (address(_feeCalc) != address(0)) {\n (value, fee) = _feeCalc.processDeposit(value, msg.sender);\n adminFeeTotal = adminFeeTotal + fee;\n }\n\n uint256 newShareTotal = curValidatorShares + value;\n\n if (newShareTotal > buffer + maxValidatorShares()) {\n revert AmountTooHigh();\n }\n curValidatorShares = newShareTotal;\n }\n\n function _withdrawAccounting(uint256 amount) internal returns (uint256) {\n uint256 fee;\n if (address(_feeCalc) != address(0)) {\n (amount, fee) = _feeCalc.processWithdraw(amount, msg.sender);\n if (refundFeesOnWithdraw) {\n adminFeeTotal = adminFeeTotal - fee;\n } else {\n adminFeeTotal = adminFeeTotal + fee;\n }\n }\n if (address(this).balance < (amount + adminFeeTotal)) {\n revert AmountTooHigh();\n }\n\n curValidatorShares = curValidatorShares - amount;\n return amount;\n }\n\n function _deposit(address dest) internal nonReentrant whenNotPaused returns (uint256 amt) {\n amt = _depositAccounting();\n _SGETH.mint(dest, amt);\n }\n\n function _withdraw(uint256 amount, address origin, address dest) internal nonReentrant whenNotPaused {\n _SGETH.burn(origin, amount); // reverts if amount is too high\n uint256 assets = _withdrawAccounting(amount);\n\n address payable recv = payable(dest);\n Address.sendValue(recv, assets);\n }\n\n receive() external payable {} // solhint-disable-line\n\n fallback() external payable {} // solhint-disable-line\n}\n" }, "contracts/v2/core/WithdrawalQueue.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\nimport {IERC4626} from \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\nimport {AccessControl} from \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport {FIFOQueue} from \"../lib/FIFOQueue.sol\";\nimport {Errors} from \"../lib/Errors.sol\";\nimport {OperatorSettable} from \"../lib/OperatorSettable.sol\";\nimport {GranularPause} from \"../lib/GranularPause.sol\";\nimport {SharedDepositMinterV2} from \"./SharedDepositMinterV2.sol\";\n\n/**\n * @title WithdrawalQueue\n * @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\n * @dev -\n * ERC-7540 inspired withdrawal contract\n * This contract is designed to be used with SharedDepositMinterV2 contract\n * As a module extension that adds 7540 methods requestRedeem and redeem\n * Example flow ->\n * user calls requestRedeem(user, user, userShares)\n * user calls setOperator(admin OR protocol provided keeper, true)\n * admin can now call redeem on the users behalf if needed after epoch\n * user calls redeem(user, user, userShares) after waiting for epoch\n * Caveats:\n * If the user requests another redemption, before fulfillment,\n * this resets the epoch length clock for their request\n * Basic upgrade path:\n * 1. Call togglePause(1), this disables the requestRedeem fn so no new requests\n * 2. Deploy new contract, direct users to it\n * 3. Fulfill any remaining redeemRequests i.e. totalPendingRequest,\n * for all RedeemRequest events from requestsFulfilled to requestsCreated\n */\ncontract WithdrawalQueue is AccessControl, GranularPause, ReentrancyGuard, FIFOQueue, OperatorSettable {\n using Address for address payable;\n\n struct Request {\n address requester;\n uint256 shares;\n }\n // SharedDepositMinterV2 public immutable MINTER;\n address public immutable MINTER;\n address public immutable WSGETH;\n\n uint256 internal totalPendingRequest;\n uint256 internal requestsCreated;\n uint256 internal requestsFulfilled;\n uint256 public totalAssetsOut;\n\n bytes32 public constant GOV = keccak256(\"GOV\"); // Governance for settings - normally timelock controlled by multisig\n\n mapping(uint256 => Request) internal requests;\n mapping(address => uint256) public redeemRequests;\n\n event RedeemRequest(\n address indexed requester,\n address indexed owner,\n uint256 indexed requestId,\n address operator,\n uint256 assets\n );\n event Redeem(address indexed requester, address indexed receiver, uint256 shares, uint256 assets);\n\n constructor(address _minter, address _wsgEth, uint256 _epochLength) FIFOQueue(_epochLength) {\n MINTER = _minter;\n WSGETH = _wsgEth;\n\n uint256 maxUint256 = 2 ** 256 - 1;\n\n IERC20(WSGETH).approve(_minter, maxUint256);\n\n _grantRole(GOV, msg.sender);\n }\n\n function requestRedeem(\n uint256 shares,\n address requester,\n address owner\n ) external onlyOwnerOrOperator(owner) nonReentrant whenNotPaused(uint16(1)) returns (uint256 requestId) {\n if (shares == 0) {\n revert Errors.InvalidAmount();\n }\n IERC20(WSGETH).transferFrom(owner, address(this), shares); // asset here is the Vault underlying asset\n\n requestId = requestsCreated++;\n requests[requestId] = Request({requester: requester, shares: shares});\n // use assets for tracking\n uint256 assets = IERC4626(WSGETH).previewRedeem(shares);\n\n _stakeForWithdrawal(owner, assets);\n totalPendingRequest += assets;\n redeemRequests[requester] += assets; // underflow would revert if not enough claimable shares\n\n emit RedeemRequest(requester, owner, requestId, msg.sender, shares);\n }\n\n function redeem(\n uint256 shares,\n address receiver,\n address requester\n ) external onlyOwnerOrOperator(requester) nonReentrant whenNotPaused(uint16(2)) returns (uint256 assets) {\n if (shares == 0) {\n revert Errors.InvalidAmount();\n }\n\n assets = IERC4626(WSGETH).previewRedeem(shares);\n\n // checks if we have enough assets to fulfill the request and if epoch has passed\n if (claimableRedeemRequest(requester) < assets) {\n _checkWithdraw(requester, totalBalance(), assets);\n return 0; // should never happen. previous fn will generate a rich error\n }\n\n _withdraw(requester, assets);\n // Treat everything as claimableRedeemRequest and validate here if there's adequate funds\n redeemRequests[requester] -= assets; // underflow would revert if not enough claimable shares\n totalPendingRequest -= assets;\n // Track total returned\n totalAssetsOut += assets;\n requestsFulfilled++;\n\n uint256 minterBalance = MINTER.balance;\n // This feels suboptimal, but is the easiest way to always burn the token on redemptions\n if (assets > minterBalance) {\n uint256 diff = assets - minterBalance;\n // We need to use donate/transfer etc. cant deposit and mint more shares as that messes up accouting\n payable(MINTER).transfer(diff);\n }\n\n // Always burn redeemed tokens\n SharedDepositMinterV2(payable(MINTER)).unstakeAndWithdraw(shares, receiver);\n\n emit Redeem(requester, receiver, shares, assets);\n }\n\n function togglePause(uint16 func) external onlyRole(GOV) {\n bool paused = paused[func];\n if (paused) {\n _unpause(func);\n } else {\n _pause(func);\n }\n }\n\n function setEpochLength(uint256 value) external onlyRole(GOV) {\n _setEpochLength(value);\n }\n\n function pendingRedeemRequest(address owner) public view returns (uint256 shares) {\n return redeemRequests[owner];\n }\n\n // claimableRedeemRequest - returns owners shares in claimable state,\n // i.e. epoch has elapsed and sufficient funds exist\n function claimableRedeemRequest(address owner) public view returns (uint256 shares) {\n if (redeemRequests[owner] > 0 && _isWithdrawalAllowed(owner, totalBalance(), redeemRequests[owner])) {\n return redeemRequests[owner];\n } else {\n return 0;\n }\n }\n\n function totalBalance() internal view returns (uint256) {\n return address(this).balance + MINTER.balance;\n }\n\n receive() external payable {} // solhint-disable-line\n\n fallback() external payable {} // solhint-disable-line\n}\n" @@ -320,7 +320,7 @@ "content": "// SPDX-License-Identifier: UNLICENSED\n\n// Modulate how much user ETH node operators can stake\n// Sliding scale starting at 100% user ETH going to protocol staking\n// Reducing to allow more ETH to flow to indie node operators and other staking vaults\n// Different staking vaults offer different possibilities such as DVT, different clients, operators etc\n// This contract will own the minter\n\ncontract ETHDepositScaler {\n constructor() {}\n}\n" }, "contracts/v2/periphery/FeeCalc.sol": { - "content": "// SPDX-License-Identifier: UNLICENSED\nimport {SafeMath} from \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {Ownable2Step} from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\n\npragma solidity ^0.8.20;\n\ncontract FeeCalc is Ownable2Step {\n struct Settings {\n uint256 adminFee;\n uint256 exitFee;\n bool refundFeesOnWithdraw;\n bool chargeOnDeposit;\n bool chargeOnExit;\n }\n Settings private config;\n uint256 public adminFee;\n uint256 public costPerValidator;\n\n uint256 private immutable BIPS = 10000;\n constructor(Settings memory _settings) Ownable2Step() {\n // admin fee in bips (10000 = 100%)\n adminFee = _settings.adminFee;\n config = _settings;\n costPerValidator = ((32 + (32 * adminFee)) * 1 ether) / BIPS;\n }\n\n function processDeposit(uint256 value) external view returns (uint256 amt, uint256 fee) {\n if (config.chargeOnDeposit) {\n fee = (value * adminFee) / BIPS;\n amt = value - fee;\n }\n }\n\n function processWithdraw(uint256 value) external view returns (uint256 amt, uint256 fee) {\n if (config.refundFeesOnWithdraw) {\n fee = (value * adminFee) / BIPS;\n amt = value + fee;\n } else if (config.chargeOnExit) {\n fee = (value * config.exitFee) / BIPS;\n amt = value - fee;\n } else {\n fee = 0;\n amt = value;\n }\n }\n\n function set(Settings calldata newSettings) external onlyOwner {\n config = newSettings;\n adminFee = newSettings.adminFee;\n }\n\n function setRefundFeesOnWithdraw(bool _refundFeesOnWithdraw) external onlyOwner {\n config.refundFeesOnWithdraw = _refundFeesOnWithdraw;\n }\n\n function setExitFee(uint256 _exitFee) external onlyOwner {\n config.exitFee = _exitFee;\n }\n\n function setAdminFee(uint256 amount) external onlyOwner {\n adminFee = amount;\n config.adminFee = amount;\n }\n}\n" + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.20;\n\nimport {Ownable2Step} from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\n\ncontract FeeCalc is Ownable2Step {\n struct Settings {\n uint256 adminFee;\n uint256 exitFee;\n bool refundFeesOnWithdraw;\n bool chargeOnDeposit;\n bool chargeOnExit;\n }\n Settings private config;\n uint256 public adminFee;\n uint256 public costPerValidator;\n\n uint256 private immutable BIPS = 10000;\n constructor(Settings memory _settings) Ownable2Step() {\n // admin fee in bips (10000 = 100%)\n adminFee = _settings.adminFee;\n config = _settings;\n costPerValidator = ((32 + (32 * adminFee)) * 1 ether) / BIPS;\n }\n\n function set(Settings calldata newSettings) external onlyOwner {\n config = newSettings;\n adminFee = newSettings.adminFee;\n }\n\n function setRefundFeesOnWithdraw(bool _refundFeesOnWithdraw) external onlyOwner {\n config.refundFeesOnWithdraw = _refundFeesOnWithdraw;\n }\n\n function setExitFee(uint256 _exitFee) external onlyOwner {\n config.exitFee = _exitFee;\n }\n\n function setAdminFee(uint256 amount) external onlyOwner {\n adminFee = amount;\n config.adminFee = amount;\n }\n\n function processDeposit(uint256 value, address _sender) external view returns (uint256 amt, uint256 fee) {\n // TODO: semder is currently unsused but can be used later to calculate a fee reduction based on token holdings\n if (config.chargeOnDeposit) {\n fee = (value * adminFee) / BIPS;\n amt = value - fee;\n }\n }\n\n function processWithdraw(uint256 value, address _sender) external view returns (uint256 amt, uint256 fee) {\n // TODO: semder is currently unsused but can be used later to calculate a fee reduction based on token holdings\n if (config.refundFeesOnWithdraw) {\n fee = (value * adminFee) / BIPS;\n amt = value + fee;\n } else if (config.chargeOnExit) {\n fee = (value * config.exitFee) / BIPS;\n amt = value - fee;\n } else {\n fee = 0;\n amt = value;\n }\n }\n}\n" }, "contracts/v2/periphery/UserDepositHelper.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.20;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {ISharedDeposit} from \"../../interfaces/ISharedDeposit.sol\";\n\n// User referral rewards tracking contract\n// Fires events on user deposits to assits attribution of rewards\n// Calls proper flow to retrieve interest bearing staked eth\n// TODO: Tests, scripts to aggregate events offchain and calc referral rewards\ncontract UserDepositHelper {\n ISharedDeposit private immutable MINTER;\n\n event Deposit(address indexed _from, uint256 _value);\n event ExtraDepositData(address indexed _from, uint256 _value, bytes32 data);\n event DepositRef(address indexed _from, uint256 _value, address ref);\n event DepositFrontend(address indexed _from, uint256 _value, address ref);\n\n constructor(address _sgEth, address _minter) {\n MINTER = ISharedDeposit(_minter);\n IERC20(_sgEth).approve(_minter, 2 ** 256 - 1);\n }\n\n // Deposit multiple users and amts from a single call with referral and frontend address emitted. useful for batch deposits to reduce gas costs\n // An external contract can buffer ETH and call this\n function depositMultipleWithReferral(\n address[] memory addrs,\n uint256[] memory amts,\n address ref,\n address frontend,\n bytes32[] memory bytesToBroadcast\n ) external payable {\n uint256 i = addrs.length;\n if (addrs.length != amts.length || addrs.length != bytesToBroadcast.length) {\n payable(msg.sender).transfer(msg.value);\n }\n while (i > 0) {\n unchecked {\n --i;\n\n emit Deposit(addrs[i], amts[i]);\n emit ExtraDepositData(msg.sender, msg.value, bytesToBroadcast[i]);\n emit DepositRef(msg.sender, msg.value, ref);\n emit DepositFrontend(msg.sender, msg.value, frontend);\n MINTER.depositAndStakeFor{value: amts[i]}(addrs[i]);\n }\n }\n }\n\n // User deposit helper. User needs to call this function.\n // Referral data can be filled in by frontend\n function depositWithEvents(address ref, address frontend, bytes32 data) external payable {\n MINTER.depositAndStakeFor{value: msg.value}(msg.sender);\n emit Deposit(msg.sender, msg.value);\n emit ExtraDepositData(msg.sender, msg.value, data);\n emit DepositRef(msg.sender, msg.value, ref);\n emit DepositFrontend(msg.sender, msg.value, frontend);\n }\n}\n" @@ -371,11 +371,6 @@ }, "metadata": { "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } } } } \ No newline at end of file diff --git a/deployments/localhost/solcInputs/ed3d37b1608de0df300eb7ef8fcf97be.json b/deployments/localhost/solcInputs/ed3d37b1608de0df300eb7ef8fcf97be.json new file mode 100644 index 0000000..b93e694 --- /dev/null +++ b/deployments/localhost/solcInputs/ed3d37b1608de0df300eb7ef8fcf97be.json @@ -0,0 +1,36 @@ +{ + "language": "Solidity", + "sources": { + "contracts/mocks/DepositContract.sol": { + "content": "// ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━\n// ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓\n// ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛\n// ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃┃━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━\n// ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓\n// ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n// SPDX-License-Identifier: CC0-1.0\n\npragma solidity 0.6.11;\n\n// This interface is designed to be compatible with the Vyper version.\n/// @notice This is the Ethereum 2.0 deposit contract interface.\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\ninterface IDepositContract {\n /// @notice A processed deposit event.\n event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);\n\n /// @notice Submit a Phase 0 DepositData object.\n /// @param pubkey A BLS12-381 public key.\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\n /// @param signature A BLS12-381 signature.\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\n /// Used as a protection against malformed input.\n function deposit(\n bytes calldata pubkey,\n bytes calldata withdrawal_credentials,\n bytes calldata signature,\n bytes32 deposit_data_root\n ) external payable;\n\n /// @notice Query the current deposit root hash.\n /// @return The deposit root hash.\n function get_deposit_root() external view returns (bytes32);\n\n /// @notice Query the current deposit count.\n /// @return The deposit count encoded as a little endian 64-bit number.\n function get_deposit_count() external view returns (bytes memory);\n}\n\n// Based on official specification in https://eips.ethereum.org/EIPS/eip-165\ninterface ERC165 {\n /// @notice Query if a contract implements an interface\n /// @param interfaceId The interface identifier, as specified in ERC-165\n /// @dev Interface identification is specified in ERC-165. This function\n /// uses less than 30,000 gas.\n /// @return `true` if the contract implements `interfaceId` and\n /// `interfaceId` is not 0xffffffff, `false` otherwise\n function supportsInterface(bytes4 interfaceId) external pure returns (bool);\n}\n\n// This is a rewrite of the Vyper Eth2.0 deposit contract in Solidity.\n// It tries to stay as close as possible to the original source code.\n/// @notice This is the Ethereum 2.0 deposit contract interface.\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\ncontract DepositContract is IDepositContract, ERC165 {\n uint constant DEPOSIT_CONTRACT_TREE_DEPTH = 4; // changed to make it cheaper for testing - chimera\n // NOTE: this also ensures `deposit_count` will fit into 64-bits\n uint constant MAX_DEPOSIT_COUNT = 2 ** DEPOSIT_CONTRACT_TREE_DEPTH - 1;\n\n bytes32[DEPOSIT_CONTRACT_TREE_DEPTH] branch;\n uint256 deposit_count;\n\n bytes32[DEPOSIT_CONTRACT_TREE_DEPTH] zero_hashes;\n\n // added for testing\n address private owner;\n\n constructor() public {\n owner = msg.sender;\n // Compute hashes in empty sparse Merkle tree\n for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH - 1; height++)\n zero_hashes[height + 1] = sha256(abi.encodePacked(zero_hashes[height], zero_hashes[height]));\n }\n\n function get_deposit_root() external view override returns (bytes32) {\n bytes32 node;\n uint size = deposit_count;\n for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH; height++) {\n if ((size & 1) == 1) node = sha256(abi.encodePacked(branch[height], node));\n else node = sha256(abi.encodePacked(node, zero_hashes[height]));\n size /= 2;\n }\n return sha256(abi.encodePacked(node, to_little_endian_64(uint64(deposit_count)), bytes24(0)));\n }\n\n function get_deposit_count() external view override returns (bytes memory) {\n return to_little_endian_64(uint64(deposit_count));\n }\n\n function deposit(\n bytes calldata pubkey,\n bytes calldata withdrawal_credentials,\n bytes calldata signature,\n bytes32 deposit_data_root\n ) external payable override {\n // Extended ABI length checks since dynamic types are used.\n require(pubkey.length == 48, \"DepositContract: invalid pubkey length\");\n require(withdrawal_credentials.length == 32, \"DepositContract: invalid withdrawal_credentials length\");\n require(signature.length == 96, \"DepositContract: invalid signature length\");\n\n // Check deposit amount\n require(msg.value >= 1 ether, \"DepositContract: deposit value too low\");\n require(msg.value % 1 gwei == 0, \"DepositContract: deposit value not multiple of gwei\");\n uint deposit_amount = msg.value / 1 gwei;\n require(deposit_amount <= type(uint64).max, \"DepositContract: deposit value too high\");\n\n // Emit `DepositEvent` log\n bytes memory amount = to_little_endian_64(uint64(deposit_amount));\n emit DepositEvent(\n pubkey,\n withdrawal_credentials,\n amount,\n signature,\n to_little_endian_64(uint64(deposit_count))\n );\n\n // Compute deposit data root (`DepositData` hash tree root)\n bytes32 pubkey_root = sha256(abi.encodePacked(pubkey, bytes16(0)));\n bytes32 signature_root = sha256(\n abi.encodePacked(\n sha256(abi.encodePacked(signature[:64])),\n sha256(abi.encodePacked(signature[64:], bytes32(0)))\n )\n );\n bytes32 node = sha256(\n abi.encodePacked(\n sha256(abi.encodePacked(pubkey_root, withdrawal_credentials)),\n sha256(abi.encodePacked(amount, bytes24(0), signature_root))\n )\n );\n\n // Verify computed and expected deposit data roots match\n require(\n node == deposit_data_root,\n \"DepositContract: reconstructed DepositData does not match supplied deposit_data_root\"\n );\n\n // Avoid overflowing the Merkle tree (and prevent edge case in computing `branch`)\n require(deposit_count < MAX_DEPOSIT_COUNT, \"DepositContract: merkle tree full\");\n\n // Add deposit data root to Merkle tree (update a single `branch` node)\n deposit_count += 1;\n uint size = deposit_count;\n for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH; height++) {\n if ((size & 1) == 1) {\n branch[height] = node;\n return;\n }\n node = sha256(abi.encodePacked(branch[height], node));\n size /= 2;\n }\n // As the loop should always end prematurely with the `return` statement,\n // this code should be unreachable. We assert `false` just to be safe.\n assert(false);\n }\n\n // added for testing\n function rug() external {\n payable(owner).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {\n return interfaceId == type(ERC165).interfaceId || interfaceId == type(IDepositContract).interfaceId;\n }\n\n function to_little_endian_64(uint64 value) internal pure returns (bytes memory ret) {\n ret = new bytes(8);\n bytes8 bytesValue = bytes8(value);\n // Byteswapping during copying to bytes.\n ret[0] = bytesValue[7];\n ret[1] = bytesValue[6];\n ret[2] = bytesValue[5];\n ret[3] = bytesValue[4];\n ret[4] = bytesValue[3];\n ret[5] = bytesValue[2];\n ret[6] = bytesValue[1];\n ret[7] = bytesValue[0];\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "storageLayout" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/DepositContract.json b/deployments/sepolia/DepositContract.json new file mode 100644 index 0000000..3388daa --- /dev/null +++ b/deployments/sepolia/DepositContract.json @@ -0,0 +1,265 @@ +{ + "address": "0xEb9e7570f8D5ac7D0Abfbed902A784E84dF16a78", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "withdrawal_credentials", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "amount", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "signature", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "index", + "type": "bytes" + } + ], + "name": "DepositEvent", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "withdrawal_credentials", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "deposit_data_root", + "type": "bytes32" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "get_deposit_count", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "get_deposit_root", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rug", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x0a29295954637531c3f1f6fb751239e58a6d615df06f73e902d057feba7d9ab9", + "receipt": { + "to": null, + "from": "0xA120FAd0498ECbF755a675E3833158484123bF30", + "contractAddress": "0xEb9e7570f8D5ac7D0Abfbed902A784E84dF16a78", + "transactionIndex": 23, + "gasUsed": "1227961", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe0592757871a645742cf6283405e5efa72cddece58c0531338f70aa29b1cac4b", + "transactionHash": "0x0a29295954637531c3f1f6fb751239e58a6d615df06f73e902d057feba7d9ab9", + "logs": [], + "blockNumber": 6233341, + "cumulativeGasUsed": "7421045", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0a8f8cbd3ce11316bfb7ec95fa86f28d", + "metadata": "{\"compiler\":{\"version\":\"0.6.11+commit.5ef660b1\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"withdrawal_credentials\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"amount\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"index\",\"type\":\"bytes\"}],\"name\":\"DepositEvent\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"withdrawal_credentials\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"deposit_data_root\",\"type\":\"bytes32\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"get_deposit_count\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"get_deposit_root\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rug\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"deposit(bytes,bytes,bytes,bytes32)\":{\"params\":{\"deposit_data_root\":\"The SHA-256 hash of the SSZ-encoded DepositData object. Used as a protection against malformed input.\",\"pubkey\":\"A BLS12-381 public key.\",\"signature\":\"A BLS12-381 signature.\",\"withdrawal_credentials\":\"Commitment to a public key for withdrawals.\"}},\"get_deposit_count()\":{\"returns\":{\"_0\":\"The deposit count encoded as a little endian 64-bit number.\"}},\"get_deposit_root()\":{\"returns\":{\"_0\":\"The deposit root hash.\"}},\"supportsInterface(bytes4)\":{\"details\":\"Interface identification is specified in ERC-165. This function uses less than 30,000 gas.\",\"params\":{\"interfaceId\":\"The interface identifier, as specified in ERC-165\"},\"returns\":{\"_0\":\"`true` if the contract implements `interfaceId` and `interfaceId` is not 0xffffffff, `false` otherwise\"}}},\"version\":1},\"userdoc\":{\"events\":{\"DepositEvent(bytes,bytes,bytes,bytes,bytes)\":{\"notice\":\"A processed deposit event.\"}},\"kind\":\"user\",\"methods\":{\"deposit(bytes,bytes,bytes,bytes32)\":{\"notice\":\"Submit a Phase 0 DepositData object.\"},\"get_deposit_count()\":{\"notice\":\"Query the current deposit count.\"},\"get_deposit_root()\":{\"notice\":\"Query the current deposit root hash.\"},\"supportsInterface(bytes4)\":{\"notice\":\"Query if a contract implements an interface\"}},\"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\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/mocks/DepositContract.sol\":\"DepositContract\"},\"evmVersion\":\"istanbul\",\"libraries\":{\"__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/mocks/DepositContract.sol\":{\"content\":\"// \\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u250f\\u2513\\u2501\\u250f\\u2513\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\n// \\u2503\\u250f\\u2501\\u2501\\u251b\\u250f\\u251b\\u2517\\u2513\\u2503\\u2503\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2517\\u2513\\u250f\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\n// \\u2503\\u2517\\u2501\\u2501\\u2513\\u2517\\u2513\\u250f\\u251b\\u2503\\u2517\\u2501\\u2513\\u2517\\u251b\\u250f\\u251b\\u2503\\u2501\\u2501\\u2503\\u2503\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2503\\u2503\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2513\\u2517\\u2513\\u250f\\u251b\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u2517\\u251b\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2513\\u2501\\u2517\\u2513\\u250f\\u251b\\u250f\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u2501\\u250f\\u2501\\u2501\\u2513\\u2517\\u2513\\u250f\\u251b\\n// \\u2503\\u250f\\u2501\\u2501\\u251b\\u2501\\u2503\\u2503\\u2501\\u2503\\u250f\\u2513\\u2503\\u250f\\u2501\\u251b\\u250f\\u251b\\u2501\\u2501\\u2503\\u2503\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2503\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u2501\\u2501\\u252b\\u2523\\u252b\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u250f\\u2513\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2513\\u2501\\u2503\\u2503\\u2501\\u2503\\u250f\\u251b\\u2517\\u2501\\u2513\\u2503\\u2501\\u2503\\u250f\\u2501\\u251b\\u2501\\u2503\\u2503\\u2501\\n// \\u2503\\u2517\\u2501\\u2501\\u2513\\u2501\\u2503\\u2517\\u2513\\u2503\\u2503\\u2503\\u2503\\u2503\\u2503\\u2517\\u2501\\u2513\\u250f\\u2513\\u2503\\u2517\\u2501\\u251b\\u2503\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u251b\\u2503\\u2503\\u2503\\u2501\\u252b\\u2503\\u2517\\u251b\\u2503\\u2503\\u2517\\u251b\\u2503\\u2523\\u2501\\u2501\\u2503\\u2503\\u2503\\u2501\\u2503\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2503\\u2517\\u2501\\u251b\\u2503\\u2503\\u2517\\u251b\\u2503\\u2503\\u2503\\u2503\\u2503\\u2501\\u2503\\u2517\\u2513\\u2503\\u2503\\u2501\\u2503\\u2517\\u251b\\u2517\\u2513\\u2503\\u2517\\u2501\\u2513\\u2501\\u2503\\u2517\\u2513\\n// \\u2517\\u2501\\u2501\\u2501\\u251b\\u2501\\u2517\\u2501\\u251b\\u2517\\u251b\\u2517\\u251b\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u251b\\u2517\\u2501\\u2501\\u2501\\u251b\\u2501\\u2501\\u2501\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2503\\u250f\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u251b\\u2501\\u2501\\u2501\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2501\\u2517\\u2501\\u251b\\n// \\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\n// \\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2517\\u251b\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\n\\n// SPDX-License-Identifier: CC0-1.0\\n\\npragma solidity 0.6.11;\\n\\n// This interface is designed to be compatible with the Vyper version.\\n/// @notice This is the Ethereum 2.0 deposit contract interface.\\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\\ninterface IDepositContract {\\n /// @notice A processed deposit event.\\n event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);\\n\\n /// @notice Submit a Phase 0 DepositData object.\\n /// @param pubkey A BLS12-381 public key.\\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\\n /// @param signature A BLS12-381 signature.\\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\\n /// Used as a protection against malformed input.\\n function deposit(\\n bytes calldata pubkey,\\n bytes calldata withdrawal_credentials,\\n bytes calldata signature,\\n bytes32 deposit_data_root\\n ) external payable;\\n\\n /// @notice Query the current deposit root hash.\\n /// @return The deposit root hash.\\n function get_deposit_root() external view returns (bytes32);\\n\\n /// @notice Query the current deposit count.\\n /// @return The deposit count encoded as a little endian 64-bit number.\\n function get_deposit_count() external view returns (bytes memory);\\n}\\n\\n// Based on official specification in https://eips.ethereum.org/EIPS/eip-165\\ninterface ERC165 {\\n /// @notice Query if a contract implements an interface\\n /// @param interfaceId The interface identifier, as specified in ERC-165\\n /// @dev Interface identification is specified in ERC-165. This function\\n /// uses less than 30,000 gas.\\n /// @return `true` if the contract implements `interfaceId` and\\n /// `interfaceId` is not 0xffffffff, `false` otherwise\\n function supportsInterface(bytes4 interfaceId) external pure returns (bool);\\n}\\n\\n// This is a rewrite of the Vyper Eth2.0 deposit contract in Solidity.\\n// It tries to stay as close as possible to the original source code.\\n/// @notice This is the Ethereum 2.0 deposit contract interface.\\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\\ncontract DepositContract is IDepositContract, ERC165 {\\n uint constant DEPOSIT_CONTRACT_TREE_DEPTH = 4; // changed to make it cheaper for testing - chimera\\n // NOTE: this also ensures `deposit_count` will fit into 64-bits\\n uint constant MAX_DEPOSIT_COUNT = 2 ** DEPOSIT_CONTRACT_TREE_DEPTH - 1;\\n\\n bytes32[DEPOSIT_CONTRACT_TREE_DEPTH] branch;\\n uint256 deposit_count;\\n\\n bytes32[DEPOSIT_CONTRACT_TREE_DEPTH] zero_hashes;\\n\\n // added for testing\\n address private owner;\\n\\n constructor() public {\\n owner = msg.sender;\\n // Compute hashes in empty sparse Merkle tree\\n for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH - 1; height++)\\n zero_hashes[height + 1] = sha256(abi.encodePacked(zero_hashes[height], zero_hashes[height]));\\n }\\n\\n function get_deposit_root() external view override returns (bytes32) {\\n bytes32 node;\\n uint size = deposit_count;\\n for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH; height++) {\\n if ((size & 1) == 1) node = sha256(abi.encodePacked(branch[height], node));\\n else node = sha256(abi.encodePacked(node, zero_hashes[height]));\\n size /= 2;\\n }\\n return sha256(abi.encodePacked(node, to_little_endian_64(uint64(deposit_count)), bytes24(0)));\\n }\\n\\n function get_deposit_count() external view override returns (bytes memory) {\\n return to_little_endian_64(uint64(deposit_count));\\n }\\n\\n function deposit(\\n bytes calldata pubkey,\\n bytes calldata withdrawal_credentials,\\n bytes calldata signature,\\n bytes32 deposit_data_root\\n ) external payable override {\\n // Extended ABI length checks since dynamic types are used.\\n require(pubkey.length == 48, \\\"DepositContract: invalid pubkey length\\\");\\n require(withdrawal_credentials.length == 32, \\\"DepositContract: invalid withdrawal_credentials length\\\");\\n require(signature.length == 96, \\\"DepositContract: invalid signature length\\\");\\n\\n // Check deposit amount\\n require(msg.value >= 1 ether, \\\"DepositContract: deposit value too low\\\");\\n require(msg.value % 1 gwei == 0, \\\"DepositContract: deposit value not multiple of gwei\\\");\\n uint deposit_amount = msg.value / 1 gwei;\\n require(deposit_amount <= type(uint64).max, \\\"DepositContract: deposit value too high\\\");\\n\\n // Emit `DepositEvent` log\\n bytes memory amount = to_little_endian_64(uint64(deposit_amount));\\n emit DepositEvent(\\n pubkey,\\n withdrawal_credentials,\\n amount,\\n signature,\\n to_little_endian_64(uint64(deposit_count))\\n );\\n\\n // Compute deposit data root (`DepositData` hash tree root)\\n bytes32 pubkey_root = sha256(abi.encodePacked(pubkey, bytes16(0)));\\n bytes32 signature_root = sha256(\\n abi.encodePacked(\\n sha256(abi.encodePacked(signature[:64])),\\n sha256(abi.encodePacked(signature[64:], bytes32(0)))\\n )\\n );\\n bytes32 node = sha256(\\n abi.encodePacked(\\n sha256(abi.encodePacked(pubkey_root, withdrawal_credentials)),\\n sha256(abi.encodePacked(amount, bytes24(0), signature_root))\\n )\\n );\\n\\n // Verify computed and expected deposit data roots match\\n require(\\n node == deposit_data_root,\\n \\\"DepositContract: reconstructed DepositData does not match supplied deposit_data_root\\\"\\n );\\n\\n // Avoid overflowing the Merkle tree (and prevent edge case in computing `branch`)\\n require(deposit_count < MAX_DEPOSIT_COUNT, \\\"DepositContract: merkle tree full\\\");\\n\\n // Add deposit data root to Merkle tree (update a single `branch` node)\\n deposit_count += 1;\\n uint size = deposit_count;\\n for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH; height++) {\\n if ((size & 1) == 1) {\\n branch[height] = node;\\n return;\\n }\\n node = sha256(abi.encodePacked(branch[height], node));\\n size /= 2;\\n }\\n // As the loop should always end prematurely with the `return` statement,\\n // this code should be unreachable. We assert `false` just to be safe.\\n assert(false);\\n }\\n\\n // added for testing\\n function rug() external {\\n payable(owner).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {\\n return interfaceId == type(ERC165).interfaceId || interfaceId == type(IDepositContract).interfaceId;\\n }\\n\\n function to_little_endian_64(uint64 value) internal pure returns (bytes memory ret) {\\n ret = new bytes(8);\\n bytes8 bytesValue = bytes8(value);\\n // Byteswapping during copying to bytes.\\n ret[0] = bytesValue[7];\\n ret[1] = bytesValue[6];\\n ret[2] = bytesValue[5];\\n ret[3] = bytesValue[4];\\n ret[4] = bytesValue[3];\\n ret[5] = bytesValue[2];\\n ret[6] = bytesValue[1];\\n ret[7] = bytesValue[0];\\n }\\n}\\n\",\"keccak256\":\"0xa3964d32d8509399e675008e860026f00499e40e97672f04b456968a7ade08c3\",\"license\":\"CC0-1.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50600980546001600160a01b0319163317905560005b60038110156101145760026005826004811061003e57fe5b01546005836004811061004d57fe5b015460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b602083106100a45780518252601f199092019160209182019101610085565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156100e3573d6000803e3d6000fd5b5050506040513d60208110156100f857600080fd5b50516005600183016004811061010a57fe5b0155600101610026565b5061137b806101246000396000f3fe60806040526004361061004a5760003560e01c806301ffc9a71461004f5780632289511814610097578063621fd130146101ad578063c5f2892f14610237578063e9be02aa1461025e575b600080fd5b34801561005b57600080fd5b506100836004803603602081101561007257600080fd5b50356001600160e01b031916610273565b604080519115158252519081900360200190f35b6101ab600480360360808110156100ad57600080fd5b8101906020810181356401000000008111156100c857600080fd5b8201836020820111156100da57600080fd5b803590602001918460018302840111640100000000831117156100fc57600080fd5b91939092909160208101903564010000000081111561011a57600080fd5b82018360208201111561012c57600080fd5b8035906020019184600183028401116401000000008311171561014e57600080fd5b91939092909160208101903564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b9193509150356102aa565b005b3480156101b957600080fd5b506101c2610d03565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101fc5781810151838201526020016101e4565b50505050905090810190601f1680156102295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561024357600080fd5b5061024c610d15565b60408051918252519081900360200190f35b34801561026a57600080fd5b506101ab610fe3565b60006001600160e01b031982166301ffc9a760e01b14806102a457506001600160e01b03198216638564090760e01b145b92915050565b603086146102e95760405162461bcd60e51b81526004018080602001828103825260268152602001806112aa6026913960400191505060405180910390fd5b602084146103285760405162461bcd60e51b81526004018080602001828103825260368152602001806112416036913960400191505060405180910390fd5b606082146103675760405162461bcd60e51b815260040180806020018281038252602981526020018061131d6029913960400191505060405180910390fd5b670de0b6b3a76400003410156103ae5760405162461bcd60e51b81526004018080602001828103825260268152602001806112f76026913960400191505060405180910390fd5b633b9aca003406156103f15760405162461bcd60e51b81526004018080602001828103825260338152602001806112776033913960400191505060405180910390fd5b633b9aca00340467ffffffffffffffff81111561043f5760405162461bcd60e51b81526004018080602001828103825260278152602001806112d06027913960400191505060405180910390fd5b606061044a8261101f565b90507f649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c589898989858a8a61047f60045461101f565b6040805160a0808252810189905290819060208201908201606083016080840160c085018e8e80828437600083820152601f01601f191690910187810386528c815260200190508c8c808284376000838201819052601f909101601f191690920188810386528c5181528c51602091820193918e019250908190849084905b838110156105165781810151838201526020016104fe565b50505050905090810190601f1680156105435780820380516001836020036101000a031916815260200191505b5086810383528881526020018989808284376000838201819052601f909101601f19169092018881038452895181528951602091820193918b019250908190849084905b8381101561059f578181015183820152602001610587565b50505050905090810190601f1680156105cc5780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390a1600060028a8a600060801b604051602001808484808284376fffffffffffffffffffffffffffffffff199094169190930190815260408051600f19818403018152601090920190819052815191955093508392506020850191508083835b602083106106615780518252601f199092019160209182019101610642565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156106a0573d6000803e3d6000fd5b5050506040513d60208110156106b557600080fd5b5051905060006002806106cb6040848a8c6111a3565b6040516020018083838082843780830192505050925050506040516020818303038152906040526040518082805190602001908083835b602083106107215780518252601f199092019160209182019101610702565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610760573d6000803e3d6000fd5b5050506040513d602081101561077557600080fd5b50516002610786896040818d6111a3565b60405160009060200180848480828437919091019283525050604080518083038152602092830191829052805190945090925082918401908083835b602083106107e15780518252601f1990920191602091820191016107c2565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610820573d6000803e3d6000fd5b5050506040513d602081101561083557600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b6020831061088b5780518252601f19909201916020918201910161086c565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156108ca573d6000803e3d6000fd5b5050506040513d60208110156108df57600080fd5b50516040805160208101858152929350600092600292839287928f928f92018383808284378083019250505093505050506040516020818303038152906040526040518082805190602001908083835b6020831061094e5780518252601f19909201916020918201910161092f565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa15801561098d573d6000803e3d6000fd5b5050506040513d60208110156109a257600080fd5b50516040518651600291889160009188916020918201918291908601908083835b602083106109e25780518252601f1990920191602091820191016109c3565b6001836020036101000a0380198251168184511680821785525050505050509050018367ffffffffffffffff191667ffffffffffffffff1916815260180182815260200193505050506040516020818303038152906040526040518082805190602001908083835b60208310610a695780518252601f199092019160209182019101610a4a565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610aa8573d6000803e3d6000fd5b5050506040513d6020811015610abd57600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610b135780518252601f199092019160209182019101610af4565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610b52573d6000803e3d6000fd5b5050506040513d6020811015610b6757600080fd5b50519050858114610ba95760405162461bcd60e51b81526004018080602001828103825260548152602001806111ed6054913960600191505060405180910390fd5b600454600f11610bea5760405162461bcd60e51b81526004018080602001828103825260218152602001806111cc6021913960400191505060405180910390fd5b600480546001019081905560005b6004811015610cf7578160011660011415610c2a578260008260048110610c1b57fe5b015550610cfa95505050505050565b600260008260048110610c3957fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610c915780518252601f199092019160209182019101610c72565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610cd0573d6000803e3d6000fd5b5050506040513d6020811015610ce557600080fd5b50519250600282049150600101610bf8565b50fe5b50505050505050565b6060610d1060045461101f565b905090565b6004546000908190815b6004811015610ec6578160011660011415610df857600260008260048110610d4357fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610d9b5780518252601f199092019160209182019101610d7c565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610dda573d6000803e3d6000fd5b5050506040513d6020811015610def57600080fd5b50519250610eb8565b60028360058360048110610e0857fe5b015460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610e5f5780518252601f199092019160209182019101610e40565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610e9e573d6000803e3d6000fd5b5050506040513d6020811015610eb357600080fd5b505192505b600282049150600101610d1f565b50600282610ed560045461101f565b600060401b6040516020018084815260200183805190602001908083835b60208310610f125780518252601f199092019160209182019101610ef3565b51815160209384036101000a600019018019909216911617905267ffffffffffffffff199590951692019182525060408051808303600719018152601890920190819052815191955093508392850191508083835b60208310610f865780518252601f199092019160209182019101610f67565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610fc5573d6000803e3d6000fd5b5050506040513d6020811015610fda57600080fd5b50519250505090565b6009546040516001600160a01b03909116904780156108fc02916000818181858888f1935050505015801561101c573d6000803e3d6000fd5b50565b60408051600880825281830190925260609160208201818036833701905050905060c082901b8060071a60f81b8260008151811061105957fe5b60200101906001600160f81b031916908160001a9053508060061a60f81b8260018151811061108457fe5b60200101906001600160f81b031916908160001a9053508060051a60f81b826002815181106110af57fe5b60200101906001600160f81b031916908160001a9053508060041a60f81b826003815181106110da57fe5b60200101906001600160f81b031916908160001a9053508060031a60f81b8260048151811061110557fe5b60200101906001600160f81b031916908160001a9053508060021a60f81b8260058151811061113057fe5b60200101906001600160f81b031916908160001a9053508060011a60f81b8260068151811061115b57fe5b60200101906001600160f81b031916908160001a9053508060001a60f81b8260078151811061118657fe5b60200101906001600160f81b031916908160001a90535050919050565b600080858511156111b2578182fd5b838611156111be578182fd5b505082019391909203915056fe4465706f736974436f6e74726163743a206d65726b6c6520747265652066756c6c4465706f736974436f6e74726163743a207265636f6e7374727563746564204465706f7369744461746120646f6573206e6f74206d6174636820737570706c696564206465706f7369745f646174615f726f6f744465706f736974436f6e74726163743a20696e76616c6964207769746864726177616c5f63726564656e7469616c73206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c7565206e6f74206d756c7469706c65206f6620677765694465706f736974436f6e74726163743a20696e76616c6964207075626b6579206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f20686967684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f206c6f774465706f736974436f6e74726163743a20696e76616c6964207369676e6174757265206c656e677468a264697066735822122006725406dc03dedf8083d50f1aa82beff11aaea76590a0bbff13f9a35de1a50d64736f6c634300060b0033", + "deployedBytecode": "0x60806040526004361061004a5760003560e01c806301ffc9a71461004f5780632289511814610097578063621fd130146101ad578063c5f2892f14610237578063e9be02aa1461025e575b600080fd5b34801561005b57600080fd5b506100836004803603602081101561007257600080fd5b50356001600160e01b031916610273565b604080519115158252519081900360200190f35b6101ab600480360360808110156100ad57600080fd5b8101906020810181356401000000008111156100c857600080fd5b8201836020820111156100da57600080fd5b803590602001918460018302840111640100000000831117156100fc57600080fd5b91939092909160208101903564010000000081111561011a57600080fd5b82018360208201111561012c57600080fd5b8035906020019184600183028401116401000000008311171561014e57600080fd5b91939092909160208101903564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b9193509150356102aa565b005b3480156101b957600080fd5b506101c2610d03565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101fc5781810151838201526020016101e4565b50505050905090810190601f1680156102295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561024357600080fd5b5061024c610d15565b60408051918252519081900360200190f35b34801561026a57600080fd5b506101ab610fe3565b60006001600160e01b031982166301ffc9a760e01b14806102a457506001600160e01b03198216638564090760e01b145b92915050565b603086146102e95760405162461bcd60e51b81526004018080602001828103825260268152602001806112aa6026913960400191505060405180910390fd5b602084146103285760405162461bcd60e51b81526004018080602001828103825260368152602001806112416036913960400191505060405180910390fd5b606082146103675760405162461bcd60e51b815260040180806020018281038252602981526020018061131d6029913960400191505060405180910390fd5b670de0b6b3a76400003410156103ae5760405162461bcd60e51b81526004018080602001828103825260268152602001806112f76026913960400191505060405180910390fd5b633b9aca003406156103f15760405162461bcd60e51b81526004018080602001828103825260338152602001806112776033913960400191505060405180910390fd5b633b9aca00340467ffffffffffffffff81111561043f5760405162461bcd60e51b81526004018080602001828103825260278152602001806112d06027913960400191505060405180910390fd5b606061044a8261101f565b90507f649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c589898989858a8a61047f60045461101f565b6040805160a0808252810189905290819060208201908201606083016080840160c085018e8e80828437600083820152601f01601f191690910187810386528c815260200190508c8c808284376000838201819052601f909101601f191690920188810386528c5181528c51602091820193918e019250908190849084905b838110156105165781810151838201526020016104fe565b50505050905090810190601f1680156105435780820380516001836020036101000a031916815260200191505b5086810383528881526020018989808284376000838201819052601f909101601f19169092018881038452895181528951602091820193918b019250908190849084905b8381101561059f578181015183820152602001610587565b50505050905090810190601f1680156105cc5780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390a1600060028a8a600060801b604051602001808484808284376fffffffffffffffffffffffffffffffff199094169190930190815260408051600f19818403018152601090920190819052815191955093508392506020850191508083835b602083106106615780518252601f199092019160209182019101610642565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156106a0573d6000803e3d6000fd5b5050506040513d60208110156106b557600080fd5b5051905060006002806106cb6040848a8c6111a3565b6040516020018083838082843780830192505050925050506040516020818303038152906040526040518082805190602001908083835b602083106107215780518252601f199092019160209182019101610702565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610760573d6000803e3d6000fd5b5050506040513d602081101561077557600080fd5b50516002610786896040818d6111a3565b60405160009060200180848480828437919091019283525050604080518083038152602092830191829052805190945090925082918401908083835b602083106107e15780518252601f1990920191602091820191016107c2565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610820573d6000803e3d6000fd5b5050506040513d602081101561083557600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b6020831061088b5780518252601f19909201916020918201910161086c565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156108ca573d6000803e3d6000fd5b5050506040513d60208110156108df57600080fd5b50516040805160208101858152929350600092600292839287928f928f92018383808284378083019250505093505050506040516020818303038152906040526040518082805190602001908083835b6020831061094e5780518252601f19909201916020918201910161092f565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa15801561098d573d6000803e3d6000fd5b5050506040513d60208110156109a257600080fd5b50516040518651600291889160009188916020918201918291908601908083835b602083106109e25780518252601f1990920191602091820191016109c3565b6001836020036101000a0380198251168184511680821785525050505050509050018367ffffffffffffffff191667ffffffffffffffff1916815260180182815260200193505050506040516020818303038152906040526040518082805190602001908083835b60208310610a695780518252601f199092019160209182019101610a4a565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610aa8573d6000803e3d6000fd5b5050506040513d6020811015610abd57600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610b135780518252601f199092019160209182019101610af4565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610b52573d6000803e3d6000fd5b5050506040513d6020811015610b6757600080fd5b50519050858114610ba95760405162461bcd60e51b81526004018080602001828103825260548152602001806111ed6054913960600191505060405180910390fd5b600454600f11610bea5760405162461bcd60e51b81526004018080602001828103825260218152602001806111cc6021913960400191505060405180910390fd5b600480546001019081905560005b6004811015610cf7578160011660011415610c2a578260008260048110610c1b57fe5b015550610cfa95505050505050565b600260008260048110610c3957fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610c915780518252601f199092019160209182019101610c72565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610cd0573d6000803e3d6000fd5b5050506040513d6020811015610ce557600080fd5b50519250600282049150600101610bf8565b50fe5b50505050505050565b6060610d1060045461101f565b905090565b6004546000908190815b6004811015610ec6578160011660011415610df857600260008260048110610d4357fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610d9b5780518252601f199092019160209182019101610d7c565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610dda573d6000803e3d6000fd5b5050506040513d6020811015610def57600080fd5b50519250610eb8565b60028360058360048110610e0857fe5b015460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610e5f5780518252601f199092019160209182019101610e40565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610e9e573d6000803e3d6000fd5b5050506040513d6020811015610eb357600080fd5b505192505b600282049150600101610d1f565b50600282610ed560045461101f565b600060401b6040516020018084815260200183805190602001908083835b60208310610f125780518252601f199092019160209182019101610ef3565b51815160209384036101000a600019018019909216911617905267ffffffffffffffff199590951692019182525060408051808303600719018152601890920190819052815191955093508392850191508083835b60208310610f865780518252601f199092019160209182019101610f67565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610fc5573d6000803e3d6000fd5b5050506040513d6020811015610fda57600080fd5b50519250505090565b6009546040516001600160a01b03909116904780156108fc02916000818181858888f1935050505015801561101c573d6000803e3d6000fd5b50565b60408051600880825281830190925260609160208201818036833701905050905060c082901b8060071a60f81b8260008151811061105957fe5b60200101906001600160f81b031916908160001a9053508060061a60f81b8260018151811061108457fe5b60200101906001600160f81b031916908160001a9053508060051a60f81b826002815181106110af57fe5b60200101906001600160f81b031916908160001a9053508060041a60f81b826003815181106110da57fe5b60200101906001600160f81b031916908160001a9053508060031a60f81b8260048151811061110557fe5b60200101906001600160f81b031916908160001a9053508060021a60f81b8260058151811061113057fe5b60200101906001600160f81b031916908160001a9053508060011a60f81b8260068151811061115b57fe5b60200101906001600160f81b031916908160001a9053508060001a60f81b8260078151811061118657fe5b60200101906001600160f81b031916908160001a90535050919050565b600080858511156111b2578182fd5b838611156111be578182fd5b505082019391909203915056fe4465706f736974436f6e74726163743a206d65726b6c6520747265652066756c6c4465706f736974436f6e74726163743a207265636f6e7374727563746564204465706f7369744461746120646f6573206e6f74206d6174636820737570706c696564206465706f7369745f646174615f726f6f744465706f736974436f6e74726163743a20696e76616c6964207769746864726177616c5f63726564656e7469616c73206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c7565206e6f74206d756c7469706c65206f6620677765694465706f736974436f6e74726163743a20696e76616c6964207075626b6579206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f20686967684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f206c6f774465706f736974436f6e74726163743a20696e76616c6964207369676e6174757265206c656e677468a264697066735822122006725406dc03dedf8083d50f1aa82beff11aaea76590a0bbff13f9a35de1a50d64736f6c634300060b0033", + "devdoc": { + "kind": "dev", + "methods": { + "deposit(bytes,bytes,bytes,bytes32)": { + "params": { + "deposit_data_root": "The SHA-256 hash of the SSZ-encoded DepositData object. Used as a protection against malformed input.", + "pubkey": "A BLS12-381 public key.", + "signature": "A BLS12-381 signature.", + "withdrawal_credentials": "Commitment to a public key for withdrawals." + } + }, + "get_deposit_count()": { + "returns": { + "_0": "The deposit count encoded as a little endian 64-bit number." + } + }, + "get_deposit_root()": { + "returns": { + "_0": "The deposit root hash." + } + }, + "supportsInterface(bytes4)": { + "details": "Interface identification is specified in ERC-165. This function uses less than 30,000 gas.", + "params": { + "interfaceId": "The interface identifier, as specified in ERC-165" + }, + "returns": { + "_0": "`true` if the contract implements `interfaceId` and `interfaceId` is not 0xffffffff, `false` otherwise" + } + } + }, + "version": 1 + }, + "userdoc": { + "events": { + "DepositEvent(bytes,bytes,bytes,bytes,bytes)": { + "notice": "A processed deposit event." + } + }, + "kind": "user", + "methods": { + "deposit(bytes,bytes,bytes,bytes32)": { + "notice": "Submit a Phase 0 DepositData object." + }, + "get_deposit_count()": { + "notice": "Query the current deposit count." + }, + "get_deposit_root()": { + "notice": "Query the current deposit root hash." + }, + "supportsInterface(bytes4)": { + "notice": "Query if a contract implements an interface" + } + }, + "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", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 68, + "contract": "contracts/mocks/DepositContract.sol:DepositContract", + "label": "branch", + "offset": 0, + "slot": "0", + "type": "t_array(t_bytes32)4_storage" + }, + { + "astId": 70, + "contract": "contracts/mocks/DepositContract.sol:DepositContract", + "label": "deposit_count", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 74, + "contract": "contracts/mocks/DepositContract.sol:DepositContract", + "label": "zero_hashes", + "offset": 0, + "slot": "5", + "type": "t_array(t_bytes32)4_storage" + }, + { + "astId": 76, + "contract": "contracts/mocks/DepositContract.sol:DepositContract", + "label": "owner", + "offset": 0, + "slot": "9", + "type": "t_address" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)4_storage": { + "base": "t_bytes32", + "encoding": "inplace", + "label": "bytes32[4]", + "numberOfBytes": "128" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/deployments/sepolia/FeeCalc.json b/deployments/sepolia/FeeCalc.json new file mode 100644 index 0000000..701498a --- /dev/null +++ b/deployments/sepolia/FeeCalc.json @@ -0,0 +1,476 @@ +{ + "address": "0xa06f409403485BB32A47ef00Bc315428Fd098057", + "abi": [ + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "adminFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exitFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "refundFeesOnWithdraw", + "type": "bool" + }, + { + "internalType": "bool", + "name": "chargeOnDeposit", + "type": "bool" + }, + { + "internalType": "bool", + "name": "chargeOnExit", + "type": "bool" + } + ], + "internalType": "struct FeeCalc.Settings", + "name": "_settings", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "adminFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "costPerValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_sender", + "type": "address" + } + ], + "name": "processDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "amt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_sender", + "type": "address" + } + ], + "name": "processWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "amt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "adminFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exitFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "refundFeesOnWithdraw", + "type": "bool" + }, + { + "internalType": "bool", + "name": "chargeOnDeposit", + "type": "bool" + }, + { + "internalType": "bool", + "name": "chargeOnExit", + "type": "bool" + } + ], + "internalType": "struct FeeCalc.Settings", + "name": "newSettings", + "type": "tuple" + } + ], + "name": "set", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "setAdminFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_exitFee", + "type": "uint256" + } + ], + "name": "setExitFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_refundFeesOnWithdraw", + "type": "bool" + } + ], + "name": "setRefundFeesOnWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x76be56ba3e35e0dd96cda9773553f52e5c826621cd9b335b4d8fa6ae95ef7b7b", + "receipt": { + "to": null, + "from": "0xA120FAd0498ECbF755a675E3833158484123bF30", + "contractAddress": "0xa06f409403485BB32A47ef00Bc315428Fd098057", + "transactionIndex": 25, + "gasUsed": "566029", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000080000000000000000000000022100000000001000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x54f57979d4529fb1f3bbcbc2e30ae4c96ef1b541704bf85a4f851046c91d5522", + "transactionHash": "0x76be56ba3e35e0dd96cda9773553f52e5c826621cd9b335b4d8fa6ae95ef7b7b", + "logs": [ + { + "transactionIndex": 25, + "blockNumber": 6233344, + "transactionHash": "0x76be56ba3e35e0dd96cda9773553f52e5c826621cd9b335b4d8fa6ae95ef7b7b", + "address": "0xa06f409403485BB32A47ef00Bc315428Fd098057", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000a120fad0498ecbf755a675e3833158484123bf30" + ], + "data": "0x", + "logIndex": 48, + "blockHash": "0x54f57979d4529fb1f3bbcbc2e30ae4c96ef1b541704bf85a4f851046c91d5522" + } + ], + "blockNumber": 6233344, + "cumulativeGasUsed": "3920512", + "status": 1, + "byzantium": true + }, + "args": [ + { + "adminFee": 10, + "exitFee": 0, + "refundFeesOnWithdraw": true, + "chargeOnDeposit": true, + "chargeOnExit": false + } + ], + "numDeployments": 1, + "solcInputHash": "b098c02b927c81fd02abb8247583d190", + "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"adminFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"exitFee\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"refundFeesOnWithdraw\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"chargeOnDeposit\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"chargeOnExit\",\"type\":\"bool\"}],\"internalType\":\"struct FeeCalc.Settings\",\"name\":\"_settings\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"costPerValidator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"}],\"name\":\"processDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"}],\"name\":\"processWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"adminFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"exitFee\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"refundFeesOnWithdraw\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"chargeOnDeposit\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"chargeOnExit\",\"type\":\"bool\"}],\"internalType\":\"struct FeeCalc.Settings\",\"name\":\"newSettings\",\"type\":\"tuple\"}],\"name\":\"set\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"setAdminFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_exitFee\",\"type\":\"uint256\"}],\"name\":\"setExitFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_refundFeesOnWithdraw\",\"type\":\"bool\"}],\"name\":\"setRefundFeesOnWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/v2/periphery/FeeCalc.sol\":\"FeeCalc\"},\"evmVersion\":\"paris\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable2Step.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Ownable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\n *\\n * This module is used through inheritance. It will make available all functions\\n * from parent (Ownable).\\n */\\nabstract contract Ownable2Step is Ownable {\\n address private _pendingOwner;\\n\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Returns the address of the pending owner.\\n */\\n function pendingOwner() public view virtual returns (address) {\\n return _pendingOwner;\\n }\\n\\n /**\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\n _pendingOwner = newOwner;\\n emit OwnershipTransferStarted(owner(), newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual override {\\n delete _pendingOwner;\\n super._transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev The new owner accepts the ownership transfer.\\n */\\n function acceptOwnership() public virtual {\\n address sender = _msgSender();\\n require(pendingOwner() == sender, \\\"Ownable2Step: caller is not the new owner\\\");\\n _transferOwnership(sender);\\n }\\n}\\n\",\"keccak256\":\"0xde231558366826d7cb61725af8147965a61c53b77a352cc8c9af38fc5a92ac3c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"contracts/v2/periphery/FeeCalc.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.20;\\n\\nimport {Ownable2Step} from \\\"@openzeppelin/contracts/access/Ownable2Step.sol\\\";\\n\\ncontract FeeCalc is Ownable2Step {\\n struct Settings {\\n uint256 adminFee;\\n uint256 exitFee;\\n bool refundFeesOnWithdraw;\\n bool chargeOnDeposit;\\n bool chargeOnExit;\\n }\\n Settings private config;\\n uint256 public adminFee;\\n uint256 public costPerValidator;\\n\\n uint256 private immutable BIPS = 10000;\\n constructor(Settings memory _settings) Ownable2Step() {\\n // admin fee in bips (10000 = 100%)\\n adminFee = _settings.adminFee;\\n config = _settings;\\n costPerValidator = ((32 + (32 * adminFee)) * 1 ether) / BIPS;\\n }\\n\\n function set(Settings calldata newSettings) external onlyOwner {\\n config = newSettings;\\n adminFee = newSettings.adminFee;\\n }\\n\\n function setRefundFeesOnWithdraw(bool _refundFeesOnWithdraw) external onlyOwner {\\n config.refundFeesOnWithdraw = _refundFeesOnWithdraw;\\n }\\n\\n function setExitFee(uint256 _exitFee) external onlyOwner {\\n config.exitFee = _exitFee;\\n }\\n\\n function setAdminFee(uint256 amount) external onlyOwner {\\n adminFee = amount;\\n config.adminFee = amount;\\n }\\n\\n function processDeposit(uint256 value, address _sender) external view returns (uint256 amt, uint256 fee) {\\n // TODO: semder is currently unsused but can be used later to calculate a fee reduction based on token holdings\\n if (config.chargeOnDeposit) {\\n fee = (value * adminFee) / BIPS;\\n amt = value - fee;\\n }\\n }\\n\\n function processWithdraw(uint256 value, address _sender) external view returns (uint256 amt, uint256 fee) {\\n // TODO: semder is currently unsused but can be used later to calculate a fee reduction based on token holdings\\n if (config.refundFeesOnWithdraw) {\\n fee = (value * adminFee) / BIPS;\\n amt = value + fee;\\n } else if (config.chargeOnExit) {\\n fee = (value * config.exitFee) / BIPS;\\n amt = value - fee;\\n } else {\\n fee = 0;\\n amt = value;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1b91581b9fe0fa69fd4faa2ad01b3edb66cc35e4ab26831b57e169f214bd6c0\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x60a060405261271060805234801561001657600080fd5b5060405161097038038061097083398101604081905261003591610154565b61003e336100d3565b80516005819055600281905560208083015160035560408301516004805460608601516080808801511515620100000262ff0000199215156101000261ff00199615159690961661ffff1990941693909317949094171617905551916100a3916101f9565b6100ae906020610216565b6100c090670de0b6b3a76400006101f9565b6100ca9190610229565b6006555061024b565b600180546001600160a01b03191690556100ec816100ef565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8051801515811461014f57600080fd5b919050565b600060a0828403121561016657600080fd5b60405160a081016001600160401b038111828210171561019657634e487b7160e01b600052604160045260246000fd5b806040525082518152602083015160208201526101b56040840161013f565b60408201526101c66060840161013f565b60608201526101d76080840161013f565b60808201529392505050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610210576102106101e3565b92915050565b80820180821115610210576102106101e3565b60008261024657634e487b7160e01b600052601260045260246000fd5b500490565b6080516106fc610274600039600081816101ed0152818161024d01526102b201526106fc6000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063a0be06f91161008c578063e30c397811610066578063e30c39781461019b578063e5a583a9146101ac578063eb52f3ae146101bf578063f2fde38b146101c857600080fd5b8063a0be06f91461015e578063c0f7056c14610175578063dc5df6391461018857600080fd5b806301e41bba146100d45780633b3436f614610101578063715018a61461011457806379ba50971461011e5780638beb60b6146101265780638da5cb5b14610139575b600080fd5b6100e76100e2366004610533565b6101db565b604080519283526020830191909152015b60405180910390f35b6100e761010f366004610533565b61029b565b61011c6102fe565b005b61011c610312565b61011c61013436600461055f565b610391565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100f8565b61016760055481565b6040519081526020016100f8565b61011c610183366004610586565b6103a3565b61011c6101963660046105aa565b6103be565b6001546001600160a01b0316610146565b61011c6101ba36600461055f565b6103db565b61016760065481565b61011c6101d63660046105c2565b6103e8565b600454600090819060ff1615610237577f00000000000000000000000000000000000000000000000000000000000000006005548561021a91906105f3565b6102249190610610565b90506102308185610632565b9150610294565b60045462010000900460ff161561028d576003547f00000000000000000000000000000000000000000000000000000000000000009061027790866105f3565b6102819190610610565b90506102308185610645565b5082905060005b9250929050565b6004546000908190610100900460ff1615610294577f0000000000000000000000000000000000000000000000000000000000000000600554856102df91906105f3565b6102e99190610610565b90506102f58185610645565b91509250929050565b610306610459565b61031060006104b3565b565b60015433906001600160a01b031681146103855760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61038e816104b3565b50565b610399610459565b6005819055600255565b6103ab610459565b6004805460ff1916911515919091179055565b6103c6610459565b8060026103d38282610658565b505035600555565b6103e3610459565b600355565b6103f0610459565b600180546001600160a01b0383166001600160a01b031990911681179091556104216000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000546001600160a01b031633146103105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161037c565b600180546001600160a01b031916905561038e81600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461052e57600080fd5b919050565b6000806040838503121561054657600080fd5b8235915061055660208401610517565b90509250929050565b60006020828403121561057157600080fd5b5035919050565b801515811461038e57600080fd5b60006020828403121561059857600080fd5b81356105a381610578565b9392505050565b600060a082840312156105bc57600080fd5b50919050565b6000602082840312156105d457600080fd5b6105a382610517565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761060a5761060a6105dd565b92915050565b60008261062d57634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561060a5761060a6105dd565b8181038181111561060a5761060a6105dd565b813581556020820135600182015560028101604083013561067881610578565b8154606085013561068881610578565b608086013561069681610578565b90151560081b61ff001662ffffff199290921692151560ff16929092171790151560101b62ff000016179055505056fea26469706673582212206421837392b8e91d6dacd1ae82ef1c709308fa2a2abd91758213d711c3b8d6e564736f6c63430008140033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063a0be06f91161008c578063e30c397811610066578063e30c39781461019b578063e5a583a9146101ac578063eb52f3ae146101bf578063f2fde38b146101c857600080fd5b8063a0be06f91461015e578063c0f7056c14610175578063dc5df6391461018857600080fd5b806301e41bba146100d45780633b3436f614610101578063715018a61461011457806379ba50971461011e5780638beb60b6146101265780638da5cb5b14610139575b600080fd5b6100e76100e2366004610533565b6101db565b604080519283526020830191909152015b60405180910390f35b6100e761010f366004610533565b61029b565b61011c6102fe565b005b61011c610312565b61011c61013436600461055f565b610391565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100f8565b61016760055481565b6040519081526020016100f8565b61011c610183366004610586565b6103a3565b61011c6101963660046105aa565b6103be565b6001546001600160a01b0316610146565b61011c6101ba36600461055f565b6103db565b61016760065481565b61011c6101d63660046105c2565b6103e8565b600454600090819060ff1615610237577f00000000000000000000000000000000000000000000000000000000000000006005548561021a91906105f3565b6102249190610610565b90506102308185610632565b9150610294565b60045462010000900460ff161561028d576003547f00000000000000000000000000000000000000000000000000000000000000009061027790866105f3565b6102819190610610565b90506102308185610645565b5082905060005b9250929050565b6004546000908190610100900460ff1615610294577f0000000000000000000000000000000000000000000000000000000000000000600554856102df91906105f3565b6102e99190610610565b90506102f58185610645565b91509250929050565b610306610459565b61031060006104b3565b565b60015433906001600160a01b031681146103855760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61038e816104b3565b50565b610399610459565b6005819055600255565b6103ab610459565b6004805460ff1916911515919091179055565b6103c6610459565b8060026103d38282610658565b505035600555565b6103e3610459565b600355565b6103f0610459565b600180546001600160a01b0383166001600160a01b031990911681179091556104216000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000546001600160a01b031633146103105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161037c565b600180546001600160a01b031916905561038e81600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461052e57600080fd5b919050565b6000806040838503121561054657600080fd5b8235915061055660208401610517565b90509250929050565b60006020828403121561057157600080fd5b5035919050565b801515811461038e57600080fd5b60006020828403121561059857600080fd5b81356105a381610578565b9392505050565b600060a082840312156105bc57600080fd5b50919050565b6000602082840312156105d457600080fd5b6105a382610517565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761060a5761060a6105dd565b92915050565b60008261062d57634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561060a5761060a6105dd565b8181038181111561060a5761060a6105dd565b813581556020820135600182015560028101604083013561067881610578565b8154606085013561068881610578565b608086013561069681610578565b90151560081b61ff001662ffffff199290921692151560ff16929092171790151560101b62ff000016179055505056fea26469706673582212206421837392b8e91d6dacd1ae82ef1c709308fa2a2abd91758213d711c3b8d6e564736f6c63430008140033", + "devdoc": { + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 4000, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 4113, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "_pendingOwner", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 18311, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "config", + "offset": 0, + "slot": "2", + "type": "t_struct(Settings)18308_storage" + }, + { + "astId": 18313, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "adminFee", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 18315, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "costPerValidator", + "offset": 0, + "slot": "6", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(Settings)18308_storage": { + "encoding": "inplace", + "label": "struct FeeCalc.Settings", + "members": [ + { + "astId": 18299, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "adminFee", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 18301, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "exitFee", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 18303, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "refundFeesOnWithdraw", + "offset": 0, + "slot": "2", + "type": "t_bool" + }, + { + "astId": 18305, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "chargeOnDeposit", + "offset": 1, + "slot": "2", + "type": "t_bool" + }, + { + "astId": 18307, + "contract": "contracts/v2/periphery/FeeCalc.sol:FeeCalc", + "label": "chargeOnExit", + "offset": 2, + "slot": "2", + "type": "t_bool" + } + ], + "numberOfBytes": "96" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/deployments/sepolia/PaymentSplitter.json b/deployments/sepolia/PaymentSplitter.json new file mode 100644 index 0000000..5316f28 --- /dev/null +++ b/deployments/sepolia/PaymentSplitter.json @@ -0,0 +1,520 @@ +{ + "address": "0x38E86964A811Ee66D1139CD97C838B713F63779B", + "abi": [ + { + "inputs": [ + { + "internalType": "address[]", + "name": "payees", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "shares_", + "type": "uint256[]" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ERC20PaymentReleased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "PayeeAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "PaymentReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "PaymentReleased", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "payee", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "releasable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "releasable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "account", + "type": "address" + } + ], + "name": "release", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "release", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "released", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "released", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "shares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + } + ], + "name": "totalReleased", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalReleased", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xa1b7f2846f84aff2c05e96b46d6ea903371b743516b8848a8f700cf1ef73a544", + "receipt": { + "to": null, + "from": "0xA120FAd0498ECbF755a675E3833158484123bF30", + "contractAddress": "0x38E86964A811Ee66D1139CD97C838B713F63779B", + "transactionIndex": 62, + "gasUsed": "929121", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000040000000000200000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7ba1833bf479908d483686d8edb8c5f400c8922b0d3c0ca855c19e9e1c83ef23", + "transactionHash": "0xa1b7f2846f84aff2c05e96b46d6ea903371b743516b8848a8f700cf1ef73a544", + "logs": [ + { + "transactionIndex": 62, + "blockNumber": 6233330, + "transactionHash": "0xa1b7f2846f84aff2c05e96b46d6ea903371b743516b8848a8f700cf1ef73a544", + "address": "0x38E86964A811Ee66D1139CD97C838B713F63779B", + "topics": ["0x40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac"], + "data": "0x000000000000000000000000a120fad0498ecbf755a675e3833158484123bf30000000000000000000000000000000000000000000000000000000000000003c", + "logIndex": 191, + "blockHash": "0x7ba1833bf479908d483686d8edb8c5f400c8922b0d3c0ca855c19e9e1c83ef23" + }, + { + "transactionIndex": 62, + "blockNumber": 6233330, + "transactionHash": "0xa1b7f2846f84aff2c05e96b46d6ea903371b743516b8848a8f700cf1ef73a544", + "address": "0x38E86964A811Ee66D1139CD97C838B713F63779B", + "topics": ["0x40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac"], + "data": "0x000000000000000000000000610c92c70eb55dfeafe8970513d13771da79f2e0000000000000000000000000000000000000000000000000000000000000001e", + "logIndex": 192, + "blockHash": "0x7ba1833bf479908d483686d8edb8c5f400c8922b0d3c0ca855c19e9e1c83ef23" + }, + { + "transactionIndex": 62, + "blockNumber": 6233330, + "transactionHash": "0xa1b7f2846f84aff2c05e96b46d6ea903371b743516b8848a8f700cf1ef73a544", + "address": "0x38E86964A811Ee66D1139CD97C838B713F63779B", + "topics": ["0x40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac"], + "data": "0x000000000000000000000000514dfd2d10ec6775f030ba2abcf7a2445c0ca6fb000000000000000000000000000000000000000000000000000000000000038e", + "logIndex": 193, + "blockHash": "0x7ba1833bf479908d483686d8edb8c5f400c8922b0d3c0ca855c19e9e1c83ef23" + } + ], + "blockNumber": 6233330, + "cumulativeGasUsed": "10042342", + "status": 1, + "byzantium": true + }, + "args": [ + [ + "0xA120FAd0498ECbF755a675E3833158484123bF30", + "0x610c92c70eb55dfeafe8970513d13771da79f2e0", + "0x514dfd2d10eC6775f030BA2abcf7A2445C0CA6Fb" + ], + [60, 30, 910] + ], + "numDeployments": 1, + "solcInputHash": "b098c02b927c81fd02abb8247583d190", + "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"payees\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"shares_\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ERC20PaymentReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"PayeeAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"PaymentReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"PaymentReleased\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"payee\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"releasable\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"releasable\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"release\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"release\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"released\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"released\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"shares\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"totalReleased\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalReleased\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalShares\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware that the Ether will be split in this way, since it is handled transparently by the contract. The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the time of contract deployment and can't be updated thereafter. `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} function. NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you to run tests before sending real value to this contract.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at the matching position in the `shares` array. All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no duplicates in `payees`.\"},\"payee(uint256)\":{\"details\":\"Getter for the address of the payee number `index`.\"},\"releasable(address)\":{\"details\":\"Getter for the amount of payee's releasable Ether.\"},\"releasable(address,address)\":{\"details\":\"Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an IERC20 contract.\"},\"release(address)\":{\"details\":\"Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the total shares and their previous withdrawals.\"},\"release(address,address)\":{\"details\":\"Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 contract.\"},\"released(address)\":{\"details\":\"Getter for the amount of Ether already released to a payee.\"},\"released(address,address)\":{\"details\":\"Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an IERC20 contract.\"},\"shares(address)\":{\"details\":\"Getter for the amount of shares held by an account.\"},\"totalReleased()\":{\"details\":\"Getter for the total amount of Ether already released.\"},\"totalReleased(address)\":{\"details\":\"Getter for the total amount of `token` already released. `token` should be the address of an IERC20 contract.\"},\"totalShares()\":{\"details\":\"Getter for the total shares held by payees.\"}},\"title\":\"PaymentSplitter\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/v2/lib/PaymentSplitter.sol\":\"PaymentSplitter\"},\"evmVersion\":\"paris\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n *\\n * ==== Security Considerations\\n *\\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\\n * generally recommended is:\\n *\\n * ```solidity\\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\\n * doThing(..., value);\\n * }\\n *\\n * function doThing(..., uint256 value) public {\\n * token.safeTransferFrom(msg.sender, address(this), value);\\n * ...\\n * }\\n * ```\\n *\\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\\n * {SafeERC20-safeTransferFrom}).\\n *\\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\\n * contracts should have entry points that don't rely on permit.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n *\\n * CAUTION: See Security Considerations above.\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xb264c03a3442eb37a68ad620cefd1182766b58bee6cec40343480392d6b14d69\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n * to be set to zero before setting it to a non-zero value, such as USDT.\\n */\\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n * Revert on invalid signature.\\n */\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0xabefac93435967b4d36a4fabcbdbb918d1f0b7ae3c3d85bc30923b326c927ed1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"contracts/v2/lib/PaymentSplitter.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n// OZ paymentsplitter with minor changes\\n// private function _addPayee made internal for better inheritance flow\\n// 0 payee chck in constructor removed to allow empty setup\\n\\n// OpenZeppelin Contracts (last updated v4.8.0) (finance/PaymentSplitter.sol)\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Context.sol\\\";\\n\\n/**\\n * @title PaymentSplitter\\n * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware\\n * that the Ether will be split in this way, since it is handled transparently by the contract.\\n *\\n * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each\\n * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim\\n * an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the\\n * time of contract deployment and can't be updated thereafter.\\n *\\n * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the\\n * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}\\n * function.\\n *\\n * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and\\n * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you\\n * to run tests before sending real value to this contract.\\n */\\ncontract PaymentSplitter is Context {\\n event PayeeAdded(address account, uint256 shares);\\n event PaymentReleased(address to, uint256 amount);\\n event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount);\\n event PaymentReceived(address from, uint256 amount);\\n\\n uint256 private _totalShares;\\n uint256 private _totalReleased;\\n\\n mapping(address => uint256) private _shares;\\n mapping(address => uint256) private _released;\\n address[] internal _payees;\\n\\n mapping(IERC20 => uint256) private _erc20TotalReleased;\\n mapping(IERC20 => mapping(address => uint256)) private _erc20Released;\\n\\n /**\\n * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at\\n * the matching position in the `shares` array.\\n *\\n * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no\\n * duplicates in `payees`.\\n */\\n constructor(address[] memory payees, uint256[] memory shares_) payable {\\n require(payees.length == shares_.length, \\\"PaymentSplitter: payees and shares length mismatch\\\");\\n // require(payees.length > 0, \\\"PaymentSplitter: no payees\\\");\\n\\n for (uint256 i = 0; i < payees.length; i++) {\\n _addPayee(payees[i], shares_[i]);\\n }\\n }\\n\\n /**\\n * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully\\n * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the\\n * reliability of the events, and not the actual splitting of Ether.\\n *\\n * To learn more about this see the Solidity documentation for\\n * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback\\n * functions].\\n */\\n receive() external payable virtual {\\n emit PaymentReceived(_msgSender(), msg.value);\\n }\\n\\n /**\\n * @dev Getter for the total shares held by payees.\\n */\\n function totalShares() public view returns (uint256) {\\n return _totalShares;\\n }\\n\\n /**\\n * @dev Getter for the total amount of Ether already released.\\n */\\n function totalReleased() public view returns (uint256) {\\n return _totalReleased;\\n }\\n\\n /**\\n * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20\\n * contract.\\n */\\n function totalReleased(IERC20 token) public view returns (uint256) {\\n return _erc20TotalReleased[token];\\n }\\n\\n /**\\n * @dev Getter for the amount of shares held by an account.\\n */\\n function shares(address account) public view returns (uint256) {\\n return _shares[account];\\n }\\n\\n /**\\n * @dev Getter for the amount of Ether already released to a payee.\\n */\\n function released(address account) public view returns (uint256) {\\n return _released[account];\\n }\\n\\n /**\\n * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an\\n * IERC20 contract.\\n */\\n function released(IERC20 token, address account) public view returns (uint256) {\\n return _erc20Released[token][account];\\n }\\n\\n /**\\n * @dev Getter for the address of the payee number `index`.\\n */\\n function payee(uint256 index) public view returns (address) {\\n return _payees[index];\\n }\\n\\n /**\\n * @dev Getter for the amount of payee's releasable Ether.\\n */\\n function releasable(address account) public view returns (uint256) {\\n uint256 totalReceived = address(this).balance + totalReleased();\\n return _pendingPayment(account, totalReceived, released(account));\\n }\\n\\n /**\\n * @dev Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an\\n * IERC20 contract.\\n */\\n function releasable(IERC20 token, address account) public view returns (uint256) {\\n uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token);\\n return _pendingPayment(account, totalReceived, released(token, account));\\n }\\n\\n /**\\n * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the\\n * total shares and their previous withdrawals.\\n */\\n function release(address payable account) public virtual {\\n require(_shares[account] > 0, \\\"PaymentSplitter: account has no shares\\\");\\n\\n uint256 payment = releasable(account);\\n\\n require(payment != 0, \\\"PaymentSplitter: account is not due payment\\\");\\n\\n // _totalReleased is the sum of all values in _released.\\n // If \\\"_totalReleased += payment\\\" does not overflow, then \\\"_released[account] += payment\\\" cannot overflow.\\n _totalReleased += payment;\\n unchecked {\\n _released[account] += payment;\\n }\\n\\n Address.sendValue(account, payment);\\n emit PaymentReleased(account, payment);\\n }\\n\\n /**\\n * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their\\n * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20\\n * contract.\\n */\\n function release(IERC20 token, address account) public virtual {\\n require(_shares[account] > 0, \\\"PaymentSplitter: account has no shares\\\");\\n\\n uint256 payment = releasable(token, account);\\n\\n require(payment != 0, \\\"PaymentSplitter: account is not due payment\\\");\\n\\n // _erc20TotalReleased[token] is the sum of all values in _erc20Released[token].\\n // If \\\"_erc20TotalReleased[token] += payment\\\" does not overflow, then \\\"_erc20Released[token][account] += payment\\\"\\n // cannot overflow.\\n _erc20TotalReleased[token] += payment;\\n unchecked {\\n _erc20Released[token][account] += payment;\\n }\\n\\n SafeERC20.safeTransfer(token, account, payment);\\n emit ERC20PaymentReleased(token, account, payment);\\n }\\n\\n /**\\n * @dev internal logic for computing the pending payment of an `account` given the token historical balances and\\n * already released amounts.\\n */\\n function _pendingPayment(\\n address account,\\n uint256 totalReceived,\\n uint256 alreadyReleased\\n ) private view returns (uint256) {\\n return (totalReceived * _shares[account]) / _totalShares - alreadyReleased;\\n }\\n\\n /**\\n * @dev Add a new payee to the contract.\\n * @param account The address of the payee to add.\\n * @param shares_ The number of shares owned by the payee.\\n */\\n function _addPayee(address account, uint256 shares_) internal {\\n require(account != address(0), \\\"PaymentSplitter: account is the zero address\\\");\\n require(shares_ > 0, \\\"PaymentSplitter: shares are 0\\\");\\n require(_shares[account] == 0, \\\"PaymentSplitter: account already has shares\\\");\\n\\n _payees.push(account);\\n _shares[account] = shares_;\\n _totalShares = _totalShares + shares_;\\n emit PayeeAdded(account, shares_);\\n }\\n}\",\"keccak256\":\"0x207135cb5400c3e0dab804834382d66ebd6e45670f8c167f1e4aa86f1757bef0\",\"license\":\"BUSL-1.1\"}},\"version\":1}", + "bytecode": "0x608060405260405162001146380380620011468339810160408190526200002691620003db565b8051825114620000985760405162461bcd60e51b815260206004820152603260248201527f5061796d656e7453706c69747465723a2070617965657320616e6420736861726044820152710cae640d8cadccee8d040dad2e6dac2e8c6d60731b60648201526084015b60405180910390fd5b60005b82518110156200010457620000ef838281518110620000be57620000be620004b9565b6020026020010151838381518110620000db57620000db620004b9565b60200260200101516200010d60201b60201c565b80620000fb81620004e5565b9150506200009b565b5050506200051d565b6001600160a01b0382166200017a5760405162461bcd60e51b815260206004820152602c60248201527f5061796d656e7453706c69747465723a206163636f756e74206973207468652060448201526b7a65726f206164647265737360a01b60648201526084016200008f565b60008111620001cc5760405162461bcd60e51b815260206004820152601d60248201527f5061796d656e7453706c69747465723a2073686172657320617265203000000060448201526064016200008f565b6001600160a01b03821660009081526002602052604090205415620002485760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e7420616c726561647960448201526a206861732073686172657360a81b60648201526084016200008f565b60048054600181019091557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b038416908117909155600090815260026020526040812082905554620002b090829062000501565b600055604080516001600160a01b0384168152602081018390527f40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac910160405180910390a15050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200033a576200033a620002f9565b604052919050565b60006001600160401b038211156200035e576200035e620002f9565b5060051b60200190565b600082601f8301126200037a57600080fd5b81516020620003936200038d8362000342565b6200030f565b82815260059290921b84018101918181019086841115620003b357600080fd5b8286015b84811015620003d05780518352918301918301620003b7565b509695505050505050565b60008060408385031215620003ef57600080fd5b82516001600160401b03808211156200040757600080fd5b818501915085601f8301126200041c57600080fd5b815160206200042f6200038d8362000342565b82815260059290921b840181019181810190898411156200044f57600080fd5b948201945b83861015620004865785516001600160a01b0381168114620004765760008081fd5b8252948201949082019062000454565b91880151919650909350505080821115620004a057600080fd5b50620004af8582860162000368565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201620004fa57620004fa620004cf565b5060010190565b80820180821115620005175762000517620004cf565b92915050565b610c19806200052d6000396000f3fe6080604052600436106100a05760003560e01c80639852595c116100645780639852595c146101ac578063a3f8eace146101e2578063c45ac05014610202578063ce7c2ac214610222578063d79779b214610258578063e33b7de31461028e57600080fd5b806319165587146100ee5780633a98ef3914610110578063406072a91461013457806348b75044146101545780638b83209b1461017457600080fd5b366100e9577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b3480156100fa57600080fd5b5061010e6101093660046109aa565b6102a3565b005b34801561011c57600080fd5b506000545b6040519081526020015b60405180910390f35b34801561014057600080fd5b5061012161014f3660046109c7565b610393565b34801561016057600080fd5b5061010e61016f3660046109c7565b6103c0565b34801561018057600080fd5b5061019461018f366004610a00565b6104d1565b6040516001600160a01b03909116815260200161012b565b3480156101b857600080fd5b506101216101c73660046109aa565b6001600160a01b031660009081526003602052604090205490565b3480156101ee57600080fd5b506101216101fd3660046109aa565b610501565b34801561020e57600080fd5b5061012161021d3660046109c7565b610549565b34801561022e57600080fd5b5061012161023d3660046109aa565b6001600160a01b031660009081526002602052604090205490565b34801561026457600080fd5b506101216102733660046109aa565b6001600160a01b031660009081526005602052604090205490565b34801561029a57600080fd5b50600154610121565b6001600160a01b0381166000908152600260205260409020546102e15760405162461bcd60e51b81526004016102d890610a19565b60405180910390fd5b60006102ec82610501565b90508060000361030e5760405162461bcd60e51b81526004016102d890610a5f565b80600160008282546103209190610ac0565b90915550506001600160a01b038216600090815260036020526040902080548201905561034d82826105ef565b604080516001600160a01b0384168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a15050565b6001600160a01b038083166000908152600660209081526040808320938516835292905220545b92915050565b6001600160a01b0381166000908152600260205260409020546103f55760405162461bcd60e51b81526004016102d890610a19565b60006104018383610549565b9050806000036104235760405162461bcd60e51b81526004016102d890610a5f565b6001600160a01b0383166000908152600560205260408120805483929061044b908490610ac0565b90915550506001600160a01b03808416600090815260066020908152604080832093861683529290522080548201905561048683838361070d565b604080516001600160a01b038481168252602082018490528516917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a910160405180910390a2505050565b6000600482815481106104e6576104e6610ad3565b6000918252602090912001546001600160a01b031692915050565b60008061050d60015490565b6105179047610ac0565b9050610542838261053d866001600160a01b031660009081526003602052604090205490565b61075f565b9392505050565b6001600160a01b03821660009081526005602052604081205481906040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa1580156105a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cc9190610ae9565b6105d69190610ac0565b90506105e7838261053d8787610393565b949350505050565b8047101561063f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016102d8565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461068c576040519150601f19603f3d011682016040523d82523d6000602084013e610691565b606091505b50509050806107085760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016102d8565b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261070890849061079a565b600080546001600160a01b0385168252600260205260408220548391906107869086610b02565b6107909190610b19565b6105e79190610b3b565b60006107ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661086f9092919063ffffffff16565b90508051600014806108105750808060200190518101906108109190610b4e565b6107085760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016102d8565b60606105e7848460008585600080866001600160a01b031685876040516108969190610b94565b60006040518083038185875af1925050503d80600081146108d3576040519150601f19603f3d011682016040523d82523d6000602084013e6108d8565b606091505b50915091506108e9878383876108f4565b979650505050505050565b6060831561096357825160000361095c576001600160a01b0385163b61095c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102d8565b50816105e7565b6105e783838151156109785781518083602001fd5b8060405162461bcd60e51b81526004016102d89190610bb0565b6001600160a01b03811681146109a757600080fd5b50565b6000602082840312156109bc57600080fd5b813561054281610992565b600080604083850312156109da57600080fd5b82356109e581610992565b915060208301356109f581610992565b809150509250929050565b600060208284031215610a1257600080fd5b5035919050565b60208082526026908201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060408201526573686172657360d01b606082015260800190565b6020808252602b908201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060408201526a191d59481c185e5b595b9d60aa1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b808201808211156103ba576103ba610aaa565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610afb57600080fd5b5051919050565b80820281158282048414176103ba576103ba610aaa565b600082610b3657634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156103ba576103ba610aaa565b600060208284031215610b6057600080fd5b8151801515811461054257600080fd5b60005b83811015610b8b578181015183820152602001610b73565b50506000910152565b60008251610ba6818460208701610b70565b9190910192915050565b6020815260008251806020840152610bcf816040850160208701610b70565b601f01601f1916919091016040019291505056fea26469706673582212204f42d862e8c16fad47201e92576b54c5eebf82e68071a8c4e610115d0a30a58564736f6c63430008140033", + "deployedBytecode": "0x6080604052600436106100a05760003560e01c80639852595c116100645780639852595c146101ac578063a3f8eace146101e2578063c45ac05014610202578063ce7c2ac214610222578063d79779b214610258578063e33b7de31461028e57600080fd5b806319165587146100ee5780633a98ef3914610110578063406072a91461013457806348b75044146101545780638b83209b1461017457600080fd5b366100e9577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b3480156100fa57600080fd5b5061010e6101093660046109aa565b6102a3565b005b34801561011c57600080fd5b506000545b6040519081526020015b60405180910390f35b34801561014057600080fd5b5061012161014f3660046109c7565b610393565b34801561016057600080fd5b5061010e61016f3660046109c7565b6103c0565b34801561018057600080fd5b5061019461018f366004610a00565b6104d1565b6040516001600160a01b03909116815260200161012b565b3480156101b857600080fd5b506101216101c73660046109aa565b6001600160a01b031660009081526003602052604090205490565b3480156101ee57600080fd5b506101216101fd3660046109aa565b610501565b34801561020e57600080fd5b5061012161021d3660046109c7565b610549565b34801561022e57600080fd5b5061012161023d3660046109aa565b6001600160a01b031660009081526002602052604090205490565b34801561026457600080fd5b506101216102733660046109aa565b6001600160a01b031660009081526005602052604090205490565b34801561029a57600080fd5b50600154610121565b6001600160a01b0381166000908152600260205260409020546102e15760405162461bcd60e51b81526004016102d890610a19565b60405180910390fd5b60006102ec82610501565b90508060000361030e5760405162461bcd60e51b81526004016102d890610a5f565b80600160008282546103209190610ac0565b90915550506001600160a01b038216600090815260036020526040902080548201905561034d82826105ef565b604080516001600160a01b0384168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a15050565b6001600160a01b038083166000908152600660209081526040808320938516835292905220545b92915050565b6001600160a01b0381166000908152600260205260409020546103f55760405162461bcd60e51b81526004016102d890610a19565b60006104018383610549565b9050806000036104235760405162461bcd60e51b81526004016102d890610a5f565b6001600160a01b0383166000908152600560205260408120805483929061044b908490610ac0565b90915550506001600160a01b03808416600090815260066020908152604080832093861683529290522080548201905561048683838361070d565b604080516001600160a01b038481168252602082018490528516917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a910160405180910390a2505050565b6000600482815481106104e6576104e6610ad3565b6000918252602090912001546001600160a01b031692915050565b60008061050d60015490565b6105179047610ac0565b9050610542838261053d866001600160a01b031660009081526003602052604090205490565b61075f565b9392505050565b6001600160a01b03821660009081526005602052604081205481906040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa1580156105a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cc9190610ae9565b6105d69190610ac0565b90506105e7838261053d8787610393565b949350505050565b8047101561063f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016102d8565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461068c576040519150601f19603f3d011682016040523d82523d6000602084013e610691565b606091505b50509050806107085760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016102d8565b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261070890849061079a565b600080546001600160a01b0385168252600260205260408220548391906107869086610b02565b6107909190610b19565b6105e79190610b3b565b60006107ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661086f9092919063ffffffff16565b90508051600014806108105750808060200190518101906108109190610b4e565b6107085760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016102d8565b60606105e7848460008585600080866001600160a01b031685876040516108969190610b94565b60006040518083038185875af1925050503d80600081146108d3576040519150601f19603f3d011682016040523d82523d6000602084013e6108d8565b606091505b50915091506108e9878383876108f4565b979650505050505050565b6060831561096357825160000361095c576001600160a01b0385163b61095c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102d8565b50816105e7565b6105e783838151156109785781518083602001fd5b8060405162461bcd60e51b81526004016102d89190610bb0565b6001600160a01b03811681146109a757600080fd5b50565b6000602082840312156109bc57600080fd5b813561054281610992565b600080604083850312156109da57600080fd5b82356109e581610992565b915060208301356109f581610992565b809150509250929050565b600060208284031215610a1257600080fd5b5035919050565b60208082526026908201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060408201526573686172657360d01b606082015260800190565b6020808252602b908201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060408201526a191d59481c185e5b595b9d60aa1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b808201808211156103ba576103ba610aaa565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610afb57600080fd5b5051919050565b80820281158282048414176103ba576103ba610aaa565b600082610b3657634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156103ba576103ba610aaa565b600060208284031215610b6057600080fd5b8151801515811461054257600080fd5b60005b83811015610b8b578181015183820152602001610b73565b50506000910152565b60008251610ba6818460208701610b70565b9190910192915050565b6020815260008251806020840152610bcf816040850160208701610b70565b601f01601f1916919091016040019291505056fea26469706673582212204f42d862e8c16fad47201e92576b54c5eebf82e68071a8c4e610115d0a30a58564736f6c63430008140033", + "devdoc": { + "details": "This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware that the Ether will be split in this way, since it is handled transparently by the contract. The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the time of contract deployment and can't be updated thereafter. `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} function. NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you to run tests before sending real value to this contract.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at the matching position in the `shares` array. All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no duplicates in `payees`." + }, + "payee(uint256)": { + "details": "Getter for the address of the payee number `index`." + }, + "releasable(address)": { + "details": "Getter for the amount of payee's releasable Ether." + }, + "releasable(address,address)": { + "details": "Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an IERC20 contract." + }, + "release(address)": { + "details": "Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the total shares and their previous withdrawals." + }, + "release(address,address)": { + "details": "Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 contract." + }, + "released(address)": { + "details": "Getter for the amount of Ether already released to a payee." + }, + "released(address,address)": { + "details": "Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an IERC20 contract." + }, + "shares(address)": { + "details": "Getter for the amount of shares held by an account." + }, + "totalReleased()": { + "details": "Getter for the total amount of Ether already released." + }, + "totalReleased(address)": { + "details": "Getter for the total amount of `token` already released. `token` should be the address of an IERC20 contract." + }, + "totalShares()": { + "details": "Getter for the total shares held by payees." + } + }, + "title": "PaymentSplitter", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 17286, + "contract": "contracts/v2/lib/PaymentSplitter.sol:PaymentSplitter", + "label": "_totalShares", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 17288, + "contract": "contracts/v2/lib/PaymentSplitter.sol:PaymentSplitter", + "label": "_totalReleased", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 17292, + "contract": "contracts/v2/lib/PaymentSplitter.sol:PaymentSplitter", + "label": "_shares", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 17296, + "contract": "contracts/v2/lib/PaymentSplitter.sol:PaymentSplitter", + "label": "_released", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 17299, + "contract": "contracts/v2/lib/PaymentSplitter.sol:PaymentSplitter", + "label": "_payees", + "offset": 0, + "slot": "4", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 17304, + "contract": "contracts/v2/lib/PaymentSplitter.sol:PaymentSplitter", + "label": "_erc20TotalReleased", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_contract(IERC20)5493,t_uint256)" + }, + { + "astId": 17311, + "contract": "contracts/v2/lib/PaymentSplitter.sol:PaymentSplitter", + "label": "_erc20Released", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_contract(IERC20)5493,t_mapping(t_address,t_uint256))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_contract(IERC20)5493": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_contract(IERC20)5493,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_contract(IERC20)5493", + "label": "mapping(contract IERC20 => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_contract(IERC20)5493,t_uint256)": { + "encoding": "mapping", + "key": "t_contract(IERC20)5493", + "label": "mapping(contract IERC20 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/deployments/sepolia/RewardsReceiver.json b/deployments/sepolia/RewardsReceiver.json new file mode 100644 index 0000000..41d2d99 --- /dev/null +++ b/deployments/sepolia/RewardsReceiver.json @@ -0,0 +1,293 @@ +{ + "address": "0xAeBD9A9b883f539894A28CBCD866d50ca34000FD", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_withdrawalAddr", + "type": "address" + }, + { + "internalType": "address[]", + "name": "yieldDirectorAddresses", + "type": "address[]" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "MINTER", + "outputs": [ + { + "internalType": "contract ISharedDeposit", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SGETH", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WITHDRAWALS", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WSGETH", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeSplitter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "flipState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeSplitter", + "type": "address" + } + ], + "name": "setDAOFeeSplitter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "state", + "outputs": [ + { + "internalType": "enum RewardsReceiver.State", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "work", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x18b5e163b98e537a1b28454acc39d9ffc66876cdc113ffd53e07813d183522c5", + "receipt": { + "to": null, + "from": "0xA120FAd0498ECbF755a675E3833158484123bF30", + "contractAddress": "0xAeBD9A9b883f539894A28CBCD866d50ca34000FD", + "transactionIndex": 25, + "gasUsed": "720506", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000001000000000000000000000000000000000000022100000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000020000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeb53ec9d6152874ebf6499ab9344f5b4bd5e604ad7f951a67d1b44e646fc4174", + "transactionHash": "0x18b5e163b98e537a1b28454acc39d9ffc66876cdc113ffd53e07813d183522c5", + "logs": [ + { + "transactionIndex": 25, + "blockNumber": 6233358, + "transactionHash": "0x18b5e163b98e537a1b28454acc39d9ffc66876cdc113ffd53e07813d183522c5", + "address": "0xAeBD9A9b883f539894A28CBCD866d50ca34000FD", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000a120fad0498ecbf755a675e3833158484123bf30" + ], + "data": "0x", + "logIndex": 65, + "blockHash": "0xeb53ec9d6152874ebf6499ab9344f5b4bd5e604ad7f951a67d1b44e646fc4174" + } + ], + "blockNumber": 6233358, + "cumulativeGasUsed": "5381599", + "status": 1, + "byzantium": true + }, + "args": [ + "0x93Ec5A17176336C95Bfb537A71130d6eEA6eF73D", + [ + "0xCF4831EBE785437DC54a90018b1b410Bd16c8533", + "0x514dfd2d10eC6775f030BA2abcf7A2445C0CA6Fb", + "0x38E86964A811Ee66D1139CD97C838B713F63779B", + "0x36c2F00cC7D02be7Df0BC9be2a8e08b74C4f2E56" + ] + ], + "numDeployments": 1, + "solcInputHash": "b098c02b927c81fd02abb8247583d190", + "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_withdrawalAddr\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"yieldDirectorAddresses\",\"type\":\"address[]\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"MINTER\",\"outputs\":[{\"internalType\":\"contract ISharedDeposit\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SGETH\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WITHDRAWALS\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WSGETH\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeSplitter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"flipState\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_feeSplitter\",\"type\":\"address\"}],\"name\":\"setDAOFeeSplitter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state\",\"outputs\":[{\"internalType\":\"enum RewardsReceiver.State\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"work\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"@ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com\",\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"RewardsReceiver - Rewards receiver contract for ETH2 CL + RL rewards\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/v2/core/RewardsReceiver.sol\":\"RewardsReceiver\"},\"evmVersion\":\"paris\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n *\\n * ==== Security Considerations\\n *\\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\\n * generally recommended is:\\n *\\n * ```solidity\\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\\n * doThing(..., value);\\n * }\\n *\\n * function doThing(..., uint256 value) public {\\n * token.safeTransferFrom(msg.sender, address(this), value);\\n * ...\\n * }\\n * ```\\n *\\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\\n * {SafeERC20-safeTransferFrom}).\\n *\\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\\n * contracts should have entry points that don't rely on permit.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n *\\n * CAUTION: See Security Considerations above.\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xb264c03a3442eb37a68ad620cefd1182766b58bee6cec40343480392d6b14d69\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n * to be set to zero before setting it to a non-zero value, such as USDT.\\n */\\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n * Revert on invalid signature.\\n */\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0xabefac93435967b4d36a4fabcbdbb918d1f0b7ae3c3d85bc30923b326c927ed1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"contracts/v2/core/RewardsReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.20;\\n\\n// Rewards receiver contract for ETH2 CL + RL rewards\\n// Acts as withdrawals address\\n// Sends recieved ETH to Deposits when system is healthy and buffer can process withdrawals\\n// Sends all recieved ETH to withdrawals contract when system is shutting down and validators are being exited\\n// normal deposit contract is ETH2sgETHYR to autocompound rewards\\n// call work() to process ETH\\n// DAO is set as owner. must call acceptOwnership. can call flipState\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {YieldDirectorBase} from \\\"../lib/YieldDirectorBase.sol\\\";\\n\\n/// @title RewardsReceiver - Rewards receiver contract for ETH2 CL + RL rewards\\n/// @author @ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com\\ncontract RewardsReceiver is Ownable, YieldDirectorBase {\\n enum State {\\n Deposits,\\n Withdrawals\\n }\\n State public state;\\n address payable public immutable WITHDRAWALS;\\n\\n constructor(\\n address _withdrawalAddr,\\n address[] memory yieldDirectorAddresses\\n ) payable Ownable() YieldDirectorBase(yieldDirectorAddresses) {\\n WITHDRAWALS = payable(_withdrawalAddr);\\n state = State.Deposits;\\n }\\n\\n function work() external payable {\\n if (state == State.Deposits) {\\n _convertToSgETHAndTransfer();\\n } else if (state == State.Withdrawals) {\\n WITHDRAWALS.transfer(address(this).balance);\\n }\\n }\\n\\n function flipState() external onlyOwner {\\n if (state == State.Deposits) {\\n state = State.Withdrawals;\\n } else if (state == State.Withdrawals) {\\n state = State.Deposits;\\n }\\n }\\n\\n // Allows upgrading/ changing the downstream DAO fee splitter only for easier fee tier changes in the future\\n function setDAOFeeSplitter(address _feeSplitter) external onlyOwner {\\n feeSplitter = _feeSplitter;\\n }\\n\\n receive() external payable {} // solhint-disable-line\\n\\n fallback() external payable {} // solhint-disable-line\\n}\\n\",\"keccak256\":\"0xef922c5ecd80eee86f24bb754f5921b4a31744da7deaca6d7238666739b744ca\",\"license\":\"BUSL-1.1\"},\"contracts/v2/interfaces/ISharedDeposit.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\ninterface ISharedDeposit {\\n function withdraw(uint256 amount) external;\\n function withdraw(uint256 amount, address dest) external;\\n\\n function deposit() external payable;\\n\\n function remainingSpaceInEpoch() external;\\n function depositAndStakeFor(address dest) external payable;\\n}\\n\",\"keccak256\":\"0x5ddc9847caef44cdf368df4f340c8c58b11fc32f0b4327271e365db23782f250\",\"license\":\"UNLICENSED\"},\"contracts/v2/lib/YieldDirectorBase.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\n\\n// Acts as the deposit contract for the reward receiver during normal functioning\\n// 100% of recieved ETH from rewards is auto-compounded back into sgETH\\n// 60% is immutably always transfered to wsgETH for staker rewards\\n// 40% is transferred to a splitter the DAO can modulate for nor payments and other use cases\\n\\n// call work() to process eth\\npragma solidity ^0.8.20;\\n\\nimport {ISharedDeposit} from \\\"../interfaces/ISharedDeposit.sol\\\";\\nimport {IERC20, SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\ncontract YieldDirectorBase {\\n IERC20 public immutable SGETH;\\n address public immutable WSGETH;\\n address public feeSplitter;\\n ISharedDeposit public immutable MINTER;\\n\\n constructor(address[] memory _addrs) payable {\\n SGETH = IERC20(_addrs[0]);\\n WSGETH = _addrs[1];\\n feeSplitter = _addrs[2];\\n MINTER = ISharedDeposit(_addrs[3]);\\n }\\n\\n function _convertToSgETHAndTransfer() internal {\\n // convert eth 2 sgETH\\n MINTER.deposit{value: address(this).balance}();\\n\\n // Calc static split\\n uint256 bal = SGETH.balanceOf(address(this));\\n uint256 part1 = (bal * 40) / 100; // upto 40% for DAO direction. most reflected back\\n uint256 part2 = bal - part1;\\n\\n // Send tokens\\n SafeERC20.safeTransfer(SGETH, feeSplitter, part1);\\n SafeERC20.safeTransfer(SGETH, WSGETH, part2);\\n }\\n}\\n\",\"keccak256\":\"0xd2edccd75827a38988e4abccd305d09509c930d24dcf0d28f0742fa2bea75b80\",\"license\":\"BUSL-1.1\"}},\"version\":1}", + "bytecode": "0x61010060405260405162000e1c38038062000e1c8339810160408190526200002791620001b3565b80620000333362000130565b806000815181106200004957620000496200029c565b60200260200101516001600160a01b03166080816001600160a01b031681525050806001815181106200008057620000806200029c565b60200260200101516001600160a01b031660a0816001600160a01b03168152505080600281518110620000b757620000b76200029c565b6020026020010151600160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600381518110620000fb57620000fb6200029c565b60209081029190910101516001600160a01b0390811660c0529290921660e05250506001805460ff60a01b19169055620002b2565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200019857600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215620001c757600080fd5b620001d28362000180565b602084810151919350906001600160401b0380821115620001f257600080fd5b818601915086601f8301126200020757600080fd5b8151818111156200021c576200021c6200019d565b8060051b604051601f19603f830116810181811085821117156200024457620002446200019d565b6040529182528482019250838101850191898311156200026357600080fd5b938501935b828510156200028c576200027c8562000180565b8452938501939285019262000268565b8096505050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c05160e051610b07620003156000396000818160c001526102d901526000818161025701526104520152600081816101a101526105d9015260008181610203015281816104da0152818161058401526105b80152610b076000f3fe6080604052600436106100a55760003560e01c80639e660663116100615780639e6606631461016f578063b8902ff71461018f578063c19d93fb146101c3578063cf36fd24146101f1578063f2fde38b14610225578063fe6d81241461024557005b80632b3d9215146100ae578063322e9f04146100ff5780636052970c14610107578063715018a6146101275780638da5cb5b1461013c5780638e9203511461015a57005b366100ac57005b005b3480156100ba57600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100ac610279565b34801561011357600080fd5b506001546100e2906001600160a01b031681565b34801561013357600080fd5b506100ac610324565b34801561014857600080fd5b506000546001600160a01b03166100e2565b34801561016657600080fd5b506100ac610336565b34801561017b57600080fd5b506100ac61018a36600461094d565b6103ab565b34801561019b57600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b3480156101cf57600080fd5b506001546101e490600160a01b900460ff1681565b6040516100f69190610993565b3480156101fd57600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b34801561023157600080fd5b506100ac61024036600461094d565b6103d5565b34801561025157600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b600060018054600160a01b900460ff16908111156102995761029961097d565b036102a8576102a6610450565b565b6001808054600160a01b900460ff16908111156102c7576102c761097d565b036102a6576040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016904780156108fc02916000818181858888f19350505050158015610321573d6000803e3d6000fd5b50565b61032c610603565b6102a6600061065d565b61033e610603565b600060018054600160a01b900460ff169081111561035e5761035e61097d565b03610378576001805460ff60a01b1916600160a01b179055565b6001808054600160a01b900460ff16908111156103975761039761097d565b036102a6576001805460ff60a01b19169055565b6103b3610603565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6103dd610603565b6001600160a01b0381166104475760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6103218161065d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b1580156104ab57600080fd5b505af11580156104bf573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600093507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506370a082319150602401602060405180830381865afa15801561052b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054f91906109bb565b9050600060646105608360286109ea565b61056a9190610a07565b905060006105788284610a29565b6001549091506105b3907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0316846106ad565b6105fe7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000836106ad565b505050565b6000546001600160a01b031633146102a65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161043e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663a9059cbb60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908401526105fe9286929160009161073d9185169084906107bd565b905080516000148061075e57508080602001905181019061075e9190610a3c565b6105fe5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161043e565b60606107cc84846000856107d4565b949350505050565b6060824710156108355760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161043e565b600080866001600160a01b031685876040516108519190610a82565b60006040518083038185875af1925050503d806000811461088e576040519150601f19603f3d011682016040523d82523d6000602084013e610893565b606091505b50915091506108a4878383876108af565b979650505050505050565b6060831561091e578251600003610917576001600160a01b0385163b6109175760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161043e565b50816107cc565b6107cc83838151156109335781518083602001fd5b8060405162461bcd60e51b815260040161043e9190610a9e565b60006020828403121561095f57600080fd5b81356001600160a01b038116811461097657600080fd5b9392505050565b634e487b7160e01b600052602160045260246000fd5b60208101600283106109b557634e487b7160e01b600052602160045260246000fd5b91905290565b6000602082840312156109cd57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610a0157610a016109d4565b92915050565b600082610a2457634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610a0157610a016109d4565b600060208284031215610a4e57600080fd5b8151801515811461097657600080fd5b60005b83811015610a79578181015183820152602001610a61565b50506000910152565b60008251610a94818460208701610a5e565b9190910192915050565b6020815260008251806020840152610abd816040850160208701610a5e565b601f01601f1916919091016040019291505056fea2646970667358221220017186d8f92a7a58958534d3f4488a368b6b291b45e3f4392b7b11b88fe762d764736f6c63430008140033", + "deployedBytecode": "0x6080604052600436106100a55760003560e01c80639e660663116100615780639e6606631461016f578063b8902ff71461018f578063c19d93fb146101c3578063cf36fd24146101f1578063f2fde38b14610225578063fe6d81241461024557005b80632b3d9215146100ae578063322e9f04146100ff5780636052970c14610107578063715018a6146101275780638da5cb5b1461013c5780638e9203511461015a57005b366100ac57005b005b3480156100ba57600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100ac610279565b34801561011357600080fd5b506001546100e2906001600160a01b031681565b34801561013357600080fd5b506100ac610324565b34801561014857600080fd5b506000546001600160a01b03166100e2565b34801561016657600080fd5b506100ac610336565b34801561017b57600080fd5b506100ac61018a36600461094d565b6103ab565b34801561019b57600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b3480156101cf57600080fd5b506001546101e490600160a01b900460ff1681565b6040516100f69190610993565b3480156101fd57600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b34801561023157600080fd5b506100ac61024036600461094d565b6103d5565b34801561025157600080fd5b506100e27f000000000000000000000000000000000000000000000000000000000000000081565b600060018054600160a01b900460ff16908111156102995761029961097d565b036102a8576102a6610450565b565b6001808054600160a01b900460ff16908111156102c7576102c761097d565b036102a6576040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016904780156108fc02916000818181858888f19350505050158015610321573d6000803e3d6000fd5b50565b61032c610603565b6102a6600061065d565b61033e610603565b600060018054600160a01b900460ff169081111561035e5761035e61097d565b03610378576001805460ff60a01b1916600160a01b179055565b6001808054600160a01b900460ff16908111156103975761039761097d565b036102a6576001805460ff60a01b19169055565b6103b3610603565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6103dd610603565b6001600160a01b0381166104475760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6103218161065d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b1580156104ab57600080fd5b505af11580156104bf573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600093507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506370a082319150602401602060405180830381865afa15801561052b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054f91906109bb565b9050600060646105608360286109ea565b61056a9190610a07565b905060006105788284610a29565b6001549091506105b3907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0316846106ad565b6105fe7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000836106ad565b505050565b6000546001600160a01b031633146102a65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161043e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663a9059cbb60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908401526105fe9286929160009161073d9185169084906107bd565b905080516000148061075e57508080602001905181019061075e9190610a3c565b6105fe5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161043e565b60606107cc84846000856107d4565b949350505050565b6060824710156108355760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161043e565b600080866001600160a01b031685876040516108519190610a82565b60006040518083038185875af1925050503d806000811461088e576040519150601f19603f3d011682016040523d82523d6000602084013e610893565b606091505b50915091506108a4878383876108af565b979650505050505050565b6060831561091e578251600003610917576001600160a01b0385163b6109175760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161043e565b50816107cc565b6107cc83838151156109335781518083602001fd5b8060405162461bcd60e51b815260040161043e9190610a9e565b60006020828403121561095f57600080fd5b81356001600160a01b038116811461097657600080fd5b9392505050565b634e487b7160e01b600052602160045260246000fd5b60208101600283106109b557634e487b7160e01b600052602160045260246000fd5b91905290565b6000602082840312156109cd57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610a0157610a016109d4565b92915050565b600082610a2457634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610a0157610a016109d4565b600060208284031215610a4e57600080fd5b8151801515811461097657600080fd5b60005b83811015610a79578181015183820152602001610a61565b50506000910152565b60008251610a94818460208701610a5e565b9190910192915050565b6020815260008251806020840152610abd816040850160208701610a5e565b601f01601f1916919091016040019291505056fea2646970667358221220017186d8f92a7a58958534d3f4488a368b6b291b45e3f4392b7b11b88fe762d764736f6c63430008140033", + "devdoc": { + "author": "@ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com", + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "title": "RewardsReceiver - Rewards receiver contract for ETH2 CL + RL rewards", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 4000, + "contract": "contracts/v2/core/RewardsReceiver.sol:RewardsReceiver", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 17953, + "contract": "contracts/v2/core/RewardsReceiver.sol:RewardsReceiver", + "label": "feeSplitter", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 14629, + "contract": "contracts/v2/core/RewardsReceiver.sol:RewardsReceiver", + "label": "state", + "offset": 20, + "slot": "1", + "type": "t_enum(State)14626" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_enum(State)14626": { + "encoding": "inplace", + "label": "enum RewardsReceiver.State", + "numberOfBytes": "1" + } + } + } +} diff --git a/deployments/sepolia/SgETH.json b/deployments/sepolia/SgETH.json index 23a5fa5..165350c 100644 --- a/deployments/sepolia/SgETH.json +++ b/deployments/sepolia/SgETH.json @@ -1,5 +1,5 @@ { - "address": "0x44642Deefe1E3732db13C84CFF7A45adc4E2d920", + "address": "0xCF4831EBE785437DC54a90018b1b410Bd16c8533", "abi": [ { "inputs": [], @@ -745,41 +745,41 @@ "type": "function" } ], - "transactionHash": "0x50d4f0c13753c9483848344ffc2eeba86c4a427404d12c96b0c76cd24a5056ae", + "transactionHash": "0x8453fef841b208c6f78178b64a535943c992dc2de56db79d07c241633d497134", "receipt": { "to": null, - "from": "0xf5CA36c9873d61Bc28C117BD470981Ef6647A685", - "contractAddress": "0x44642Deefe1E3732db13C84CFF7A45adc4E2d920", - "transactionIndex": 38, + "from": "0xA120FAd0498ECbF755a675E3833158484123bF30", + "contractAddress": "0xCF4831EBE785437DC54a90018b1b410Bd16c8533", + "transactionIndex": 66, "gasUsed": "1775033", - "logsBloom": "0x00000004000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000040000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000800000000000000000000100000000000020000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xb43661f384eba83410c262f5d48fcc976a0de779cd1233dd1172169721438913", - "transactionHash": "0x50d4f0c13753c9483848344ffc2eeba86c4a427404d12c96b0c76cd24a5056ae", + "logsBloom": "0x00000004000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000022100000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000021000000000000000000000000000000000000000000000000000000000000100000000000020000000000000000000000000000008000000000000000000000000000000000000", + "blockHash": "0x5c9f61e13a5a782ea7f580cc5cbd550b5a6f28fcc794733ec01d75b056ae1c10", + "transactionHash": "0x8453fef841b208c6f78178b64a535943c992dc2de56db79d07c241633d497134", "logs": [ { - "transactionIndex": 38, - "blockNumber": 6184320, - "transactionHash": "0x50d4f0c13753c9483848344ffc2eeba86c4a427404d12c96b0c76cd24a5056ae", - "address": "0x44642Deefe1E3732db13C84CFF7A45adc4E2d920", + "transactionIndex": 66, + "blockNumber": 6233074, + "transactionHash": "0x8453fef841b208c6f78178b64a535943c992dc2de56db79d07c241633d497134", + "address": "0xCF4831EBE785437DC54a90018b1b410Bd16c8533", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x000000000000000000000000f5ca36c9873d61bc28c117bd470981ef6647a685", - "0x000000000000000000000000f5ca36c9873d61bc28c117bd470981ef6647a685" + "0x000000000000000000000000a120fad0498ecbf755a675e3833158484123bf30", + "0x000000000000000000000000a120fad0498ecbf755a675e3833158484123bf30" ], "data": "0x", - "logIndex": 55, - "blockHash": "0xb43661f384eba83410c262f5d48fcc976a0de779cd1233dd1172169721438913" + "logIndex": 164, + "blockHash": "0x5c9f61e13a5a782ea7f580cc5cbd550b5a6f28fcc794733ec01d75b056ae1c10" } ], - "blockNumber": 6184320, - "cumulativeGasUsed": "6248514", + "blockNumber": 6233074, + "cumulativeGasUsed": "12425083", "status": 1, "byzantium": true }, "args": [], "numDeployments": 1, - "solcInputHash": "266f4835dc637e40f5c59a1cd15f5094", + "solcInputHash": "8284d085d319e8366de9f230a23ab070", "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidShortString\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"str\",\"type\":\"string\"}],\"name\":\"StringTooLong\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINTER\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minterAddress\",\"type\":\"address\"}],\"name\":\"addMinter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amt\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amt\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amt\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minterAddress\",\"type\":\"address\"}],\"name\":\"removeMinter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"@ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"}},\"kind\":\"dev\",\"methods\":{\"DOMAIN_SEPARATOR()\":{\"details\":\"Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\"},\"allowance(address,address)\":{\"details\":\"See {IERC20-allowance}.\"},\"approve(address,uint256)\":{\"details\":\"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.\"},\"balanceOf(address)\":{\"details\":\"See {IERC20-balanceOf}.\"},\"burn(uint256)\":{\"details\":\"Destroys `amount` tokens from the caller. See {ERC20-_burn}.\"},\"burnFrom(address,uint256)\":{\"params\":{\"addr\":\"The address to burn from\",\"amt\":\"The amount to burn\"}},\"decimals()\":{\"details\":\"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.\"},\"decreaseAllowance(address,uint256)\":{\"details\":\"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`.\"},\"eip712Domain()\":{\"details\":\"See {EIP-5267}. _Available since v4.9._\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"increaseAllowance(address,uint256)\":{\"details\":\"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.\"},\"mint(address,uint256)\":{\"params\":{\"addr\":\"The address to mint to \",\"amt\":\"The amount to mint \"}},\"name()\":{\"details\":\"Returns the name of the token.\"},\"nonces(address)\":{\"details\":\"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.\"},\"permit(address,address,uint256,uint256,uint8,bytes32,bytes32)\":{\"details\":\"Sets `value` as the allowance of `spender` over ``owner``'s tokens, given ``owner``'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also apply here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address. - `deadline` must be a timestamp in the future. - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments. - the signature must use ``owner``'s current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token, usually a shorter version of the name.\"},\"totalSupply()\":{\"details\":\"See {IERC20-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"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`.\"}},\"title\":\"SgETH - SharedStake Governed Staked Ether\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"burnFrom(address,uint256)\":{\"notice\":\"burnFrom Used by minters when user redeems\"},\"mint(address,uint256)\":{\"notice\":\"mint This function is what other minters will call to mint new tokens\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/v2/core/SgETH.sol\":\"SgETH\"},\"evmVersion\":\"paris\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(account),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0dd6e52cb394d7f5abe5dca2d4908a6be40417914720932de757de34a99ab87f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC5267.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC5267 {\\n /**\\n * @dev MAY be emitted to signal that the domain could have changed.\\n */\\n event EIP712DomainChanged();\\n\\n /**\\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\\n * signature.\\n */\\n function eip712Domain()\\n external\\n view\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n );\\n}\\n\",\"keccak256\":\"0xac6c2efc64baccbde4904ae18ed45139c9aa8cff96d6888344d1e4d2eb8b659f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * The default value of {decimals} is 18. To change this, you should override\\n * this function so it returns a different value.\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the default value returned by this function, unless\\n * it's overridden.\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _transfer(owner, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Requirements:\\n *\\n * - `from` and `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``from``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(from, spender, amount);\\n _transfer(from, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, allowance(owner, spender) + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n uint256 currentAllowance = allowance(owner, spender);\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `from` to `to`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n */\\n function _transfer(address from, address to, uint256 amount) internal virtual {\\n require(from != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\\n // decrementing then incrementing.\\n _balances[to] += amount;\\n }\\n\\n emit Transfer(from, to, amount);\\n\\n _afterTokenTransfer(from, to, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n unchecked {\\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\\n _balances[account] += amount;\\n }\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n // Overflow not possible: amount <= accountBalance <= totalSupply.\\n _totalSupply -= amount;\\n }\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(address owner, address spender, uint256 amount) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {Approval} event.\\n */\\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC20: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\\n}\\n\",\"keccak256\":\"0xa56ca923f70c1748830700250b19c61b70db9a683516dc5e216694a50445d99c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC20.sol\\\";\\nimport \\\"../../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\\n * tokens and those that they have an allowance for, in a way that can be\\n * recognized off-chain (via event analysis).\\n */\\nabstract contract ERC20Burnable is Context, ERC20 {\\n /**\\n * @dev Destroys `amount` tokens from the caller.\\n *\\n * See {ERC20-_burn}.\\n */\\n function burn(uint256 amount) public virtual {\\n _burn(_msgSender(), amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, deducting from the caller's\\n * allowance.\\n *\\n * See {ERC20-_burn} and {ERC20-allowance}.\\n *\\n * Requirements:\\n *\\n * - the caller must have allowance for ``accounts``'s tokens of at least\\n * `amount`.\\n */\\n function burnFrom(address account, uint256 amount) public virtual {\\n _spendAllowance(account, _msgSender(), amount);\\n _burn(account, amount);\\n }\\n}\\n\",\"keccak256\":\"0x0d19410453cda55960a818e02bd7c18952a5c8fe7a3036e81f0d599f34487a7b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/ERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20Permit.sol\\\";\\nimport \\\"../ERC20.sol\\\";\\nimport \\\"../../../utils/cryptography/ECDSA.sol\\\";\\nimport \\\"../../../utils/cryptography/EIP712.sol\\\";\\nimport \\\"../../../utils/Counters.sol\\\";\\n\\n/**\\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n *\\n * _Available since v3.4._\\n */\\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {\\n using Counters for Counters.Counter;\\n\\n mapping(address => Counters.Counter) private _nonces;\\n\\n // solhint-disable-next-line var-name-mixedcase\\n bytes32 private constant _PERMIT_TYPEHASH =\\n keccak256(\\\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\\\");\\n /**\\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\\n * However, to ensure consistency with the upgradeable transpiler, we will continue\\n * to reserve a slot.\\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\\n */\\n // solhint-disable-next-line var-name-mixedcase\\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\\n\\n /**\\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\\\"1\\\"`.\\n *\\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\\n */\\n constructor(string memory name) EIP712(name, \\\"1\\\") {}\\n\\n /**\\n * @inheritdoc IERC20Permit\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) public virtual override {\\n require(block.timestamp <= deadline, \\\"ERC20Permit: expired deadline\\\");\\n\\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\\n\\n bytes32 hash = _hashTypedDataV4(structHash);\\n\\n address signer = ECDSA.recover(hash, v, r, s);\\n require(signer == owner, \\\"ERC20Permit: invalid signature\\\");\\n\\n _approve(owner, spender, value);\\n }\\n\\n /**\\n * @inheritdoc IERC20Permit\\n */\\n function nonces(address owner) public view virtual override returns (uint256) {\\n return _nonces[owner].current();\\n }\\n\\n /**\\n * @inheritdoc IERC20Permit\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\\n return _domainSeparatorV4();\\n }\\n\\n /**\\n * @dev \\\"Consume a nonce\\\": return the current value and increment.\\n *\\n * _Available since v4.1._\\n */\\n function _useNonce(address owner) internal virtual returns (uint256 current) {\\n Counters.Counter storage nonce = _nonces[owner];\\n current = nonce.current();\\n nonce.increment();\\n }\\n}\\n\",\"keccak256\":\"0xbb16110ffe0b625944fe7dd97adcf1158e514185c956a5628bc09be90d606174\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n *\\n * ==== Security Considerations\\n *\\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\\n * generally recommended is:\\n *\\n * ```solidity\\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\\n * doThing(..., value);\\n * }\\n *\\n * function doThing(..., uint256 value) public {\\n * token.safeTransferFrom(msg.sender, address(this), value);\\n * ...\\n * }\\n * ```\\n *\\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\\n * {SafeERC20-safeTransferFrom}).\\n *\\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\\n * contracts should have entry points that don't rely on permit.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n *\\n * CAUTION: See Security Considerations above.\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xb264c03a3442eb37a68ad620cefd1182766b58bee6cec40343480392d6b14d69\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Counters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Counters\\n * @author Matt Condon (@shrugs)\\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\\n *\\n * Include with `using Counters for Counters.Counter;`\\n */\\nlibrary Counters {\\n struct Counter {\\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\\n // this feature: see https://github.com/ethereum/solidity/issues/4637\\n uint256 _value; // default: 0\\n }\\n\\n function current(Counter storage counter) internal view returns (uint256) {\\n return counter._value;\\n }\\n\\n function increment(Counter storage counter) internal {\\n unchecked {\\n counter._value += 1;\\n }\\n }\\n\\n function decrement(Counter storage counter) internal {\\n uint256 value = counter._value;\\n require(value > 0, \\\"Counter: decrement overflow\\\");\\n unchecked {\\n counter._value = value - 1;\\n }\\n }\\n\\n function reset(Counter storage counter) internal {\\n counter._value = 0;\\n }\\n}\\n\",\"keccak256\":\"0xf0018c2440fbe238dd3a8732fa8e17a0f9dce84d31451dc8a32f6d62b349c9f1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/ShortStrings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)\\n\\npragma solidity ^0.8.8;\\n\\nimport \\\"./StorageSlot.sol\\\";\\n\\n// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |\\n// | length | 0x BB |\\ntype ShortString is bytes32;\\n\\n/**\\n * @dev This library provides functions to convert short memory strings\\n * into a `ShortString` type that can be used as an immutable variable.\\n *\\n * Strings of arbitrary length can be optimized using this library if\\n * they are short enough (up to 31 bytes) by packing them with their\\n * length (1 byte) in a single EVM word (32 bytes). Additionally, a\\n * fallback mechanism can be used for every other case.\\n *\\n * Usage example:\\n *\\n * ```solidity\\n * contract Named {\\n * using ShortStrings for *;\\n *\\n * ShortString private immutable _name;\\n * string private _nameFallback;\\n *\\n * constructor(string memory contractName) {\\n * _name = contractName.toShortStringWithFallback(_nameFallback);\\n * }\\n *\\n * function name() external view returns (string memory) {\\n * return _name.toStringWithFallback(_nameFallback);\\n * }\\n * }\\n * ```\\n */\\nlibrary ShortStrings {\\n // Used as an identifier for strings longer than 31 bytes.\\n bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;\\n\\n error StringTooLong(string str);\\n error InvalidShortString();\\n\\n /**\\n * @dev Encode a string of at most 31 chars into a `ShortString`.\\n *\\n * This will trigger a `StringTooLong` error is the input string is too long.\\n */\\n function toShortString(string memory str) internal pure returns (ShortString) {\\n bytes memory bstr = bytes(str);\\n if (bstr.length > 31) {\\n revert StringTooLong(str);\\n }\\n return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\\n }\\n\\n /**\\n * @dev Decode a `ShortString` back to a \\\"normal\\\" string.\\n */\\n function toString(ShortString sstr) internal pure returns (string memory) {\\n uint256 len = byteLength(sstr);\\n // using `new string(len)` would work locally but is not memory safe.\\n string memory str = new string(32);\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(str, len)\\n mstore(add(str, 0x20), sstr)\\n }\\n return str;\\n }\\n\\n /**\\n * @dev Return the length of a `ShortString`.\\n */\\n function byteLength(ShortString sstr) internal pure returns (uint256) {\\n uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\\n if (result > 31) {\\n revert InvalidShortString();\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.\\n */\\n function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {\\n if (bytes(value).length < 32) {\\n return toShortString(value);\\n } else {\\n StorageSlot.getStringSlot(store).value = value;\\n return ShortString.wrap(_FALLBACK_SENTINEL);\\n }\\n }\\n\\n /**\\n * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\\n */\\n function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {\\n if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {\\n return toString(value);\\n } else {\\n return store;\\n }\\n }\\n\\n /**\\n * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\\n *\\n * WARNING: This will return the \\\"byte length\\\" of the string. This may not reflect the actual length in terms of\\n * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.\\n */\\n function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {\\n if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {\\n return byteLength(value);\\n } else {\\n return bytes(store).length;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc0e310c163edf15db45d4ff938113ab357f94fa86e61ea8e790853c4d2e13256\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```solidity\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\\n * _Available since v4.9 for `string`, `bytes`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n struct StringSlot {\\n string value;\\n }\\n\\n struct BytesSlot {\\n bytes value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\\n */\\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\\n */\\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\\n */\\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\\n */\\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf09e68aa0dc6722a25bc46490e8d48ed864466d17313b8a0b254c36b54e49899\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/EIP712.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.8;\\n\\nimport \\\"./ECDSA.sol\\\";\\nimport \\\"../ShortStrings.sol\\\";\\nimport \\\"../../interfaces/IERC5267.sol\\\";\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\\n *\\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\\n *\\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\\n * ({_hashTypedDataV4}).\\n *\\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\\n * the chain id to protect against replay attacks on an eventual fork of the chain.\\n *\\n * NOTE: This contract implements the version of the encoding known as \\\"v4\\\", as implemented by the JSON RPC method\\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\\n *\\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\\n *\\n * _Available since v3.4._\\n *\\n * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\\n */\\nabstract contract EIP712 is IERC5267 {\\n using ShortStrings for *;\\n\\n bytes32 private constant _TYPE_HASH =\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\");\\n\\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\\n // invalidate the cached domain separator if the chain id changes.\\n bytes32 private immutable _cachedDomainSeparator;\\n uint256 private immutable _cachedChainId;\\n address private immutable _cachedThis;\\n\\n bytes32 private immutable _hashedName;\\n bytes32 private immutable _hashedVersion;\\n\\n ShortString private immutable _name;\\n ShortString private immutable _version;\\n string private _nameFallback;\\n string private _versionFallback;\\n\\n /**\\n * @dev Initializes the domain separator and parameter caches.\\n *\\n * The meaning of `name` and `version` is specified in\\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\\n *\\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\\n * - `version`: the current major version of the signing domain.\\n *\\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\\n * contract upgrade].\\n */\\n constructor(string memory name, string memory version) {\\n _name = name.toShortStringWithFallback(_nameFallback);\\n _version = version.toShortStringWithFallback(_versionFallback);\\n _hashedName = keccak256(bytes(name));\\n _hashedVersion = keccak256(bytes(version));\\n\\n _cachedChainId = block.chainid;\\n _cachedDomainSeparator = _buildDomainSeparator();\\n _cachedThis = address(this);\\n }\\n\\n /**\\n * @dev Returns the domain separator for the current chain.\\n */\\n function _domainSeparatorV4() internal view returns (bytes32) {\\n if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\\n return _cachedDomainSeparator;\\n } else {\\n return _buildDomainSeparator();\\n }\\n }\\n\\n function _buildDomainSeparator() private view returns (bytes32) {\\n return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));\\n }\\n\\n /**\\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\\n * function returns the hash of the fully encoded EIP712 message for this domain.\\n *\\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\\n *\\n * ```solidity\\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\\n * keccak256(\\\"Mail(address to,string contents)\\\"),\\n * mailTo,\\n * keccak256(bytes(mailContents))\\n * )));\\n * address signer = ECDSA.recover(digest, signature);\\n * ```\\n */\\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n\\n /**\\n * @dev See {EIP-5267}.\\n *\\n * _Available since v4.9._\\n */\\n function eip712Domain()\\n public\\n view\\n virtual\\n override\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n )\\n {\\n return (\\n hex\\\"0f\\\", // 01111\\n _name.toStringWithFallback(_nameFallback),\\n _version.toStringWithFallback(_versionFallback),\\n block.chainid,\\n address(this),\\n bytes32(0),\\n new uint256[](0)\\n );\\n }\\n}\\n\",\"keccak256\":\"0x8432884527a7ad91e6eed1cfc5a0811ae2073e5bca107bd0ca442e9236b03dbd\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/v2/core/SgETH.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.20;\\nimport {ERC20MintableBurnableByMinter} from \\\"../lib/ERC20MintableBurnableByMinter.sol\\\";\\nimport {Errors} from \\\"../lib/Errors.sol\\\";\\n\\n/// @title SgETH - SharedStake Governed Staked Ether\\n/// @author @ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com\\ncontract SgETH is ERC20MintableBurnableByMinter {\\n constructor() ERC20MintableBurnableByMinter(\\\"SharedStake Governed Staked Ether\\\", \\\"sgETH\\\") {\\n // Set the admin of the minter role; this causes the grant and revole role fns to gaurd to this admin role\\n _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);\\n }\\n\\n // Adds whitelisted minters - only callable by DEFAULT_ADMIN_ROLE enforced in OZ dep\\n function addMinter(address minterAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n if (minterAddress != address(0)) {\\n grantRole(MINTER, minterAddress);\\n } else {\\n revert Errors.ZeroAddress();\\n }\\n }\\n\\n // Remove a minter - only callable by DEFAULT_ADMIN_ROLE enforced internally\\n function removeMinter(address minterAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n // oz uses maps so 0 address will return true but does not break anything\\n revokeRole(MINTER, minterAddress);\\n }\\n\\n // Transfer ownership of who can add/rm minters\\n function transferOwnership(address newOwner) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n grantRole(DEFAULT_ADMIN_ROLE, newOwner);\\n renounceRole(DEFAULT_ADMIN_ROLE, msg.sender); // permission gaurded via revert if called lacks role\\n }\\n}\\n\",\"keccak256\":\"0xd7c0b4f3bde7b8dfc35d08f1e9cc45bc413542cc8d81a3a1caa663bb7011a7b3\",\"license\":\"BUSL-1.1\"},\"contracts/v2/lib/ERC20MintableBurnableByMinter.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\n\\nimport {ERC20Burnable} from \\\"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\\\";\\nimport {AccessControl} from\\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {ERC20, ERC20Permit} from \\\"@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol\\\";\\n\\n/// @title Parent contract for sgETH.sol\\n/** @notice Based on ERC20PermitPermissionedMint - base contract for frxETH. \\n Changed to reduce code footprint and rely on OZ primitives instead\\n Using ownable and OZ AccessControl for minter management and standard underlying events instead of extra custom events\\n Also includes a list of authorized minters \\n Steps: 1. Deploy it. 2. Set new sgETH minter 3. Transfer ownership to multisig timelock 4. confirm accept ownership from timelock */\\n/// @dev Adheres to EIP-712/EIP-2612 and can use permits\\ncontract ERC20MintableBurnableByMinter is ERC20Burnable, ERC20Permit, AccessControl {\\n bytes32 public constant MINTER = keccak256(\\\"MINTER\\\");\\n\\n /* ========== CONSTRUCTOR ========== */\\n constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) ERC20Permit(_name) AccessControl() {}\\n\\n /* ========== RESTRICTED FUNCTIONS ========== */\\n /// @notice burnFrom Used by minters when user redeems\\n /// @param addr The address to burn from\\n /// @param amt The amount to burn\\n function burnFrom(address addr, uint256 amt) public override onlyRole(MINTER) {\\n super.burnFrom(addr, amt);\\n }\\n\\n function burn(address addr, uint256 amt) public onlyRole(MINTER) {\\n super._burn(addr, amt);\\n }\\n\\n /// @notice mint This function is what other minters will call to mint new tokens\\n /// @param addr The address to mint to \\n /// @param amt The amount to mint \\n function mint(address addr, uint256 amt) public onlyRole(MINTER) {\\n _mint(addr, amt);\\n }\\n}\\n\",\"keccak256\":\"0x30a9fefb6dd3abbb5a18b97e010ef5d5ff32036705cb47eca608510ae3ce49eb\",\"license\":\"BUSL-1.1\"},\"contracts/v2/lib/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\n\\n/**\\n * @title Errors\\n * @author Sharedstake\\n * @notice Contains all the custom errors\\n */\\nlibrary Errors {\\n error ZeroAddress();\\n error InvalidAmount();\\n error PermissionDenied();\\n error InsufficientBalance();\\n error TooEarly();\\n error FailedCall();\\n}\\n\",\"keccak256\":\"0x5fd673f73b02e0db4a39a9fb8c1aeecc7e88d24cdf895cdee6a40c8e728be75a\",\"license\":\"BUSL-1.1\"}},\"version\":1}", "bytecode": "0x6101606040523480156200001257600080fd5b506040518060600160405280602181526020016200205460219139604051806040016040528060058152602001640e6ce8aa8960db1b8152508180604051806040016040528060018152602001603160f81b815250848481600390816200007a91906200032a565b5060046200008982826200032a565b506200009b915083905060056200015b565b61012052620000ac8160066200015b565b61014052815160208084019190912060e052815190820120610100524660a0526200013a60e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c05250620001559150600090503362000194565b6200046b565b60006020835110156200017b57620001738362000239565b90506200018e565b816200018884826200032a565b5060ff90505b92915050565b60008281526009602090815260408083206001600160a01b038516845290915290205460ff16620002355760008281526009602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620001f43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600080829050601f8151111562000270578260405163305a27a960e01b8152600401620002679190620003f6565b60405180910390fd5b80516200027d8262000446565b179392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620002b057607f821691505b602082108103620002d157634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200032557600081815260208120601f850160051c81016020861015620003005750805b601f850160051c820191505b8181101562000321578281556001016200030c565b5050505b505050565b81516001600160401b0381111562000346576200034662000285565b6200035e816200035784546200029b565b84620002d7565b602080601f8311600181146200039657600084156200037d5750858301515b600019600386901b1c1916600185901b17855562000321565b600085815260208120601f198616915b82811015620003c757888601518255948401946001909101908401620003a6565b5085821015620003e65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208083528351808285015260005b81811015620004255785810183015185820160400152820162000407565b506000604082860101526040601f19601f8301168501019250505092915050565b80516020808301519190811015620002d15760001960209190910360031b1b16919050565b60805160a05160c05160e051610100516101205161014051611b8e620004c660003960006106ea015260006106bf01526000610eeb01526000610ec301526000610e1e01526000610e4801526000610e720152611b8e6000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c806379cc679011610104578063a217fddf116100a2578063d547741f11610071578063d547741f146103ee578063dd62ed3e14610401578063f2fde38b14610414578063fe6d81241461042757600080fd5b8063a217fddf146103ad578063a457c2d7146103b5578063a9059cbb146103c8578063d505accf146103db57600080fd5b806391d14854116100de57806391d148541461036c57806395d89b411461037f578063983b2d56146103875780639dc29fac1461039a57600080fd5b806379cc67901461032b5780637ecebe001461033e57806384b0196e1461035157600080fd5b80633092afd51161017c578063395093511161014b57806339509351146102c957806340c10f19146102dc57806342966c68146102ef57806370a082311461030257600080fd5b80633092afd51461028c578063313ce5671461029f5780633644e515146102ae57806336568abe146102b657600080fd5b806318160ddd116101b857806318160ddd1461022f57806323b872dd14610241578063248a9ca3146102545780632f2ff15d1461027757600080fd5b806301ffc9a7146101df57806306fdde0314610207578063095ea7b31461021c575b600080fd5b6101f26101ed366004611754565b61043c565b60405190151581526020015b60405180910390f35b61020f610473565b6040516101fe91906117ce565b6101f261022a3660046117fd565b610505565b6002545b6040519081526020016101fe565b6101f261024f366004611827565b61051d565b610233610262366004611863565b60009081526009602052604090206001015490565b61028a61028536600461187c565b610541565b005b61028a61029a3660046118a8565b61056b565b604051601281526020016101fe565b610233610592565b61028a6102c436600461187c565b6105a1565b6101f26102d73660046117fd565b610620565b61028a6102ea3660046117fd565b610642565b61028a6102fd366004611863565b610664565b6102336103103660046118a8565b6001600160a01b031660009081526020819052604090205490565b61028a6103393660046117fd565b610671565b61023361034c3660046118a8565b610693565b6103596106b1565b6040516101fe97969594939291906118c3565b6101f261037a36600461187c565b61073a565b61020f610765565b61028a6103953660046118a8565b610774565b61028a6103a83660046117fd565b6107bf565b610233600081565b6101f26103c33660046117fd565b6107e1565b6101f26103d63660046117fd565b61085c565b61028a6103e9366004611959565b61086a565b61028a6103fc36600461187c565b6109ce565b61023361040f3660046119cc565b6109f3565b61028a6104223660046118a8565b610a1e565b610233600080516020611b3983398151915281565b60006001600160e01b03198216637965db0b60e01b148061046d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060038054610482906119f6565b80601f01602080910402602001604051908101604052809291908181526020018280546104ae906119f6565b80156104fb5780601f106104d0576101008083540402835291602001916104fb565b820191906000526020600020905b8154815290600101906020018083116104de57829003601f168201915b5050505050905090565b600033610513818585610a3f565b5060019392505050565b60003361052b858285610b63565b610536858585610bdd565b506001949350505050565b60008281526009602052604090206001015461055c81610d81565b6105668383610d8b565b505050565b600061057681610d81565b61058e600080516020611b39833981519152836109ce565b5050565b600061059c610e11565b905090565b6001600160a01b03811633146106165760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61058e8282610f3c565b60003361051381858561063383836109f3565b61063d9190611a40565b610a3f565b600080516020611b3983398151915261065a81610d81565b6105668383610fa3565b61066e3382611062565b50565b600080516020611b3983398151915261068981610d81565b6105668383611194565b6001600160a01b03811660009081526007602052604081205461046d565b6000606080828080836106e57f000000000000000000000000000000000000000000000000000000000000000060056111a9565b6107107f000000000000000000000000000000000000000000000000000000000000000060066111a9565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60009182526009602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060048054610482906119f6565b600061077f81610d81565b6001600160a01b038216156107a65761058e600080516020611b3983398151915283610541565b60405163d92e233d60e01b815260040160405180910390fd5b600080516020611b398339815191526107d781610d81565b6105668383611062565b600033816107ef82866109f3565b90508381101561084f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161060d565b6105368286868403610a3f565b600033610513818585610bdd565b834211156108ba5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161060d565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886108e98c611254565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006109448261127c565b90506000610954828787876112a9565b9050896001600160a01b0316816001600160a01b0316146109b75760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161060d565b6109c28a8a8a610a3f565b50505050505050505050565b6000828152600960205260409020600101546109e981610d81565b6105668383610f3c565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6000610a2981610d81565b610a34600083610541565b61058e6000336105a1565b6001600160a01b038316610aa15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161060d565b6001600160a01b038216610b025760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161060d565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610b6f84846109f3565b90506000198114610bd75781811015610bca5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161060d565b610bd78484848403610a3f565b50505050565b6001600160a01b038316610c415760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161060d565b6001600160a01b038216610ca35760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161060d565b6001600160a01b03831660009081526020819052604090205481811015610d1b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161060d565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610bd7565b61066e81336112d1565b610d95828261073a565b61058e5760008281526009602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610dcd3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015610e6a57507f000000000000000000000000000000000000000000000000000000000000000046145b15610e9457507f000000000000000000000000000000000000000000000000000000000000000090565b61059c604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b610f46828261073a565b1561058e5760008281526009602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b038216610ff95760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161060d565b806002600082825461100b9190611a40565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166110c25760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161060d565b6001600160a01b038216600090815260208190526040902054818110156111365760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161060d565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b61119f823383610b63565b61058e8282611062565b606060ff83146111c3576111bc8361132a565b905061046d565b8180546111cf906119f6565b80601f01602080910402602001604051908101604052809291908181526020018280546111fb906119f6565b80156112485780601f1061121d57610100808354040283529160200191611248565b820191906000526020600020905b81548152906001019060200180831161122b57829003601f168201915b5050505050905061046d565b6001600160a01b03811660009081526007602052604090208054600181018255905b50919050565b600061046d611289610e11565b8360405161190160f01b8152600281019290925260228201526042902090565b60008060006112ba87878787611369565b915091506112c78161142d565b5095945050505050565b6112db828261073a565b61058e576112e881611577565b6112f3836020611589565b604051602001611304929190611a69565b60408051601f198184030181529082905262461bcd60e51b825261060d916004016117ce565b606060006113378361172c565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156113a05750600090506003611424565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156113f4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661141d57600060019250925050611424565b9150600090505b94509492505050565b600081600481111561144157611441611ade565b036114495750565b600181600481111561145d5761145d611ade565b036114aa5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161060d565b60028160048111156114be576114be611ade565b0361150b5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161060d565b600381600481111561151f5761151f611ade565b0361066e5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161060d565b606061046d6001600160a01b03831660145b60606000611598836002611af4565b6115a3906002611a40565b67ffffffffffffffff8111156115bb576115bb611a53565b6040519080825280601f01601f1916602001820160405280156115e5576020820181803683370190505b509050600360fc1b8160008151811061160057611600611b0b565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061162f5761162f611b0b565b60200101906001600160f81b031916908160001a9053506000611653846002611af4565b61165e906001611a40565b90505b60018111156116d6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061169257611692611b0b565b1a60f81b8282815181106116a8576116a8611b0b565b60200101906001600160f81b031916908160001a90535060049490941c936116cf81611b21565b9050611661565b5083156117255760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161060d565b9392505050565b600060ff8216601f81111561046d57604051632cd44ac360e21b815260040160405180910390fd5b60006020828403121561176657600080fd5b81356001600160e01b03198116811461172557600080fd5b60005b83811015611799578181015183820152602001611781565b50506000910152565b600081518084526117ba81602086016020860161177e565b601f01601f19169290920160200192915050565b60208152600061172560208301846117a2565b80356001600160a01b03811681146117f857600080fd5b919050565b6000806040838503121561181057600080fd5b611819836117e1565b946020939093013593505050565b60008060006060848603121561183c57600080fd5b611845846117e1565b9250611853602085016117e1565b9150604084013590509250925092565b60006020828403121561187557600080fd5b5035919050565b6000806040838503121561188f57600080fd5b8235915061189f602084016117e1565b90509250929050565b6000602082840312156118ba57600080fd5b611725826117e1565b60ff60f81b881681526000602060e0818401526118e360e084018a6117a2565b83810360408501526118f5818a6117a2565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b818110156119475783518352928401929184019160010161192b565b50909c9b505050505050505050505050565b600080600080600080600060e0888a03121561197457600080fd5b61197d886117e1565b965061198b602089016117e1565b95506040880135945060608801359350608088013560ff811681146119af57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156119df57600080fd5b6119e8836117e1565b915061189f602084016117e1565b600181811c90821680611a0a57607f821691505b60208210810361127657634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561046d5761046d611a2a565b634e487b7160e01b600052604160045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611aa181601785016020880161177e565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611ad281602884016020880161177e565b01602801949350505050565b634e487b7160e01b600052602160045260246000fd5b808202811582820484141761046d5761046d611a2a565b634e487b7160e01b600052603260045260246000fd5b600081611b3057611b30611a2a565b50600019019056fef0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9a2646970667358221220ddad89cc92f611a6dec998297863aa4273fb4bdcc1297448d315969669c1079b64736f6c634300081400335368617265645374616b6520476f7665726e6564205374616b6564204574686572", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101da5760003560e01c806379cc679011610104578063a217fddf116100a2578063d547741f11610071578063d547741f146103ee578063dd62ed3e14610401578063f2fde38b14610414578063fe6d81241461042757600080fd5b8063a217fddf146103ad578063a457c2d7146103b5578063a9059cbb146103c8578063d505accf146103db57600080fd5b806391d14854116100de57806391d148541461036c57806395d89b411461037f578063983b2d56146103875780639dc29fac1461039a57600080fd5b806379cc67901461032b5780637ecebe001461033e57806384b0196e1461035157600080fd5b80633092afd51161017c578063395093511161014b57806339509351146102c957806340c10f19146102dc57806342966c68146102ef57806370a082311461030257600080fd5b80633092afd51461028c578063313ce5671461029f5780633644e515146102ae57806336568abe146102b657600080fd5b806318160ddd116101b857806318160ddd1461022f57806323b872dd14610241578063248a9ca3146102545780632f2ff15d1461027757600080fd5b806301ffc9a7146101df57806306fdde0314610207578063095ea7b31461021c575b600080fd5b6101f26101ed366004611754565b61043c565b60405190151581526020015b60405180910390f35b61020f610473565b6040516101fe91906117ce565b6101f261022a3660046117fd565b610505565b6002545b6040519081526020016101fe565b6101f261024f366004611827565b61051d565b610233610262366004611863565b60009081526009602052604090206001015490565b61028a61028536600461187c565b610541565b005b61028a61029a3660046118a8565b61056b565b604051601281526020016101fe565b610233610592565b61028a6102c436600461187c565b6105a1565b6101f26102d73660046117fd565b610620565b61028a6102ea3660046117fd565b610642565b61028a6102fd366004611863565b610664565b6102336103103660046118a8565b6001600160a01b031660009081526020819052604090205490565b61028a6103393660046117fd565b610671565b61023361034c3660046118a8565b610693565b6103596106b1565b6040516101fe97969594939291906118c3565b6101f261037a36600461187c565b61073a565b61020f610765565b61028a6103953660046118a8565b610774565b61028a6103a83660046117fd565b6107bf565b610233600081565b6101f26103c33660046117fd565b6107e1565b6101f26103d63660046117fd565b61085c565b61028a6103e9366004611959565b61086a565b61028a6103fc36600461187c565b6109ce565b61023361040f3660046119cc565b6109f3565b61028a6104223660046118a8565b610a1e565b610233600080516020611b3983398151915281565b60006001600160e01b03198216637965db0b60e01b148061046d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060038054610482906119f6565b80601f01602080910402602001604051908101604052809291908181526020018280546104ae906119f6565b80156104fb5780601f106104d0576101008083540402835291602001916104fb565b820191906000526020600020905b8154815290600101906020018083116104de57829003601f168201915b5050505050905090565b600033610513818585610a3f565b5060019392505050565b60003361052b858285610b63565b610536858585610bdd565b506001949350505050565b60008281526009602052604090206001015461055c81610d81565b6105668383610d8b565b505050565b600061057681610d81565b61058e600080516020611b39833981519152836109ce565b5050565b600061059c610e11565b905090565b6001600160a01b03811633146106165760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61058e8282610f3c565b60003361051381858561063383836109f3565b61063d9190611a40565b610a3f565b600080516020611b3983398151915261065a81610d81565b6105668383610fa3565b61066e3382611062565b50565b600080516020611b3983398151915261068981610d81565b6105668383611194565b6001600160a01b03811660009081526007602052604081205461046d565b6000606080828080836106e57f000000000000000000000000000000000000000000000000000000000000000060056111a9565b6107107f000000000000000000000000000000000000000000000000000000000000000060066111a9565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60009182526009602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060048054610482906119f6565b600061077f81610d81565b6001600160a01b038216156107a65761058e600080516020611b3983398151915283610541565b60405163d92e233d60e01b815260040160405180910390fd5b600080516020611b398339815191526107d781610d81565b6105668383611062565b600033816107ef82866109f3565b90508381101561084f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161060d565b6105368286868403610a3f565b600033610513818585610bdd565b834211156108ba5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161060d565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886108e98c611254565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006109448261127c565b90506000610954828787876112a9565b9050896001600160a01b0316816001600160a01b0316146109b75760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161060d565b6109c28a8a8a610a3f565b50505050505050505050565b6000828152600960205260409020600101546109e981610d81565b6105668383610f3c565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6000610a2981610d81565b610a34600083610541565b61058e6000336105a1565b6001600160a01b038316610aa15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161060d565b6001600160a01b038216610b025760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161060d565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610b6f84846109f3565b90506000198114610bd75781811015610bca5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161060d565b610bd78484848403610a3f565b50505050565b6001600160a01b038316610c415760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161060d565b6001600160a01b038216610ca35760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161060d565b6001600160a01b03831660009081526020819052604090205481811015610d1b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161060d565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610bd7565b61066e81336112d1565b610d95828261073a565b61058e5760008281526009602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610dcd3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015610e6a57507f000000000000000000000000000000000000000000000000000000000000000046145b15610e9457507f000000000000000000000000000000000000000000000000000000000000000090565b61059c604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b610f46828261073a565b1561058e5760008281526009602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b038216610ff95760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161060d565b806002600082825461100b9190611a40565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166110c25760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161060d565b6001600160a01b038216600090815260208190526040902054818110156111365760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161060d565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b61119f823383610b63565b61058e8282611062565b606060ff83146111c3576111bc8361132a565b905061046d565b8180546111cf906119f6565b80601f01602080910402602001604051908101604052809291908181526020018280546111fb906119f6565b80156112485780601f1061121d57610100808354040283529160200191611248565b820191906000526020600020905b81548152906001019060200180831161122b57829003601f168201915b5050505050905061046d565b6001600160a01b03811660009081526007602052604090208054600181018255905b50919050565b600061046d611289610e11565b8360405161190160f01b8152600281019290925260228201526042902090565b60008060006112ba87878787611369565b915091506112c78161142d565b5095945050505050565b6112db828261073a565b61058e576112e881611577565b6112f3836020611589565b604051602001611304929190611a69565b60408051601f198184030181529082905262461bcd60e51b825261060d916004016117ce565b606060006113378361172c565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156113a05750600090506003611424565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156113f4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661141d57600060019250925050611424565b9150600090505b94509492505050565b600081600481111561144157611441611ade565b036114495750565b600181600481111561145d5761145d611ade565b036114aa5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161060d565b60028160048111156114be576114be611ade565b0361150b5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161060d565b600381600481111561151f5761151f611ade565b0361066e5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161060d565b606061046d6001600160a01b03831660145b60606000611598836002611af4565b6115a3906002611a40565b67ffffffffffffffff8111156115bb576115bb611a53565b6040519080825280601f01601f1916602001820160405280156115e5576020820181803683370190505b509050600360fc1b8160008151811061160057611600611b0b565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061162f5761162f611b0b565b60200101906001600160f81b031916908160001a9053506000611653846002611af4565b61165e906001611a40565b90505b60018111156116d6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061169257611692611b0b565b1a60f81b8282815181106116a8576116a8611b0b565b60200101906001600160f81b031916908160001a90535060049490941c936116cf81611b21565b9050611661565b5083156117255760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161060d565b9392505050565b600060ff8216601f81111561046d57604051632cd44ac360e21b815260040160405180910390fd5b60006020828403121561176657600080fd5b81356001600160e01b03198116811461172557600080fd5b60005b83811015611799578181015183820152602001611781565b50506000910152565b600081518084526117ba81602086016020860161177e565b601f01601f19169290920160200192915050565b60208152600061172560208301846117a2565b80356001600160a01b03811681146117f857600080fd5b919050565b6000806040838503121561181057600080fd5b611819836117e1565b946020939093013593505050565b60008060006060848603121561183c57600080fd5b611845846117e1565b9250611853602085016117e1565b9150604084013590509250925092565b60006020828403121561187557600080fd5b5035919050565b6000806040838503121561188f57600080fd5b8235915061189f602084016117e1565b90509250929050565b6000602082840312156118ba57600080fd5b611725826117e1565b60ff60f81b881681526000602060e0818401526118e360e084018a6117a2565b83810360408501526118f5818a6117a2565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b818110156119475783518352928401929184019160010161192b565b50909c9b505050505050505050505050565b600080600080600080600060e0888a03121561197457600080fd5b61197d886117e1565b965061198b602089016117e1565b95506040880135945060608801359350608088013560ff811681146119af57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156119df57600080fd5b6119e8836117e1565b915061189f602084016117e1565b600181811c90821680611a0a57607f821691505b60208210810361127657634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561046d5761046d611a2a565b634e487b7160e01b600052604160045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611aa181601785016020880161177e565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611ad281602884016020880161177e565b01602801949350505050565b634e487b7160e01b600052602160045260246000fd5b808202811582820484141761046d5761046d611a2a565b634e487b7160e01b600052603260045260246000fd5b600081611b3057611b30611a2a565b50600019019056fef0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9a2646970667358221220ddad89cc92f611a6dec998297863aa4273fb4bdcc1297448d315969669c1079b64736f6c63430008140033", @@ -1085,4 +1085,4 @@ } } } -} \ No newline at end of file +} diff --git a/deployments/sepolia/SharedDepositMinterV2.json b/deployments/sepolia/SharedDepositMinterV2.json new file mode 100644 index 0000000..217147b --- /dev/null +++ b/deployments/sepolia/SharedDepositMinterV2.json @@ -0,0 +1,1000 @@ +{ + "address": "0x36c2F00cC7D02be7Df0BC9be2a8e08b74C4f2E56", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_numValidators", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_adminFee", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AmountTooHigh", + "type": "error" + }, + { + "inputs": [], + "name": "NoValidators", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "_withdrawalCredential", + "type": "bytes" + } + ], + "name": "WithdrawalCredentialSet", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEPOSIT_CONTRACT", + "outputs": [ + { + "internalType": "contract IDepositContract", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "adminFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "adminFeeTotal", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "pubkeys", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "signatures", + "type": "bytes[]" + }, + { + "internalType": "bytes32[]", + "name": "depositDataRoots", + "type": "bytes32[]" + } + ], + "name": "batchDepositToEth2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "buffer", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "costPerValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "curValidatorShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "depositAndStake", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dest", + "type": "address" + } + ], + "name": "depositAndStakeFor", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dest", + "type": "address" + } + ], + "name": "depositFor", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "donate", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxValidatorShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "migrateShares", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "numValidators", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "refundFeesOnWithdraw", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "remainingSpaceInEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeCalculatorAddr", + "type": "address" + } + ], + "name": "setFeeCalc", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_numValidators", + "type": "uint256" + } + ], + "name": "setNumValidators", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_newWithdrawalCreds", + "type": "bytes" + } + ], + "name": "setWithdrawalCredential", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amt", + "type": "uint256" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "togglePause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "toggleWithdrawRefund", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "dest", + "type": "address" + } + ], + "name": "unstakeAndWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "validatorsCreated", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawAdminFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "dest", + "type": "address" + } + ], + "name": "withdrawTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawalPubKey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xec5dcfcdc353434c26a878a7d2f958ff629578fd8be20cb316ac0bede632916f", + "receipt": { + "to": null, + "from": "0xA120FAd0498ECbF755a675E3833158484123bF30", + "contractAddress": "0x36c2F00cC7D02be7Df0BC9be2a8e08b74C4f2E56", + "transactionIndex": 37, + "gasUsed": "1986492", + "logsBloom": "0x00080004000000000000000000000000000000400000000000000000000020004000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000000000000000002000000000000002100000008000004000000000000000800000000000000000000000000000000000000000000000000000000800000000000000000000000000000020000000000000000000000000000080001000000000006021000000000000000000000000000000000000040000000000000200000000101000000400000000010000400000000000000000008000000000000000000000000100000000000", + "blockHash": "0xb980e98cbd094851e0e790448f094699869868d1ba61b566794942c3b6534f3a", + "transactionHash": "0xec5dcfcdc353434c26a878a7d2f958ff629578fd8be20cb316ac0bede632916f", + "logs": [ + { + "transactionIndex": 37, + "blockNumber": 6233355, + "transactionHash": "0xec5dcfcdc353434c26a878a7d2f958ff629578fd8be20cb316ac0bede632916f", + "address": "0xCF4831EBE785437DC54a90018b1b410Bd16c8533", + "topics": [ + "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "0x00000000000000000000000036c2f00cc7d02be7df0bc9be2a8e08b74c4f2e56", + "0x000000000000000000000000514dfd2d10ec6775f030ba2abcf7a2445c0ca6fb" + ], + "data": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "logIndex": 65, + "blockHash": "0xb980e98cbd094851e0e790448f094699869868d1ba61b566794942c3b6534f3a" + }, + { + "transactionIndex": 37, + "blockNumber": 6233355, + "transactionHash": "0xec5dcfcdc353434c26a878a7d2f958ff629578fd8be20cb316ac0bede632916f", + "address": "0x36c2F00cC7D02be7Df0BC9be2a8e08b74C4f2E56", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea", + "0x000000000000000000000000a120fad0498ecbf755a675e3833158484123bf30", + "0x000000000000000000000000a120fad0498ecbf755a675e3833158484123bf30" + ], + "data": "0x", + "logIndex": 66, + "blockHash": "0xb980e98cbd094851e0e790448f094699869868d1ba61b566794942c3b6534f3a" + }, + { + "transactionIndex": 37, + "blockNumber": 6233355, + "transactionHash": "0xec5dcfcdc353434c26a878a7d2f958ff629578fd8be20cb316ac0bede632916f", + "address": "0x36c2F00cC7D02be7Df0BC9be2a8e08b74C4f2E56", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf", + "0x000000000000000000000000610c92c70eb55dfeafe8970513d13771da79f2e0", + "0x000000000000000000000000a120fad0498ecbf755a675e3833158484123bf30" + ], + "data": "0x", + "logIndex": 67, + "blockHash": "0xb980e98cbd094851e0e790448f094699869868d1ba61b566794942c3b6534f3a" + } + ], + "blockNumber": 6233355, + "cumulativeGasUsed": "7419501", + "status": 1, + "byzantium": true + }, + "args": [ + 1000, + 0, + [ + "0xa06f409403485BB32A47ef00Bc315428Fd098057", + "0xCF4831EBE785437DC54a90018b1b410Bd16c8533", + "0x514dfd2d10eC6775f030BA2abcf7A2445C0CA6Fb", + "0x610c92c70eb55dfeafe8970513d13771da79f2e0", + "0xEb9e7570f8D5ac7D0Abfbed902A784E84dF16a78" + ] + ], + "numDeployments": 1, + "solcInputHash": "b098c02b927c81fd02abb8247583d190", + "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numValidators\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_adminFee\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"addresses\",\"type\":\"address[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AmountTooHigh\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoValidators\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_withdrawalCredential\",\"type\":\"bytes\"}],\"name\":\"WithdrawalCredentialSet\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEPOSIT_CONTRACT\",\"outputs\":[{\"internalType\":\"contract IDepositContract\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GOV\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"adminFeeTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"pubkeys\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes[]\",\"name\":\"signatures\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"depositDataRoots\",\"type\":\"bytes32[]\"}],\"name\":\"batchDepositToEth2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"buffer\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"costPerValidator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"curValidatorShares\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositAndStake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"dest\",\"type\":\"address\"}],\"name\":\"depositAndStakeFor\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"dest\",\"type\":\"address\"}],\"name\":\"depositFor\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"donate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxValidatorShares\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"migrateShares\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numValidators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"refundFeesOnWithdraw\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"remainingSpaceInEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_feeCalculatorAddr\",\"type\":\"address\"}],\"name\":\"setFeeCalc\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numValidators\",\"type\":\"uint256\"}],\"name\":\"setNumValidators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_newWithdrawalCreds\",\"type\":\"bytes\"}],\"name\":\"setWithdrawalCredential\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amt\",\"type\":\"uint256\"}],\"name\":\"slash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"togglePause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"toggleWithdrawRefund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"dest\",\"type\":\"address\"}],\"name\":\"unstakeAndWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorsCreated\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawAdminFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"dest\",\"type\":\"address\"}],\"name\":\"withdrawTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawalPubKey\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\",\"details\":\"Deployment params: - addresses : [feeCalc, sgeth, wsgeth, gov]\",\"events\":{\"Paused(address)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"},\"Unpaused(address)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"title\":\"SharedDepositMinterV2\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Mints LSD tokens for ETH deposited to the contract. Handles the depositing of ETH to the ETH2 deposit contract and validator creation\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/v2/core/SharedDepositMinterV2.sol\":\"SharedDepositMinterV2\"},\"evmVersion\":\"paris\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(account),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0dd6e52cb394d7f5abe5dca2d4908a6be40417914720932de757de34a99ab87f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\nimport \\\"../token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n *\\n * _Available since v4.7._\\n */\\ninterface IERC4626 is IERC20, IERC20Metadata {\\n event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed sender,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n *\\n * - MUST be an ERC-20 token contract.\\n * - MUST NOT revert.\\n */\\n function asset() external view returns (address assetTokenAddress);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n *\\n * - SHOULD include any compounding that occurs from yield.\\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT revert.\\n */\\n function totalAssets() external view returns (uint256 totalManagedAssets);\\n\\n /**\\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToShares(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n * through a deposit call.\\n *\\n * - MUST return a limited value if receiver is subject to some deposit limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n * - MUST NOT revert.\\n */\\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\\n * in the same transaction.\\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * deposit execution, and are accounted for during deposit.\\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\\n * - MUST return a limited value if receiver is subject to some mint limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n * - MUST NOT revert.\\n */\\n function maxMint(address receiver) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\\n * same transaction.\\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\\n * would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\\n */\\n function previewMint(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\\n * execution, and are accounted for during mint.\\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0x5a173dcd1c1f0074e4df6a9cdab3257e17f2e64f7b8f30ca9e17a8c5ea250e1c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract Pausable is Context {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n constructor() {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n _requireNotPaused();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n _requirePaused();\\n _;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Throws if the contract is paused.\\n */\\n function _requireNotPaused() internal view virtual {\\n require(!paused(), \\\"Pausable: paused\\\");\\n }\\n\\n /**\\n * @dev Throws if the contract is not paused.\\n */\\n function _requirePaused() internal view virtual {\\n require(paused(), \\\"Pausable: not paused\\\");\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n}\\n\",\"keccak256\":\"0x0849d93b16c9940beb286a7864ed02724b248b93e0d80ef6355af5ef15c64773\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == _ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/v2/core/SharedDepositMinterV2.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.20;\\n\\n/// @title SharedDepositMinterV2 - minter for ETH LSD\\n/// @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\\n// v1 sharedstake veth2 minter with some code removed\\n// user deposits eth to get minted token\\n// The contract cannot move user ETH outside unless\\n// 1. the user redeems 1:1\\n// 2. the depositToEth2 or depositToEth2Batch fns are called which allow moving ETH to the mainnet deposit contract only\\n// 3. The contract allows permissioned external actors to supply validator public keys\\n// 4. Who's allowed to deposit how many validators is governed outside this contract\\n// 5. The ability to provision validators for user ETH is portioned out by the DAO\\n\\n// Changes\\n/**\\n- Custom errors instead of revert strings\\n- Granular management via AccessControl with GOV and NOR roles. Node operator can only deploy validators\\n- Refactored to allow users to specify destination address for fns - for zaps\\n- Added deposit+stake/unstake+withdraw combo convenience routes\\n- Refactored fee calc out to external contract\\n*/\\nimport {IFeeCalc} from \\\"../interfaces/IFeeCalc.sol\\\";\\nimport {IERC20MintableBurnable} from \\\"../interfaces/IERC20MintableBurnable.sol\\\";\\nimport {IERC4626} from \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\n\\nimport {AccessControl} from \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {Pausable} from \\\"@openzeppelin/contracts/security/Pausable.sol\\\";\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport {ETH2DepositWithdrawalCredentials} from \\\"../lib/ETH2DepositWithdrawalCredentials.sol\\\";\\n\\n/// @title SharedDepositMinterV2\\n/// @author ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\\n/// @notice Mints LSD tokens for ETH deposited to the contract. Handles the depositing of ETH to the ETH2 deposit contract and validator creation\\n/// @dev Deployment params: \\n/// - addresses : [feeCalc, sgeth, wsgeth, gov]\\ncontract SharedDepositMinterV2 is AccessControl, Pausable, ReentrancyGuard, ETH2DepositWithdrawalCredentials {\\n /* ========== STATE VARIABLES ========== */\\n uint256 public adminFee;\\n uint256 public numValidators;\\n uint256 public costPerValidator;\\n\\n // The validator shares created by this shared stake contract. 1 share costs >= 1 eth\\n uint256 public curValidatorShares; //initialized to 0\\n\\n // The number of times the deposit to eth2 contract has been called to create validators\\n uint256 public validatorsCreated; //initialized to 0\\n\\n // Total accrued admin fee\\n uint256 public adminFeeTotal; //initialized to 0\\n\\n // Its hard to exactly hit the max deposit amount with small shares. this allows a small bit of overflow room\\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token via a user withdraw\\n uint256 public buffer;\\n\\n // Flash loan tokenomic protection in case of changes in admin fee with future lots\\n bool public refundFeesOnWithdraw; //initialized to false\\n\\n // NEW\\n IERC20MintableBurnable private immutable _SGETH;\\n IERC4626 private immutable _WSGETH;\\n IFeeCalc private _feeCalc;\\n\\n bytes32 public constant NOR = keccak256(\\\"NOR\\\"); // Node operator for deploying validators\\n bytes32 public constant GOV = keccak256(\\\"GOV\\\"); // Governance for settings - normally timelock controlled by multisig\\n\\n //errors\\n error AmountTooHigh();\\n error NoValidators();\\n\\n constructor(\\n uint256 _numValidators,\\n uint256 _adminFee,\\n address[] memory addresses\\n ) AccessControl() Pausable() ReentrancyGuard() ETH2DepositWithdrawalCredentials(addresses[4]) {\\n _feeCalc = IFeeCalc(addresses[0]);\\n _SGETH = IERC20MintableBurnable(addresses[1]);\\n _WSGETH = IERC4626(addresses[2]);\\n\\n _SGETH.approve(address(_WSGETH), 2 ** 256 - 1); // max approve wsgeth for deposit and stake\\n\\n adminFee = _adminFee; // Admin and infra fees\\n numValidators = _numValidators; // The number of validators to create in this lot. Sets a max limit on deposits\\n\\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token\\n buffer = 10 * 1e18; // roughly equal to 10 eth.\\n\\n costPerValidator = (32 * 1e18) + adminFee;\\n\\n _grantRole(NOR, msg.sender);\\n _grantRole(GOV, addresses[3]); // deployer will need it to set withdrawal creds. since the non-custodial withdrawal path depends on the minter.\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n DEPOSIT/WITHDRAWAL LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n // USER INTERACTIONS\\n /*\\n Shares minted = Z\\n Principal deposit input = P\\n AdminFee = a\\n costPerValidator = 32 + a\\n AdminFee as percent in 1e18 = a% = (a / costPerValidator) * 1e18\\n AdminFee on tx in 1e18 = (P * a% / 1e18)\\n\\n on deposit:\\n P - (P * a%) = Z\\n\\n on withdraw with admin fee refund:\\n P = Z / (1 - a%)\\n P = Z - Z*a%\\n */\\n\\n function deposit() external payable {\\n _deposit(msg.sender);\\n }\\n\\n function depositFor(address dest) external payable {\\n _deposit(dest);\\n }\\n\\n function depositAndStake() external payable {\\n _WSGETH.deposit(_deposit(address(this)), msg.sender);\\n }\\n\\n function depositAndStakeFor(address dest) external payable {\\n _WSGETH.deposit(_deposit(address(this)), dest);\\n }\\n\\n function withdraw(uint256 amount) external {\\n _withdraw(amount, msg.sender, msg.sender);\\n }\\n\\n function withdrawTo(uint256 amount, address dest) external {\\n _withdraw(amount, msg.sender, dest);\\n }\\n\\n function unstakeAndWithdraw(uint256 amount, address dest) external {\\n _withdraw(_WSGETH.redeem(amount, address(this), msg.sender), address(this), dest);\\n }\\n\\n // migration function to accept old monies and copy over state\\n // users should not use this as it just donates the money without minting veth or tracking donations\\n function donate() external payable {} // solhint-disable-line\\n\\n /*//////////////////////////////////////////////////////////////\\n ADMIN LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n // Batch deposit eth to the eth2 contract with preset creds\\n // Data needs to be verified offchain to save gas\\n function batchDepositToEth2(\\n bytes[] calldata pubkeys,\\n bytes[] calldata signatures,\\n bytes32[] calldata depositDataRoots\\n ) external onlyRole(NOR) {\\n if (address(this).balance < (_depositAmount * pubkeys.length)) {\\n revert AmountTooHigh(); // Not enough bal in contract to deploy all validators\\n }\\n _batchDeposit(pubkeys, signatures, depositDataRoots);\\n validatorsCreated = validatorsCreated + pubkeys.length;\\n }\\n\\n function setWithdrawalCredential(bytes memory _newWithdrawalCreds) external onlyRole(NOR) {\\n // can only be called once\\n _setWithdrawalCredential(_newWithdrawalCreds);\\n }\\n\\n // Slashes the onchain staked sgETH to mirror CL validator slashings\\n // modifies wsgeth virtual price\\n function slash(uint256 amt) external onlyRole(GOV) {\\n if (amt > curValidatorShares) {\\n revert AmountTooHigh(); // Cannot slash more than minted\\n }\\n _SGETH.burn(address(_WSGETH), amt);\\n }\\n\\n // Set fee calc address. if addr = 0 then fees are assumed to be 0\\n function setFeeCalc(address _feeCalculatorAddr) external onlyRole(GOV) {\\n _feeCalc = IFeeCalc(_feeCalculatorAddr);\\n }\\n\\n function togglePause() external onlyRole(GOV) {\\n bool paused = paused();\\n if (paused) {\\n _unpause();\\n } else {\\n _pause();\\n }\\n }\\n\\n // Used to migrate state over to new contract\\n function migrateShares(uint256 shares) external onlyRole(GOV) {\\n curValidatorShares = shares;\\n }\\n\\n function toggleWithdrawRefund() external onlyRole(GOV) {\\n refundFeesOnWithdraw = !refundFeesOnWithdraw;\\n }\\n\\n function setNumValidators(uint256 _numValidators) external onlyRole(GOV) {\\n if (_numValidators > 0) {\\n numValidators = _numValidators;\\n } else {\\n revert NoValidators();\\n }\\n }\\n\\n function withdrawAdminFee(uint256 amount) external onlyRole(GOV) {\\n address payable sender = payable(msg.sender);\\n if (amount == 0) {\\n amount = adminFeeTotal;\\n }\\n if (amount > adminFeeTotal) {\\n revert AmountTooHigh();\\n }\\n adminFeeTotal = adminFeeTotal - amount;\\n Address.sendValue(sender, amount);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ACCOUNTING LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function remainingSpaceInEpoch() external view returns (uint256) {\\n // Helpful view function to gauge how much the user can send to the contract when it is near full\\n uint256 remainingShares = maxValidatorShares() - curValidatorShares;\\n uint256 valBeforeAdmin = (remainingShares * 1e18) / (((1 * 1e18) - (adminFee * 1e18) / costPerValidator));\\n return valBeforeAdmin;\\n }\\n\\n function maxValidatorShares() public view returns (uint256) {\\n return 32 * 1e18 * numValidators;\\n }\\n\\n function _depositAccounting() internal returns (uint256 value) {\\n // input is whole, not / 1e18 , i.e. in 1 = 1 eth send when from etherscan\\n value = msg.value;\\n uint256 fee;\\n\\n if (address(_feeCalc) != address(0)) {\\n (value, fee) = _feeCalc.processDeposit(value, msg.sender);\\n adminFeeTotal = adminFeeTotal + fee;\\n }\\n\\n uint256 newShareTotal = curValidatorShares + value;\\n\\n if (newShareTotal > buffer + maxValidatorShares()) {\\n revert AmountTooHigh();\\n }\\n curValidatorShares = newShareTotal;\\n }\\n\\n function _withdrawAccounting(uint256 amount) internal returns (uint256) {\\n uint256 fee;\\n if (address(_feeCalc) != address(0)) {\\n (amount, fee) = _feeCalc.processWithdraw(amount, msg.sender);\\n if (refundFeesOnWithdraw) {\\n adminFeeTotal = adminFeeTotal - fee;\\n } else {\\n adminFeeTotal = adminFeeTotal + fee;\\n }\\n }\\n if (address(this).balance < (amount + adminFeeTotal)) {\\n revert AmountTooHigh();\\n }\\n\\n curValidatorShares = curValidatorShares - amount;\\n return amount;\\n }\\n\\n function _deposit(address dest) internal nonReentrant whenNotPaused returns (uint256 amt) {\\n amt = _depositAccounting();\\n _SGETH.mint(dest, amt);\\n }\\n\\n function _withdraw(uint256 amount, address origin, address dest) internal nonReentrant whenNotPaused {\\n _SGETH.burn(origin, amount); // reverts if amount is too high\\n uint256 assets = _withdrawAccounting(amount);\\n\\n address payable recv = payable(dest);\\n Address.sendValue(recv, assets);\\n }\\n\\n receive() external payable {} // solhint-disable-line\\n\\n fallback() external payable {} // solhint-disable-line\\n}\\n\",\"keccak256\":\"0x1ad67e5f7bb03182702d6d249923c1e2c89d84e8071b537814e1f6c79ee7279d\",\"license\":\"BUSL-1.1\"},\"contracts/v2/interfaces/IDepositContract.sol\":{\"content\":\"pragma solidity ^0.8.0;\\n\\n// \\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u250f\\u2513\\u2501\\u250f\\u2513\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\n// \\u2503\\u250f\\u2501\\u2501\\u251b\\u250f\\u251b\\u2517\\u2513\\u2503\\u2503\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2517\\u2513\\u250f\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\n// \\u2503\\u2517\\u2501\\u2501\\u2513\\u2517\\u2513\\u250f\\u251b\\u2503\\u2517\\u2501\\u2513\\u2517\\u251b\\u250f\\u251b\\u2503\\u2501\\u2501\\u2503\\u2503\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2503\\u2503\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2513\\u2517\\u2513\\u250f\\u251b\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u2517\\u251b\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2513\\u2501\\u2517\\u2513\\u250f\\u251b\\u250f\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u2501\\u250f\\u2501\\u2501\\u2513\\u2517\\u2513\\u250f\\u251b\\n// \\u2503\\u250f\\u2501\\u2501\\u251b\\u2501\\u2503\\u2503\\u2501\\u2503\\u250f\\u2513\\u2503\\u250f\\u2501\\u251b\\u250f\\u251b\\u2501\\u2501\\u2503\\u2503\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2503\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u2501\\u2501\\u252b\\u2523\\u252b\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u250f\\u2513\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2513\\u2501\\u2503\\u2503\\u2501\\u2503\\u250f\\u251b\\u2517\\u2501\\u2513\\u2503\\u2501\\u2503\\u250f\\u2501\\u251b\\u2501\\u2503\\u2503\\u2501\\n// \\u2503\\u2517\\u2501\\u2501\\u2513\\u2501\\u2503\\u2517\\u2513\\u2503\\u2503\\u2503\\u2503\\u2503\\u2503\\u2517\\u2501\\u2513\\u250f\\u2513\\u2503\\u2517\\u2501\\u251b\\u2503\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u251b\\u2503\\u2503\\u2503\\u2501\\u252b\\u2503\\u2517\\u251b\\u2503\\u2503\\u2517\\u251b\\u2503\\u2523\\u2501\\u2501\\u2503\\u2503\\u2503\\u2501\\u2503\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2503\\u2517\\u2501\\u251b\\u2503\\u2503\\u2517\\u251b\\u2503\\u2503\\u2503\\u2503\\u2503\\u2501\\u2503\\u2517\\u2513\\u2503\\u2503\\u2501\\u2503\\u2517\\u251b\\u2517\\u2513\\u2503\\u2517\\u2501\\u2513\\u2501\\u2503\\u2517\\u2513\\n// \\u2517\\u2501\\u2501\\u2501\\u251b\\u2501\\u2517\\u2501\\u251b\\u2517\\u251b\\u2517\\u251b\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u251b\\u2517\\u2501\\u2501\\u2501\\u251b\\u2501\\u2501\\u2501\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2503\\u250f\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u251b\\u2501\\u2501\\u2501\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2501\\u2517\\u2501\\u251b\\n// \\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\n// \\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2517\\u251b\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\n\\n// SPDX-License-Identifier: CC0-1.0\\n\\n// This interface is designed to be compatible with the Vyper version.\\n/// @notice This is the Ethereum 2.0 deposit contract interface.\\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\\ninterface IDepositContract {\\n /// @notice A processed deposit event.\\n event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);\\n\\n /// @notice Submit a Phase 0 DepositData object.\\n /// @param pubkey A BLS12-381 public key.\\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\\n /// @param signature A BLS12-381 signature.\\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\\n /// Used as a protection against malformed input.\\n function deposit(\\n bytes calldata pubkey,\\n bytes calldata withdrawal_credentials,\\n bytes calldata signature,\\n bytes32 deposit_data_root\\n ) external payable;\\n\\n /// @notice Query the current deposit root hash.\\n /// @return The deposit root hash.\\n function get_deposit_root() external view returns (bytes32);\\n\\n /// @notice Query the current deposit count.\\n /// @return The deposit count encoded as a little endian 64-bit number.\\n function get_deposit_count() external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xe2089e69dbf1fb4940e4dffcdb10524418a40b6e9529b72cb83f2e921fb08e3f\",\"license\":\"CC0-1.0\"},\"contracts/v2/interfaces/IERC20MintableBurnable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\ninterface IERC20MintableBurnable {\\n function mintingAllowedAfter() external view returns (uint256);\\n\\n /**\\n * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`\\n * @param account The address of the account holding the funds\\n * @param spender The address of the account spending the funds\\n * @return The number of tokens approved\\n */\\n function allowance(address account, address spender) external view returns (uint256);\\n\\n /**\\n * @notice Get the number of tokens held by the `account`\\n * @param account The address of the account to get the balance of\\n * @return The number of tokens held\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @notice Approve `spender` to transfer up to `amount` from `src`\\n * @dev This will overwrite the approval amount for `spender`\\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\\n * @param spender The address of the account which may transfer tokens\\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\\n * @return Whether or not the approval succeeded\\n */\\n function approve(address spender, uint256 rawAmount) external returns (bool);\\n\\n /**\\n * @notice Triggers an approval from owner to spends\\n * @param owner The address to approve from\\n * @param spender The address to be approved\\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\\n * @param deadline The time at which to expire the signature\\n * @param v The recovery byte of the signature\\n * @param r Half of the ECDSA signature pair\\n * @param s Half of the ECDSA signature pair\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 rawAmount,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\\n * @param dst The address of the destination account\\n * @param rawAmount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n function transfer(address dst, uint256 rawAmount) external returns (bool);\\n\\n /**\\n * @notice Transfer `amount` tokens from `src` to `dst`\\n * @param src The address of the source account\\n * @param dst The address of the destination account\\n * @param rawAmount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n function transferFrom(address src, address dst, uint256 rawAmount) external returns (bool);\\n\\n /**\\n * @notice Mint new tokens\\n * @param dst The address of the destination account\\n * @param rawAmount The number of tokens to be minted\\n */\\n function mint(address dst, uint256 rawAmount) external;\\n\\n function burn(address src, uint256 rawAmount) external;\\n function setMinter(address minter_) external;\\n}\\n\",\"keccak256\":\"0x2fcd50fd565019546be3412013205df119fe96fdca5bb152229b70fb4ec1169b\",\"license\":\"UNLICENSED\"},\"contracts/v2/interfaces/IFeeCalc.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\ninterface IFeeCalc {\\n function processDeposit(uint256 amt, address who) external view returns (uint256, uint256);\\n\\n function processWithdraw(uint256 amt, address who) external view returns (uint256, uint256);\\n}\\n\",\"keccak256\":\"0x2391271eeaf9baaa39edf4dc69b057824db52b0b87474680ca0b71c25a6b0550\",\"license\":\"UNLICENSED\"},\"contracts/v2/lib/ETH2DepositWithdrawalCredentials.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\n\\nimport {IDepositContract} from \\\"../interfaces/IDepositContract.sol\\\";\\n\\n/// @title A contract for holding a eth2 validator withrawal pubkey\\n/// @author @chimeraDefi\\n/// @notice A contract for holding a eth2 validator withrawal pubkey\\n/// @dev Downstream contract needs to implement who can set the withdrawal address and set it\\ncontract ETH2DepositWithdrawalCredentials {\\n uint256 internal constant _depositAmount = 32 ether;\\n IDepositContract public immutable DEPOSIT_CONTRACT;\\n bytes public withdrawalPubKey; // Pubkey for ETH 2.0 withdrawal creds\\n\\n event WithdrawalCredentialSet(bytes _withdrawalCredential);\\n\\n constructor(address _dc) {\\n DEPOSIT_CONTRACT = IDepositContract(_dc);\\n }\\n\\n /// @notice A more streamlined variant of batch deposit for use with preset withdrawal addresses\\n /// Submit index-matching arrays that form Phase 0 DepositData objects.\\n /// Will create a deposit transaction per index of the arrays submitted.\\n ///\\n /// @param pubkeys - An array of BLS12-381 public keys.\\n /// @param signatures - An array of BLS12-381 signatures.\\n /// @param depositDataRoots - An array of the SHA-256 hash of the SSZ-encoded DepositData object.\\n function _batchDeposit(\\n bytes[] calldata pubkeys,\\n bytes[] calldata signatures,\\n bytes32[] calldata depositDataRoots\\n ) internal {\\n // optimizations https://ethereum.stackexchange.com/questions/113221/what-is-the-purpose-of-unchecked-in-solidity\\n // https://medium.com/@bloqarl/solidity-gas-optimization-tips-with-assembly-you-havent-heard-yet-1381c77ff078\\n // 30m gas / block roughly, say 10m max used so 100 validators a batch max \\n // each deposit call costs roughly 128k https://etherscan.io/tx/0xa2acf6e6bde99b532125cc8026cd88eea345f296968ce732556945ab4705d03e\\n uint256 i = pubkeys.length;\\n uint256 _amt = _depositAmount;\\n bytes memory wpk = withdrawalPubKey;\\n\\n while (i > 0) {\\n unchecked {\\n // While loop check prevents underflow.\\n // --i is cheaper than i--\\n // reverse while loop cheapest compared to while or for \\n // Since we set the upper loop bound to the arr len, we decr 1st to not hit out of bounds\\n --i;\\n\\n DEPOSIT_CONTRACT.deposit{value: _amt}(\\n pubkeys[i],\\n wpk,\\n signatures[i],\\n depositDataRoots[i]\\n );\\n }\\n }\\n }\\n\\n /// @notice sets curr_withdrawal_pubkey to be used when deploying validators\\n function _setWithdrawalCredential(bytes memory newPk) internal {\\n withdrawalPubKey = newPk;\\n\\n emit WithdrawalCredentialSet(newPk);\\n }\\n}\\n\",\"keccak256\":\"0x0ebea7361fe05b3b8eb90b0dde098d2d93a994e54d9e498dcba951735de53a56\",\"license\":\"BUSL-1.1\"}},\"version\":1}", + "bytecode": "0x60e06040523480156200001157600080fd5b50604051620023f5380380620023f5833981016040819052620000349162000327565b806004815181106200004a576200004a62000410565b60209081029190910101516001805460ff191681556002556001600160a01b03166080528051819060009062000084576200008462000410565b6020026020010151600b60016101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600181518110620000c857620000c862000410565b60200260200101516001600160a01b031660a0816001600160a01b03168152505080600281518110620000ff57620000ff62000410565b60209081029190910101516001600160a01b0390811660c081905260a05160405163095ea7b360e01b8152600481019290925260001960248301529091169063095ea7b3906044016020604051808303816000875af115801562000167573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018d919062000426565b5060048290556005839055678ac7230489e80000600a55620001b9826801bc16d674ec80000062000451565b600655620001e87f6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea3362000240565b620002377f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf8260038151811062000223576200022362000410565b60200260200101516200024060201b60201c565b50505062000473565b6200024c8282620002c9565b620002c5576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620002843390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff165b92915050565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b03811681146200032257600080fd5b919050565b6000806000606084860312156200033d57600080fd5b835160208086015160408701519295509350906001600160401b03808211156200036657600080fd5b818701915087601f8301126200037b57600080fd5b815181811115620003905762000390620002f4565b8060051b604051601f19603f83011681018181108582111715620003b857620003b8620002f4565b60405291825284820192508381018501918a831115620003d757600080fd5b938501935b828510156200040057620003f0856200030a565b84529385019392850192620003dc565b8096505050505050509250925092565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156200043957600080fd5b815180151581146200044a57600080fd5b9392505050565b80820180821115620002ee57634e487b7160e01b600052601160045260246000fd5b60805160a05160c051611f28620004cd6000396000818161091f01528181610a2401528181610b490152610c8901526000818161094e01528181610f50015261114301526000818161040e01526112660152611f286000f3fe60806040526004361061021c5760003560e01c806391d1485411610122578063c86283c8116100a5578063ed88c68e1161006c578063ed88c68e14610223578063edaafe2014610621578063f26b342f14610637578063f317229f14610651578063ffd2ffb91461067157005b8063c86283c8146105ae578063cacda096146105ce578063d0e30db0146105e3578063d547741f146105eb578063eb52f3ae1461060b57005b8063b1b54567116100e9578063b1b5456714610519578063b8027e8314610539578063bef989d81461056d578063c4ae316814610583578063c6fe82871461059857005b806391d148541461049b578063a0be06f9146104bb578063a217fddf146104d1578063aa67c919146104e6578063acc2216a146104f957005b80633683c204116101aa57806366519bd61161017157806366519bd6146103f45780636b96736b146103fc5780636ebf9f9e1461044857806382e48a83146104685780638c1077991461047b57005b80633683c2041461037157806345bc4d10146103915780634d327025146103b15780635c975abb146103c65780635d593f8d146103de57005b8063248a9ca3116101ee578063248a9ca3146102cc5780632e1a7d4d146102fc5780632e6ea0cf1461031c5780632f2ff15d1461033157806336568abe1461035157005b806301ffc9a7146102255780630eec46311461025a578063180cb47f1461027c5780631efdfe6e146102ac57005b3661022357005b005b34801561023157600080fd5b506102456102403660046118ce565b610687565b60405190151581526020015b60405180910390f35b34801561026657600080fd5b5061026f6106be565b6040516102519190611948565b34801561028857600080fd5b5061029e600080516020611ed383398151915281565b604051908152602001610251565b3480156102b857600080fd5b506102236102c736600461195b565b61074c565b3480156102d857600080fd5b5061029e6102e736600461195b565b60009081526020819052604090206001015490565b34801561030857600080fd5b5061022361031736600461195b565b6107b7565b34801561032857600080fd5b506102236107c5565b34801561033d57600080fd5b5061022361034c36600461198b565b6107f2565b34801561035d57600080fd5b5061022361036c36600461198b565b610817565b34801561037d57600080fd5b5061022361038c3660046119cd565b61089a565b34801561039d57600080fd5b506102236103ac36600461195b565b6108cd565b3480156103bd57600080fd5b5061029e6109ae565b3480156103d257600080fd5b5060015460ff16610245565b3480156103ea57600080fd5b5061029e60055481565b610223610a22565b34801561040857600080fd5b506104307f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610251565b34801561045457600080fd5b50610223610463366004611aca565b610ac2565b610223610476366004611b64565b610b47565b34801561048757600080fd5b50610223610496366004611b64565b610bf0565b3480156104a757600080fd5b506102456104b636600461198b565b610c31565b3480156104c757600080fd5b5061029e60045481565b3480156104dd57600080fd5b5061029e600081565b6102236104f4366004611b64565b610c5a565b34801561050557600080fd5b5061022361051436600461198b565b610c63565b34801561052557600080fd5b5061022361053436600461195b565b610d05565b34801561054557600080fd5b5061029e7f6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea81565b34801561057957600080fd5b5061029e60085481565b34801561058f57600080fd5b50610223610d23565b3480156105a457600080fd5b5061029e60095481565b3480156105ba57600080fd5b506102236105c936600461198b565b610d61565b3480156105da57600080fd5b5061029e610d6c565b610223610d8a565b3480156105f757600080fd5b5061022361060636600461198b565b610d93565b34801561061757600080fd5b5061029e60065481565b34801561062d57600080fd5b5061029e600a5481565b34801561064357600080fd5b50600b546102459060ff1681565b34801561065d57600080fd5b5061022361066c36600461195b565b610dba565b34801561067d57600080fd5b5061029e60075481565b60006001600160e01b03198216637965db0b60e01b14806106b857506301ffc9a760e01b6001600160e01b03198316145b92915050565b600380546106cb90611b7f565b80601f01602080910402602001604051908101604052809291908181526020018280546106f790611b7f565b80156107445780601f1061071957610100808354040283529160200191610744565b820191906000526020600020905b81548152906001019060200180831161072757829003601f168201915b505050505081565b600080516020611ed383398151915261076481610df7565b3360008390036107745760095492505b6009548311156107975760405163fd7850ad60e01b815260040160405180910390fd5b826009546107a59190611bcf565b6009556107b28184610e01565b505050565b6107c2813333610f1a565b50565b600080516020611ed38339815191526107dd81610df7565b50600b805460ff19811660ff90911615179055565b60008281526020819052604090206001015461080d81610df7565b6107b28383610fd0565b6001600160a01b038116331461088c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6108968282611054565b5050565b7f6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea6108c481610df7565b610896826110b9565b600080516020611ed38339815191526108e581610df7565b6007548211156109085760405163fd7850ad60e01b815260040160405180910390fd5b604051632770a7eb60e21b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018490527f00000000000000000000000000000000000000000000000000000000000000001690639dc29fac90604401600060405180830381600087803b15801561099257600080fd5b505af11580156109a6573d6000803e3d6000fd5b505050505050565b6000806007546109bc610d6c565b6109c69190611bcf565b90506000600654600454670de0b6b3a76400006109e39190611be2565b6109ed9190611bf9565b6109ff90670de0b6b3a7640000611bcf565b610a1183670de0b6b3a7640000611be2565b610a1b9190611bf9565b9392505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636e553f65610a5a30611100565b6040516001600160e01b031960e084901b16815260048101919091523360248201526044016020604051808303816000875af1158015610a9e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c29190611c1b565b7f6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea610aec81610df7565b610aff866801bc16d674ec800000611be2565b471015610b1f5760405163fd7850ad60e01b815260040160405180910390fd5b610b2d8787878787876111b0565b600854610b3b908790611c34565b60085550505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636e553f65610b7f30611100565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b03841660248201526044016020604051808303816000875af1158015610bcc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108969190611c1b565b600080516020611ed3833981519152610c0881610df7565b50600b80546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61089681611100565b604051635d043b2960e11b815260048101839052306024820152336044820152610896907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ba087652906064016020604051808303816000875af1158015610cda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cfe9190611c1b565b3083610f1a565b600080516020611ed3833981519152610d1d81610df7565b50600755565b600080516020611ed3833981519152610d3b81610df7565b6000610d4960015460ff1690565b90508015610d5957610896611351565b6108966113a3565b610896823383610f1a565b60006005546801bc16d674ec800000610d859190611be2565b905090565b6107c233611100565b600082815260208190526040902060010154610dae81610df7565b6107b28383611054565b565b600080516020611ed3833981519152610dd281610df7565b8115610dde5750600555565b6040516313f8a3a760e31b815260040160405180910390fd5b6107c281336113de565b80471015610e515760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610883565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610e9e576040519150601f19603f3d011682016040523d82523d6000602084013e610ea3565b606091505b50509050806107b25760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610883565b610f22611437565b610f2a61148e565b604051632770a7eb60e21b81526001600160a01b038381166004830152602482018590527f00000000000000000000000000000000000000000000000000000000000000001690639dc29fac90604401600060405180830381600087803b158015610f9457600080fd5b505af1158015610fa8573d6000803e3d6000fd5b505050506000610fb7846114d4565b905081610fc48183610e01565b50506107b26001600255565b610fda8282610c31565b610896576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556110103390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61105e8282610c31565b15610896576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60036110c58282611c8d565b507f8ba040512c1273086ac3dc9e59c32b9fc104064d6df4c3747fec10e029bc3fba816040516110f59190611948565b60405180910390a150565b600061110a611437565b61111261148e565b61111a6115e1565b6040516340c10f1960e01b81526001600160a01b038481166004830152602482018390529192507f0000000000000000000000000000000000000000000000000000000000000000909116906340c10f1990604401600060405180830381600087803b15801561118957600080fd5b505af115801561119d573d6000803e3d6000fd5b505050506111ab6001600255565b919050565b6003805486916801bc16d674ec80000091600091906111ce90611b7f565b80601f01602080910402602001604051908101604052809291908181526020018280546111fa90611b7f565b80156112475780601f1061121c57610100808354040283529160200191611247565b820191906000526020600020905b81548152906001019060200180831161122a57829003601f168201915b505050505090505b821561134657600019909201916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166322895118838b8b8781811061129e5761129e611d4d565b90506020028101906112b09190611d63565b858c8c8a8181106112c3576112c3611d4d565b90506020028101906112d59190611d63565b8c8c8c8181106112e7576112e7611d4d565b905060200201356040518863ffffffff1660e01b815260040161130f96959493929190611dd3565b6000604051808303818588803b15801561132857600080fd5b505af115801561133c573d6000803e3d6000fd5b505050505061124f565b505050505050505050565b6113596116d7565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6113ab61148e565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611386565b6113e88282610c31565b610896576113f581611720565b611400836020611732565b604051602001611411929190611e22565b60408051601f198184030181529082905262461bcd60e51b825261088391600401611948565b60028054036114885760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610883565b60028055565b60015460ff1615610db85760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610883565b600b54600090819061010090046001600160a01b03161561159c57600b5460405162f20ddd60e11b8152600481018590523360248201526101009091046001600160a01b0316906301e41bba906044016040805180830381865afa158015611540573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115649190611e97565b600b54919450915060ff161561158a57806009546115829190611bcf565b60095561159c565b806009546115989190611c34565b6009555b6009546115a99084611c34565b4710156115c95760405163fd7850ad60e01b815260040160405180910390fd5b826007546115d79190611bcf565b6007555090919050565b600b54349060009061010090046001600160a01b03161561168957600b54604051631d9a1b7b60e11b8152600481018490523360248201526101009091046001600160a01b031690633b3436f6906044016040805180830381865afa15801561164e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116729190611e97565b6009549193509150611685908290611c34565b6009555b6000826007546116999190611c34565b90506116a3610d6c565b600a546116b09190611c34565b8111156116d05760405163fd7850ad60e01b815260040160405180910390fd5b6007555090565b60015460ff16610db85760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610883565b60606106b86001600160a01b03831660145b60606000611741836002611be2565b61174c906002611c34565b67ffffffffffffffff811115611764576117646119b7565b6040519080825280601f01601f19166020018201604052801561178e576020820181803683370190505b509050600360fc1b816000815181106117a9576117a9611d4d565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106117d8576117d8611d4d565b60200101906001600160f81b031916908160001a90535060006117fc846002611be2565b611807906001611c34565b90505b600181111561187f576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061183b5761183b611d4d565b1a60f81b82828151811061185157611851611d4d565b60200101906001600160f81b031916908160001a90535060049490941c9361187881611ebb565b905061180a565b508315610a1b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610883565b6000602082840312156118e057600080fd5b81356001600160e01b031981168114610a1b57600080fd5b60005b838110156119135781810151838201526020016118fb565b50506000910152565b600081518084526119348160208601602086016118f8565b601f01601f19169290920160200192915050565b602081526000610a1b602083018461191c565b60006020828403121561196d57600080fd5b5035919050565b80356001600160a01b03811681146111ab57600080fd5b6000806040838503121561199e57600080fd5b823591506119ae60208401611974565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156119df57600080fd5b813567ffffffffffffffff808211156119f757600080fd5b818401915084601f830112611a0b57600080fd5b813581811115611a1d57611a1d6119b7565b604051601f8201601f19908116603f01168101908382118183101715611a4557611a456119b7565b81604052828152876020848701011115611a5e57600080fd5b826020860160208301376000928101602001929092525095945050505050565b60008083601f840112611a9057600080fd5b50813567ffffffffffffffff811115611aa857600080fd5b6020830191508360208260051b8501011115611ac357600080fd5b9250929050565b60008060008060008060608789031215611ae357600080fd5b863567ffffffffffffffff80821115611afb57600080fd5b611b078a838b01611a7e565b90985096506020890135915080821115611b2057600080fd5b611b2c8a838b01611a7e565b90965094506040890135915080821115611b4557600080fd5b50611b5289828a01611a7e565b979a9699509497509295939492505050565b600060208284031215611b7657600080fd5b610a1b82611974565b600181811c90821680611b9357607f821691505b602082108103611bb357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106b8576106b8611bb9565b80820281158282048414176106b8576106b8611bb9565b600082611c1657634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215611c2d57600080fd5b5051919050565b808201808211156106b8576106b8611bb9565b601f8211156107b257600081815260208120601f850160051c81016020861015611c6e5750805b601f850160051c820191505b818110156109a657828155600101611c7a565b815167ffffffffffffffff811115611ca757611ca76119b7565b611cbb81611cb58454611b7f565b84611c47565b602080601f831160018114611cf05760008415611cd85750858301515b600019600386901b1c1916600185901b1785556109a6565b600085815260208120601f198616915b82811015611d1f57888601518255948401946001909101908401611d00565b5085821015611d3d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112611d7a57600080fd5b83018035915067ffffffffffffffff821115611d9557600080fd5b602001915036819003821315611ac357600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b608081526000611de760808301888a611daa565b8281036020840152611df9818861191c565b90508281036040840152611e0e818688611daa565b915050826060830152979650505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611e5a8160178501602088016118f8565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611e8b8160288401602088016118f8565b01602801949350505050565b60008060408385031215611eaa57600080fd5b505080516020909101519092909150565b600081611eca57611eca611bb9565b50600019019056fe8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecfa2646970667358221220e7e405151bcc57aefd85945f85c74881526c9ca0037a140799a2d4d58313dadf64736f6c63430008140033", + "deployedBytecode": "0x60806040526004361061021c5760003560e01c806391d1485411610122578063c86283c8116100a5578063ed88c68e1161006c578063ed88c68e14610223578063edaafe2014610621578063f26b342f14610637578063f317229f14610651578063ffd2ffb91461067157005b8063c86283c8146105ae578063cacda096146105ce578063d0e30db0146105e3578063d547741f146105eb578063eb52f3ae1461060b57005b8063b1b54567116100e9578063b1b5456714610519578063b8027e8314610539578063bef989d81461056d578063c4ae316814610583578063c6fe82871461059857005b806391d148541461049b578063a0be06f9146104bb578063a217fddf146104d1578063aa67c919146104e6578063acc2216a146104f957005b80633683c204116101aa57806366519bd61161017157806366519bd6146103f45780636b96736b146103fc5780636ebf9f9e1461044857806382e48a83146104685780638c1077991461047b57005b80633683c2041461037157806345bc4d10146103915780634d327025146103b15780635c975abb146103c65780635d593f8d146103de57005b8063248a9ca3116101ee578063248a9ca3146102cc5780632e1a7d4d146102fc5780632e6ea0cf1461031c5780632f2ff15d1461033157806336568abe1461035157005b806301ffc9a7146102255780630eec46311461025a578063180cb47f1461027c5780631efdfe6e146102ac57005b3661022357005b005b34801561023157600080fd5b506102456102403660046118ce565b610687565b60405190151581526020015b60405180910390f35b34801561026657600080fd5b5061026f6106be565b6040516102519190611948565b34801561028857600080fd5b5061029e600080516020611ed383398151915281565b604051908152602001610251565b3480156102b857600080fd5b506102236102c736600461195b565b61074c565b3480156102d857600080fd5b5061029e6102e736600461195b565b60009081526020819052604090206001015490565b34801561030857600080fd5b5061022361031736600461195b565b6107b7565b34801561032857600080fd5b506102236107c5565b34801561033d57600080fd5b5061022361034c36600461198b565b6107f2565b34801561035d57600080fd5b5061022361036c36600461198b565b610817565b34801561037d57600080fd5b5061022361038c3660046119cd565b61089a565b34801561039d57600080fd5b506102236103ac36600461195b565b6108cd565b3480156103bd57600080fd5b5061029e6109ae565b3480156103d257600080fd5b5060015460ff16610245565b3480156103ea57600080fd5b5061029e60055481565b610223610a22565b34801561040857600080fd5b506104307f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610251565b34801561045457600080fd5b50610223610463366004611aca565b610ac2565b610223610476366004611b64565b610b47565b34801561048757600080fd5b50610223610496366004611b64565b610bf0565b3480156104a757600080fd5b506102456104b636600461198b565b610c31565b3480156104c757600080fd5b5061029e60045481565b3480156104dd57600080fd5b5061029e600081565b6102236104f4366004611b64565b610c5a565b34801561050557600080fd5b5061022361051436600461198b565b610c63565b34801561052557600080fd5b5061022361053436600461195b565b610d05565b34801561054557600080fd5b5061029e7f6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea81565b34801561057957600080fd5b5061029e60085481565b34801561058f57600080fd5b50610223610d23565b3480156105a457600080fd5b5061029e60095481565b3480156105ba57600080fd5b506102236105c936600461198b565b610d61565b3480156105da57600080fd5b5061029e610d6c565b610223610d8a565b3480156105f757600080fd5b5061022361060636600461198b565b610d93565b34801561061757600080fd5b5061029e60065481565b34801561062d57600080fd5b5061029e600a5481565b34801561064357600080fd5b50600b546102459060ff1681565b34801561065d57600080fd5b5061022361066c36600461195b565b610dba565b34801561067d57600080fd5b5061029e60075481565b60006001600160e01b03198216637965db0b60e01b14806106b857506301ffc9a760e01b6001600160e01b03198316145b92915050565b600380546106cb90611b7f565b80601f01602080910402602001604051908101604052809291908181526020018280546106f790611b7f565b80156107445780601f1061071957610100808354040283529160200191610744565b820191906000526020600020905b81548152906001019060200180831161072757829003601f168201915b505050505081565b600080516020611ed383398151915261076481610df7565b3360008390036107745760095492505b6009548311156107975760405163fd7850ad60e01b815260040160405180910390fd5b826009546107a59190611bcf565b6009556107b28184610e01565b505050565b6107c2813333610f1a565b50565b600080516020611ed38339815191526107dd81610df7565b50600b805460ff19811660ff90911615179055565b60008281526020819052604090206001015461080d81610df7565b6107b28383610fd0565b6001600160a01b038116331461088c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6108968282611054565b5050565b7f6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea6108c481610df7565b610896826110b9565b600080516020611ed38339815191526108e581610df7565b6007548211156109085760405163fd7850ad60e01b815260040160405180910390fd5b604051632770a7eb60e21b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018490527f00000000000000000000000000000000000000000000000000000000000000001690639dc29fac90604401600060405180830381600087803b15801561099257600080fd5b505af11580156109a6573d6000803e3d6000fd5b505050505050565b6000806007546109bc610d6c565b6109c69190611bcf565b90506000600654600454670de0b6b3a76400006109e39190611be2565b6109ed9190611bf9565b6109ff90670de0b6b3a7640000611bcf565b610a1183670de0b6b3a7640000611be2565b610a1b9190611bf9565b9392505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636e553f65610a5a30611100565b6040516001600160e01b031960e084901b16815260048101919091523360248201526044016020604051808303816000875af1158015610a9e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c29190611c1b565b7f6018e1702a3123d04beb23a17c959ee998830f34f27bcf3823bfbecf0779f4ea610aec81610df7565b610aff866801bc16d674ec800000611be2565b471015610b1f5760405163fd7850ad60e01b815260040160405180910390fd5b610b2d8787878787876111b0565b600854610b3b908790611c34565b60085550505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636e553f65610b7f30611100565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b03841660248201526044016020604051808303816000875af1158015610bcc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108969190611c1b565b600080516020611ed3833981519152610c0881610df7565b50600b80546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61089681611100565b604051635d043b2960e11b815260048101839052306024820152336044820152610896907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ba087652906064016020604051808303816000875af1158015610cda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cfe9190611c1b565b3083610f1a565b600080516020611ed3833981519152610d1d81610df7565b50600755565b600080516020611ed3833981519152610d3b81610df7565b6000610d4960015460ff1690565b90508015610d5957610896611351565b6108966113a3565b610896823383610f1a565b60006005546801bc16d674ec800000610d859190611be2565b905090565b6107c233611100565b600082815260208190526040902060010154610dae81610df7565b6107b28383611054565b565b600080516020611ed3833981519152610dd281610df7565b8115610dde5750600555565b6040516313f8a3a760e31b815260040160405180910390fd5b6107c281336113de565b80471015610e515760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610883565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610e9e576040519150601f19603f3d011682016040523d82523d6000602084013e610ea3565b606091505b50509050806107b25760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610883565b610f22611437565b610f2a61148e565b604051632770a7eb60e21b81526001600160a01b038381166004830152602482018590527f00000000000000000000000000000000000000000000000000000000000000001690639dc29fac90604401600060405180830381600087803b158015610f9457600080fd5b505af1158015610fa8573d6000803e3d6000fd5b505050506000610fb7846114d4565b905081610fc48183610e01565b50506107b26001600255565b610fda8282610c31565b610896576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556110103390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61105e8282610c31565b15610896576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60036110c58282611c8d565b507f8ba040512c1273086ac3dc9e59c32b9fc104064d6df4c3747fec10e029bc3fba816040516110f59190611948565b60405180910390a150565b600061110a611437565b61111261148e565b61111a6115e1565b6040516340c10f1960e01b81526001600160a01b038481166004830152602482018390529192507f0000000000000000000000000000000000000000000000000000000000000000909116906340c10f1990604401600060405180830381600087803b15801561118957600080fd5b505af115801561119d573d6000803e3d6000fd5b505050506111ab6001600255565b919050565b6003805486916801bc16d674ec80000091600091906111ce90611b7f565b80601f01602080910402602001604051908101604052809291908181526020018280546111fa90611b7f565b80156112475780601f1061121c57610100808354040283529160200191611247565b820191906000526020600020905b81548152906001019060200180831161122a57829003601f168201915b505050505090505b821561134657600019909201916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166322895118838b8b8781811061129e5761129e611d4d565b90506020028101906112b09190611d63565b858c8c8a8181106112c3576112c3611d4d565b90506020028101906112d59190611d63565b8c8c8c8181106112e7576112e7611d4d565b905060200201356040518863ffffffff1660e01b815260040161130f96959493929190611dd3565b6000604051808303818588803b15801561132857600080fd5b505af115801561133c573d6000803e3d6000fd5b505050505061124f565b505050505050505050565b6113596116d7565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6113ab61148e565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611386565b6113e88282610c31565b610896576113f581611720565b611400836020611732565b604051602001611411929190611e22565b60408051601f198184030181529082905262461bcd60e51b825261088391600401611948565b60028054036114885760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610883565b60028055565b60015460ff1615610db85760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610883565b600b54600090819061010090046001600160a01b03161561159c57600b5460405162f20ddd60e11b8152600481018590523360248201526101009091046001600160a01b0316906301e41bba906044016040805180830381865afa158015611540573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115649190611e97565b600b54919450915060ff161561158a57806009546115829190611bcf565b60095561159c565b806009546115989190611c34565b6009555b6009546115a99084611c34565b4710156115c95760405163fd7850ad60e01b815260040160405180910390fd5b826007546115d79190611bcf565b6007555090919050565b600b54349060009061010090046001600160a01b03161561168957600b54604051631d9a1b7b60e11b8152600481018490523360248201526101009091046001600160a01b031690633b3436f6906044016040805180830381865afa15801561164e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116729190611e97565b6009549193509150611685908290611c34565b6009555b6000826007546116999190611c34565b90506116a3610d6c565b600a546116b09190611c34565b8111156116d05760405163fd7850ad60e01b815260040160405180910390fd5b6007555090565b60015460ff16610db85760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610883565b60606106b86001600160a01b03831660145b60606000611741836002611be2565b61174c906002611c34565b67ffffffffffffffff811115611764576117646119b7565b6040519080825280601f01601f19166020018201604052801561178e576020820181803683370190505b509050600360fc1b816000815181106117a9576117a9611d4d565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106117d8576117d8611d4d565b60200101906001600160f81b031916908160001a90535060006117fc846002611be2565b611807906001611c34565b90505b600181111561187f576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061183b5761183b611d4d565b1a60f81b82828151811061185157611851611d4d565b60200101906001600160f81b031916908160001a90535060049490941c9361187881611ebb565b905061180a565b508315610a1b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610883565b6000602082840312156118e057600080fd5b81356001600160e01b031981168114610a1b57600080fd5b60005b838110156119135781810151838201526020016118fb565b50506000910152565b600081518084526119348160208601602086016118f8565b601f01601f19169290920160200192915050565b602081526000610a1b602083018461191c565b60006020828403121561196d57600080fd5b5035919050565b80356001600160a01b03811681146111ab57600080fd5b6000806040838503121561199e57600080fd5b823591506119ae60208401611974565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156119df57600080fd5b813567ffffffffffffffff808211156119f757600080fd5b818401915084601f830112611a0b57600080fd5b813581811115611a1d57611a1d6119b7565b604051601f8201601f19908116603f01168101908382118183101715611a4557611a456119b7565b81604052828152876020848701011115611a5e57600080fd5b826020860160208301376000928101602001929092525095945050505050565b60008083601f840112611a9057600080fd5b50813567ffffffffffffffff811115611aa857600080fd5b6020830191508360208260051b8501011115611ac357600080fd5b9250929050565b60008060008060008060608789031215611ae357600080fd5b863567ffffffffffffffff80821115611afb57600080fd5b611b078a838b01611a7e565b90985096506020890135915080821115611b2057600080fd5b611b2c8a838b01611a7e565b90965094506040890135915080821115611b4557600080fd5b50611b5289828a01611a7e565b979a9699509497509295939492505050565b600060208284031215611b7657600080fd5b610a1b82611974565b600181811c90821680611b9357607f821691505b602082108103611bb357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106b8576106b8611bb9565b80820281158282048414176106b8576106b8611bb9565b600082611c1657634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215611c2d57600080fd5b5051919050565b808201808211156106b8576106b8611bb9565b601f8211156107b257600081815260208120601f850160051c81016020861015611c6e5750805b601f850160051c820191505b818110156109a657828155600101611c7a565b815167ffffffffffffffff811115611ca757611ca76119b7565b611cbb81611cb58454611b7f565b84611c47565b602080601f831160018114611cf05760008415611cd85750858301515b600019600386901b1c1916600185901b1785556109a6565b600085815260208120601f198616915b82811015611d1f57888601518255948401946001909101908401611d00565b5085821015611d3d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112611d7a57600080fd5b83018035915067ffffffffffffffff821115611d9557600080fd5b602001915036819003821315611ac357600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b608081526000611de760808301888a611daa565b8281036020840152611df9818861191c565b90508281036040840152611e0e818688611daa565b915050826060830152979650505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611e5a8160178501602088016118f8565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611e8b8160288401602088016118f8565b01602801949350505050565b60008060408385031215611eaa57600080fd5b505080516020909101519092909150565b600081611eca57611eca611bb9565b50600019019056fe8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecfa2646970667358221220e7e405151bcc57aefd85945f85c74881526c9ca0037a140799a2d4d58313dadf64736f6c63430008140033", + "devdoc": { + "author": "ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org", + "details": "Deployment params: - addresses : [feeCalc, sgeth, wsgeth, gov]", + "events": { + "Paused(address)": { + "details": "Emitted when the pause is triggered by `account`." + }, + "RoleAdminChanged(bytes32,bytes32,bytes32)": { + "details": "Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._" + }, + "RoleGranted(bytes32,address,address)": { + "details": "Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}." + }, + "RoleRevoked(bytes32,address,address)": { + "details": "Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)" + }, + "Unpaused(address)": { + "details": "Emitted when the pause is lifted by `account`." + } + }, + "kind": "dev", + "methods": { + "getRoleAdmin(bytes32)": { + "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." + }, + "grantRole(bytes32,address)": { + "details": "Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event." + }, + "hasRole(bytes32,address)": { + "details": "Returns `true` if `account` has been granted `role`." + }, + "paused()": { + "details": "Returns true if the contract is paused, and false otherwise." + }, + "renounceRole(bytes32,address)": { + "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event." + }, + "revokeRole(bytes32,address)": { + "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event." + }, + "supportsInterface(bytes4)": { + "details": "See {IERC165-supportsInterface}." + } + }, + "title": "SharedDepositMinterV2", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "notice": "Mints LSD tokens for ETH deposited to the contract. Handles the depositing of ETH to the ETH2 deposit contract and validator creation", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3628, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "_roles", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_struct(RoleData)3623_storage)" + }, + { + "astId": 4673, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "_paused", + "offset": 0, + "slot": "1", + "type": "t_bool" + }, + { + "astId": 4774, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "_status", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 16740, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "withdrawalPubKey", + "offset": 0, + "slot": "3", + "type": "t_bytes_storage" + }, + { + "astId": 14920, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "adminFee", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 14922, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "numValidators", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 14924, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "costPerValidator", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 14926, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "curValidatorShares", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 14928, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "validatorsCreated", + "offset": 0, + "slot": "8", + "type": "t_uint256" + }, + { + "astId": 14930, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "adminFeeTotal", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 14932, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "buffer", + "offset": 0, + "slot": "10", + "type": "t_uint256" + }, + { + "astId": 14934, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "refundFeesOnWithdraw", + "offset": 0, + "slot": "11", + "type": "t_bool" + }, + { + "astId": 14943, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "_feeCalc", + "offset": 1, + "slot": "11", + "type": "t_contract(IFeeCalc)16516" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(IFeeCalc)16516": { + "encoding": "inplace", + "label": "contract IFeeCalc", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_bytes32,t_struct(RoleData)3623_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct AccessControl.RoleData)", + "numberOfBytes": "32", + "value": "t_struct(RoleData)3623_storage" + }, + "t_struct(RoleData)3623_storage": { + "encoding": "inplace", + "label": "struct AccessControl.RoleData", + "members": [ + { + "astId": 3620, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "members", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 3622, + "contract": "contracts/v2/core/SharedDepositMinterV2.sol:SharedDepositMinterV2", + "label": "adminRole", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/deployments/sepolia/WSGETH.json b/deployments/sepolia/WSGETH.json index fe7b31c..efcffe9 100644 --- a/deployments/sepolia/WSGETH.json +++ b/deployments/sepolia/WSGETH.json @@ -1,5 +1,5 @@ { - "address": "0xa54CabcF7da592561D380409dDdb62E529915285", + "address": "0x514dfd2d10eC6775f030BA2abcf7A2445C0CA6Fb", "abi": [ { "inputs": [ @@ -850,28 +850,25 @@ "type": "function" } ], - "transactionHash": "0xc138718e6d9a63553252a0f8d9dd26d5e78d6756eb175d42e468443bb91a5c31", + "transactionHash": "0x68a01f4434de6026f2aa1ca174a6e0a62a26e9188d64b9fc5de0162ad55f1d8d", "receipt": { "to": null, - "from": "0xf5CA36c9873d61Bc28C117BD470981Ef6647A685", - "contractAddress": "0xa54CabcF7da592561D380409dDdb62E529915285", - "transactionIndex": 48, + "from": "0xA120FAd0498ECbF755a675E3833158484123bF30", + "contractAddress": "0x514dfd2d10eC6775f030BA2abcf7A2445C0CA6Fb", + "transactionIndex": 20, "gasUsed": "1745344", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x813300185d69680011948d715023cd254afda7345c7aa36c418b36051caad70c", - "transactionHash": "0xc138718e6d9a63553252a0f8d9dd26d5e78d6756eb175d42e468443bb91a5c31", + "blockHash": "0x60be08d16dc6483e8ac00ee6b467378609722c62281159ae97bb53fdc4831b0e", + "transactionHash": "0x68a01f4434de6026f2aa1ca174a6e0a62a26e9188d64b9fc5de0162ad55f1d8d", "logs": [], - "blockNumber": 6184321, - "cumulativeGasUsed": "11499563", + "blockNumber": 6233322, + "cumulativeGasUsed": "6566744", "status": 1, "byzantium": true }, - "args": [ - "0x44642Deefe1E3732db13C84CFF7A45adc4E2d920", - 86400 - ], + "args": ["0xCF4831EBE785437DC54a90018b1b410Bd16c8533", 86400], "numDeployments": 1, - "solcInputHash": "266f4835dc637e40f5c59a1cd15f5094", + "solcInputHash": "b098c02b927c81fd02abb8247583d190", "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ERC20\",\"name\":\"_underlying\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"_rewardsCycleLength\",\"type\":\"uint32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"SyncError\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"cycleEnd\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardAmount\",\"type\":\"uint256\"}],\"name\":\"NewRewardsCycle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"asset\",\"outputs\":[{\"internalType\":\"contract ERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"convertToAssets\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"convertToShares\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"deposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"approveMax\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"depositWithSignature\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastRewardAmount\",\"outputs\":[{\"internalType\":\"uint192\",\"name\":\"\",\"type\":\"uint192\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastSync\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"maxDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"maxMint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"maxRedeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"maxWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"previewDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"previewMint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"previewRedeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"previewWithdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pricePerShare\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"redeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsCycleEnd\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsCycleLength\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"syncRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalAssets\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"withdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Exchange rate between sgETH and ssgETH floats, you can convert your ssgETH for more sgETH over time. Exchange rate increases as validator rewardSplitter mints new sgETH corresponding to the staking yield and drops it into this vault (ssgETH contract). There is a short time period, \\u201ccycles\\u201d which the exchange rate increases linearly over. This is to prevent gaming the exchange rate (MEV). The cycles are constant length, but calling syncRewards slightly into a would-be cycle keeps the same would-be endpoint (so cycle ends are every X seconds). Someone must call syncRewards, which queues any new ssgETH in the contract to be added to the redeemable amount. Mint vs Deposit mint() - deposit targeting a specific number of ssgETH out deposit() - deposit knowing a specific number of ssgETH in \",\"errors\":{\"SyncError()\":[{\"details\":\"thrown when syncing before cycle ends.\"}]},\"events\":{\"NewRewardsCycle(uint32,uint256)\":{\"details\":\"emit every time a new rewards cycle starts\"}},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deposit(uint256,address)\":{\"notice\":\"inlines syncRewards with deposits when able\"},\"depositWithSignature(uint256,address,uint256,bool,uint8,bytes32,bytes32)\":{\"notice\":\"Approve and deposit() in one transaction\"},\"lastRewardAmount()\":{\"notice\":\"the amount of rewards distributed in a the most recent cycle.\"},\"lastSync()\":{\"notice\":\"the effective start of the current cycle\"},\"mint(uint256,address)\":{\"notice\":\"inlines syncRewards with mints when able\"},\"pricePerShare()\":{\"notice\":\"How much sgETH is 1E18 ssgETH worth. Price is in ETH, not USD\"},\"redeem(uint256,address,address)\":{\"notice\":\"inlines syncRewards with redemptions when able\"},\"rewardsCycleEnd()\":{\"notice\":\"the end of the current cycle. Will always be evenly divisible by `rewardsCycleLength`.\"},\"rewardsCycleLength()\":{\"notice\":\"the maximum length of a rewards cycle\"},\"syncRewards()\":{\"notice\":\"Distributes rewards to xERC4626 holders. All surplus `asset` balance of the contract over the internal balance becomes queued for the next cycle.\"},\"totalAssets()\":{\"notice\":\"Compute the amount of tokens available to share holders. Increases linearly during a reward distribution period from the sync call, not the cycle start.\"},\"withdraw(uint256,address,address)\":{\"notice\":\"inlines syncRewards with withdrawals when able\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/v2/core/WSGEth.sol\":\"WSGETH\"},\"evmVersion\":\"paris\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == _ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"contracts/v2/core/WSGEth.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.20;\\n\\nimport {ERC4626, xERC4626} from \\\"../lib/xERC4626.sol\\\";\\nimport {ERC20} from \\\"solmate/src/mixins/ERC4626.sol\\\";\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\n\\n/// @title ssgETH - Vault token for staked sgETH. ERC20 + ERC4626\\n/// @author @ChimeraDefi - sharedstake.org - based on sfrxETH\\n/// @notice Is a vault that takes sgETH and gives you ssgETH erc20 tokens\\n/** @dev Exchange rate between sgETH and ssgETH floats, you can convert your ssgETH for more sgETH over time.\\n Exchange rate increases as validator rewardSplitter mints new sgETH corresponding to the staking yield and drops it into this vault (ssgETH contract).\\n There is a short time period, \\u201ccycles\\u201d which the exchange rate increases linearly over. This is to prevent gaming the exchange rate (MEV).\\n The cycles are constant length, but calling syncRewards slightly into a would-be cycle keeps the same would-be endpoint (so cycle ends are every X seconds).\\n Someone must call syncRewards, which queues any new ssgETH in the contract to be added to the redeemable amount.\\n Mint vs Deposit\\n mint() - deposit targeting a specific number of ssgETH out\\n deposit() - deposit knowing a specific number of ssgETH in */\\ncontract WSGETH is xERC4626, ReentrancyGuard {\\n modifier andSync() {\\n if (block.timestamp >= rewardsCycleEnd) {\\n syncRewards();\\n }\\n _;\\n }\\n\\n /* ========== CONSTRUCTOR ========== */\\n constructor(\\n ERC20 _underlying,\\n uint32 _rewardsCycleLength\\n ) ERC4626(_underlying, \\\"Wrapped SharedStake Governed Ether\\\", \\\"wsgETH\\\") xERC4626(_rewardsCycleLength) {} // solhint-disable-line\\n\\n /// @notice Approve and deposit() in one transaction\\n function depositWithSignature(\\n uint256 assets,\\n address receiver,\\n uint256 deadline,\\n bool approveMax,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external returns (uint256 shares) {\\n uint256 amount = approveMax ? type(uint256).max : assets;\\n asset.permit(msg.sender, address(this), amount, deadline, v, r, s);\\n return (deposit(assets, receiver));\\n }\\n\\n /// @notice inlines syncRewards with deposits when able\\n function deposit(uint256 assets, address receiver) public override nonReentrant andSync returns (uint256 shares) {\\n return super.deposit(assets, receiver);\\n }\\n\\n /// @notice inlines syncRewards with mints when able\\n function mint(uint256 shares, address receiver) public override nonReentrant andSync returns (uint256 assets) {\\n return super.mint(shares, receiver);\\n }\\n\\n /// @notice inlines syncRewards with withdrawals when able\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) public override nonReentrant andSync returns (uint256 shares) {\\n return super.withdraw(assets, receiver, owner);\\n }\\n\\n /// @notice inlines syncRewards with redemptions when able\\n function redeem(uint256 shares, address receiver, address owner) public override andSync returns (uint256 assets) {\\n return super.redeem(shares, receiver, owner);\\n }\\n\\n /// @notice How much sgETH is 1E18 ssgETH worth. Price is in ETH, not USD\\n function pricePerShare() public view returns (uint256) {\\n return convertToAssets(1e18);\\n }\\n}\\n\",\"keccak256\":\"0xa67bcf20433ffa25c195a4b58aa4ebfabb48a465412498b4b5f1318b11896226\",\"license\":\"BUSL-1.1\"},\"contracts/v2/interfaces/IxERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// Cloned from fei/rari ERC4626 impl https://github.com/fei-protocol/ERC4626/blob/main/src/interfaces/IxERC4626.sol\\n// @ChimeraDefi Jun 2023\\n\\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/** \\n @title An xERC4626 Single Staking Contract Interface\\n @notice This contract allows users to autocompound rewards denominated in an underlying reward token. \\n It is fully compatible with [ERC4626](https://eips.ethereum.org/EIPS/eip-4626) allowing for DeFi composability.\\n It maintains balances using internal accounting to prevent instantaneous changes in the exchange rate.\\n NOTE: an exception is at contract creation, when a reward cycle begins before the first deposit. After the first deposit, exchange rate updates smoothly.\\n\\n Operates on \\\"cycles\\\" which distribute the rewards surplus over the internal balance to users linearly over the remainder of the cycle window.\\n*/\\ninterface IxERC4626 {\\n /*////////////////////////////////////////////////////////\\n Custom Errors\\n ////////////////////////////////////////////////////////*/\\n\\n /// @dev thrown when syncing before cycle ends.\\n error SyncError();\\n\\n /*////////////////////////////////////////////////////////\\n Events\\n ////////////////////////////////////////////////////////*/\\n\\n /// @dev emit every time a new rewards cycle starts\\n event NewRewardsCycle(uint32 indexed cycleEnd, uint256 rewardAmount);\\n\\n /*////////////////////////////////////////////////////////\\n View Methods\\n ////////////////////////////////////////////////////////*/\\n\\n /// @notice the maximum length of a rewards cycle\\n function rewardsCycleLength() external view returns (uint32);\\n\\n /// @notice the effective start of the current cycle\\n /// NOTE: This will likely be after `rewardsCycleEnd - rewardsCycleLength` as this is set as block.timestamp of the last `syncRewards` call.\\n function lastSync() external view returns (uint32);\\n\\n /// @notice the end of the current cycle. Will always be evenly divisible by `rewardsCycleLength`.\\n function rewardsCycleEnd() external view returns (uint32);\\n\\n /// @notice the amount of rewards distributed in a the most recent cycle\\n function lastRewardAmount() external view returns (uint192);\\n\\n /*////////////////////////////////////////////////////////\\n State Changing Methods\\n ////////////////////////////////////////////////////////*/\\n\\n /// @notice Distributes rewards to xERC4626 holders.\\n /// All surplus `asset` balance of the contract over the internal balance becomes queued for the next cycle.\\n function syncRewards() external;\\n}\\n\",\"keccak256\":\"0xc8f1178f922c26f8ddb0fce2b2a097a73949818a7a6400df5ef0a4b3f9dbedc3\",\"license\":\"MIT\"},\"contracts/v2/lib/xERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// Cloned from fei/rari ERC4626 impl https://github.com/fei-protocol/ERC4626/blob/main/src/interfaces/IxERC4626.sol\\n// In use by sfrxeth https://etherscan.io/address/0xac3e018457b222d93114458476f3e3416abbe38f#code\\n// @ChimeraDefi Jun 2023\\n\\npragma solidity ^0.8.20;\\n\\nimport {ERC4626} from \\\"solmate/src/mixins/ERC4626.sol\\\";\\nimport {SafeCastLib} from \\\"solmate/src/utils/SafeCastLib.sol\\\";\\nimport {IxERC4626} from \\\"../interfaces/IxERC4626.sol\\\";\\n\\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)\\n\\n/**\\n@title An xERC4626 Single Staking Contract\\n@notice This contract allows users to autocompound rewards denominated in an underlying reward token.\\n It is fully compatible with [ERC4626](https://eips.ethereum.org/EIPS/eip-4626) allowing for DeFi composability.\\n It maintains balances using internal accounting to prevent instantaneous changes in the exchange rate.\\n NOTE: an exception is at contract creation, when a reward cycle begins before the first deposit. After the first deposit, exchange rate updates smoothly.\\n\\n Operates on \\\"cycles\\\" which distribute the rewards surplus over the internal balance to users linearly over the remainder of the cycle window.\\n*/\\nabstract contract xERC4626 is IxERC4626, ERC4626 {\\n using SafeCastLib for *;\\n\\n /// @notice the maximum length of a rewards cycle\\n uint32 public immutable rewardsCycleLength;\\n\\n /// @notice the effective start of the current cycle\\n uint32 public lastSync;\\n\\n /// @notice the end of the current cycle. Will always be evenly divisible by `rewardsCycleLength`.\\n uint32 public rewardsCycleEnd;\\n\\n /// @notice the amount of rewards distributed in a the most recent cycle.\\n uint192 public lastRewardAmount;\\n\\n uint256 internal storedTotalAssets;\\n\\n constructor(uint32 _rewardsCycleLength) {\\n rewardsCycleLength = _rewardsCycleLength;\\n // seed initial rewardsCycleEnd\\n rewardsCycleEnd = (block.timestamp.safeCastTo32() / rewardsCycleLength) * rewardsCycleLength;\\n }\\n\\n /// @notice Compute the amount of tokens available to share holders.\\n /// Increases linearly during a reward distribution period from the sync call, not the cycle start.\\n function totalAssets() public view override returns (uint256) {\\n // cache global vars\\n uint256 storedTotalAssets_ = storedTotalAssets;\\n uint192 lastRewardAmount_ = lastRewardAmount;\\n uint32 rewardsCycleEnd_ = rewardsCycleEnd;\\n uint32 lastSync_ = lastSync;\\n\\n if (block.timestamp >= rewardsCycleEnd_) {\\n // no rewards or rewards fully unlocked\\n // entire reward amount is available\\n return storedTotalAssets_ + lastRewardAmount_;\\n }\\n\\n // rewards not fully unlocked\\n // add unlocked rewards to stored total\\n uint256 unlockedRewards = (lastRewardAmount_ * (block.timestamp - lastSync_)) / (rewardsCycleEnd_ - lastSync_);\\n return storedTotalAssets_ + unlockedRewards;\\n }\\n\\n // Update storedTotalAssets on withdraw/redeem\\n function beforeWithdraw(uint256 amount, uint256 shares) internal virtual override {\\n super.beforeWithdraw(amount, shares);\\n storedTotalAssets -= amount;\\n }\\n\\n // Update storedTotalAssets on deposit/mint\\n function afterDeposit(uint256 amount, uint256 shares) internal virtual override {\\n storedTotalAssets += amount;\\n super.afterDeposit(amount, shares);\\n }\\n\\n /// @notice Distributes rewards to xERC4626 holders.\\n /// All surplus `asset` balance of the contract over the internal balance becomes queued for the next cycle.\\n function syncRewards() public virtual {\\n uint192 lastRewardAmount_ = lastRewardAmount;\\n uint32 timestamp = block.timestamp.safeCastTo32();\\n\\n if (timestamp < rewardsCycleEnd) revert SyncError();\\n\\n uint256 storedTotalAssets_ = storedTotalAssets;\\n uint256 nextRewards = asset.balanceOf(address(this)) - storedTotalAssets_ - lastRewardAmount_;\\n\\n storedTotalAssets = storedTotalAssets_ + lastRewardAmount_; // SSTORE\\n\\n uint32 end = ((timestamp + rewardsCycleLength) / rewardsCycleLength) * rewardsCycleLength;\\n\\n if (end - timestamp < rewardsCycleLength / 20) {\\n end += rewardsCycleLength;\\n }\\n\\n // Combined single SSTORE\\n lastRewardAmount = nextRewards.safeCastTo192();\\n lastSync = timestamp;\\n rewardsCycleEnd = end;\\n\\n emit NewRewardsCycle(end, nextRewards);\\n }\\n}\\n\",\"keccak256\":\"0x89e895b144d1a28dbf96aec81e7601b8b5c9abfb4bf6bcb2a17eb7c40d7b7c79\",\"license\":\"MIT\"},\"solmate/src/mixins/ERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport {ERC20} from \\\"../tokens/ERC20.sol\\\";\\nimport {SafeTransferLib} from \\\"../utils/SafeTransferLib.sol\\\";\\nimport {FixedPointMathLib} from \\\"../utils/FixedPointMathLib.sol\\\";\\n\\n/// @notice Minimal ERC4626 tokenized Vault implementation.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/mixins/ERC4626.sol)\\nabstract contract ERC4626 is ERC20 {\\n using SafeTransferLib for ERC20;\\n using FixedPointMathLib for uint256;\\n\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed caller,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /*//////////////////////////////////////////////////////////////\\n IMMUTABLES\\n //////////////////////////////////////////////////////////////*/\\n\\n ERC20 public immutable asset;\\n\\n constructor(\\n ERC20 _asset,\\n string memory _name,\\n string memory _symbol\\n ) ERC20(_name, _symbol, _asset.decimals()) {\\n asset = _asset;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n DEPOSIT/WITHDRAWAL LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function deposit(uint256 assets, address receiver) public virtual returns (uint256 shares) {\\n // Check for rounding error since we round down in previewDeposit.\\n require((shares = previewDeposit(assets)) != 0, \\\"ZERO_SHARES\\\");\\n\\n // Need to transfer before minting or ERC777s could reenter.\\n asset.safeTransferFrom(msg.sender, address(this), assets);\\n\\n _mint(receiver, shares);\\n\\n emit Deposit(msg.sender, receiver, assets, shares);\\n\\n afterDeposit(assets, shares);\\n }\\n\\n function mint(uint256 shares, address receiver) public virtual returns (uint256 assets) {\\n assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.\\n\\n // Need to transfer before minting or ERC777s could reenter.\\n asset.safeTransferFrom(msg.sender, address(this), assets);\\n\\n _mint(receiver, shares);\\n\\n emit Deposit(msg.sender, receiver, assets, shares);\\n\\n afterDeposit(assets, shares);\\n }\\n\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) public virtual returns (uint256 shares) {\\n shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.\\n\\n if (msg.sender != owner) {\\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\\n\\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\\n }\\n\\n beforeWithdraw(assets, shares);\\n\\n _burn(owner, shares);\\n\\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\\n\\n asset.safeTransfer(receiver, assets);\\n }\\n\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address owner\\n ) public virtual returns (uint256 assets) {\\n if (msg.sender != owner) {\\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\\n\\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\\n }\\n\\n // Check for rounding error since we round down in previewRedeem.\\n require((assets = previewRedeem(shares)) != 0, \\\"ZERO_ASSETS\\\");\\n\\n beforeWithdraw(assets, shares);\\n\\n _burn(owner, shares);\\n\\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\\n\\n asset.safeTransfer(receiver, assets);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ACCOUNTING LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function totalAssets() public view virtual returns (uint256);\\n\\n function convertToShares(uint256 assets) public view virtual returns (uint256) {\\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\\n\\n return supply == 0 ? assets : assets.mulDivDown(supply, totalAssets());\\n }\\n\\n function convertToAssets(uint256 shares) public view virtual returns (uint256) {\\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\\n\\n return supply == 0 ? shares : shares.mulDivDown(totalAssets(), supply);\\n }\\n\\n function previewDeposit(uint256 assets) public view virtual returns (uint256) {\\n return convertToShares(assets);\\n }\\n\\n function previewMint(uint256 shares) public view virtual returns (uint256) {\\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\\n\\n return supply == 0 ? shares : shares.mulDivUp(totalAssets(), supply);\\n }\\n\\n function previewWithdraw(uint256 assets) public view virtual returns (uint256) {\\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\\n\\n return supply == 0 ? assets : assets.mulDivUp(supply, totalAssets());\\n }\\n\\n function previewRedeem(uint256 shares) public view virtual returns (uint256) {\\n return convertToAssets(shares);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n DEPOSIT/WITHDRAWAL LIMIT LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function maxDeposit(address) public view virtual returns (uint256) {\\n return type(uint256).max;\\n }\\n\\n function maxMint(address) public view virtual returns (uint256) {\\n return type(uint256).max;\\n }\\n\\n function maxWithdraw(address owner) public view virtual returns (uint256) {\\n return convertToAssets(balanceOf[owner]);\\n }\\n\\n function maxRedeem(address owner) public view virtual returns (uint256) {\\n return balanceOf[owner];\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n INTERNAL HOOKS LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {}\\n\\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {}\\n}\\n\",\"keccak256\":\"0xa404f6f45bd53f24a90cc5ffe95e16b52e3f2dfd88f0d7a1edcb35f815919a7b\",\"license\":\"AGPL-3.0-only\"},\"solmate/src/tokens/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\\nabstract contract ERC20 {\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n\\n /*//////////////////////////////////////////////////////////////\\n METADATA STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n string public name;\\n\\n string public symbol;\\n\\n uint8 public immutable decimals;\\n\\n /*//////////////////////////////////////////////////////////////\\n ERC20 STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 public totalSupply;\\n\\n mapping(address => uint256) public balanceOf;\\n\\n mapping(address => mapping(address => uint256)) public allowance;\\n\\n /*//////////////////////////////////////////////////////////////\\n EIP-2612 STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 internal immutable INITIAL_CHAIN_ID;\\n\\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\\n\\n mapping(address => uint256) public nonces;\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n string memory _name,\\n string memory _symbol,\\n uint8 _decimals\\n ) {\\n name = _name;\\n symbol = _symbol;\\n decimals = _decimals;\\n\\n INITIAL_CHAIN_ID = block.chainid;\\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ERC20 LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function approve(address spender, uint256 amount) public virtual returns (bool) {\\n allowance[msg.sender][spender] = amount;\\n\\n emit Approval(msg.sender, spender, amount);\\n\\n return true;\\n }\\n\\n function transfer(address to, uint256 amount) public virtual returns (bool) {\\n balanceOf[msg.sender] -= amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(msg.sender, to, amount);\\n\\n return true;\\n }\\n\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) public virtual returns (bool) {\\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\\n\\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\\n\\n balanceOf[from] -= amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(from, to, amount);\\n\\n return true;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n EIP-2612 LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) public virtual {\\n require(deadline >= block.timestamp, \\\"PERMIT_DEADLINE_EXPIRED\\\");\\n\\n // Unchecked because the only math done is incrementing\\n // the owner's nonce which cannot realistically overflow.\\n unchecked {\\n address recoveredAddress = ecrecover(\\n keccak256(\\n abi.encodePacked(\\n \\\"\\\\x19\\\\x01\\\",\\n DOMAIN_SEPARATOR(),\\n keccak256(\\n abi.encode(\\n keccak256(\\n \\\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\\\"\\n ),\\n owner,\\n spender,\\n value,\\n nonces[owner]++,\\n deadline\\n )\\n )\\n )\\n ),\\n v,\\n r,\\n s\\n );\\n\\n require(recoveredAddress != address(0) && recoveredAddress == owner, \\\"INVALID_SIGNER\\\");\\n\\n allowance[recoveredAddress][spender] = value;\\n }\\n\\n emit Approval(owner, spender, value);\\n }\\n\\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\\n }\\n\\n function computeDomainSeparator() internal view virtual returns (bytes32) {\\n return\\n keccak256(\\n abi.encode(\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"),\\n keccak256(bytes(name)),\\n keccak256(\\\"1\\\"),\\n block.chainid,\\n address(this)\\n )\\n );\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n INTERNAL MINT/BURN LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function _mint(address to, uint256 amount) internal virtual {\\n totalSupply += amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(address(0), to, amount);\\n }\\n\\n function _burn(address from, uint256 amount) internal virtual {\\n balanceOf[from] -= amount;\\n\\n // Cannot underflow because a user's balance\\n // will never be larger than the total supply.\\n unchecked {\\n totalSupply -= amount;\\n }\\n\\n emit Transfer(from, address(0), amount);\\n }\\n}\\n\",\"keccak256\":\"0xcdfd8db76b2a3415620e4d18cc5545f3d50de792dbf2c3dd5adb40cbe6f94b10\",\"license\":\"AGPL-3.0-only\"},\"solmate/src/utils/FixedPointMathLib.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Arithmetic library with operations for fixed-point numbers.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)\\n/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)\\nlibrary FixedPointMathLib {\\n /*//////////////////////////////////////////////////////////////\\n SIMPLIFIED FIXED POINT OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 internal constant MAX_UINT256 = 2**256 - 1;\\n\\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\\n\\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\\n }\\n\\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\\n }\\n\\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\\n }\\n\\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n LOW LEVEL FIXED POINT OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function mulDivDown(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 z) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\\n if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\\n revert(0, 0)\\n }\\n\\n // Divide x * y by the denominator.\\n z := div(mul(x, y), denominator)\\n }\\n }\\n\\n function mulDivUp(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 z) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\\n if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\\n revert(0, 0)\\n }\\n\\n // If x * y modulo the denominator is strictly greater than 0,\\n // 1 is added to round up the division of x * y by the denominator.\\n z := add(gt(mod(mul(x, y), denominator), 0), div(mul(x, y), denominator))\\n }\\n }\\n\\n function rpow(\\n uint256 x,\\n uint256 n,\\n uint256 scalar\\n ) internal pure returns (uint256 z) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n switch x\\n case 0 {\\n switch n\\n case 0 {\\n // 0 ** 0 = 1\\n z := scalar\\n }\\n default {\\n // 0 ** n = 0\\n z := 0\\n }\\n }\\n default {\\n switch mod(n, 2)\\n case 0 {\\n // If n is even, store scalar in z for now.\\n z := scalar\\n }\\n default {\\n // If n is odd, store x in z for now.\\n z := x\\n }\\n\\n // Shifting right by 1 is like dividing by 2.\\n let half := shr(1, scalar)\\n\\n for {\\n // Shift n right by 1 before looping to halve it.\\n n := shr(1, n)\\n } n {\\n // Shift n right by 1 each iteration to halve it.\\n n := shr(1, n)\\n } {\\n // Revert immediately if x ** 2 would overflow.\\n // Equivalent to iszero(eq(div(xx, x), x)) here.\\n if shr(128, x) {\\n revert(0, 0)\\n }\\n\\n // Store x squared.\\n let xx := mul(x, x)\\n\\n // Round to the nearest number.\\n let xxRound := add(xx, half)\\n\\n // Revert if xx + half overflowed.\\n if lt(xxRound, xx) {\\n revert(0, 0)\\n }\\n\\n // Set x to scaled xxRound.\\n x := div(xxRound, scalar)\\n\\n // If n is even:\\n if mod(n, 2) {\\n // Compute z * x.\\n let zx := mul(z, x)\\n\\n // If z * x overflowed:\\n if iszero(eq(div(zx, x), z)) {\\n // Revert if x is non-zero.\\n if iszero(iszero(x)) {\\n revert(0, 0)\\n }\\n }\\n\\n // Round to the nearest number.\\n let zxRound := add(zx, half)\\n\\n // Revert if zx + half overflowed.\\n if lt(zxRound, zx) {\\n revert(0, 0)\\n }\\n\\n // Return properly scaled zxRound.\\n z := div(zxRound, scalar)\\n }\\n }\\n }\\n }\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n GENERAL NUMBER UTILITIES\\n //////////////////////////////////////////////////////////////*/\\n\\n function sqrt(uint256 x) internal pure returns (uint256 z) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let y := x // We start y at x, which will help us make our initial estimate.\\n\\n z := 181 // The \\\"correct\\\" value is 1, but this saves a multiplication later.\\n\\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\\n\\n // We check y >= 2^(k + 8) but shift right by k bits\\n // each branch to ensure that if x >= 256, then y >= 256.\\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\\n y := shr(128, y)\\n z := shl(64, z)\\n }\\n if iszero(lt(y, 0x1000000000000000000)) {\\n y := shr(64, y)\\n z := shl(32, z)\\n }\\n if iszero(lt(y, 0x10000000000)) {\\n y := shr(32, y)\\n z := shl(16, z)\\n }\\n if iszero(lt(y, 0x1000000)) {\\n y := shr(16, y)\\n z := shl(8, z)\\n }\\n\\n // Goal was to get z*z*y within a small factor of x. More iterations could\\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\\n\\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\\n\\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\\n\\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\\n\\n // There is no overflow risk here since y < 2^136 after the first branch above.\\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\\n\\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n\\n // If x+1 is a perfect square, the Babylonian method cycles between\\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\\n z := sub(z, lt(div(x, z), z))\\n }\\n }\\n\\n function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Mod x by y. Note this will return\\n // 0 instead of reverting if y is zero.\\n z := mod(x, y)\\n }\\n }\\n\\n function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Divide x by y. Note this will return\\n // 0 instead of reverting if y is zero.\\n r := div(x, y)\\n }\\n }\\n\\n function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Add 1 to x * y if x % y > 0. Note this will\\n // return 0 instead of reverting if y is zero.\\n z := add(gt(mod(x, y), 0), div(x, y))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1b62af9baf5b8e991ed7531bc87f45550ba9d61e8dbff5caf237ccaf3a3fd843\",\"license\":\"AGPL-3.0-only\"},\"solmate/src/utils/SafeCastLib.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Safe unsigned integer casting library that reverts on overflow.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeCastLib.sol)\\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeCast.sol)\\nlibrary SafeCastLib {\\n function safeCastTo248(uint256 x) internal pure returns (uint248 y) {\\n require(x < 1 << 248);\\n\\n y = uint248(x);\\n }\\n\\n function safeCastTo224(uint256 x) internal pure returns (uint224 y) {\\n require(x < 1 << 224);\\n\\n y = uint224(x);\\n }\\n\\n function safeCastTo192(uint256 x) internal pure returns (uint192 y) {\\n require(x < 1 << 192);\\n\\n y = uint192(x);\\n }\\n\\n function safeCastTo160(uint256 x) internal pure returns (uint160 y) {\\n require(x < 1 << 160);\\n\\n y = uint160(x);\\n }\\n\\n function safeCastTo128(uint256 x) internal pure returns (uint128 y) {\\n require(x < 1 << 128);\\n\\n y = uint128(x);\\n }\\n\\n function safeCastTo96(uint256 x) internal pure returns (uint96 y) {\\n require(x < 1 << 96);\\n\\n y = uint96(x);\\n }\\n\\n function safeCastTo64(uint256 x) internal pure returns (uint64 y) {\\n require(x < 1 << 64);\\n\\n y = uint64(x);\\n }\\n\\n function safeCastTo32(uint256 x) internal pure returns (uint32 y) {\\n require(x < 1 << 32);\\n\\n y = uint32(x);\\n }\\n\\n function safeCastTo24(uint256 x) internal pure returns (uint24 y) {\\n require(x < 1 << 24);\\n\\n y = uint24(x);\\n }\\n\\n function safeCastTo16(uint256 x) internal pure returns (uint16 y) {\\n require(x < 1 << 16);\\n\\n y = uint16(x);\\n }\\n\\n function safeCastTo8(uint256 x) internal pure returns (uint8 y) {\\n require(x < 1 << 8);\\n\\n y = uint8(x);\\n }\\n}\\n\",\"keccak256\":\"0xb784a14411858036491124e677aecde6d500e695b7a70c74aa8f1001bda2ccab\",\"license\":\"AGPL-3.0-only\"},\"solmate/src/utils/SafeTransferLib.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport {ERC20} from \\\"../tokens/ERC20.sol\\\";\\n\\n/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)\\n/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.\\n/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.\\nlibrary SafeTransferLib {\\n /*//////////////////////////////////////////////////////////////\\n ETH OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function safeTransferETH(address to, uint256 amount) internal {\\n bool success;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Transfer the ETH and store if it succeeded or not.\\n success := call(gas(), to, amount, 0, 0, 0, 0)\\n }\\n\\n require(success, \\\"ETH_TRANSFER_FAILED\\\");\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ERC20 OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function safeTransferFrom(\\n ERC20 token,\\n address from,\\n address to,\\n uint256 amount\\n ) internal {\\n bool success;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Get a pointer to some free memory.\\n let freeMemoryPointer := mload(0x40)\\n\\n // Write the abi-encoded calldata into memory, beginning with the function selector.\\n mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\\n mstore(add(freeMemoryPointer, 4), from) // Append the \\\"from\\\" argument.\\n mstore(add(freeMemoryPointer, 36), to) // Append the \\\"to\\\" argument.\\n mstore(add(freeMemoryPointer, 68), amount) // Append the \\\"amount\\\" argument.\\n\\n success := and(\\n // Set success to whether the call reverted, if not we check it either\\n // returned exactly 1 (can't just be non-zero data), or had no return data.\\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\\n // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.\\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\\n // Counterintuitively, this call must be positioned second to the or() call in the\\n // surrounding and() call or else returndatasize() will be zero during the computation.\\n call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)\\n )\\n }\\n\\n require(success, \\\"TRANSFER_FROM_FAILED\\\");\\n }\\n\\n function safeTransfer(\\n ERC20 token,\\n address to,\\n uint256 amount\\n ) internal {\\n bool success;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Get a pointer to some free memory.\\n let freeMemoryPointer := mload(0x40)\\n\\n // Write the abi-encoded calldata into memory, beginning with the function selector.\\n mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\\n mstore(add(freeMemoryPointer, 4), to) // Append the \\\"to\\\" argument.\\n mstore(add(freeMemoryPointer, 36), amount) // Append the \\\"amount\\\" argument.\\n\\n success := and(\\n // Set success to whether the call reverted, if not we check it either\\n // returned exactly 1 (can't just be non-zero data), or had no return data.\\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\\n // Counterintuitively, this call must be positioned second to the or() call in the\\n // surrounding and() call or else returndatasize() will be zero during the computation.\\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\\n )\\n }\\n\\n require(success, \\\"TRANSFER_FAILED\\\");\\n }\\n\\n function safeApprove(\\n ERC20 token,\\n address to,\\n uint256 amount\\n ) internal {\\n bool success;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Get a pointer to some free memory.\\n let freeMemoryPointer := mload(0x40)\\n\\n // Write the abi-encoded calldata into memory, beginning with the function selector.\\n mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)\\n mstore(add(freeMemoryPointer, 4), to) // Append the \\\"to\\\" argument.\\n mstore(add(freeMemoryPointer, 36), amount) // Append the \\\"amount\\\" argument.\\n\\n success := and(\\n // Set success to whether the call reverted, if not we check it either\\n // returned exactly 1 (can't just be non-zero data), or had no return data.\\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\\n // Counterintuitively, this call must be positioned second to the or() call in the\\n // surrounding and() call or else returndatasize() will be zero during the computation.\\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\\n )\\n }\\n\\n require(success, \\\"APPROVE_FAILED\\\");\\n }\\n}\\n\",\"keccak256\":\"0xbadf3d708cf532b12f75f78a1d423135954b63774a6d4ba15914a551d348db8a\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", "bytecode": "0x6101206040523480156200001257600080fd5b506040516200217e3803806200217e833981016040819052620000359162000239565b80826040518060600160405280602281526020016200215c60229139604051806040016040528060068152602001650eee6ce8aa8960d31b8152508181846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000b1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d791906200028b565b6000620000e584826200035c565b506001620000f483826200035c565b5060ff81166080524660a0526200010a62000185565b60c0525050506001600160a01b0390921660e052505063ffffffff811661010081905280620001394262000221565b62000145919062000428565b6200015191906200045a565b6006805463ffffffff929092166401000000000263ffffffff60201b1990921691909117905550506001600855506200050f565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051620001b9919062000491565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600064010000000082106200023557600080fd5b5090565b600080604083850312156200024d57600080fd5b82516001600160a01b03811681146200026557600080fd5b602084015190925063ffffffff811681146200028057600080fd5b809150509250929050565b6000602082840312156200029e57600080fd5b815160ff81168114620002b057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620002e257607f821691505b6020821081036200030357634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200035757600081815260208120601f850160051c81016020861015620003325750805b601f850160051c820191505b8181101562000353578281556001016200033e565b5050505b505050565b81516001600160401b03811115620003785762000378620002b7565b6200039081620003898454620002cd565b8462000309565b602080601f831160018114620003c85760008415620003af5750858301515b600019600386901b1c1916600185901b17855562000353565b600085815260208120601f198616915b82811015620003f957888601518255948401946001909101908401620003d8565b5085821015620004185787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600063ffffffff808416806200044e57634e487b7160e01b600052601260045260246000fd5b92169190910492915050565b63ffffffff8181168382160280821691908281146200048957634e487b7160e01b600052601160045260246000fd5b505092915050565b6000808354620004a181620002cd565b60018281168015620004bc5760018114620004d25762000503565b60ff198416875282151583028701945062000503565b8760005260208060002060005b85811015620004fa5781548a820152908401908201620004df565b50505082870194505b50929695505050505050565b60805160a05160c05160e05161010051611bc96200059360003960008181610390015281816109f801528181610a3f0152610a840152600081816102f10152818161095501528181610b850152818161116f015281816112330152818161139c01526114e80152600061086d01526000610838015260006102b00152611bc96000f3fe608060405234801561001057600080fd5b50600436106102115760003560e01c806375e077c311610125578063bafedcaa116100ad578063d505accf1161007c578063d505accf146104d6578063d905777e146104e9578063dd62ed3e14610512578063e7ff69f11461053d578063ef8b30f71461055457600080fd5b8063bafedcaa1461047e578063c63d75b61461032b578063c6e6f592146104b0578063ce96cb77146104c357600080fd5b806399530b06116100f457806399530b061461042a578063a9059cbb14610432578063b3d7f6b914610445578063b460af9414610458578063ba0876521461046b57600080fd5b806375e077c3146103dc5780637ecebe00146103ef57806394bf804d1461040f57806395d89b411461042257600080fd5b80633644e515116101a85780636917516b116101775780636917516b146103535780636e553f65146103785780636fcf5e5f1461038b57806370a08231146103b257806372c0c211146103d257600080fd5b80633644e515146102e457806338d52e0f146102ec578063402d267d1461032b5780634cdad5061461034057600080fd5b80630a28a477116101e45780630a28a4771461027c57806318160ddd1461028f57806323b872dd14610298578063313ce567146102ab57600080fd5b806301e1d1141461021657806306fdde031461023157806307a2d13a14610246578063095ea7b314610259575b600080fd5b61021e610567565b6040519081526020015b60405180910390f35b61023961060c565b6040516102289190611712565b61021e610254366004611760565b61069a565b61026c610267366004611795565b6106c7565b6040519015158152602001610228565b61021e61028a366004611760565b610734565b61021e60025481565b61026c6102a63660046117bf565b610754565b6102d27f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff9091168152602001610228565b61021e610834565b6103137f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610228565b61021e6103393660046117fb565b5060001990565b61021e61034e366004611760565b61088f565b6006546103639063ffffffff1681565b60405163ffffffff9091168152602001610228565b61021e610386366004611816565b61089a565b6103637f000000000000000000000000000000000000000000000000000000000000000081565b61021e6103c03660046117fb565b60036020526000908152604090205481565b6103da6108d8565b005b61021e6103ea366004611853565b610b30565b61021e6103fd3660046117fb565b60056020526000908152604090205481565b61021e61041d366004611816565b610c00565b610239610c32565b61021e610c3f565b61026c610440366004611795565b610c52565b61021e610453366004611760565b610cb8565b61021e6104663660046118c4565b610cd7565b61021e6104793660046118c4565b610d16565b60065461049890600160401b90046001600160c01b031681565b6040516001600160c01b039091168152602001610228565b61021e6104be366004611760565b610d4a565b61021e6104d13660046117fb565b610d6a565b6103da6104e4366004611900565b610d8c565b61021e6104f73660046117fb565b6001600160a01b031660009081526003602052604090205490565b61021e61052036600461194e565b600460209081526000928352604080842090915290825290205481565b60065461036390600160201b900463ffffffff1681565b61021e610562366004611760565b610fd5565b600754600654600091906001600160c01b03600160401b8204169063ffffffff600160201b8204811691164282116105b5576105ac6001600160c01b0384168561198e565b94505050505090565b60006105c182846119a1565b63ffffffff168263ffffffff16426105d991906119c5565b6105ec906001600160c01b0387166119d8565b6105f69190611a05565b9050610602818661198e565b9550505050505090565b6000805461061990611a19565b80601f016020809104026020016040519081016040528092919081815260200182805461064590611a19565b80156106925780601f1061066757610100808354040283529160200191610692565b820191906000526020600020905b81548152906001019060200180831161067557829003601f168201915b505050505081565b60025460009080156106be576106b96106b1610567565b849083610fe0565b6106c0565b825b9392505050565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107229086815260200190565b60405180910390a35060015b92915050565b60025460009080156106be576106b98161074c610567565b859190610ffe565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146107b05761078b83826119c5565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906107d89084906119c5565b90915550506001600160a01b0380851660008181526003602052604090819020805487019055519091871690600080516020611b74833981519152906108219087815260200190565b60405180910390a3506001949350505050565b60007f0000000000000000000000000000000000000000000000000000000000000000461461086a57610865611024565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b600061072e8261069a565b60006108a46110be565b600654600160201b900463ffffffff1642106108c2576108c26108d8565b6108cc8383611117565b905061072e6001600855565b600654600160401b90046001600160c01b031660006108f6426111f1565b60065490915063ffffffff600160201b9091048116908216101561092d5760405163127d33e760e21b815260040160405180910390fd5b6007546040516370a0823160e01b81523060048201526000906001600160c01b0385169083907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156109a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c89190611a53565b6109d291906119c5565b6109dc91906119c5565b90506109f16001600160c01b0385168361198e565b60075560007f000000000000000000000000000000000000000000000000000000000000000080610a228187611a6c565b610a2c9190611a89565b610a369190611aac565b9050610a6360147f0000000000000000000000000000000000000000000000000000000000000000611a89565b63ffffffff16610a7385836119a1565b63ffffffff161015610aac57610aa97f000000000000000000000000000000000000000000000000000000000000000082611a6c565b90505b610ab582611207565b63ffffffff828116600160201b81026001600160c01b0393909316600160401b0267ffffffffffffffff191691871691909117919091176006556040517f2fa39aac60d1c94cda4ab0e86ae9c0ffab5b926e5b827a4ccba1d9b5b2ef596e90610b219085815260200190565b60405180910390a25050505050565b60008085610b3e5788610b42565b6000195b60405163d505accf60e01b8152336004820152306024820152604481018290526064810189905260ff8716608482015260a4810186905260c481018590529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d505accf9060e401600060405180830381600087803b158015610bd157600080fd5b505af1158015610be5573d6000803e3d6000fd5b50505050610bf3898961089a565b9998505050505050505050565b6000610c0a6110be565b600654600160201b900463ffffffff164210610c2857610c286108d8565b6108cc8383611219565b6001805461061990611a19565b6000610865670de0b6b3a764000061069a565b33600090815260036020526040812080548391908390610c739084906119c5565b90915550506001600160a01b03831660008181526003602052604090819020805485019055513390600080516020611b74833981519152906107229086815260200190565b60025460009080156106be576106b9610ccf610567565b849083610ffe565b6000610ce16110be565b600654600160201b900463ffffffff164210610cff57610cff6108d8565b610d0a8484846112b5565b90506106c06001600855565b600654600090600160201b900463ffffffff164210610d3757610d376108d8565b610d428484846113c3565b949350505050565b60025460009080156106be576106b981610d62610567565b859190610fe0565b6001600160a01b03811660009081526003602052604081205461072e9061069a565b42841015610de15760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b60006001610ded610834565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610ef9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590610f2f5750876001600160a01b0316816001600160a01b0316145b610f6c5760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b6044820152606401610dd8565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b600061072e82610d4a565b6000826000190484118302158202610ff757600080fd5b5091020490565b600082600019048411830215820261101557600080fd5b50910281810615159190040190565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516110569190611ad4565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6002600854036111105760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610dd8565b6002600855565b600061112283610fd5565b9050806000036111625760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f53484152455360a81b6044820152606401610dd8565b6111976001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308661150f565b6111a18282611599565b60408051848152602081018390526001600160a01b0384169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a361072e83826115f3565b6000600160201b821061120357600080fd5b5090565b6000600160c01b821061120357600080fd5b600061122483610cb8565b905061125b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308461150f565b6112658284611599565b60408051828152602081018590526001600160a01b0384169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a361072e81846115f3565b60006112c084610734565b9050336001600160a01b03831614611330576001600160a01b0382166000908152600460209081526040808320338452909152902054600019811461132e5761130982826119c5565b6001600160a01b03841660009081526004602090815260408083203384529091529020555b505b61133a8482611617565b6113448282611632565b60408051858152602081018390526001600160a01b03808516929086169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a46106c06001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168486611694565b6000336001600160a01b03831614611433576001600160a01b038216600090815260046020908152604080832033845290915290205460001981146114315761140c85826119c5565b6001600160a01b03841660009081526004602090815260408083203384529091529020555b505b61143c8461088f565b90508060000361147c5760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f41535345545360a81b6044820152606401610dd8565b6114868185611617565b6114908285611632565b60408051828152602081018690526001600160a01b03808516929086169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a46106c06001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168483611694565b60006040516323b872dd60e01b81528460048201528360248201528260448201526020600060648360008a5af13d15601f3d11600160005114161716915050806115925760405162461bcd60e51b81526020600482015260146024820152731514905394d1915497d19493d357d1905253115160621b6044820152606401610dd8565b5050505050565b80600260008282546115ab919061198e565b90915550506001600160a01b038216600081815260036020908152604080832080548601905551848152600080516020611b7483398151915291015b60405180910390a35050565b8160076000828254611605919061198e565b909155506116139050828282565b5050565b816007600082825461162991906119c5565b90915550505050565b6001600160a01b0382166000908152600360205260408120805483929061165a9084906119c5565b90915550506002805482900390556040518181526000906001600160a01b03841690600080516020611b74833981519152906020016115e7565b600060405163a9059cbb60e01b8152836004820152826024820152602060006044836000895af13d15601f3d116001600051141617169150508061170c5760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610dd8565b50505050565b600060208083528351808285015260005b8181101561173f57858101830151858201604001528201611723565b506000604082860101526040601f19601f8301168501019250505092915050565b60006020828403121561177257600080fd5b5035919050565b80356001600160a01b038116811461179057600080fd5b919050565b600080604083850312156117a857600080fd5b6117b183611779565b946020939093013593505050565b6000806000606084860312156117d457600080fd5b6117dd84611779565b92506117eb60208501611779565b9150604084013590509250925092565b60006020828403121561180d57600080fd5b6106c082611779565b6000806040838503121561182957600080fd5b8235915061183960208401611779565b90509250929050565b803560ff8116811461179057600080fd5b600080600080600080600060e0888a03121561186e57600080fd5b8735965061187e60208901611779565b9550604088013594506060880135801515811461189a57600080fd5b93506118a860808901611842565b925060a0880135915060c0880135905092959891949750929550565b6000806000606084860312156118d957600080fd5b833592506118e960208501611779565b91506118f760408501611779565b90509250925092565b600080600080600080600060e0888a03121561191b57600080fd5b61192488611779565b965061193260208901611779565b955060408801359450606088013593506118a860808901611842565b6000806040838503121561196157600080fd5b61196a83611779565b915061183960208401611779565b634e487b7160e01b600052601160045260246000fd5b8082018082111561072e5761072e611978565b63ffffffff8281168282160390808211156119be576119be611978565b5092915050565b8181038181111561072e5761072e611978565b808202811582820484141761072e5761072e611978565b634e487b7160e01b600052601260045260246000fd5b600082611a1457611a146119ef565b500490565b600181811c90821680611a2d57607f821691505b602082108103611a4d57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611a6557600080fd5b5051919050565b63ffffffff8181168382160190808211156119be576119be611978565b600063ffffffff80841680611aa057611aa06119ef565b92169190910492915050565b63ffffffff818116838216028082169190828114611acc57611acc611978565b505092915050565b600080835481600182811c915080831680611af057607f831692505b60208084108203611b0f57634e487b7160e01b86526022600452602486fd5b818015611b235760018114611b3857611b65565b60ff1986168952841515850289019650611b65565b60008a81526020902060005b86811015611b5d5781548b820152908501908301611b44565b505084890196505b50949897505050505050505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212201b82a77a567413574ee09c2f49e5e773f279c060b97cba53deaa654febea5f6064736f6c6343000814003357726170706564205368617265645374616b6520476f7665726e6564204574686572", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102115760003560e01c806375e077c311610125578063bafedcaa116100ad578063d505accf1161007c578063d505accf146104d6578063d905777e146104e9578063dd62ed3e14610512578063e7ff69f11461053d578063ef8b30f71461055457600080fd5b8063bafedcaa1461047e578063c63d75b61461032b578063c6e6f592146104b0578063ce96cb77146104c357600080fd5b806399530b06116100f457806399530b061461042a578063a9059cbb14610432578063b3d7f6b914610445578063b460af9414610458578063ba0876521461046b57600080fd5b806375e077c3146103dc5780637ecebe00146103ef57806394bf804d1461040f57806395d89b411461042257600080fd5b80633644e515116101a85780636917516b116101775780636917516b146103535780636e553f65146103785780636fcf5e5f1461038b57806370a08231146103b257806372c0c211146103d257600080fd5b80633644e515146102e457806338d52e0f146102ec578063402d267d1461032b5780634cdad5061461034057600080fd5b80630a28a477116101e45780630a28a4771461027c57806318160ddd1461028f57806323b872dd14610298578063313ce567146102ab57600080fd5b806301e1d1141461021657806306fdde031461023157806307a2d13a14610246578063095ea7b314610259575b600080fd5b61021e610567565b6040519081526020015b60405180910390f35b61023961060c565b6040516102289190611712565b61021e610254366004611760565b61069a565b61026c610267366004611795565b6106c7565b6040519015158152602001610228565b61021e61028a366004611760565b610734565b61021e60025481565b61026c6102a63660046117bf565b610754565b6102d27f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff9091168152602001610228565b61021e610834565b6103137f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610228565b61021e6103393660046117fb565b5060001990565b61021e61034e366004611760565b61088f565b6006546103639063ffffffff1681565b60405163ffffffff9091168152602001610228565b61021e610386366004611816565b61089a565b6103637f000000000000000000000000000000000000000000000000000000000000000081565b61021e6103c03660046117fb565b60036020526000908152604090205481565b6103da6108d8565b005b61021e6103ea366004611853565b610b30565b61021e6103fd3660046117fb565b60056020526000908152604090205481565b61021e61041d366004611816565b610c00565b610239610c32565b61021e610c3f565b61026c610440366004611795565b610c52565b61021e610453366004611760565b610cb8565b61021e6104663660046118c4565b610cd7565b61021e6104793660046118c4565b610d16565b60065461049890600160401b90046001600160c01b031681565b6040516001600160c01b039091168152602001610228565b61021e6104be366004611760565b610d4a565b61021e6104d13660046117fb565b610d6a565b6103da6104e4366004611900565b610d8c565b61021e6104f73660046117fb565b6001600160a01b031660009081526003602052604090205490565b61021e61052036600461194e565b600460209081526000928352604080842090915290825290205481565b60065461036390600160201b900463ffffffff1681565b61021e610562366004611760565b610fd5565b600754600654600091906001600160c01b03600160401b8204169063ffffffff600160201b8204811691164282116105b5576105ac6001600160c01b0384168561198e565b94505050505090565b60006105c182846119a1565b63ffffffff168263ffffffff16426105d991906119c5565b6105ec906001600160c01b0387166119d8565b6105f69190611a05565b9050610602818661198e565b9550505050505090565b6000805461061990611a19565b80601f016020809104026020016040519081016040528092919081815260200182805461064590611a19565b80156106925780601f1061066757610100808354040283529160200191610692565b820191906000526020600020905b81548152906001019060200180831161067557829003601f168201915b505050505081565b60025460009080156106be576106b96106b1610567565b849083610fe0565b6106c0565b825b9392505050565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107229086815260200190565b60405180910390a35060015b92915050565b60025460009080156106be576106b98161074c610567565b859190610ffe565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146107b05761078b83826119c5565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906107d89084906119c5565b90915550506001600160a01b0380851660008181526003602052604090819020805487019055519091871690600080516020611b74833981519152906108219087815260200190565b60405180910390a3506001949350505050565b60007f0000000000000000000000000000000000000000000000000000000000000000461461086a57610865611024565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b600061072e8261069a565b60006108a46110be565b600654600160201b900463ffffffff1642106108c2576108c26108d8565b6108cc8383611117565b905061072e6001600855565b600654600160401b90046001600160c01b031660006108f6426111f1565b60065490915063ffffffff600160201b9091048116908216101561092d5760405163127d33e760e21b815260040160405180910390fd5b6007546040516370a0823160e01b81523060048201526000906001600160c01b0385169083907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156109a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c89190611a53565b6109d291906119c5565b6109dc91906119c5565b90506109f16001600160c01b0385168361198e565b60075560007f000000000000000000000000000000000000000000000000000000000000000080610a228187611a6c565b610a2c9190611a89565b610a369190611aac565b9050610a6360147f0000000000000000000000000000000000000000000000000000000000000000611a89565b63ffffffff16610a7385836119a1565b63ffffffff161015610aac57610aa97f000000000000000000000000000000000000000000000000000000000000000082611a6c565b90505b610ab582611207565b63ffffffff828116600160201b81026001600160c01b0393909316600160401b0267ffffffffffffffff191691871691909117919091176006556040517f2fa39aac60d1c94cda4ab0e86ae9c0ffab5b926e5b827a4ccba1d9b5b2ef596e90610b219085815260200190565b60405180910390a25050505050565b60008085610b3e5788610b42565b6000195b60405163d505accf60e01b8152336004820152306024820152604481018290526064810189905260ff8716608482015260a4810186905260c481018590529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d505accf9060e401600060405180830381600087803b158015610bd157600080fd5b505af1158015610be5573d6000803e3d6000fd5b50505050610bf3898961089a565b9998505050505050505050565b6000610c0a6110be565b600654600160201b900463ffffffff164210610c2857610c286108d8565b6108cc8383611219565b6001805461061990611a19565b6000610865670de0b6b3a764000061069a565b33600090815260036020526040812080548391908390610c739084906119c5565b90915550506001600160a01b03831660008181526003602052604090819020805485019055513390600080516020611b74833981519152906107229086815260200190565b60025460009080156106be576106b9610ccf610567565b849083610ffe565b6000610ce16110be565b600654600160201b900463ffffffff164210610cff57610cff6108d8565b610d0a8484846112b5565b90506106c06001600855565b600654600090600160201b900463ffffffff164210610d3757610d376108d8565b610d428484846113c3565b949350505050565b60025460009080156106be576106b981610d62610567565b859190610fe0565b6001600160a01b03811660009081526003602052604081205461072e9061069a565b42841015610de15760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b60006001610ded610834565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610ef9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590610f2f5750876001600160a01b0316816001600160a01b0316145b610f6c5760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b6044820152606401610dd8565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b600061072e82610d4a565b6000826000190484118302158202610ff757600080fd5b5091020490565b600082600019048411830215820261101557600080fd5b50910281810615159190040190565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516110569190611ad4565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6002600854036111105760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610dd8565b6002600855565b600061112283610fd5565b9050806000036111625760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f53484152455360a81b6044820152606401610dd8565b6111976001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308661150f565b6111a18282611599565b60408051848152602081018390526001600160a01b0384169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a361072e83826115f3565b6000600160201b821061120357600080fd5b5090565b6000600160c01b821061120357600080fd5b600061122483610cb8565b905061125b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308461150f565b6112658284611599565b60408051828152602081018590526001600160a01b0384169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a361072e81846115f3565b60006112c084610734565b9050336001600160a01b03831614611330576001600160a01b0382166000908152600460209081526040808320338452909152902054600019811461132e5761130982826119c5565b6001600160a01b03841660009081526004602090815260408083203384529091529020555b505b61133a8482611617565b6113448282611632565b60408051858152602081018390526001600160a01b03808516929086169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a46106c06001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168486611694565b6000336001600160a01b03831614611433576001600160a01b038216600090815260046020908152604080832033845290915290205460001981146114315761140c85826119c5565b6001600160a01b03841660009081526004602090815260408083203384529091529020555b505b61143c8461088f565b90508060000361147c5760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f41535345545360a81b6044820152606401610dd8565b6114868185611617565b6114908285611632565b60408051828152602081018690526001600160a01b03808516929086169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a46106c06001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168483611694565b60006040516323b872dd60e01b81528460048201528360248201528260448201526020600060648360008a5af13d15601f3d11600160005114161716915050806115925760405162461bcd60e51b81526020600482015260146024820152731514905394d1915497d19493d357d1905253115160621b6044820152606401610dd8565b5050505050565b80600260008282546115ab919061198e565b90915550506001600160a01b038216600081815260036020908152604080832080548601905551848152600080516020611b7483398151915291015b60405180910390a35050565b8160076000828254611605919061198e565b909155506116139050828282565b5050565b816007600082825461162991906119c5565b90915550505050565b6001600160a01b0382166000908152600360205260408120805483929061165a9084906119c5565b90915550506002805482900390556040518181526000906001600160a01b03841690600080516020611b74833981519152906020016115e7565b600060405163a9059cbb60e01b8152836004820152826024820152602060006044836000895af13d15601f3d116001600051141617169150508061170c5760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610dd8565b50505050565b600060208083528351808285015260005b8181101561173f57858101830151858201604001528201611723565b506000604082860101526040601f19601f8301168501019250505092915050565b60006020828403121561177257600080fd5b5035919050565b80356001600160a01b038116811461179057600080fd5b919050565b600080604083850312156117a857600080fd5b6117b183611779565b946020939093013593505050565b6000806000606084860312156117d457600080fd5b6117dd84611779565b92506117eb60208501611779565b9150604084013590509250925092565b60006020828403121561180d57600080fd5b6106c082611779565b6000806040838503121561182957600080fd5b8235915061183960208401611779565b90509250929050565b803560ff8116811461179057600080fd5b600080600080600080600060e0888a03121561186e57600080fd5b8735965061187e60208901611779565b9550604088013594506060880135801515811461189a57600080fd5b93506118a860808901611842565b925060a0880135915060c0880135905092959891949750929550565b6000806000606084860312156118d957600080fd5b833592506118e960208501611779565b91506118f760408501611779565b90509250925092565b600080600080600080600060e0888a03121561191b57600080fd5b61192488611779565b965061193260208901611779565b955060408801359450606088013593506118a860808901611842565b6000806040838503121561196157600080fd5b61196a83611779565b915061183960208401611779565b634e487b7160e01b600052601160045260246000fd5b8082018082111561072e5761072e611978565b63ffffffff8281168282160390808211156119be576119be611978565b5092915050565b8181038181111561072e5761072e611978565b808202811582820484141761072e5761072e611978565b634e487b7160e01b600052601260045260246000fd5b600082611a1457611a146119ef565b500490565b600181811c90821680611a2d57607f821691505b602082108103611a4d57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611a6557600080fd5b5051919050565b63ffffffff8181168382160190808211156119be576119be611978565b600063ffffffff80841680611aa057611aa06119ef565b92169190910492915050565b63ffffffff818116838216028082169190828114611acc57611acc611978565b505092915050565b600080835481600182811c915080831680611af057607f831692505b60208084108203611b0f57634e487b7160e01b86526022600452602486fd5b818015611b235760018114611b3857611b65565b60ff1986168952841515850289019650611b65565b60008a81526020902060005b86811015611b5d5781548b820152908501908301611b44565b505084890196505b50949897505050505050505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212201b82a77a567413574ee09c2f49e5e773f279c060b97cba53deaa654febea5f6064736f6c63430008140033", @@ -938,7 +935,7 @@ "storageLayout": { "storage": [ { - "astId": 19388, + "astId": 19389, "contract": "contracts/v2/core/WSGEth.sol:WSGETH", "label": "name", "offset": 0, @@ -946,7 +943,7 @@ "type": "t_string_storage" }, { - "astId": 19390, + "astId": 19391, "contract": "contracts/v2/core/WSGEth.sol:WSGETH", "label": "symbol", "offset": 0, @@ -954,7 +951,7 @@ "type": "t_string_storage" }, { - "astId": 19394, + "astId": 19395, "contract": "contracts/v2/core/WSGEth.sol:WSGETH", "label": "totalSupply", "offset": 0, @@ -962,7 +959,7 @@ "type": "t_uint256" }, { - "astId": 19398, + "astId": 19399, "contract": "contracts/v2/core/WSGEth.sol:WSGETH", "label": "balanceOf", "offset": 0, @@ -970,7 +967,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 19404, + "astId": 19405, "contract": "contracts/v2/core/WSGEth.sol:WSGETH", "label": "allowance", "offset": 0, @@ -978,7 +975,7 @@ "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" }, { - "astId": 19412, + "astId": 19413, "contract": "contracts/v2/core/WSGEth.sol:WSGETH", "label": "nonces", "offset": 0, @@ -986,7 +983,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 18068, + "astId": 18069, "contract": "contracts/v2/core/WSGEth.sol:WSGETH", "label": "lastSync", "offset": 0, @@ -994,7 +991,7 @@ "type": "t_uint32" }, { - "astId": 18071, + "astId": 18072, "contract": "contracts/v2/core/WSGEth.sol:WSGETH", "label": "rewardsCycleEnd", "offset": 4, @@ -1002,7 +999,7 @@ "type": "t_uint32" }, { - "astId": 18074, + "astId": 18075, "contract": "contracts/v2/core/WSGEth.sol:WSGETH", "label": "lastRewardAmount", "offset": 8, @@ -1010,7 +1007,7 @@ "type": "t_uint192" }, { - "astId": 18076, + "astId": 18077, "contract": "contracts/v2/core/WSGEth.sol:WSGETH", "label": "storedTotalAssets", "offset": 0, @@ -1068,4 +1065,4 @@ } } } -} \ No newline at end of file +} diff --git a/deployments/sepolia/WithdrawalQueue.json b/deployments/sepolia/WithdrawalQueue.json new file mode 100644 index 0000000..7fb8418 --- /dev/null +++ b/deployments/sepolia/WithdrawalQueue.json @@ -0,0 +1,1095 @@ +{ + "address": "0x93Ec5A17176336C95Bfb537A71130d6eEA6eF73D", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_minter", + "type": "address" + }, + { + "internalType": "address", + "name": "_wsgEth", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_epochLength", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "IsNotPaused", + "type": "error" + }, + { + "inputs": [], + "name": "IsPaused", + "type": "error" + }, + { + "inputs": [], + "name": "PermissionDenied", + "type": "error" + }, + { + "inputs": [], + "name": "TooEarly", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "value", + "type": "bool" + } + ], + "name": "OperatorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "item", + "type": "uint16" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "requester", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "requester", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "RedeemRequest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "item", + "type": "uint16" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINTER", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WSGETH", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "balanceOfSelf", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountToWithdraw", + "type": "uint256" + } + ], + "name": "_checkWithdraw", + "outputs": [ + { + "internalType": "bool", + "name": "withdrawalAllowed", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "balanceOfSelf", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountToWithdraw", + "type": "uint256" + } + ], + "name": "_isWithdrawalAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "claimableRedeemRequest", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epochLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "requester", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isOperator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "pendingRedeemRequest", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "requester", + "type": "address" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "redeemRequests", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "requester", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "requestRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "setEpochLength", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setOperator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "func", + "type": "uint16" + } + ], + "name": "togglePause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssetsOut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userEntries", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blocknum", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x7f49538195ad726a17c61beef02bbb32f4570862e7a071df7eb2441db627b919", + "receipt": { + "to": null, + "from": "0xA120FAd0498ECbF755a675E3833158484123bF30", + "contractAddress": "0x93Ec5A17176336C95Bfb537A71130d6eEA6eF73D", + "transactionIndex": 88, + "gasUsed": "1512469", + "logsBloom": "0x04000004000000000000000000000000000000000000000000000000202000004000000000000000000000000400000000000002000000200000000000240000000000000000000000000000000000000000000000000000000000000000000000000004002100000000000004000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000002021000000000000000000000000040000000000000000000000020000000000100000000000000000010000000000000000000000000000000000000000000000000100000000000", + "blockHash": "0xf49449654e6db27093b8521690a7708f9862c68a0ebb2ea71a7f144e7cf52e55", + "transactionHash": "0x7f49538195ad726a17c61beef02bbb32f4570862e7a071df7eb2441db627b919", + "logs": [ + { + "transactionIndex": 88, + "blockNumber": 6233357, + "transactionHash": "0x7f49538195ad726a17c61beef02bbb32f4570862e7a071df7eb2441db627b919", + "address": "0x514dfd2d10eC6775f030BA2abcf7A2445C0CA6Fb", + "topics": [ + "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "0x00000000000000000000000093ec5a17176336c95bfb537a71130d6eea6ef73d", + "0x00000000000000000000000036c2f00cc7d02be7df0bc9be2a8e08b74c4f2e56" + ], + "data": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "logIndex": 155, + "blockHash": "0xf49449654e6db27093b8521690a7708f9862c68a0ebb2ea71a7f144e7cf52e55" + }, + { + "transactionIndex": 88, + "blockNumber": 6233357, + "transactionHash": "0x7f49538195ad726a17c61beef02bbb32f4570862e7a071df7eb2441db627b919", + "address": "0x93Ec5A17176336C95Bfb537A71130d6eEA6eF73D", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf", + "0x000000000000000000000000a120fad0498ecbf755a675e3833158484123bf30", + "0x000000000000000000000000a120fad0498ecbf755a675e3833158484123bf30" + ], + "data": "0x", + "logIndex": 156, + "blockHash": "0xf49449654e6db27093b8521690a7708f9862c68a0ebb2ea71a7f144e7cf52e55" + } + ], + "blockNumber": 6233357, + "cumulativeGasUsed": "16813131", + "status": 1, + "byzantium": true + }, + "args": ["0x36c2F00cC7D02be7Df0BC9be2a8e08b74C4f2E56", "0x514dfd2d10eC6775f030BA2abcf7A2445C0CA6Fb", 1], + "numDeployments": 1, + "solcInputHash": "b098c02b927c81fd02abb8247583d190", + "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_minter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wsgEth\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_epochLength\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IsNotPaused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IsPaused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PermissionDenied\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooEarly\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"value\",\"type\":\"bool\"}],\"name\":\"OperatorSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"item\",\"type\":\"uint16\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"Redeem\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"name\":\"RedeemRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"item\",\"type\":\"uint16\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GOV\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINTER\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WSGETH\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"balanceOfSelf\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"_checkWithdraw\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"withdrawalAllowed\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"balanceOfSelf\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountToWithdraw\",\"type\":\"uint256\"}],\"name\":\"_isWithdrawalAllowed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"claimableRedeemRequest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"epochLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"pendingRedeemRequest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"}],\"name\":\"redeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"redeemRequests\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"requestRedeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"requestId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"setEpochLength\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"func\",\"type\":\"uint16\"}],\"name\":\"togglePause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalAssetsOut\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"userEntries\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blocknum\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"@ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\",\"details\":\"- ERC-7540 inspired withdrawal contract This contract is designed to be used with SharedDepositMinterV2 contract As a module extension that adds 7540 methods requestRedeem and redeem Example flow -> user calls requestRedeem(user, user, userShares) user calls setOperator(admin OR protocol provided keeper, true) admin can now call redeem on the users behalf if needed after epoch user calls redeem(user, user, userShares) after waiting for epoch Caveats: If the user requests another redemption, before fulfillment, this resets the epoch length clock for their request Basic upgrade path: 1. Call togglePause(1), this disables the requestRedeem fn so no new requests 2. Deploy new contract, direct users to it 3. Fulfill any remaining redeemRequests i.e. totalPendingRequest, for all RedeemRequest events from requestsFulfilled to requestsCreated\",\"events\":{\"Paused(address,uint16)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"},\"Unpaused(address,uint16)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"title\":\"WithdrawalQueue\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/v2/core/WithdrawalQueue.sol\":\"WithdrawalQueue\"},\"evmVersion\":\"paris\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(account),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0dd6e52cb394d7f5abe5dca2d4908a6be40417914720932de757de34a99ab87f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0x6ebf1944ab804b8660eb6fc52f9fe84588cee01c2566a69023e59497e7d27f45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\nimport \\\"../token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n *\\n * _Available since v4.7._\\n */\\ninterface IERC4626 is IERC20, IERC20Metadata {\\n event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed sender,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n *\\n * - MUST be an ERC-20 token contract.\\n * - MUST NOT revert.\\n */\\n function asset() external view returns (address assetTokenAddress);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n *\\n * - SHOULD include any compounding that occurs from yield.\\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT revert.\\n */\\n function totalAssets() external view returns (uint256 totalManagedAssets);\\n\\n /**\\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToShares(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n * through a deposit call.\\n *\\n * - MUST return a limited value if receiver is subject to some deposit limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n * - MUST NOT revert.\\n */\\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\\n * in the same transaction.\\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * deposit execution, and are accounted for during deposit.\\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\\n * - MUST return a limited value if receiver is subject to some mint limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n * - MUST NOT revert.\\n */\\n function maxMint(address receiver) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\\n * same transaction.\\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\\n * would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\\n */\\n function previewMint(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\\n * execution, and are accounted for during mint.\\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0x5a173dcd1c1f0074e4df6a9cdab3257e17f2e64f7b8f30ca9e17a8c5ea250e1c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract Pausable is Context {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n constructor() {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n _requireNotPaused();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n _requirePaused();\\n _;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Throws if the contract is paused.\\n */\\n function _requireNotPaused() internal view virtual {\\n require(!paused(), \\\"Pausable: paused\\\");\\n }\\n\\n /**\\n * @dev Throws if the contract is not paused.\\n */\\n function _requirePaused() internal view virtual {\\n require(paused(), \\\"Pausable: not paused\\\");\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n}\\n\",\"keccak256\":\"0x0849d93b16c9940beb286a7864ed02724b248b93e0d80ef6355af5ef15c64773\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == _ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/v2/core/SharedDepositMinterV2.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.20;\\n\\n/// @title SharedDepositMinterV2 - minter for ETH LSD\\n/// @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\\n// v1 sharedstake veth2 minter with some code removed\\n// user deposits eth to get minted token\\n// The contract cannot move user ETH outside unless\\n// 1. the user redeems 1:1\\n// 2. the depositToEth2 or depositToEth2Batch fns are called which allow moving ETH to the mainnet deposit contract only\\n// 3. The contract allows permissioned external actors to supply validator public keys\\n// 4. Who's allowed to deposit how many validators is governed outside this contract\\n// 5. The ability to provision validators for user ETH is portioned out by the DAO\\n\\n// Changes\\n/**\\n- Custom errors instead of revert strings\\n- Granular management via AccessControl with GOV and NOR roles. Node operator can only deploy validators\\n- Refactored to allow users to specify destination address for fns - for zaps\\n- Added deposit+stake/unstake+withdraw combo convenience routes\\n- Refactored fee calc out to external contract\\n*/\\nimport {IFeeCalc} from \\\"../interfaces/IFeeCalc.sol\\\";\\nimport {IERC20MintableBurnable} from \\\"../interfaces/IERC20MintableBurnable.sol\\\";\\nimport {IERC4626} from \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\n\\nimport {AccessControl} from \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {Pausable} from \\\"@openzeppelin/contracts/security/Pausable.sol\\\";\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport {ETH2DepositWithdrawalCredentials} from \\\"../lib/ETH2DepositWithdrawalCredentials.sol\\\";\\n\\n/// @title SharedDepositMinterV2\\n/// @author ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\\n/// @notice Mints LSD tokens for ETH deposited to the contract. Handles the depositing of ETH to the ETH2 deposit contract and validator creation\\n/// @dev Deployment params: \\n/// - addresses : [feeCalc, sgeth, wsgeth, gov]\\ncontract SharedDepositMinterV2 is AccessControl, Pausable, ReentrancyGuard, ETH2DepositWithdrawalCredentials {\\n /* ========== STATE VARIABLES ========== */\\n uint256 public adminFee;\\n uint256 public numValidators;\\n uint256 public costPerValidator;\\n\\n // The validator shares created by this shared stake contract. 1 share costs >= 1 eth\\n uint256 public curValidatorShares; //initialized to 0\\n\\n // The number of times the deposit to eth2 contract has been called to create validators\\n uint256 public validatorsCreated; //initialized to 0\\n\\n // Total accrued admin fee\\n uint256 public adminFeeTotal; //initialized to 0\\n\\n // Its hard to exactly hit the max deposit amount with small shares. this allows a small bit of overflow room\\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token via a user withdraw\\n uint256 public buffer;\\n\\n // Flash loan tokenomic protection in case of changes in admin fee with future lots\\n bool public refundFeesOnWithdraw; //initialized to false\\n\\n // NEW\\n IERC20MintableBurnable private immutable _SGETH;\\n IERC4626 private immutable _WSGETH;\\n IFeeCalc private _feeCalc;\\n\\n bytes32 public constant NOR = keccak256(\\\"NOR\\\"); // Node operator for deploying validators\\n bytes32 public constant GOV = keccak256(\\\"GOV\\\"); // Governance for settings - normally timelock controlled by multisig\\n\\n //errors\\n error AmountTooHigh();\\n error NoValidators();\\n\\n constructor(\\n uint256 _numValidators,\\n uint256 _adminFee,\\n address[] memory addresses\\n ) AccessControl() Pausable() ReentrancyGuard() ETH2DepositWithdrawalCredentials(addresses[4]) {\\n _feeCalc = IFeeCalc(addresses[0]);\\n _SGETH = IERC20MintableBurnable(addresses[1]);\\n _WSGETH = IERC4626(addresses[2]);\\n\\n _SGETH.approve(address(_WSGETH), 2 ** 256 - 1); // max approve wsgeth for deposit and stake\\n\\n adminFee = _adminFee; // Admin and infra fees\\n numValidators = _numValidators; // The number of validators to create in this lot. Sets a max limit on deposits\\n\\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token\\n buffer = 10 * 1e18; // roughly equal to 10 eth.\\n\\n costPerValidator = (32 * 1e18) + adminFee;\\n\\n _grantRole(NOR, msg.sender);\\n _grantRole(GOV, addresses[3]); // deployer will need it to set withdrawal creds. since the non-custodial withdrawal path depends on the minter.\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n DEPOSIT/WITHDRAWAL LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n // USER INTERACTIONS\\n /*\\n Shares minted = Z\\n Principal deposit input = P\\n AdminFee = a\\n costPerValidator = 32 + a\\n AdminFee as percent in 1e18 = a% = (a / costPerValidator) * 1e18\\n AdminFee on tx in 1e18 = (P * a% / 1e18)\\n\\n on deposit:\\n P - (P * a%) = Z\\n\\n on withdraw with admin fee refund:\\n P = Z / (1 - a%)\\n P = Z - Z*a%\\n */\\n\\n function deposit() external payable {\\n _deposit(msg.sender);\\n }\\n\\n function depositFor(address dest) external payable {\\n _deposit(dest);\\n }\\n\\n function depositAndStake() external payable {\\n _WSGETH.deposit(_deposit(address(this)), msg.sender);\\n }\\n\\n function depositAndStakeFor(address dest) external payable {\\n _WSGETH.deposit(_deposit(address(this)), dest);\\n }\\n\\n function withdraw(uint256 amount) external {\\n _withdraw(amount, msg.sender, msg.sender);\\n }\\n\\n function withdrawTo(uint256 amount, address dest) external {\\n _withdraw(amount, msg.sender, dest);\\n }\\n\\n function unstakeAndWithdraw(uint256 amount, address dest) external {\\n _withdraw(_WSGETH.redeem(amount, address(this), msg.sender), address(this), dest);\\n }\\n\\n // migration function to accept old monies and copy over state\\n // users should not use this as it just donates the money without minting veth or tracking donations\\n function donate() external payable {} // solhint-disable-line\\n\\n /*//////////////////////////////////////////////////////////////\\n ADMIN LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n // Batch deposit eth to the eth2 contract with preset creds\\n // Data needs to be verified offchain to save gas\\n function batchDepositToEth2(\\n bytes[] calldata pubkeys,\\n bytes[] calldata signatures,\\n bytes32[] calldata depositDataRoots\\n ) external onlyRole(NOR) {\\n if (address(this).balance < (_depositAmount * pubkeys.length)) {\\n revert AmountTooHigh(); // Not enough bal in contract to deploy all validators\\n }\\n _batchDeposit(pubkeys, signatures, depositDataRoots);\\n validatorsCreated = validatorsCreated + pubkeys.length;\\n }\\n\\n function setWithdrawalCredential(bytes memory _newWithdrawalCreds) external onlyRole(NOR) {\\n // can only be called once\\n _setWithdrawalCredential(_newWithdrawalCreds);\\n }\\n\\n // Slashes the onchain staked sgETH to mirror CL validator slashings\\n // modifies wsgeth virtual price\\n function slash(uint256 amt) external onlyRole(GOV) {\\n if (amt > curValidatorShares) {\\n revert AmountTooHigh(); // Cannot slash more than minted\\n }\\n _SGETH.burn(address(_WSGETH), amt);\\n }\\n\\n // Set fee calc address. if addr = 0 then fees are assumed to be 0\\n function setFeeCalc(address _feeCalculatorAddr) external onlyRole(GOV) {\\n _feeCalc = IFeeCalc(_feeCalculatorAddr);\\n }\\n\\n function togglePause() external onlyRole(GOV) {\\n bool paused = paused();\\n if (paused) {\\n _unpause();\\n } else {\\n _pause();\\n }\\n }\\n\\n // Used to migrate state over to new contract\\n function migrateShares(uint256 shares) external onlyRole(GOV) {\\n curValidatorShares = shares;\\n }\\n\\n function toggleWithdrawRefund() external onlyRole(GOV) {\\n refundFeesOnWithdraw = !refundFeesOnWithdraw;\\n }\\n\\n function setNumValidators(uint256 _numValidators) external onlyRole(GOV) {\\n if (_numValidators > 0) {\\n numValidators = _numValidators;\\n } else {\\n revert NoValidators();\\n }\\n }\\n\\n function withdrawAdminFee(uint256 amount) external onlyRole(GOV) {\\n address payable sender = payable(msg.sender);\\n if (amount == 0) {\\n amount = adminFeeTotal;\\n }\\n if (amount > adminFeeTotal) {\\n revert AmountTooHigh();\\n }\\n adminFeeTotal = adminFeeTotal - amount;\\n Address.sendValue(sender, amount);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ACCOUNTING LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function remainingSpaceInEpoch() external view returns (uint256) {\\n // Helpful view function to gauge how much the user can send to the contract when it is near full\\n uint256 remainingShares = maxValidatorShares() - curValidatorShares;\\n uint256 valBeforeAdmin = (remainingShares * 1e18) / (((1 * 1e18) - (adminFee * 1e18) / costPerValidator));\\n return valBeforeAdmin;\\n }\\n\\n function maxValidatorShares() public view returns (uint256) {\\n return 32 * 1e18 * numValidators;\\n }\\n\\n function _depositAccounting() internal returns (uint256 value) {\\n // input is whole, not / 1e18 , i.e. in 1 = 1 eth send when from etherscan\\n value = msg.value;\\n uint256 fee;\\n\\n if (address(_feeCalc) != address(0)) {\\n (value, fee) = _feeCalc.processDeposit(value, msg.sender);\\n adminFeeTotal = adminFeeTotal + fee;\\n }\\n\\n uint256 newShareTotal = curValidatorShares + value;\\n\\n if (newShareTotal > buffer + maxValidatorShares()) {\\n revert AmountTooHigh();\\n }\\n curValidatorShares = newShareTotal;\\n }\\n\\n function _withdrawAccounting(uint256 amount) internal returns (uint256) {\\n uint256 fee;\\n if (address(_feeCalc) != address(0)) {\\n (amount, fee) = _feeCalc.processWithdraw(amount, msg.sender);\\n if (refundFeesOnWithdraw) {\\n adminFeeTotal = adminFeeTotal - fee;\\n } else {\\n adminFeeTotal = adminFeeTotal + fee;\\n }\\n }\\n if (address(this).balance < (amount + adminFeeTotal)) {\\n revert AmountTooHigh();\\n }\\n\\n curValidatorShares = curValidatorShares - amount;\\n return amount;\\n }\\n\\n function _deposit(address dest) internal nonReentrant whenNotPaused returns (uint256 amt) {\\n amt = _depositAccounting();\\n _SGETH.mint(dest, amt);\\n }\\n\\n function _withdraw(uint256 amount, address origin, address dest) internal nonReentrant whenNotPaused {\\n _SGETH.burn(origin, amount); // reverts if amount is too high\\n uint256 assets = _withdrawAccounting(amount);\\n\\n address payable recv = payable(dest);\\n Address.sendValue(recv, assets);\\n }\\n\\n receive() external payable {} // solhint-disable-line\\n\\n fallback() external payable {} // solhint-disable-line\\n}\\n\",\"keccak256\":\"0x1ad67e5f7bb03182702d6d249923c1e2c89d84e8071b537814e1f6c79ee7279d\",\"license\":\"BUSL-1.1\"},\"contracts/v2/core/WithdrawalQueue.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\n\\nimport {IERC4626} from \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\nimport {AccessControl} from \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport {FIFOQueue} from \\\"../lib/FIFOQueue.sol\\\";\\nimport {Errors} from \\\"../lib/Errors.sol\\\";\\nimport {OperatorSettable} from \\\"../lib/OperatorSettable.sol\\\";\\nimport {GranularPause} from \\\"../lib/GranularPause.sol\\\";\\nimport {SharedDepositMinterV2} from \\\"./SharedDepositMinterV2.sol\\\";\\n\\n/**\\n * @title WithdrawalQueue\\n * @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\\n * @dev -\\n * ERC-7540 inspired withdrawal contract\\n * This contract is designed to be used with SharedDepositMinterV2 contract\\n * As a module extension that adds 7540 methods requestRedeem and redeem\\n * Example flow ->\\n * user calls requestRedeem(user, user, userShares)\\n * user calls setOperator(admin OR protocol provided keeper, true)\\n * admin can now call redeem on the users behalf if needed after epoch\\n * user calls redeem(user, user, userShares) after waiting for epoch\\n * Caveats:\\n * If the user requests another redemption, before fulfillment,\\n * this resets the epoch length clock for their request\\n * Basic upgrade path:\\n * 1. Call togglePause(1), this disables the requestRedeem fn so no new requests\\n * 2. Deploy new contract, direct users to it\\n * 3. Fulfill any remaining redeemRequests i.e. totalPendingRequest,\\n * for all RedeemRequest events from requestsFulfilled to requestsCreated\\n */\\ncontract WithdrawalQueue is AccessControl, ReentrancyGuard, GranularPause, FIFOQueue, OperatorSettable {\\n using Address for address payable;\\n\\n struct Request {\\n address requester;\\n uint256 shares;\\n }\\n // SharedDepositMinterV2 public immutable MINTER;\\n address public immutable MINTER;\\n address public immutable WSGETH;\\n\\n uint256 internal totalPendingRequest;\\n uint256 internal requestsCreated;\\n uint256 internal requestsFulfilled;\\n uint256 public totalAssetsOut;\\n\\n bytes32 public constant GOV = keccak256(\\\"GOV\\\"); // Governance for settings - normally timelock controlled by multisig\\n\\n mapping(uint256 => Request) internal requests;\\n mapping(address => uint256) public redeemRequests;\\n\\n event RedeemRequest(\\n address indexed requester,\\n address indexed owner,\\n uint256 indexed requestId,\\n address operator,\\n uint256 assets\\n );\\n event Redeem(address indexed requester, address indexed receiver, uint256 shares, uint256 assets);\\n\\n constructor(address _minter, address _wsgEth, uint256 _epochLength) FIFOQueue(_epochLength) {\\n MINTER = _minter;\\n WSGETH = _wsgEth;\\n\\n uint256 maxUint256 = 2 ** 256 - 1;\\n\\n IERC20(WSGETH).approve(_minter, maxUint256);\\n\\n _grantRole(GOV, msg.sender);\\n }\\n\\n function requestRedeem(\\n uint256 shares,\\n address requester,\\n address owner\\n ) external onlyOwnerOrOperator(owner) nonReentrant whenNotPaused(uint16(1)) returns (uint256 requestId) {\\n if (shares == 0) {\\n revert Errors.InvalidAmount();\\n }\\n IERC20(WSGETH).transferFrom(owner, address(this), shares); // asset here is the Vault underlying asset\\n\\n requestId = requestsCreated++;\\n requests[requestId] = Request({requester: requester, shares: shares});\\n // use assets for tracking\\n uint256 assets = IERC4626(WSGETH).previewRedeem(shares);\\n\\n _stakeForWithdrawal(owner, assets);\\n totalPendingRequest += assets;\\n redeemRequests[requester] += assets; // underflow would revert if not enough claimable shares\\n\\n emit RedeemRequest(requester, owner, requestId, msg.sender, shares);\\n }\\n\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address requester\\n ) external onlyOwnerOrOperator(requester) nonReentrant whenNotPaused(uint16(2)) returns (uint256 assets) {\\n if (shares == 0) {\\n revert Errors.InvalidAmount();\\n }\\n\\n assets = IERC4626(WSGETH).previewRedeem(shares);\\n\\n // checks if we have enough assets to fulfill the request and if epoch has passed\\n if (claimableRedeemRequest(requester) < assets) {\\n _checkWithdraw(requester, totalBalance(), assets);\\n return 0; // should never happen. previous fn will generate a rich error\\n }\\n\\n _withdraw(requester, assets);\\n // Treat everything as claimableRedeemRequest and validate here if there's adequate funds\\n redeemRequests[requester] -= assets; // underflow would revert if not enough claimable shares\\n totalPendingRequest -= assets;\\n // Track total returned\\n totalAssetsOut += assets;\\n requestsFulfilled++;\\n\\n uint256 minterBalance = MINTER.balance;\\n // This feels suboptimal, but is the easiest way to always burn the token on redemptions\\n if (assets > minterBalance) {\\n uint256 diff = assets - minterBalance;\\n // We need to use donate/transfer etc. cant deposit and mint more shares as that messes up accouting\\n payable(MINTER).transfer(diff);\\n }\\n\\n // Always burn redeemed tokens\\n SharedDepositMinterV2(payable(MINTER)).unstakeAndWithdraw(shares, receiver);\\n\\n emit Redeem(requester, receiver, shares, assets);\\n }\\n\\n function togglePause(uint16 func) external onlyRole(GOV) {\\n bool paused = paused[func];\\n if (paused) {\\n _unpause(func);\\n } else {\\n _pause(func);\\n }\\n }\\n\\n function setEpochLength(uint256 value) external onlyRole(GOV) {\\n _setEpochLength(value);\\n }\\n\\n function pendingRedeemRequest(address owner) public view returns (uint256 shares) {\\n return redeemRequests[owner];\\n }\\n\\n // claimableRedeemRequest - returns owners shares in claimable state,\\n // i.e. epoch has elapsed and sufficient funds exist\\n function claimableRedeemRequest(address owner) public view returns (uint256 shares) {\\n if (redeemRequests[owner] > 0 && _isWithdrawalAllowed(owner, totalBalance(), redeemRequests[owner])) {\\n return redeemRequests[owner];\\n } else {\\n return 0;\\n }\\n }\\n\\n function totalBalance() internal view returns (uint256) {\\n return address(this).balance + MINTER.balance;\\n }\\n\\n receive() external payable {} // solhint-disable-line\\n\\n fallback() external payable {} // solhint-disable-line\\n}\\n\",\"keccak256\":\"0xcc9b4c773b330c1942e0cac4b96809316c2e68ceb3d49a146cb4747e88afb320\",\"license\":\"BUSL-1.1\"},\"contracts/v2/interfaces/IDepositContract.sol\":{\"content\":\"pragma solidity ^0.8.0;\\n\\n// \\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u250f\\u2513\\u2501\\u250f\\u2513\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2501\\u2501\\u2501\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u2513\\u2501\\n// \\u2503\\u250f\\u2501\\u2501\\u251b\\u250f\\u251b\\u2517\\u2513\\u2503\\u2503\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2517\\u2513\\u250f\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2503\\u250f\\u2501\\u2513\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u2513\\n// \\u2503\\u2517\\u2501\\u2501\\u2513\\u2517\\u2513\\u250f\\u251b\\u2503\\u2517\\u2501\\u2513\\u2517\\u251b\\u250f\\u251b\\u2503\\u2501\\u2501\\u2503\\u2503\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2503\\u2503\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u250f\\u2513\\u2517\\u2513\\u250f\\u251b\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u2517\\u251b\\u250f\\u2501\\u2501\\u2513\\u250f\\u2501\\u2513\\u2501\\u2517\\u2513\\u250f\\u251b\\u250f\\u2501\\u2513\\u250f\\u2501\\u2501\\u2513\\u2501\\u250f\\u2501\\u2501\\u2513\\u2517\\u2513\\u250f\\u251b\\n// \\u2503\\u250f\\u2501\\u2501\\u251b\\u2501\\u2503\\u2503\\u2501\\u2503\\u250f\\u2513\\u2503\\u250f\\u2501\\u251b\\u250f\\u251b\\u2501\\u2501\\u2503\\u2503\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2503\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2503\\u2503\\u2501\\u2501\\u252b\\u2523\\u252b\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u250f\\u2513\\u2503\\u250f\\u2513\\u2503\\u2503\\u250f\\u2513\\u2513\\u2501\\u2503\\u2503\\u2501\\u2503\\u250f\\u251b\\u2517\\u2501\\u2513\\u2503\\u2501\\u2503\\u250f\\u2501\\u251b\\u2501\\u2503\\u2503\\u2501\\n// \\u2503\\u2517\\u2501\\u2501\\u2513\\u2501\\u2503\\u2517\\u2513\\u2503\\u2503\\u2503\\u2503\\u2503\\u2503\\u2517\\u2501\\u2513\\u250f\\u2513\\u2503\\u2517\\u2501\\u251b\\u2503\\u2501\\u2501\\u2501\\u2501\\u250f\\u251b\\u2517\\u251b\\u2503\\u2503\\u2503\\u2501\\u252b\\u2503\\u2517\\u251b\\u2503\\u2503\\u2517\\u251b\\u2503\\u2523\\u2501\\u2501\\u2503\\u2503\\u2503\\u2501\\u2503\\u2517\\u2513\\u2501\\u2501\\u2501\\u2501\\u2503\\u2517\\u2501\\u251b\\u2503\\u2503\\u2517\\u251b\\u2503\\u2503\\u2503\\u2503\\u2503\\u2501\\u2503\\u2517\\u2513\\u2503\\u2503\\u2501\\u2503\\u2517\\u251b\\u2517\\u2513\\u2503\\u2517\\u2501\\u2513\\u2501\\u2503\\u2517\\u2513\\n// \\u2517\\u2501\\u2501\\u2501\\u251b\\u2501\\u2517\\u2501\\u251b\\u2517\\u251b\\u2517\\u251b\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u251b\\u2517\\u2501\\u2501\\u2501\\u251b\\u2501\\u2501\\u2501\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2503\\u250f\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u251b\\u2501\\u2501\\u2501\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2517\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u251b\\u2517\\u251b\\u2501\\u2517\\u2501\\u2501\\u2501\\u251b\\u2517\\u2501\\u2501\\u251b\\u2501\\u2517\\u2501\\u251b\\n// \\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2503\\u2503\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\n// \\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2517\\u251b\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\u2501\\n\\n// SPDX-License-Identifier: CC0-1.0\\n\\n// This interface is designed to be compatible with the Vyper version.\\n/// @notice This is the Ethereum 2.0 deposit contract interface.\\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\\ninterface IDepositContract {\\n /// @notice A processed deposit event.\\n event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);\\n\\n /// @notice Submit a Phase 0 DepositData object.\\n /// @param pubkey A BLS12-381 public key.\\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\\n /// @param signature A BLS12-381 signature.\\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\\n /// Used as a protection against malformed input.\\n function deposit(\\n bytes calldata pubkey,\\n bytes calldata withdrawal_credentials,\\n bytes calldata signature,\\n bytes32 deposit_data_root\\n ) external payable;\\n\\n /// @notice Query the current deposit root hash.\\n /// @return The deposit root hash.\\n function get_deposit_root() external view returns (bytes32);\\n\\n /// @notice Query the current deposit count.\\n /// @return The deposit count encoded as a little endian 64-bit number.\\n function get_deposit_count() external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xe2089e69dbf1fb4940e4dffcdb10524418a40b6e9529b72cb83f2e921fb08e3f\",\"license\":\"CC0-1.0\"},\"contracts/v2/interfaces/IERC20MintableBurnable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\ninterface IERC20MintableBurnable {\\n function mintingAllowedAfter() external view returns (uint256);\\n\\n /**\\n * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`\\n * @param account The address of the account holding the funds\\n * @param spender The address of the account spending the funds\\n * @return The number of tokens approved\\n */\\n function allowance(address account, address spender) external view returns (uint256);\\n\\n /**\\n * @notice Get the number of tokens held by the `account`\\n * @param account The address of the account to get the balance of\\n * @return The number of tokens held\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @notice Approve `spender` to transfer up to `amount` from `src`\\n * @dev This will overwrite the approval amount for `spender`\\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\\n * @param spender The address of the account which may transfer tokens\\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\\n * @return Whether or not the approval succeeded\\n */\\n function approve(address spender, uint256 rawAmount) external returns (bool);\\n\\n /**\\n * @notice Triggers an approval from owner to spends\\n * @param owner The address to approve from\\n * @param spender The address to be approved\\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\\n * @param deadline The time at which to expire the signature\\n * @param v The recovery byte of the signature\\n * @param r Half of the ECDSA signature pair\\n * @param s Half of the ECDSA signature pair\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 rawAmount,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\\n * @param dst The address of the destination account\\n * @param rawAmount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n function transfer(address dst, uint256 rawAmount) external returns (bool);\\n\\n /**\\n * @notice Transfer `amount` tokens from `src` to `dst`\\n * @param src The address of the source account\\n * @param dst The address of the destination account\\n * @param rawAmount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n function transferFrom(address src, address dst, uint256 rawAmount) external returns (bool);\\n\\n /**\\n * @notice Mint new tokens\\n * @param dst The address of the destination account\\n * @param rawAmount The number of tokens to be minted\\n */\\n function mint(address dst, uint256 rawAmount) external;\\n\\n function burn(address src, uint256 rawAmount) external;\\n function setMinter(address minter_) external;\\n}\\n\",\"keccak256\":\"0x2fcd50fd565019546be3412013205df119fe96fdca5bb152229b70fb4ec1169b\",\"license\":\"UNLICENSED\"},\"contracts/v2/interfaces/IFeeCalc.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\ninterface IFeeCalc {\\n function processDeposit(uint256 amt, address who) external view returns (uint256, uint256);\\n\\n function processWithdraw(uint256 amt, address who) external view returns (uint256, uint256);\\n}\\n\",\"keccak256\":\"0x2391271eeaf9baaa39edf4dc69b057824db52b0b87474680ca0b71c25a6b0550\",\"license\":\"UNLICENSED\"},\"contracts/v2/lib/ETH2DepositWithdrawalCredentials.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\n\\nimport {IDepositContract} from \\\"../interfaces/IDepositContract.sol\\\";\\n\\n/// @title A contract for holding a eth2 validator withrawal pubkey\\n/// @author @chimeraDefi\\n/// @notice A contract for holding a eth2 validator withrawal pubkey\\n/// @dev Downstream contract needs to implement who can set the withdrawal address and set it\\ncontract ETH2DepositWithdrawalCredentials {\\n uint256 internal constant _depositAmount = 32 ether;\\n IDepositContract public immutable DEPOSIT_CONTRACT;\\n bytes public withdrawalPubKey; // Pubkey for ETH 2.0 withdrawal creds\\n\\n event WithdrawalCredentialSet(bytes _withdrawalCredential);\\n\\n constructor(address _dc) {\\n DEPOSIT_CONTRACT = IDepositContract(_dc);\\n }\\n\\n /// @notice A more streamlined variant of batch deposit for use with preset withdrawal addresses\\n /// Submit index-matching arrays that form Phase 0 DepositData objects.\\n /// Will create a deposit transaction per index of the arrays submitted.\\n ///\\n /// @param pubkeys - An array of BLS12-381 public keys.\\n /// @param signatures - An array of BLS12-381 signatures.\\n /// @param depositDataRoots - An array of the SHA-256 hash of the SSZ-encoded DepositData object.\\n function _batchDeposit(\\n bytes[] calldata pubkeys,\\n bytes[] calldata signatures,\\n bytes32[] calldata depositDataRoots\\n ) internal {\\n // optimizations https://ethereum.stackexchange.com/questions/113221/what-is-the-purpose-of-unchecked-in-solidity\\n // https://medium.com/@bloqarl/solidity-gas-optimization-tips-with-assembly-you-havent-heard-yet-1381c77ff078\\n // 30m gas / block roughly, say 10m max used so 100 validators a batch max \\n // each deposit call costs roughly 128k https://etherscan.io/tx/0xa2acf6e6bde99b532125cc8026cd88eea345f296968ce732556945ab4705d03e\\n uint256 i = pubkeys.length;\\n uint256 _amt = _depositAmount;\\n bytes memory wpk = withdrawalPubKey;\\n\\n while (i > 0) {\\n unchecked {\\n // While loop check prevents underflow.\\n // --i is cheaper than i--\\n // reverse while loop cheapest compared to while or for \\n // Since we set the upper loop bound to the arr len, we decr 1st to not hit out of bounds\\n --i;\\n\\n DEPOSIT_CONTRACT.deposit{value: _amt}(\\n pubkeys[i],\\n wpk,\\n signatures[i],\\n depositDataRoots[i]\\n );\\n }\\n }\\n }\\n\\n /// @notice sets curr_withdrawal_pubkey to be used when deploying validators\\n function _setWithdrawalCredential(bytes memory newPk) internal {\\n withdrawalPubKey = newPk;\\n\\n emit WithdrawalCredentialSet(newPk);\\n }\\n}\\n\",\"keccak256\":\"0x0ebea7361fe05b3b8eb90b0dde098d2d93a994e54d9e498dcba951735de53a56\",\"license\":\"BUSL-1.1\"},\"contracts/v2/lib/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\n\\n/**\\n * @title Errors\\n * @author Sharedstake\\n * @notice Contains all the custom errors\\n */\\nlibrary Errors {\\n error ZeroAddress();\\n error InvalidAmount();\\n error PermissionDenied();\\n error InsufficientBalance();\\n error TooEarly();\\n error FailedCall();\\n}\\n\",\"keccak256\":\"0x5fd673f73b02e0db4a39a9fb8c1aeecc7e88d24cdf895cdee6a40c8e728be75a\",\"license\":\"BUSL-1.1\"},\"contracts/v2/lib/FIFOQueue.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\n\\nimport {Errors} from \\\"./Errors.sol\\\";\\n\\n// Simple First in first out queue\\n// Uses a system of cascading locks based on the block number.\\n// Users need to wait a minimum of epochLength blocks before withdrawing\\n// Users past the epoch boundary can claim, allowing some time for earlier users to claim first\\nabstract contract FIFOQueue {\\n struct UserEntry {\\n uint256 amount;\\n uint256 blocknum;\\n }\\n mapping(address => UserEntry) public userEntries;\\n\\n uint256 public epochLength;\\n\\n constructor(uint256 _epochLength) {\\n epochLength = _epochLength;\\n }\\n\\n function _checkWithdraw(\\n address sender,\\n uint256 balanceOfSelf,\\n uint256 amountToWithdraw\\n ) public view returns (bool withdrawalAllowed) {\\n UserEntry memory ue = userEntries[sender];\\n\\n if (!(amountToWithdraw <= balanceOfSelf && amountToWithdraw <= ue.amount)) {\\n revert Errors.InvalidAmount();\\n }\\n\\n if (!(block.number >= ue.blocknum + epochLength)) {\\n revert Errors.TooEarly();\\n }\\n return true;\\n }\\n\\n function _isWithdrawalAllowed(\\n address sender,\\n uint256 balanceOfSelf,\\n uint256 amountToWithdraw\\n ) public view returns (bool) {\\n UserEntry memory ue = userEntries[sender];\\n\\n return (amountToWithdraw <= balanceOfSelf && amountToWithdraw <= ue.amount) && (block.number >= ue.blocknum + epochLength);\\n }\\n\\n // should be admin only or used in a constructor upstream\\n // set epoch length in blocks\\n function _setEpochLength(uint256 _value) internal {\\n if (_value == 0) {\\n revert Errors.InvalidAmount();\\n }\\n epochLength = _value;\\n }\\n\\n function _stakeForWithdrawal(address sender, uint256 amount) internal {\\n UserEntry memory ue = userEntries[sender];\\n ue.amount = ue.amount + amount;\\n ue.blocknum = block.number;\\n userEntries[sender] = ue;\\n }\\n\\n function _withdraw(address sender, uint256 amount) internal {\\n UserEntry memory ue = userEntries[sender];\\n if (amount > ue.amount) {\\n revert Errors.InvalidAmount();\\n }\\n\\n if (amount == ue.amount) {\\n delete userEntries[sender];\\n } else {\\n ue.amount = ue.amount - amount;\\n ue.blocknum = block.number;\\n userEntries[sender] = ue;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7475970bd9b373e9a671b090676a143db81e57f498352bbb9d1ac9a50d5b8d02\",\"license\":\"BUSL-1.1\"},\"contracts/v2/lib/GranularPause.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\nimport {Context} from \\\"@openzeppelin/contracts/utils/Context.sol\\\";\\n\\n/// @title GranularPause \\n/// @author ChimeraDefi - chimera_defi@protonmail.com\\n/// @notice allows more granular control of pausing functions\\n/// @dev Inherit in child contract, you need to number each function you want to pause\\n\\nabstract contract GranularPause is Context {\\n mapping(uint16 => bool) public paused;\\n\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account, uint16 item);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account, uint16 item);\\n\\n error IsPaused();\\n error IsNotPaused();\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused(uint16 _id) {\\n if (paused[_id]) {\\n revert IsPaused();\\n }\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused(uint16 _id) {\\n if (!paused[_id]) {\\n revert IsNotPaused();\\n }\\n _;\\n }\\n\\n /// @notice pauses a function\\n /// @param _id id of function to pause\\n function _pause(uint16 _id) internal virtual {\\n paused[_id] = true;\\n emit Paused(_msgSender(), _id);\\n }\\n\\n /// @notice unpauses a function\\n /// @param _id id of function to unpause\\n function _unpause(uint16 _id) internal virtual {\\n paused[_id] = false;\\n emit Unpaused(_msgSender(), _id);\\n }\\n}\\n\\n\",\"keccak256\":\"0x49069f2e183ef89b36245e2905afda4a49274f1f1d189510b80939659a6d8988\",\"license\":\"BUSL-1.1\"},\"contracts/v2/lib/OperatorSettable.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.20;\\nimport {Errors} from \\\"./Errors.sol\\\";\\n\\n/**\\n * @title OperatorSettable\\n * @author Sharedstake\\n * @notice Handles operators for ERC-7450 like contracts\\n */\\nabstract contract OperatorSettable {\\n mapping(address requester => mapping(address operator => bool)) public isOperator;\\n event OperatorSet(address indexed owner, address indexed operator, bool value);\\n\\n modifier onlyOwnerOrOperator(address owner) {\\n if (owner != msg.sender && !isOperator[owner][msg.sender]) {\\n revert Errors.PermissionDenied();\\n }\\n _;\\n }\\n\\n function setOperator(address operator, bool approved) external returns (bool) {\\n isOperator[msg.sender][operator] = approved;\\n emit OperatorSet(msg.sender, operator, approved);\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0xc45fe8bc3a1c1b2da225e27f82e4dd95b5a4143b6a291167deb45e20d72269d6\",\"license\":\"BUSL-1.1\"}},\"version\":1}", + "bytecode": "0x60c06040523480156200001157600080fd5b5060405162001b0038038062001b008339810160408190526200003491620001b8565b6001805560048181556001600160a01b03848116608081905290841660a081905260405163095ea7b360e01b815292830191909152600019602483018190529163095ea7b3906044016020604051808303816000875af11580156200009d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000c39190620001f9565b50620000f07f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf33620000fa565b5050505062000224565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000197576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001563390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b0381168114620001b357600080fd5b919050565b600080600060608486031215620001ce57600080fd5b620001d9846200019b565b9250620001e9602085016200019b565b9150604084015190509250925092565b6000602082840312156200020c57600080fd5b815180151581146200021d57600080fd5b9392505050565b60805160a0516118856200027b600039600081816104940152818161092701528181610a0b0152610c3b01526000818161054001528181610d6401528181610da901528181610e1b0152610f9c01526118856000f3fe60806040526004361061015a5760003560e01c80637a6f12ff116100c8578063a217fddf11610084578063ba08765211610061578063ba087652146104ce578063d4b825a7146104ee578063d547741f1461050e578063fe6d81241461052e57005b8063a217fddf14610432578063b6363cf214610447578063b8902ff71461048257005b80637a6f12ff146103465780637ce7eada1461035c5780637d41c86e1461037c5780638d158c2a1461039c57806391d14854146103c95780639f10a990146103e957005b806336568abe1161011757806336568abe1461027a57806353dc1dd31461029a57806354eea796146102d0578063558a7297146102f057806357d775f8146103105780636e8b2bb81461032657005b806288d3e51461016357806301ffc9a714610196578063180cb47f146101c6578063248a9ca3146101fa5780632f2ff15d1461022a5780633375ed6b1461024a57005b3661016157005b005b34801561016f57600080fd5b5061018361017e366004611512565b610562565b6040519081526020015b60405180910390f35b3480156101a257600080fd5b506101b66101b136600461152d565b6105dc565b604051901515815260200161018d565b3480156101d257600080fd5b506101837f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf81565b34801561020657600080fd5b50610183610215366004611557565b60009081526020819052604090206001015490565b34801561023657600080fd5b50610161610245366004611570565b610613565b34801561025657600080fd5b506101b661026536600461159c565b60026020526000908152604090205460ff1681565b34801561028657600080fd5b50610161610295366004611570565b61063d565b3480156102a657600080fd5b506101836102b5366004611512565b6001600160a01b03166000908152600b602052604090205490565b3480156102dc57600080fd5b506101616102eb366004611557565b6106c0565b3480156102fc57600080fd5b506101b661030b3660046115ce565b6106f3565b34801561031c57600080fd5b5061018360045481565b34801561033257600080fd5b506101b6610341366004611605565b610763565b34801561035257600080fd5b5061018360095481565b34801561036857600080fd5b5061016161037736600461159c565b6107cc565b34801561038857600080fd5b50610183610397366004611638565b610825565b3480156103a857600080fd5b506101836103b7366004611512565b600b6020526000908152604090205481565b3480156103d557600080fd5b506101b66103e4366004611570565b610b26565b3480156103f557600080fd5b5061041d610404366004611512565b6003602052600090815260409020805460019091015482565b6040805192835260208301919091520161018d565b34801561043e57600080fd5b50610183600081565b34801561045357600080fd5b506101b6610462366004611674565b600560209081526000928352604080842090915290825290205460ff1681565b34801561048e57600080fd5b506104b67f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161018d565b3480156104da57600080fd5b506101836104e9366004611638565b610b4f565b3480156104fa57600080fd5b506101b6610509366004611605565b610ecb565b34801561051a57600080fd5b50610161610529366004611570565b610f68565b34801561053a57600080fd5b506104b67f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b0381166000908152600b6020526040812054158015906105ae57506105ae82610590610f8d565b6001600160a01b0385166000908152600b6020526040902054610763565b156105cf57506001600160a01b03166000908152600b602052604090205490565b506000919050565b919050565b60006001600160e01b03198216637965db0b60e01b148061060d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60008281526020819052604090206001015461062e81610fc8565b6106388383610fd5565b505050565b6001600160a01b03811633146106b25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106bc8282611059565b5050565b7f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf6106ea81610fc8565b6106bc826110be565b3360008181526005602090815260408083206001600160a01b038716808552908352818420805460ff191687151590811790915591519182529293917fceb576d9f15e4e200fdb5096d64d5dfd667e16def20c1eefd14256d8e3faa267910160405180910390a350600192915050565b6001600160a01b038316600090815260036020908152604080832081518083019092528054825260010154918101919091528383118015906107a6575080518311155b80156107c3575060045481602001516107bf91906116b4565b4310155b95945050505050565b7f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf6107f681610fc8565b61ffff821660009081526002602052604090205460ff16801561081c57610638836110e4565b61063883611149565b6000816001600160a01b038116331480159061086557506001600160a01b038116600090815260056020908152604080832033845290915290205460ff16155b1561088357604051630782484160e21b815260040160405180910390fd5b61088b61118f565b6001600081905260026020527fe90b7bceb6e7df5418fb78d8ee546e97c83a08bbccc01a0644d599ccd2a7c2e05460ff16156108da57604051631309a56360e01b815260040160405180910390fd5b856000036108fb5760405163162908e360e11b815260040160405180910390fd5b6040516323b872dd60e01b81526001600160a01b038581166004830152306024830152604482018890527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064016020604051808303816000875af1158015610970573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099491906116c7565b50600780549060006109a5836116e4565b909155506040805180820182526001600160a01b03888116825260208083018b81526000868152600a909252848220935184546001600160a01b03191690841617845551600190930192909255915163266d6a8360e11b8152600481018a9052929550917f000000000000000000000000000000000000000000000000000000000000000090911690634cdad50690602401602060405180830381865afa158015610a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7891906116fd565b9050610a8485826111e8565b8060066000828254610a9691906116b4565b90915550506001600160a01b0386166000908152600b602052604081208054839290610ac39084906116b4565b9091555050604080513381526020810189905285916001600160a01b0380891692908a16917f1fdc681a13d8c5da54e301c7ce6542dcde4581e4725043fdab2db12ddc574506910160405180910390a45050610b1e60018055565b509392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000816001600160a01b0381163314801590610b8f57506001600160a01b038116600090815260056020908152604080832033845290915290205460ff16155b15610bad57604051630782484160e21b815260040160405180910390fd5b610bb561118f565b6002600081905260208190527f679795a0195a1b76cdebb7c51d74e058aee92919b8c3389af86ef24535e8a28c5460ff1615610c0457604051631309a56360e01b815260040160405180910390fd5b85600003610c255760405163162908e360e11b815260040160405180910390fd5b60405163266d6a8360e11b8152600481018790527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634cdad50690602401602060405180830381865afa158015610c8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cae91906116fd565b925082610cba85610562565b1015610cdc57610cd284610ccc610f8d565b85610ecb565b5060009250610ec1565b610ce68484611260565b6001600160a01b0384166000908152600b602052604081208054859290610d0e908490611716565b925050819055508260066000828254610d279190611716565b925050819055508260096000828254610d4091906116b4565b909155505060088054906000610d55836116e4565b90915550506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163180841115610df5576000610d998286611716565b6040519091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169082156108fc029083906000818181858888f19350505050158015610df2573d6000803e3d6000fd5b50505b60405163566110b560e11b8152600481018890526001600160a01b0387811660248301527f0000000000000000000000000000000000000000000000000000000000000000169063acc2216a90604401600060405180830381600087803b158015610e5f57600080fd5b505af1158015610e73573d6000803e3d6000fd5b5050604080518a8152602081018890526001600160a01b03808b169450891692507f3f693fff038bb8a046aa76d9516190ac7444f7d69cf952c4cbdc086fdef2d6fc910160405180910390a3505b50610b1e60018055565b6001600160a01b03831660009081526003602090815260408083208151808301909252805482526001015491810191909152838311801590610f0e575080518311155b610f2b5760405163162908e360e11b815260040160405180910390fd5b6004548160200151610f3d91906116b4565b431015610f5d5760405163085de62560e01b815260040160405180910390fd5b506001949350505050565b600082815260208190526040902060010154610f8381610fc8565b6106388383611059565b6000610fc36001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001631476116b4565b905090565b610fd281336112ed565b50565b610fdf8282610b26565b6106bc576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556110153390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6110638282610b26565b156106bc576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b806000036110df5760405163162908e360e11b815260040160405180910390fd5b600455565b61ffff81166000908152600260205260409020805460ff191690557ffecc441e78e32a5c28004d47baebe659faee4271cbb13a7c05457fed0c771232335b604080516001600160a01b03909216825261ffff841660208301520160405180910390a150565b61ffff81166000908152600260205260409020805460ff191660011790557f38eb43248f2146c7882ffb321eebe73c10ee8fc9fe3a42102dd07937caba4f536111223390565b6002600154036111e15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106a9565b6002600155565b6001600160a01b03821660009081526003602090815260409182902082518084019093528054808452600190910154918301919091526112299083906116b4565b81524360208083019182526001600160a01b0390941660009081526003909452604090932090518155915160019092019190915550565b6001600160a01b03821660009081526003602090815260409182902082518084019093528054808452600190910154918301919091528211156112b65760405163162908e360e11b815260040160405180910390fd5b805182036112e05750506001600160a01b0316600090815260036020526040812081815560010155565b8051611229908390611716565b6112f78282610b26565b6106bc5761130481611346565b61130f836020611358565b60405160200161132092919061174d565b60408051601f198184030181529082905262461bcd60e51b82526106a9916004016117c2565b606061060d6001600160a01b03831660145b606060006113678360026117f5565b6113729060026116b4565b67ffffffffffffffff81111561138a5761138a61180c565b6040519080825280601f01601f1916602001820160405280156113b4576020820181803683370190505b509050600360fc1b816000815181106113cf576113cf611822565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106113fe576113fe611822565b60200101906001600160f81b031916908160001a90535060006114228460026117f5565b61142d9060016116b4565b90505b60018111156114a5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061146157611461611822565b1a60f81b82828151811061147757611477611822565b60200101906001600160f81b031916908160001a90535060049490941c9361149e81611838565b9050611430565b5083156114f45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106a9565b9392505050565b80356001600160a01b03811681146105d757600080fd5b60006020828403121561152457600080fd5b6114f4826114fb565b60006020828403121561153f57600080fd5b81356001600160e01b0319811681146114f457600080fd5b60006020828403121561156957600080fd5b5035919050565b6000806040838503121561158357600080fd5b82359150611593602084016114fb565b90509250929050565b6000602082840312156115ae57600080fd5b813561ffff811681146114f457600080fd5b8015158114610fd257600080fd5b600080604083850312156115e157600080fd5b6115ea836114fb565b915060208301356115fa816115c0565b809150509250929050565b60008060006060848603121561161a57600080fd5b611623846114fb565b95602085013595506040909401359392505050565b60008060006060848603121561164d57600080fd5b8335925061165d602085016114fb565b915061166b604085016114fb565b90509250925092565b6000806040838503121561168757600080fd5b611690836114fb565b9150611593602084016114fb565b634e487b7160e01b600052601160045260246000fd5b8082018082111561060d5761060d61169e565b6000602082840312156116d957600080fd5b81516114f4816115c0565b6000600182016116f6576116f661169e565b5060010190565b60006020828403121561170f57600080fd5b5051919050565b8181038181111561060d5761060d61169e565b60005b8381101561174457818101518382015260200161172c565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611785816017850160208801611729565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516117b6816028840160208801611729565b01602801949350505050565b60208152600082518060208401526117e1816040850160208701611729565b601f01601f19169190910160400192915050565b808202811582820484141761060d5761060d61169e565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816118475761184761169e565b50600019019056fea2646970667358221220254bd4aab919e8b255f1c139b44e4faa367bfd74ea9bf9d25d82d0c3e7cc385f64736f6c63430008140033", + "deployedBytecode": "0x60806040526004361061015a5760003560e01c80637a6f12ff116100c8578063a217fddf11610084578063ba08765211610061578063ba087652146104ce578063d4b825a7146104ee578063d547741f1461050e578063fe6d81241461052e57005b8063a217fddf14610432578063b6363cf214610447578063b8902ff71461048257005b80637a6f12ff146103465780637ce7eada1461035c5780637d41c86e1461037c5780638d158c2a1461039c57806391d14854146103c95780639f10a990146103e957005b806336568abe1161011757806336568abe1461027a57806353dc1dd31461029a57806354eea796146102d0578063558a7297146102f057806357d775f8146103105780636e8b2bb81461032657005b806288d3e51461016357806301ffc9a714610196578063180cb47f146101c6578063248a9ca3146101fa5780632f2ff15d1461022a5780633375ed6b1461024a57005b3661016157005b005b34801561016f57600080fd5b5061018361017e366004611512565b610562565b6040519081526020015b60405180910390f35b3480156101a257600080fd5b506101b66101b136600461152d565b6105dc565b604051901515815260200161018d565b3480156101d257600080fd5b506101837f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf81565b34801561020657600080fd5b50610183610215366004611557565b60009081526020819052604090206001015490565b34801561023657600080fd5b50610161610245366004611570565b610613565b34801561025657600080fd5b506101b661026536600461159c565b60026020526000908152604090205460ff1681565b34801561028657600080fd5b50610161610295366004611570565b61063d565b3480156102a657600080fd5b506101836102b5366004611512565b6001600160a01b03166000908152600b602052604090205490565b3480156102dc57600080fd5b506101616102eb366004611557565b6106c0565b3480156102fc57600080fd5b506101b661030b3660046115ce565b6106f3565b34801561031c57600080fd5b5061018360045481565b34801561033257600080fd5b506101b6610341366004611605565b610763565b34801561035257600080fd5b5061018360095481565b34801561036857600080fd5b5061016161037736600461159c565b6107cc565b34801561038857600080fd5b50610183610397366004611638565b610825565b3480156103a857600080fd5b506101836103b7366004611512565b600b6020526000908152604090205481565b3480156103d557600080fd5b506101b66103e4366004611570565b610b26565b3480156103f557600080fd5b5061041d610404366004611512565b6003602052600090815260409020805460019091015482565b6040805192835260208301919091520161018d565b34801561043e57600080fd5b50610183600081565b34801561045357600080fd5b506101b6610462366004611674565b600560209081526000928352604080842090915290825290205460ff1681565b34801561048e57600080fd5b506104b67f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161018d565b3480156104da57600080fd5b506101836104e9366004611638565b610b4f565b3480156104fa57600080fd5b506101b6610509366004611605565b610ecb565b34801561051a57600080fd5b50610161610529366004611570565b610f68565b34801561053a57600080fd5b506104b67f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b0381166000908152600b6020526040812054158015906105ae57506105ae82610590610f8d565b6001600160a01b0385166000908152600b6020526040902054610763565b156105cf57506001600160a01b03166000908152600b602052604090205490565b506000919050565b919050565b60006001600160e01b03198216637965db0b60e01b148061060d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60008281526020819052604090206001015461062e81610fc8565b6106388383610fd5565b505050565b6001600160a01b03811633146106b25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106bc8282611059565b5050565b7f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf6106ea81610fc8565b6106bc826110be565b3360008181526005602090815260408083206001600160a01b038716808552908352818420805460ff191687151590811790915591519182529293917fceb576d9f15e4e200fdb5096d64d5dfd667e16def20c1eefd14256d8e3faa267910160405180910390a350600192915050565b6001600160a01b038316600090815260036020908152604080832081518083019092528054825260010154918101919091528383118015906107a6575080518311155b80156107c3575060045481602001516107bf91906116b4565b4310155b95945050505050565b7f8eeeb5290718f324aa0965d35cf24b6163c00698ab277824ce00bdf229264ecf6107f681610fc8565b61ffff821660009081526002602052604090205460ff16801561081c57610638836110e4565b61063883611149565b6000816001600160a01b038116331480159061086557506001600160a01b038116600090815260056020908152604080832033845290915290205460ff16155b1561088357604051630782484160e21b815260040160405180910390fd5b61088b61118f565b6001600081905260026020527fe90b7bceb6e7df5418fb78d8ee546e97c83a08bbccc01a0644d599ccd2a7c2e05460ff16156108da57604051631309a56360e01b815260040160405180910390fd5b856000036108fb5760405163162908e360e11b815260040160405180910390fd5b6040516323b872dd60e01b81526001600160a01b038581166004830152306024830152604482018890527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064016020604051808303816000875af1158015610970573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099491906116c7565b50600780549060006109a5836116e4565b909155506040805180820182526001600160a01b03888116825260208083018b81526000868152600a909252848220935184546001600160a01b03191690841617845551600190930192909255915163266d6a8360e11b8152600481018a9052929550917f000000000000000000000000000000000000000000000000000000000000000090911690634cdad50690602401602060405180830381865afa158015610a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7891906116fd565b9050610a8485826111e8565b8060066000828254610a9691906116b4565b90915550506001600160a01b0386166000908152600b602052604081208054839290610ac39084906116b4565b9091555050604080513381526020810189905285916001600160a01b0380891692908a16917f1fdc681a13d8c5da54e301c7ce6542dcde4581e4725043fdab2db12ddc574506910160405180910390a45050610b1e60018055565b509392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000816001600160a01b0381163314801590610b8f57506001600160a01b038116600090815260056020908152604080832033845290915290205460ff16155b15610bad57604051630782484160e21b815260040160405180910390fd5b610bb561118f565b6002600081905260208190527f679795a0195a1b76cdebb7c51d74e058aee92919b8c3389af86ef24535e8a28c5460ff1615610c0457604051631309a56360e01b815260040160405180910390fd5b85600003610c255760405163162908e360e11b815260040160405180910390fd5b60405163266d6a8360e11b8152600481018790527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634cdad50690602401602060405180830381865afa158015610c8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cae91906116fd565b925082610cba85610562565b1015610cdc57610cd284610ccc610f8d565b85610ecb565b5060009250610ec1565b610ce68484611260565b6001600160a01b0384166000908152600b602052604081208054859290610d0e908490611716565b925050819055508260066000828254610d279190611716565b925050819055508260096000828254610d4091906116b4565b909155505060088054906000610d55836116e4565b90915550506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163180841115610df5576000610d998286611716565b6040519091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169082156108fc029083906000818181858888f19350505050158015610df2573d6000803e3d6000fd5b50505b60405163566110b560e11b8152600481018890526001600160a01b0387811660248301527f0000000000000000000000000000000000000000000000000000000000000000169063acc2216a90604401600060405180830381600087803b158015610e5f57600080fd5b505af1158015610e73573d6000803e3d6000fd5b5050604080518a8152602081018890526001600160a01b03808b169450891692507f3f693fff038bb8a046aa76d9516190ac7444f7d69cf952c4cbdc086fdef2d6fc910160405180910390a3505b50610b1e60018055565b6001600160a01b03831660009081526003602090815260408083208151808301909252805482526001015491810191909152838311801590610f0e575080518311155b610f2b5760405163162908e360e11b815260040160405180910390fd5b6004548160200151610f3d91906116b4565b431015610f5d5760405163085de62560e01b815260040160405180910390fd5b506001949350505050565b600082815260208190526040902060010154610f8381610fc8565b6106388383611059565b6000610fc36001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001631476116b4565b905090565b610fd281336112ed565b50565b610fdf8282610b26565b6106bc576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556110153390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6110638282610b26565b156106bc576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b806000036110df5760405163162908e360e11b815260040160405180910390fd5b600455565b61ffff81166000908152600260205260409020805460ff191690557ffecc441e78e32a5c28004d47baebe659faee4271cbb13a7c05457fed0c771232335b604080516001600160a01b03909216825261ffff841660208301520160405180910390a150565b61ffff81166000908152600260205260409020805460ff191660011790557f38eb43248f2146c7882ffb321eebe73c10ee8fc9fe3a42102dd07937caba4f536111223390565b6002600154036111e15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106a9565b6002600155565b6001600160a01b03821660009081526003602090815260409182902082518084019093528054808452600190910154918301919091526112299083906116b4565b81524360208083019182526001600160a01b0390941660009081526003909452604090932090518155915160019092019190915550565b6001600160a01b03821660009081526003602090815260409182902082518084019093528054808452600190910154918301919091528211156112b65760405163162908e360e11b815260040160405180910390fd5b805182036112e05750506001600160a01b0316600090815260036020526040812081815560010155565b8051611229908390611716565b6112f78282610b26565b6106bc5761130481611346565b61130f836020611358565b60405160200161132092919061174d565b60408051601f198184030181529082905262461bcd60e51b82526106a9916004016117c2565b606061060d6001600160a01b03831660145b606060006113678360026117f5565b6113729060026116b4565b67ffffffffffffffff81111561138a5761138a61180c565b6040519080825280601f01601f1916602001820160405280156113b4576020820181803683370190505b509050600360fc1b816000815181106113cf576113cf611822565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106113fe576113fe611822565b60200101906001600160f81b031916908160001a90535060006114228460026117f5565b61142d9060016116b4565b90505b60018111156114a5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061146157611461611822565b1a60f81b82828151811061147757611477611822565b60200101906001600160f81b031916908160001a90535060049490941c9361149e81611838565b9050611430565b5083156114f45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106a9565b9392505050565b80356001600160a01b03811681146105d757600080fd5b60006020828403121561152457600080fd5b6114f4826114fb565b60006020828403121561153f57600080fd5b81356001600160e01b0319811681146114f457600080fd5b60006020828403121561156957600080fd5b5035919050565b6000806040838503121561158357600080fd5b82359150611593602084016114fb565b90509250929050565b6000602082840312156115ae57600080fd5b813561ffff811681146114f457600080fd5b8015158114610fd257600080fd5b600080604083850312156115e157600080fd5b6115ea836114fb565b915060208301356115fa816115c0565b809150509250929050565b60008060006060848603121561161a57600080fd5b611623846114fb565b95602085013595506040909401359392505050565b60008060006060848603121561164d57600080fd5b8335925061165d602085016114fb565b915061166b604085016114fb565b90509250925092565b6000806040838503121561168757600080fd5b611690836114fb565b9150611593602084016114fb565b634e487b7160e01b600052601160045260246000fd5b8082018082111561060d5761060d61169e565b6000602082840312156116d957600080fd5b81516114f4816115c0565b6000600182016116f6576116f661169e565b5060010190565b60006020828403121561170f57600080fd5b5051919050565b8181038181111561060d5761060d61169e565b60005b8381101561174457818101518382015260200161172c565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611785816017850160208801611729565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516117b6816028840160208801611729565b01602801949350505050565b60208152600082518060208401526117e1816040850160208701611729565b601f01601f19169190910160400192915050565b808202811582820484141761060d5761060d61169e565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816118475761184761169e565b50600019019056fea2646970667358221220254bd4aab919e8b255f1c139b44e4faa367bfd74ea9bf9d25d82d0c3e7cc385f64736f6c63430008140033", + "devdoc": { + "author": "@ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org", + "details": "- ERC-7540 inspired withdrawal contract This contract is designed to be used with SharedDepositMinterV2 contract As a module extension that adds 7540 methods requestRedeem and redeem Example flow -> user calls requestRedeem(user, user, userShares) user calls setOperator(admin OR protocol provided keeper, true) admin can now call redeem on the users behalf if needed after epoch user calls redeem(user, user, userShares) after waiting for epoch Caveats: If the user requests another redemption, before fulfillment, this resets the epoch length clock for their request Basic upgrade path: 1. Call togglePause(1), this disables the requestRedeem fn so no new requests 2. Deploy new contract, direct users to it 3. Fulfill any remaining redeemRequests i.e. totalPendingRequest, for all RedeemRequest events from requestsFulfilled to requestsCreated", + "events": { + "Paused(address,uint16)": { + "details": "Emitted when the pause is triggered by `account`." + }, + "RoleAdminChanged(bytes32,bytes32,bytes32)": { + "details": "Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._" + }, + "RoleGranted(bytes32,address,address)": { + "details": "Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}." + }, + "RoleRevoked(bytes32,address,address)": { + "details": "Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)" + }, + "Unpaused(address,uint16)": { + "details": "Emitted when the pause is lifted by `account`." + } + }, + "kind": "dev", + "methods": { + "getRoleAdmin(bytes32)": { + "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." + }, + "grantRole(bytes32,address)": { + "details": "Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event." + }, + "hasRole(bytes32,address)": { + "details": "Returns `true` if `account` has been granted `role`." + }, + "renounceRole(bytes32,address)": { + "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event." + }, + "revokeRole(bytes32,address)": { + "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event." + }, + "supportsInterface(bytes4)": { + "details": "See {IERC165-supportsInterface}." + } + }, + "title": "WithdrawalQueue", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3628, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "_roles", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_struct(RoleData)3623_storage)" + }, + { + "astId": 4774, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "_status", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 17088, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "paused", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint16,t_bool)" + }, + { + "astId": 16855, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "userEntries", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_struct(UserEntry)16850_storage)" + }, + { + "astId": 16857, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "epochLength", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 17187, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "isOperator", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 15888, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "totalPendingRequest", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 15890, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "requestsCreated", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 15892, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "requestsFulfilled", + "offset": 0, + "slot": "8", + "type": "t_uint256" + }, + { + "astId": 15894, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "totalAssetsOut", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 15904, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "requests", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_uint256,t_struct(Request)15882_storage)" + }, + { + "astId": 15908, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "redeemRequests", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_address,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_address,t_struct(UserEntry)16850_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct FIFOQueue.UserEntry)", + "numberOfBytes": "32", + "value": "t_struct(UserEntry)16850_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_bytes32,t_struct(RoleData)3623_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct AccessControl.RoleData)", + "numberOfBytes": "32", + "value": "t_struct(RoleData)3623_storage" + }, + "t_mapping(t_uint16,t_bool)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_uint256,t_struct(Request)15882_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct WithdrawalQueue.Request)", + "numberOfBytes": "32", + "value": "t_struct(Request)15882_storage" + }, + "t_struct(Request)15882_storage": { + "encoding": "inplace", + "label": "struct WithdrawalQueue.Request", + "members": [ + { + "astId": 15879, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "requester", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 15881, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "shares", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RoleData)3623_storage": { + "encoding": "inplace", + "label": "struct AccessControl.RoleData", + "members": [ + { + "astId": 3620, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "members", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 3622, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "adminRole", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_struct(UserEntry)16850_storage": { + "encoding": "inplace", + "label": "struct FIFOQueue.UserEntry", + "members": [ + { + "astId": 16847, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "amount", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 16849, + "contract": "contracts/v2/core/WithdrawalQueue.sol:WithdrawalQueue", + "label": "blocknum", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/deployments/sepolia/solcInputs/0a8f8cbd3ce11316bfb7ec95fa86f28d.json b/deployments/sepolia/solcInputs/0a8f8cbd3ce11316bfb7ec95fa86f28d.json new file mode 100644 index 0000000..9c1f617 --- /dev/null +++ b/deployments/sepolia/solcInputs/0a8f8cbd3ce11316bfb7ec95fa86f28d.json @@ -0,0 +1,39 @@ +{ + "language": "Solidity", + "sources": { + "contracts/mocks/DepositContract.sol": { + "content": "// ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━\n// ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓\n// ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛\n// ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃┃━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━\n// ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓\n// ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n// SPDX-License-Identifier: CC0-1.0\n\npragma solidity 0.6.11;\n\n// This interface is designed to be compatible with the Vyper version.\n/// @notice This is the Ethereum 2.0 deposit contract interface.\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\ninterface IDepositContract {\n /// @notice A processed deposit event.\n event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);\n\n /// @notice Submit a Phase 0 DepositData object.\n /// @param pubkey A BLS12-381 public key.\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\n /// @param signature A BLS12-381 signature.\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\n /// Used as a protection against malformed input.\n function deposit(\n bytes calldata pubkey,\n bytes calldata withdrawal_credentials,\n bytes calldata signature,\n bytes32 deposit_data_root\n ) external payable;\n\n /// @notice Query the current deposit root hash.\n /// @return The deposit root hash.\n function get_deposit_root() external view returns (bytes32);\n\n /// @notice Query the current deposit count.\n /// @return The deposit count encoded as a little endian 64-bit number.\n function get_deposit_count() external view returns (bytes memory);\n}\n\n// Based on official specification in https://eips.ethereum.org/EIPS/eip-165\ninterface ERC165 {\n /// @notice Query if a contract implements an interface\n /// @param interfaceId The interface identifier, as specified in ERC-165\n /// @dev Interface identification is specified in ERC-165. This function\n /// uses less than 30,000 gas.\n /// @return `true` if the contract implements `interfaceId` and\n /// `interfaceId` is not 0xffffffff, `false` otherwise\n function supportsInterface(bytes4 interfaceId) external pure returns (bool);\n}\n\n// This is a rewrite of the Vyper Eth2.0 deposit contract in Solidity.\n// It tries to stay as close as possible to the original source code.\n/// @notice This is the Ethereum 2.0 deposit contract interface.\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\ncontract DepositContract is IDepositContract, ERC165 {\n uint constant DEPOSIT_CONTRACT_TREE_DEPTH = 4; // changed to make it cheaper for testing - chimera\n // NOTE: this also ensures `deposit_count` will fit into 64-bits\n uint constant MAX_DEPOSIT_COUNT = 2 ** DEPOSIT_CONTRACT_TREE_DEPTH - 1;\n\n bytes32[DEPOSIT_CONTRACT_TREE_DEPTH] branch;\n uint256 deposit_count;\n\n bytes32[DEPOSIT_CONTRACT_TREE_DEPTH] zero_hashes;\n\n // added for testing\n address private owner;\n\n constructor() public {\n owner = msg.sender;\n // Compute hashes in empty sparse Merkle tree\n for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH - 1; height++)\n zero_hashes[height + 1] = sha256(abi.encodePacked(zero_hashes[height], zero_hashes[height]));\n }\n\n function get_deposit_root() external view override returns (bytes32) {\n bytes32 node;\n uint size = deposit_count;\n for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH; height++) {\n if ((size & 1) == 1) node = sha256(abi.encodePacked(branch[height], node));\n else node = sha256(abi.encodePacked(node, zero_hashes[height]));\n size /= 2;\n }\n return sha256(abi.encodePacked(node, to_little_endian_64(uint64(deposit_count)), bytes24(0)));\n }\n\n function get_deposit_count() external view override returns (bytes memory) {\n return to_little_endian_64(uint64(deposit_count));\n }\n\n function deposit(\n bytes calldata pubkey,\n bytes calldata withdrawal_credentials,\n bytes calldata signature,\n bytes32 deposit_data_root\n ) external payable override {\n // Extended ABI length checks since dynamic types are used.\n require(pubkey.length == 48, \"DepositContract: invalid pubkey length\");\n require(withdrawal_credentials.length == 32, \"DepositContract: invalid withdrawal_credentials length\");\n require(signature.length == 96, \"DepositContract: invalid signature length\");\n\n // Check deposit amount\n require(msg.value >= 1 ether, \"DepositContract: deposit value too low\");\n require(msg.value % 1 gwei == 0, \"DepositContract: deposit value not multiple of gwei\");\n uint deposit_amount = msg.value / 1 gwei;\n require(deposit_amount <= type(uint64).max, \"DepositContract: deposit value too high\");\n\n // Emit `DepositEvent` log\n bytes memory amount = to_little_endian_64(uint64(deposit_amount));\n emit DepositEvent(\n pubkey,\n withdrawal_credentials,\n amount,\n signature,\n to_little_endian_64(uint64(deposit_count))\n );\n\n // Compute deposit data root (`DepositData` hash tree root)\n bytes32 pubkey_root = sha256(abi.encodePacked(pubkey, bytes16(0)));\n bytes32 signature_root = sha256(\n abi.encodePacked(\n sha256(abi.encodePacked(signature[:64])),\n sha256(abi.encodePacked(signature[64:], bytes32(0)))\n )\n );\n bytes32 node = sha256(\n abi.encodePacked(\n sha256(abi.encodePacked(pubkey_root, withdrawal_credentials)),\n sha256(abi.encodePacked(amount, bytes24(0), signature_root))\n )\n );\n\n // Verify computed and expected deposit data roots match\n require(\n node == deposit_data_root,\n \"DepositContract: reconstructed DepositData does not match supplied deposit_data_root\"\n );\n\n // Avoid overflowing the Merkle tree (and prevent edge case in computing `branch`)\n require(deposit_count < MAX_DEPOSIT_COUNT, \"DepositContract: merkle tree full\");\n\n // Add deposit data root to Merkle tree (update a single `branch` node)\n deposit_count += 1;\n uint size = deposit_count;\n for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH; height++) {\n if ((size & 1) == 1) {\n branch[height] = node;\n return;\n }\n node = sha256(abi.encodePacked(branch[height], node));\n size /= 2;\n }\n // As the loop should always end prematurely with the `return` statement,\n // this code should be unreachable. We assert `false` just to be safe.\n assert(false);\n }\n\n // added for testing\n function rug() external {\n payable(owner).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {\n return interfaceId == type(ERC165).interfaceId || interfaceId == type(IDepositContract).interfaceId;\n }\n\n function to_little_endian_64(uint64 value) internal pure returns (bytes memory ret) {\n ret = new bytes(8);\n bytes8 bytesValue = bytes8(value);\n // Byteswapping during copying to bytes.\n ret[0] = bytesValue[7];\n ret[1] = bytesValue[6];\n ret[2] = bytesValue[5];\n ret[3] = bytesValue[4];\n ret[4] = bytesValue[3];\n ret[5] = bytesValue[2];\n ret[6] = bytesValue[1];\n ret[7] = bytesValue[0];\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "storageLayout" + ], + "": ["ast"] + } + }, + "metadata": { + "useLiteralContent": true + }, + "libraries": { + "": { + "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" + } + } + } +} diff --git a/deployments/sepolia/solcInputs/8284d085d319e8366de9f230a23ab070.json b/deployments/sepolia/solcInputs/8284d085d319e8366de9f230a23ab070.json new file mode 100644 index 0000000..8b1d755 --- /dev/null +++ b/deployments/sepolia/solcInputs/8284d085d319e8366de9f230a23ab070.json @@ -0,0 +1,379 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlEnumerableUpgradeable.sol\";\nimport \"./AccessControlUpgradeable.sol\";\nimport \"../utils/structs/EnumerableSetUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {\n using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;\n\n mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;\n\n function __AccessControlEnumerable_init() internal onlyInitializing {\n }\n\n function __AccessControlEnumerable_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override {\n super._grantRole(role, account);\n _roleMembers[role].add(account);\n }\n\n /**\n * @dev Overload {_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override {\n super._revokeRole(role, account);\n _roleMembers[role].remove(account);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/IAccessControlEnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport {Initializable} from \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMathUpgradeable {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSetUpgradeable {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(account),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable2Step.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n}\n" + }, + "@openzeppelin/contracts/governance/utils/IVotes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotes {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at a specific moment in the past. If the `clock()` is\n * configured to use block numbers, this will return the value at the end of the corresponding block.\n */\n function getPastVotes(address account, uint256 timepoint) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is\n * configured to use block numbers, this will return the value at the end of the corresponding block.\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 timepoint) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed sender,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC5267.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC5267 {\n /**\n * @dev MAY be emitted to signal that the domain could have changed.\n */\n event EIP712DomainChanged();\n\n /**\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n * signature.\n */\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC5805.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5805.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../governance/utils/IVotes.sol\";\nimport \"./IERC6372.sol\";\n\ninterface IERC5805 is IERC6372, IVotes {}\n" + }, + "@openzeppelin/contracts/interfaces/IERC6372.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC6372.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC6372 {\n /**\n * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).\n */\n function clock() external view returns (uint48);\n\n /**\n * @dev Description of the clock\n */\n // solhint-disable-next-line func-name-mixedcase\n function CLOCK_MODE() external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts/security/Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n" + }, + "@openzeppelin/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n// EIP-2612 is Final as of 2022-11-01. This file is deprecated.\n\nimport \"./ERC20Permit.sol\";\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\n * tokens and those that they have an allowance for, in a way that can be\n * recognized off-chain (via event analysis).\n */\nabstract contract ERC20Burnable is Context, ERC20 {\n /**\n * @dev Destroys `amount` tokens from the caller.\n *\n * See {ERC20-_burn}.\n */\n function burn(uint256 amount) public virtual {\n _burn(_msgSender(), amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, deducting from the caller's\n * allowance.\n *\n * See {ERC20-_burn} and {ERC20-allowance}.\n *\n * Requirements:\n *\n * - the caller must have allowance for ``accounts``'s tokens of at least\n * `amount`.\n */\n function burnFrom(address account, uint256 amount) public virtual {\n _spendAllowance(account, _msgSender(), amount);\n _burn(account, amount);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Permit.sol\";\nimport \"../ERC20.sol\";\nimport \"../../../utils/cryptography/ECDSA.sol\";\nimport \"../../../utils/cryptography/EIP712.sol\";\nimport \"../../../utils/Counters.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * _Available since v3.4._\n */\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {\n using Counters for Counters.Counter;\n\n mapping(address => Counters.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n constructor(string memory name) EIP712(name, \"1\") {}\n\n /**\n * @inheritdoc IERC20Permit\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSA.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @inheritdoc IERC20Permit\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @inheritdoc IERC20Permit\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n Counters.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Votes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ERC20Permit.sol\";\nimport \"../../../interfaces/IERC5805.sol\";\nimport \"../../../utils/math/Math.sol\";\nimport \"../../../utils/math/SafeCast.sol\";\nimport \"../../../utils/cryptography/ECDSA.sol\";\n\n/**\n * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,\n * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.\n *\n * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.\n *\n * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either\n * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting\n * power can be queried through the public accessors {getVotes} and {getPastVotes}.\n *\n * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it\n * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.\n *\n * _Available since v4.2._\n */\nabstract contract ERC20Votes is ERC20Permit, IERC5805 {\n struct Checkpoint {\n uint32 fromBlock;\n uint224 votes;\n }\n\n bytes32 private constant _DELEGATION_TYPEHASH =\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n\n mapping(address => address) private _delegates;\n mapping(address => Checkpoint[]) private _checkpoints;\n Checkpoint[] private _totalSupplyCheckpoints;\n\n /**\n * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).\n */\n function clock() public view virtual override returns (uint48) {\n return SafeCast.toUint48(block.number);\n }\n\n /**\n * @dev Description of the clock\n */\n // solhint-disable-next-line func-name-mixedcase\n function CLOCK_MODE() public view virtual override returns (string memory) {\n // Check that the clock was not modified\n require(clock() == block.number, \"ERC20Votes: broken clock mode\");\n return \"mode=blocknumber&from=default\";\n }\n\n /**\n * @dev Get the `pos`-th checkpoint for `account`.\n */\n function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {\n return _checkpoints[account][pos];\n }\n\n /**\n * @dev Get number of checkpoints for `account`.\n */\n function numCheckpoints(address account) public view virtual returns (uint32) {\n return SafeCast.toUint32(_checkpoints[account].length);\n }\n\n /**\n * @dev Get the address `account` is currently delegating to.\n */\n function delegates(address account) public view virtual override returns (address) {\n return _delegates[account];\n }\n\n /**\n * @dev Gets the current votes balance for `account`\n */\n function getVotes(address account) public view virtual override returns (uint256) {\n uint256 pos = _checkpoints[account].length;\n unchecked {\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\n }\n }\n\n /**\n * @dev Retrieve the number of votes for `account` at the end of `timepoint`.\n *\n * Requirements:\n *\n * - `timepoint` must be in the past\n */\n function getPastVotes(address account, uint256 timepoint) public view virtual override returns (uint256) {\n require(timepoint < clock(), \"ERC20Votes: future lookup\");\n return _checkpointsLookup(_checkpoints[account], timepoint);\n }\n\n /**\n * @dev Retrieve the `totalSupply` at the end of `timepoint`. Note, this value is the sum of all balances.\n * It is NOT the sum of all the delegated votes!\n *\n * Requirements:\n *\n * - `timepoint` must be in the past\n */\n function getPastTotalSupply(uint256 timepoint) public view virtual override returns (uint256) {\n require(timepoint < clock(), \"ERC20Votes: future lookup\");\n return _checkpointsLookup(_totalSupplyCheckpoints, timepoint);\n }\n\n /**\n * @dev Lookup a value in a list of (sorted) checkpoints.\n */\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 timepoint) private view returns (uint256) {\n // We run a binary search to look for the last (most recent) checkpoint taken before (or at) `timepoint`.\n //\n // Initially we check if the block is recent to narrow the search range.\n // During the loop, the index of the wanted checkpoint remains in the range [low-1, high).\n // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.\n // - If the middle checkpoint is after `timepoint`, we look in [low, mid)\n // - If the middle checkpoint is before or equal to `timepoint`, we look in [mid+1, high)\n // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not\n // out of bounds (in which case we're looking too far in the past and the result is 0).\n // Note that if the latest checkpoint available is exactly for `timepoint`, we end up with an index that is\n // past the end of the array, so we technically don't find a checkpoint after `timepoint`, but it works out\n // the same.\n uint256 length = ckpts.length;\n\n uint256 low = 0;\n uint256 high = length;\n\n if (length > 5) {\n uint256 mid = length - Math.sqrt(length);\n if (_unsafeAccess(ckpts, mid).fromBlock > timepoint) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n while (low < high) {\n uint256 mid = Math.average(low, high);\n if (_unsafeAccess(ckpts, mid).fromBlock > timepoint) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n unchecked {\n return high == 0 ? 0 : _unsafeAccess(ckpts, high - 1).votes;\n }\n }\n\n /**\n * @dev Delegate votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) public virtual override {\n _delegate(_msgSender(), delegatee);\n }\n\n /**\n * @dev Delegates votes from signer to `delegatee`\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= expiry, \"ERC20Votes: signature expired\");\n address signer = ECDSA.recover(\n _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),\n v,\n r,\n s\n );\n require(nonce == _useNonce(signer), \"ERC20Votes: invalid nonce\");\n _delegate(signer, delegatee);\n }\n\n /**\n * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).\n */\n function _maxSupply() internal view virtual returns (uint224) {\n return type(uint224).max;\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been increased.\n */\n function _mint(address account, uint256 amount) internal virtual override {\n super._mint(account, amount);\n require(totalSupply() <= _maxSupply(), \"ERC20Votes: total supply risks overflowing votes\");\n\n _writeCheckpoint(_totalSupplyCheckpoints, _add, amount);\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been decreased.\n */\n function _burn(address account, uint256 amount) internal virtual override {\n super._burn(account, amount);\n\n _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);\n }\n\n /**\n * @dev Move voting power when tokens are transferred.\n *\n * Emits a {IVotes-DelegateVotesChanged} event.\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual override {\n super._afterTokenTransfer(from, to, amount);\n\n _moveVotingPower(delegates(from), delegates(to), amount);\n }\n\n /**\n * @dev Change delegation for `delegator` to `delegatee`.\n *\n * Emits events {IVotes-DelegateChanged} and {IVotes-DelegateVotesChanged}.\n */\n function _delegate(address delegator, address delegatee) internal virtual {\n address currentDelegate = delegates(delegator);\n uint256 delegatorBalance = balanceOf(delegator);\n _delegates[delegator] = delegatee;\n\n emit DelegateChanged(delegator, currentDelegate, delegatee);\n\n _moveVotingPower(currentDelegate, delegatee, delegatorBalance);\n }\n\n function _moveVotingPower(address src, address dst, uint256 amount) private {\n if (src != dst && amount > 0) {\n if (src != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);\n emit DelegateVotesChanged(src, oldWeight, newWeight);\n }\n\n if (dst != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);\n emit DelegateVotesChanged(dst, oldWeight, newWeight);\n }\n }\n }\n\n function _writeCheckpoint(\n Checkpoint[] storage ckpts,\n function(uint256, uint256) view returns (uint256) op,\n uint256 delta\n ) private returns (uint256 oldWeight, uint256 newWeight) {\n uint256 pos = ckpts.length;\n\n unchecked {\n Checkpoint memory oldCkpt = pos == 0 ? Checkpoint(0, 0) : _unsafeAccess(ckpts, pos - 1);\n\n oldWeight = oldCkpt.votes;\n newWeight = op(oldWeight, delta);\n\n if (pos > 0 && oldCkpt.fromBlock == clock()) {\n _unsafeAccess(ckpts, pos - 1).votes = SafeCast.toUint224(newWeight);\n } else {\n ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(clock()), votes: SafeCast.toUint224(newWeight)}));\n }\n }\n }\n\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\n return a + b;\n }\n\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.\n */\n function _unsafeAccess(Checkpoint[] storage ckpts, uint256 pos) private pure returns (Checkpoint storage result) {\n assembly {\n mstore(0, ckpts.slot)\n result.slot := add(keccak256(0, 0x20), pos)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n *\n * CAUTION: See Security Considerations above.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"./IERC721Enumerable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721Enumerable is ERC721, IERC721Enumerable {\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {\n return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Enumerable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n\n if (batchSize > 1) {\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\n revert(\"ERC721Enumerable: consecutive transfers not supported\");\n }\n\n uint256 tokenId = firstTokenId;\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Enumerable is IERC721 {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Counters.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary Counters {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./ECDSA.sol\";\nimport \"../ShortStrings.sol\";\nimport \"../../interfaces/IERC5267.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * _Available since v3.4._\n *\n * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n */\nabstract contract EIP712 is IERC5267 {\n using ShortStrings for *;\n\n bytes32 private constant _TYPE_HASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _cachedDomainSeparator;\n uint256 private immutable _cachedChainId;\n address private immutable _cachedThis;\n\n bytes32 private immutable _hashedName;\n bytes32 private immutable _hashedVersion;\n\n ShortString private immutable _name;\n ShortString private immutable _version;\n string private _nameFallback;\n string private _versionFallback;\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n _name = name.toShortStringWithFallback(_nameFallback);\n _version = version.toShortStringWithFallback(_versionFallback);\n _hashedName = keccak256(bytes(name));\n _hashedVersion = keccak256(bytes(version));\n\n _cachedChainId = block.chainid;\n _cachedDomainSeparator = _buildDomainSeparator();\n _cachedThis = address(this);\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\n return _cachedDomainSeparator;\n } else {\n return _buildDomainSeparator();\n }\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev See {EIP-5267}.\n *\n * _Available since v4.9._\n */\n function eip712Domain()\n public\n view\n virtual\n override\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n return (\n hex\"0f\", // 01111\n _name.toStringWithFallback(_nameFallback),\n _version.toStringWithFallback(_versionFallback),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/ShortStrings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./StorageSlot.sol\";\n\n// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |\n// | length | 0x BB |\ntype ShortString is bytes32;\n\n/**\n * @dev This library provides functions to convert short memory strings\n * into a `ShortString` type that can be used as an immutable variable.\n *\n * Strings of arbitrary length can be optimized using this library if\n * they are short enough (up to 31 bytes) by packing them with their\n * length (1 byte) in a single EVM word (32 bytes). Additionally, a\n * fallback mechanism can be used for every other case.\n *\n * Usage example:\n *\n * ```solidity\n * contract Named {\n * using ShortStrings for *;\n *\n * ShortString private immutable _name;\n * string private _nameFallback;\n *\n * constructor(string memory contractName) {\n * _name = contractName.toShortStringWithFallback(_nameFallback);\n * }\n *\n * function name() external view returns (string memory) {\n * return _name.toStringWithFallback(_nameFallback);\n * }\n * }\n * ```\n */\nlibrary ShortStrings {\n // Used as an identifier for strings longer than 31 bytes.\n bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n error StringTooLong(string str);\n error InvalidShortString();\n\n /**\n * @dev Encode a string of at most 31 chars into a `ShortString`.\n *\n * This will trigger a `StringTooLong` error is the input string is too long.\n */\n function toShortString(string memory str) internal pure returns (ShortString) {\n bytes memory bstr = bytes(str);\n if (bstr.length > 31) {\n revert StringTooLong(str);\n }\n return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n }\n\n /**\n * @dev Decode a `ShortString` back to a \"normal\" string.\n */\n function toString(ShortString sstr) internal pure returns (string memory) {\n uint256 len = byteLength(sstr);\n // using `new string(len)` would work locally but is not memory safe.\n string memory str = new string(32);\n /// @solidity memory-safe-assembly\n assembly {\n mstore(str, len)\n mstore(add(str, 0x20), sstr)\n }\n return str;\n }\n\n /**\n * @dev Return the length of a `ShortString`.\n */\n function byteLength(ShortString sstr) internal pure returns (uint256) {\n uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n if (result > 31) {\n revert InvalidShortString();\n }\n return result;\n }\n\n /**\n * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.\n */\n function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {\n if (bytes(value).length < 32) {\n return toShortString(value);\n } else {\n StorageSlot.getStringSlot(store).value = value;\n return ShortString.wrap(_FALLBACK_SENTINEL);\n }\n }\n\n /**\n * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\n */\n function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {\n if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {\n return toString(value);\n } else {\n return store;\n }\n }\n\n /**\n * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\n *\n * WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.\n */\n function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {\n if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {\n return byteLength(value);\n } else {\n return bytes(store).length;\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/drafts/Controller.sol": { + "content": "pragma solidity 0.8.20;\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controller is Ownable {\n struct Settings {\n address _addr;\n uint256 _val;\n }\n mapping(string => Settings) public settingsMap;\n // Settings public settings;\n Settings[] public settingsArr;\n\n constructor(\n address[] memory addresses,\n uint256[] memory vals,\n string[] memory names\n ) Ownable() {\n uint256 i = vals.length;\n while (i > 0) {\n unchecked {\n --i;\n _setSetting(names[i], addresses[i], vals[i]);\n }\n }\n }\n\n function get(string calldata name) public returns (address _a, uint256 _v) {\n Settings memory _s = settingsMap[name];\n _a = _s._addr;\n _v = _s._val;\n }\n\n function _setSetting(\n string memory name,\n address addr,\n uint256 val\n ) internal {\n Settings memory _s = Settings({_addr: addr, _val: val});\n\n settingsMap[name] = _s;\n }\n}\n" + }, + "contracts/governance/SGTv2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.7;\n\n// Inherit permit to allow a permit signed approval for gas savings\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol\";\n// Token needs to be burnable to allow the voteEscrow to burn self tokens as early withdraw penalyu\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\";\n\ncontract SGTv2 is ERC20Burnable, ERC20Permit {\n constructor(\n string memory name,\n string memory symbol,\n uint256 initialSupply,\n address owner\n ) ERC20(name, symbol) ERC20Permit(name) {\n _mint(owner, initialSupply);\n }\n}\n" + }, + "contracts/governance/voteEscrow.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.7;\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\nimport \"../interfaces/IVotingEscrow.sol\";\n\ncontract VoteEscrow is ERC20Votes, ReentrancyGuard, Ownable, IVotingEscrow {\n using SafeERC20 for IERC20;\n\n struct LockedBalance {\n uint256 amount;\n uint256 end;\n }\n // flags\n uint256 public constant MINDAYS = 7;\n uint256 public constant MAXDAYS = 3 * 365;\n\n uint256 public constant MAXTIME = MAXDAYS * 1 days; // 3 years\n uint256 public constant MAX_WITHDRAWAL_PENALTY = 50000; // 50%\n uint256 public constant PRECISION = 100000; // 5 decimals\n\n address public lockedToken;\n address public penaltyCollector;\n uint256 public minLockedAmount;\n uint256 public earlyWithdrawPenaltyRate;\n\n uint256 public override supply;\n\n mapping(address => LockedBalance) public locked;\n mapping(address => uint256) public mintedForLock;\n address public constant burn = 0x000000000000000000000000000000000000dEaD;\n\n /* =============== EVENTS ==================== */\n event Deposit(address indexed provider, uint256 value, uint256 locktime, uint256 timestamp);\n event Withdraw(address indexed provider, uint256 value, uint256 timestamp);\n event PenaltyCollectorSet(address indexed addr);\n event EarlyWithdrawPenaltySet(uint256 indexed penalty);\n event MinLockedAmountSet(uint256 indexed amount);\n\n constructor(\n string memory _name,\n string memory _symbol,\n address _lockedToken,\n uint256 _minLockedAmount\n ) ERC20(_name, _symbol) ERC20Permit(_name) {\n lockedToken = _lockedToken;\n minLockedAmount = _minLockedAmount;\n earlyWithdrawPenaltyRate = 30000; // 30%\n }\n\n function deposit_for(address _addr, uint256 _value) external override {\n require(_value >= minLockedAmount, \"VE:VL0\");\n _deposit_for(_addr, _value, 0);\n }\n\n function create_lock(uint256 _value, uint256 _days) external override {\n require(_value >= minLockedAmount, \"less than min amount\");\n require(locked[_msgSender()].amount == 0, \"Withdraw old tokens first\");\n require(_days >= MINDAYS, \"Voting lock can be 7 days min\");\n require(_days <= MAXDAYS, \"Voting lock can be 4 years max\");\n _deposit_for(_msgSender(), _value, _days);\n }\n\n function increase_amount(uint256 _value) external override {\n require(_value >= minLockedAmount, \"less than min amount\");\n _deposit_for(_msgSender(), _value, 0);\n }\n\n function increase_unlock_time(uint256 _days) external override {\n require(_days >= MINDAYS, \"Voting lock can be 7 days min\");\n require(_days <= MAXDAYS, \"Voting lock can be 4 years max\");\n _deposit_for(_msgSender(), 0, _days);\n }\n\n function withdraw() external override nonReentrant {\n LockedBalance storage _locked = locked[_msgSender()];\n uint256 _now = block.timestamp;\n require(_locked.amount > 0, \"Nothing to withdraw\");\n require(_now >= _locked.end, \"The lock didn't expire\");\n uint256 _amount = _locked.amount;\n _locked.end = 0;\n _locked.amount = 0;\n _burn(_msgSender(), mintedForLock[_msgSender()]);\n mintedForLock[_msgSender()] = 0;\n IERC20(lockedToken).safeTransfer(_msgSender(), _amount);\n\n emit Withdraw(_msgSender(), _amount, _now);\n }\n\n // This will charge PENALTY if lock is not expired yet\n function emergencyWithdraw() external nonReentrant {\n LockedBalance storage _locked = locked[_msgSender()];\n uint256 _now = block.timestamp;\n require(_locked.amount > 0, \"Nothing to withdraw\");\n uint256 _amount = _locked.amount;\n if (_now < _locked.end) {\n uint256 _fee = (_amount * earlyWithdrawPenaltyRate) / PRECISION;\n _penalize(_fee);\n _amount = _amount - _fee;\n }\n _locked.end = 0;\n supply -= _locked.amount;\n _locked.amount = 0;\n _burn(_msgSender(), mintedForLock[_msgSender()]);\n mintedForLock[_msgSender()] = 0;\n\n IERC20(lockedToken).safeTransfer(_msgSender(), _amount);\n\n emit Withdraw(_msgSender(), _amount, _now);\n }\n\n /* ========== RESTRICTED FUNCTIONS ========== */\n\n function setMinLockedAmount(uint256 _minLockedAmount) external onlyOwner {\n minLockedAmount = _minLockedAmount;\n emit MinLockedAmountSet(_minLockedAmount);\n }\n\n function setEarlyWithdrawPenaltyRate(uint256 _earlyWithdrawPenaltyRate) external onlyOwner {\n require(_earlyWithdrawPenaltyRate <= MAX_WITHDRAWAL_PENALTY, \"withdrawal penalty is too high\"); // <= 50%\n earlyWithdrawPenaltyRate = _earlyWithdrawPenaltyRate;\n emit EarlyWithdrawPenaltySet(_earlyWithdrawPenaltyRate);\n }\n\n function setPenaltyCollector(address _addr) external onlyOwner {\n penaltyCollector = _addr;\n emit PenaltyCollectorSet(_addr);\n }\n\n /* ========== PUBLIC FUNCTIONS ========== */\n\n function locked__of(address _addr) external view returns (uint256) {\n return locked[_addr].amount;\n }\n\n function locked__end(address _addr) external view returns (uint256) {\n return locked[_addr].end;\n }\n\n function voting_power_unlock_time(uint256 _value, uint256 _unlockTime) public view returns (uint256) {\n uint256 _now = block.timestamp;\n if (_unlockTime <= _now) return 0;\n uint256 _lockedSeconds = _unlockTime - _now;\n if (_lockedSeconds >= MAXTIME) {\n return _value;\n }\n return (_value * _lockedSeconds) / MAXTIME;\n }\n\n function voting_power_locked_days(uint256 _value, uint256 _days) public view returns (uint256) {\n if (_days >= MAXDAYS) {\n return _value;\n }\n return (_value * _days) / MAXDAYS;\n }\n\n /* ========== INTERNAL FUNCTIONS ========== */\n\n function _deposit_for(address _addr, uint256 _value, uint256 _days) internal nonReentrant {\n LockedBalance storage _locked = locked[_addr];\n uint256 _now = block.timestamp;\n uint256 _amount = _locked.amount;\n uint256 _end = _locked.end;\n uint256 _vp;\n if (_amount == 0) {\n _vp = voting_power_locked_days(_value, _days);\n _locked.amount = _value;\n _locked.end = _now + _days * 1 days;\n } else if (_days == 0) {\n _vp = voting_power_unlock_time(_value, _end);\n _locked.amount = _amount + _value;\n } else {\n require(_value == 0, \"Cannot increase amount and extend lock in the same time\");\n _vp = voting_power_locked_days(_amount, _days);\n _locked.end = _end + _days * 1 days;\n require(_locked.end - _now <= MAXTIME, \"Cannot extend lock to more than 4 years\");\n }\n require(_vp > 0, \"No benefit to lock\");\n if (_value > 0) {\n IERC20(lockedToken).safeTransferFrom(_msgSender(), address(this), _value);\n }\n _mint(_addr, _vp);\n mintedForLock[_addr] += _vp;\n supply += _value;\n\n emit Deposit(_addr, _locked.amount, _locked.end, _now);\n }\n\n function _penalize(uint256 _amount) internal {\n // TODO: we cannot burn univ2/sushi LP tokens, therefore they need to be sent to 0xdead or this needs to change\n if (penaltyCollector != address(0)) {\n // send to collector if `penaltyCollector` set\n IERC20(lockedToken).safeTransfer(penaltyCollector, _amount);\n } else {\n ERC20Burnable(lockedToken).burn(_amount);\n }\n }\n\n function _withdraw() internal {\n LockedBalance storage _locked = locked[_msgSender()];\n uint256 _now = block.timestamp;\n require(_locked.amount > 0, \"Nothing to withdraw\");\n uint256 _amount = _locked.amount;\n if (_now < _locked.end) {\n uint256 _fee = (_amount * earlyWithdrawPenaltyRate) / PRECISION;\n _penalize(_fee);\n _amount = _amount - _fee;\n }\n _locked.end = 0;\n _locked.amount = 0;\n _burn(_msgSender(), mintedForLock[_msgSender()]);\n mintedForLock[_msgSender()] = 0;\n supply -= _amount;\n\n IERC20(lockedToken).safeTransfer(_msgSender(), _amount);\n\n emit Withdraw(_msgSender(), _amount, _now);\n }\n}\n" + }, + "contracts/governance/VoteEscrowFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.7;\nimport \"./voteEscrow.sol\";\nimport \"../interfaces/IVotingEscrow.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract VoteEscrowFactory {\n event VoteEscrowCreated(\n address indexed addr,\n string name,\n string indexed symbol,\n address lockedToken,\n uint256 minLockedAmount\n );\n\n constructor() {}\n\n function createVoteEscrowContract(\n string memory _name,\n string memory _symbol,\n address _lockedToken,\n uint256 _minLockedAmount\n ) external returns (address ve) {\n ve = address(new VoteEscrow(_name, _symbol, _lockedToken, _minLockedAmount));\n Ownable(ve).transferOwnership(msg.sender);\n emit VoteEscrowCreated(ve, _name, _symbol, _lockedToken, _minLockedAmount);\n return ve;\n }\n}\n" + }, + "contracts/interfaces/IAllowlist.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IAllowlist {\n function inAllowlist(address _user) external returns (bool _isInAllowlist);\n}\n" + }, + "contracts/interfaces/IBlocklist.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IBlocklist {\n function inBlockList(address _user) external returns (bool _isInBlocklist);\n}\n" + }, + "contracts/interfaces/IDepositContract.sol": { + "content": "pragma solidity ^0.8.0;\n\n// ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━\n// ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓\n// ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛\n// ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃┃━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━\n// ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓\n// ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n// SPDX-License-Identifier: CC0-1.0\n\n// This interface is designed to be compatible with the Vyper version.\n/// @notice This is the Ethereum 2.0 deposit contract interface.\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\ninterface IDepositContract {\n /// @notice A processed deposit event.\n event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);\n\n /// @notice Submit a Phase 0 DepositData object.\n /// @param pubkey A BLS12-381 public key.\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\n /// @param signature A BLS12-381 signature.\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\n /// Used as a protection against malformed input.\n function deposit(\n bytes calldata pubkey,\n bytes calldata withdrawal_credentials,\n bytes calldata signature,\n bytes32 deposit_data_root\n ) external payable;\n\n /// @notice Query the current deposit root hash.\n /// @return The deposit root hash.\n function get_deposit_root() external view returns (bytes32);\n\n /// @notice Query the current deposit count.\n /// @return The deposit count encoded as a little endian 64-bit number.\n function get_deposit_count() external view returns (bytes memory);\n}\n" + }, + "contracts/interfaces/IERC20MintableBurnable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IERC20MintableBurnable {\n function mintingAllowedAfter() external view returns (uint256);\n\n /**\n * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`\n * @param account The address of the account holding the funds\n * @param spender The address of the account spending the funds\n * @return The number of tokens approved\n */\n function allowance(address account, address spender) external view returns (uint256);\n\n /**\n * @notice Get the number of tokens held by the `account`\n * @param account The address of the account to get the balance of\n * @return The number of tokens held\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(address spender, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Triggers an approval from owner to spends\n * @param owner The address to approve from\n * @param spender The address to be approved\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @param deadline The time at which to expire the signature\n * @param v The recovery byte of the signature\n * @param r Half of the ECDSA signature pair\n * @param s Half of the ECDSA signature pair\n */\n function permit(\n address owner,\n address spender,\n uint256 rawAmount,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(address dst, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(address src, address dst, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Mint new tokens\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to be minted\n */\n function mint(address dst, uint256 rawAmount) external;\n\n function burn(address src, uint256 rawAmount) external;\n function setMinter(address minter_) external;\n}\n" + }, + "contracts/interfaces/IFeeCalc.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IFeeCalc {\n function processDeposit(uint256 amt, address who) external view returns (uint256, uint256);\n\n function processWithdraw(uint256 amt, address who) external view returns (uint256, uint256);\n\n}" + }, + "contracts/interfaces/IFundDistributor.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFundDistributor {\n function distributeTo(address _receiver, uint256 _amount) external;\n}\n" + }, + "contracts/interfaces/IMasterChef.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\npragma experimental ABIEncoderV2;\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IMasterChef {\n struct UserInfo {\n uint256 amount; // How many LP tokens the user has provided.\n uint256 rewardDebt; // Reward debt. See explanation below.\n }\n\n struct PoolInfo {\n IERC20 lpToken; // Address of LP token contract.\n uint256 allocPoint; // How many allocation points assigned to this pool. SUSHI to distribute per block.\n uint256 lastRewardBlock; // Last block number that SUSHI distribution occurs.\n uint256 accSushiPerShare; // Accumulated SUSHI per share, times 1e12. See below.\n }\n\n function poolInfo(uint256 pid) external view returns (IMasterChef.PoolInfo memory);\n\n function totalAllocPoint() external view returns (uint256);\n\n function deposit(uint256 _pid, uint256 _amount) external;\n}\n" + }, + "contracts/interfaces/IMiniChefV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\npragma experimental ABIEncoderV2;\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IMiniChefV2 {\n struct UserInfo {\n uint256 amount;\n uint256 rewardDebt;\n }\n\n struct PoolInfo {\n uint128 accSushiPerShare;\n uint64 lastRewardTime;\n uint64 allocPoint;\n }\n\n function poolLength() external view returns (uint256);\n\n function updatePool(uint256 pid) external returns (IMiniChefV2.PoolInfo memory);\n\n function userInfo(uint256 _pid, address _user) external view returns (uint256, uint256);\n\n function deposit(\n uint256 pid,\n uint256 amount,\n address to\n ) external;\n\n function withdraw(\n uint256 pid,\n uint256 amount,\n address to\n ) external;\n\n function harvest(uint256 pid, address to) external;\n\n function withdrawAndHarvest(\n uint256 pid,\n uint256 amount,\n address to\n ) external;\n\n function emergencyWithdraw(uint256 pid, address to) external;\n\n function lpToken(uint256 _pid) external view returns (IERC20);\n}\n" + }, + "contracts/interfaces/IPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IPriceOracle {\n function setCostPerShare(uint256 shares) external;\n\n function getCostPerShare() external returns (uint256 _costPerShare);\n}\n" + }, + "contracts/interfaces/IRewarder.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IRewarder {\n function onReward(\n uint256 pid,\n address user,\n address recipient,\n uint256 rewardAmount,\n uint256 newLpAmount\n ) external;\n\n function pendingTokens(\n uint256 pid,\n address user,\n uint256 rewardAmount\n ) external view returns (IERC20[] memory, uint256[] memory);\n}\n" + }, + "contracts/interfaces/ISGEth.sol": { + "content": "// SPDX-License-Identifier: MIT\n// @ChimeraDefi Jun 2023\npragma solidity ^0.8.0;\n\ninterface ISGEth {\n function burn(address addr, uint256 amt) external;\n function approve(address spender, uint256 amount) external returns (bool);\n function mint(address addr, uint256 amt) external;\n}\n\n// | SharedDepositMinterV2 · 8.78 │" + }, + "contracts/interfaces/ISharedDeposit.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface ISharedDeposit {\n function withdraw(uint256 amount) external;\n function withdraw(uint256 amount, address dest) external;\n\n function deposit() payable external;\n\n function remainingSpaceInEpoch() external;\n function depositAndStakeFor(address dest) external payable;\n}\n" + }, + "contracts/interfaces/ITokenManager.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface ITokenManager {\n function donate(uint256 shares) external payable;\n\n function setTokenAddress(address _address) external;\n\n function mint(address recv, uint256 amt) external;\n\n function burn(address recv, uint256 amt) external;\n\n function petrifyMinterTransfer() external;\n\n function transferTokenMinterRights(address payable minter_) external;\n}\n" + }, + "contracts/interfaces/ITokenUtilityModule.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\n// A benefits module for token/nft holders\n// Externally calculate boosts and bonuses\ninterface ITokenUtilityModule {\n // Allow epoch length reduction\n function getEpochLength(\n address _sender,\n address _requestContract,\n uint256 amt,\n uint256 defaultVal\n ) external view returns (uint256);\n\n function getAdminFee(\n address _address,\n address _requestContract,\n uint256 amt,\n uint256 defaultVal\n ) external view returns (uint256);\n\n function getWithdrawalTotal(\n address _address,\n address _requestContract,\n uint256 amt,\n uint256 defaultVal\n ) external view returns (uint256);\n\n function getBoost(\n address _address,\n address _requestContract,\n uint256 amt,\n uint256 defaultVal\n ) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IvETH2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IvETH2 {\n function setMinter(address minter_) external;\n\n /**\n * @notice Mint new tokens\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to be minted\n */\n function mint(address dst, uint256 rawAmount) external;\n\n function burn(address src, uint256 rawAmount) external;\n\n function mintingAllowedAfter() external view returns (uint256);\n\n /**\n * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`\n * @param account The address of the account holding the funds\n * @param spender The address of the account spending the funds\n * @return The number of tokens approved\n */\n function allowance(address account, address spender) external view returns (uint256);\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(address spender, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Triggers an approval from owner to spends\n * @param owner The address to approve from\n * @param spender The address to be approved\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @param deadline The time at which to expire the signature\n * @param v The recovery byte of the signature\n * @param r Half of the ECDSA signature pair\n * @param s Half of the ECDSA signature pair\n */\n function permit(\n address owner,\n address spender,\n uint256 rawAmount,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @notice Get the number of tokens held by the `account`\n * @param account The address of the account to get the balance of\n * @return The number of tokens held\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(address dst, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(\n address src,\n address dst,\n uint256 rawAmount\n ) external returns (bool);\n\n function totalSupply() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IVotingEscrow.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\n// Standard Curvefi voting escrow interface\n// We want to use a standard iface to allow compatibility\npragma solidity ^0.8.0;\n\ninterface IVotingEscrow {\n // Following are used in Fee distribution contracts e.g.\n /*\n https://etherscan.io/address/0x74c6cade3ef61d64dcc9b97490d9fbb231e4bdcc#code\n */\n // struct Point {\n // int128 bias;\n // int128 slope;\n // uint256 ts;\n // uint256 blk;\n // }\n\n // function user_point_epoch(address addr) external view returns (uint256);\n\n // function epoch() external view returns (uint256);\n\n // function user_point_history(address addr, uint256 loc) external view returns (Point);\n\n // function checkpoint() external;\n\n /*\n https://etherscan.io/address/0x2e57627ACf6c1812F99e274d0ac61B786c19E74f#readContract\n */\n // Gauge proxy requires the following. inherit from ERC20\n // balanceOf\n // totalSupply\n\n function deposit_for(address _addr, uint256 _value) external;\n\n function create_lock(uint256 _value, uint256 _unlock_time) external;\n\n function increase_amount(uint256 _value) external;\n\n function increase_unlock_time(uint256 _unlock_time) external;\n\n function withdraw() external;\n\n // Extra required views\n function supply() external view returns (uint256);\n\n // function transferOwnership(address addr) external;\n}\n" + }, + "contracts/interfaces/IWSGEth.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// Cloned from fei/rari ERC4626 impl https://github.com/fei-protocol/ERC4626/blob/main/src/interfaces/IxERC4626.sol\n// @ChimeraDefi Jun 2023\n\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)\n\npragma solidity ^0.8.0;\n\ninterface IWSGEth {\n // Takes X(n=assets) ETH and returns Y(n=shares) wsgETH\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n // Takes assets wsgETH and returns shares sgETH\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n" + }, + "contracts/v1/GoerliETHRecov.sol": { + "content": "//SPDX-License-Identifier: Unlicensed\n\npragma solidity 0.8.20;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\ninterface ISharedDeposit {\n function donate(uint256 shares) external payable;\n}\n\ncontract GoerliETHRecov is ISharedDeposit {\n constructor() {}\n\n // Allows recovering ETH from old v1 goerli minter to test v2\n\n // needed to set this as a minter\n function donate(uint256 shares) external payable {\n uint256 incoming = msg.value;\n address payable recv = payable(0xa1feaF41d843d53d0F6bEd86a8cF592cE21C409e);\n\n if (incoming > 0) {\n Address.sendValue(recv, incoming);\n }\n\n uint256 bal = address(this).balance;\n if (bal > 0) {\n Address.sendValue(recv, bal);\n }\n }\n}\n" + }, + "contracts/v2/core/RewardsReceiver.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\n\n// Rewards receiver contract for ETH2 CL + RL rewards\n// Acts as withdrawals address\n// Sends recieved ETH to Deposits when system is healthy and buffer can process withdrawals\n// Sends all recieved ETH to withdrawals contract when system is shutting down and validators are being exited\n// normal deposit contract is ETH2sgETHYR to autocompound rewards\n// call work() to process ETH\n// DAO is set as owner. must call acceptOwnership. can call flipState\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {YieldDirectorBase} from \"../lib/YieldDirectorBase.sol\";\n\n/// @title RewardsReceiver - Rewards receiver contract for ETH2 CL + RL rewards\n/// @author @ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com\ncontract RewardsReceiver is Ownable, YieldDirectorBase {\n enum State {\n Deposits,\n Withdrawals\n }\n State public state;\n address payable public immutable WITHDRAWALS;\n\n constructor(\n address _withdrawalAddr,\n address[] memory yieldDirectorAddresses\n ) payable Ownable() YieldDirectorBase(yieldDirectorAddresses) {\n WITHDRAWALS = payable(_withdrawalAddr);\n state = State.Deposits;\n }\n\n function work() external payable {\n if (state == State.Deposits) {\n _convertToSgETHAndTransfer();\n } else if (state == State.Withdrawals) {\n WITHDRAWALS.transfer(address(this).balance);\n }\n }\n\n function flipState() external onlyOwner {\n if (state == State.Deposits) {\n state = State.Withdrawals;\n } else if (state == State.Withdrawals) {\n state = State.Deposits;\n }\n }\n\n // Allows upgrading/ changing the downstream DAO fee splitter only for easier fee tier changes in the future\n function setDAOFeeSplitter(address _feeSplitter) external onlyOwner {\n feeSplitter = _feeSplitter;\n }\n\n receive() external payable {} // solhint-disable-line\n\n fallback() external payable {} // solhint-disable-line\n}\n" + }, + "contracts/v2/core/Rollover.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\n\nimport {SafeERC20, SafeMath, IERC20, RedemptionsBase} from \"../lib/RedemptionsBase.sol\";\n\n/// @title Rollover - ERC20 token to ETH redemption contract\n/// @author @ChimeraDefi - sharedstake.org\n/// @notice Rollover accepts an underlying ERC20 and redeems it for another ERC20\n/** @dev Deployer chooses static virtual price at launch in 1e18 and the underlying ERC20 token\n Users call deposit(amt) to stake their ERC20 and signal intent to exit\n When the contract has enough ETH to service the users debt\n Users call redeem() to redem for ERC20 = deposited shares * virtualPrice\n The user can further call withdraw() if they change their mind about redeeming for ETH\n TODO Docs\n Test on goerli deployed at https://goerli.etherscan.io/address/0x4db116ad5cca33ba5d2956dba80d56f27b6b2455\n**/\ncontract Rollover is RedemptionsBase {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n IERC20 public immutable NEW_TOKEN;\n\n constructor(\n address _underlying,\n address _newToken,\n uint256 _virtualPrice\n ) payable RedemptionsBase(_underlying, _virtualPrice) {\n NEW_TOKEN = IERC20(_newToken);\n }\n\n function _redeem(uint256 amountToReturn) internal override {\n // make sure user has tokens to redeem offchain first by looking at userEntries otherwise this will just waste gas\n if (amountToReturn > NEW_TOKEN.balanceOf(address(this))) {\n revert ContractBalanceTooLow();\n }\n\n NEW_TOKEN.transfer(msg.sender, amountToReturn);\n }\n}\n" + }, + "contracts/v2/core/SgETH.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\nimport {ERC20MintableBurnableByMinter} from \"../lib/ERC20MintableBurnableByMinter.sol\";\nimport {Errors} from \"../lib/Errors.sol\";\n\n/// @title SgETH - SharedStake Governed Staked Ether\n/// @author @ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com\ncontract SgETH is ERC20MintableBurnableByMinter {\n constructor() ERC20MintableBurnableByMinter(\"SharedStake Governed Staked Ether\", \"sgETH\") {\n // Set the admin of the minter role; this causes the grant and revole role fns to gaurd to this admin role\n _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);\n }\n\n // Adds whitelisted minters - only callable by DEFAULT_ADMIN_ROLE enforced in OZ dep\n function addMinter(address minterAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {\n if (minterAddress != address(0)) {\n grantRole(MINTER, minterAddress);\n } else {\n revert Errors.ZeroAddress();\n }\n }\n\n // Remove a minter - only callable by DEFAULT_ADMIN_ROLE enforced internally\n function removeMinter(address minterAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {\n // oz uses maps so 0 address will return true but does not break anything\n revokeRole(MINTER, minterAddress);\n }\n\n // Transfer ownership of who can add/rm minters\n function transferOwnership(address newOwner) external onlyRole(DEFAULT_ADMIN_ROLE) {\n grantRole(DEFAULT_ADMIN_ROLE, newOwner);\n renounceRole(DEFAULT_ADMIN_ROLE, msg.sender); // permission gaurded via revert if called lacks role\n }\n}\n" + }, + "contracts/v2/core/SharedDepositMinterV2.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\n\n/// @title SharedDepositMinterV2 - minter for ETH LSD\n/// @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\n// v1 sharedstake veth2 minter with some code removed\n// user deposits eth to get minted token\n// The contract cannot move user ETH outside unless\n// 1. the user redeems 1:1\n// 2. the depositToEth2 or depositToEth2Batch fns are called which allow moving ETH to the mainnet deposit contract only\n// 3. The contract allows permissioned external actors to supply validator public keys\n// 4. Who's allowed to deposit how many validators is governed outside this contract\n// 5. The ability to provision validators for user ETH is portioned out by the DAO\n\n// Changes\n/**\n- Custom errors instead of revert strings\n- Granular management via AccessControl with GOV and NOR roles. Node operator can only deploy validators\n- Refactored to allow users to specify destination address for fns - for zaps\n- Added deposit+stake/unstake+withdraw combo convenience routes\n- Refactored fee calc out to external contract\n*/\nimport {IFeeCalc} from \"../interfaces/IFeeCalc.sol\";\nimport {IERC20MintableBurnable} from \"../interfaces/IERC20MintableBurnable.sol\";\nimport {IERC4626} from \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\n\nimport {AccessControl} from \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {Pausable} from \"@openzeppelin/contracts/security/Pausable.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport {ETH2DepositWithdrawalCredentials} from \"../lib/ETH2DepositWithdrawalCredentials.sol\";\n\n/// @title SharedDepositMinterV2\n/// @author ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\n/// @notice Mints LSD tokens for ETH deposited to the contract. Handles the depositing of ETH to the ETH2 deposit contract and validator creation\n/// @dev Deployment params: \n/// - addresses : [feeCalc, sgeth, wsgeth, gov]\ncontract SharedDepositMinterV2 is AccessControl, Pausable, ReentrancyGuard, ETH2DepositWithdrawalCredentials {\n /* ========== STATE VARIABLES ========== */\n uint256 public adminFee;\n uint256 public numValidators;\n uint256 public costPerValidator;\n\n // The validator shares created by this shared stake contract. 1 share costs >= 1 eth\n uint256 public curValidatorShares; //initialized to 0\n\n // The number of times the deposit to eth2 contract has been called to create validators\n uint256 public validatorsCreated; //initialized to 0\n\n // Total accrued admin fee\n uint256 public adminFeeTotal; //initialized to 0\n\n // Its hard to exactly hit the max deposit amount with small shares. this allows a small bit of overflow room\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token via a user withdraw\n uint256 public buffer;\n\n // Flash loan tokenomic protection in case of changes in admin fee with future lots\n bool public refundFeesOnWithdraw; //initialized to false\n\n // NEW\n IERC20MintableBurnable private immutable _SGETH;\n IERC4626 private immutable _WSGETH;\n IFeeCalc private _feeCalc;\n\n bytes32 public constant NOR = keccak256(\"NOR\"); // Node operator for deploying validators\n bytes32 public constant GOV = keccak256(\"GOV\"); // Governance for settings - normally timelock controlled by multisig\n\n //errors\n error AmountTooHigh();\n error NoValidators();\n\n constructor(\n uint256 _numValidators,\n uint256 _adminFee,\n address[] memory addresses\n ) AccessControl() Pausable() ReentrancyGuard() ETH2DepositWithdrawalCredentials(addresses[4]) {\n _feeCalc = IFeeCalc(addresses[0]);\n _SGETH = IERC20MintableBurnable(addresses[1]);\n _WSGETH = IERC4626(addresses[2]);\n\n _SGETH.approve(address(_WSGETH), 2 ** 256 - 1); // max approve wsgeth for deposit and stake\n\n adminFee = _adminFee; // Admin and infra fees\n numValidators = _numValidators; // The number of validators to create in this lot. Sets a max limit on deposits\n\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token\n buffer = 10 * 1e18; // roughly equal to 10 eth.\n\n costPerValidator = (32 * 1e18) + adminFee;\n\n _grantRole(NOR, msg.sender);\n _grantRole(GOV, addresses[3]); // deployer will need it to set withdrawal creds. since the non-custodial withdrawal path depends on the minter.\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LOGIC\n //////////////////////////////////////////////////////////////*/\n\n // USER INTERACTIONS\n /*\n Shares minted = Z\n Principal deposit input = P\n AdminFee = a\n costPerValidator = 32 + a\n AdminFee as percent in 1e18 = a% = (a / costPerValidator) * 1e18\n AdminFee on tx in 1e18 = (P * a% / 1e18)\n\n on deposit:\n P - (P * a%) = Z\n\n on withdraw with admin fee refund:\n P = Z / (1 - a%)\n P = Z - Z*a%\n */\n\n function deposit() external payable {\n _deposit(msg.sender);\n }\n\n function depositFor(address dest) external payable {\n _deposit(dest);\n }\n\n function depositAndStake() external payable {\n _WSGETH.deposit(_deposit(address(this)), msg.sender);\n }\n\n function depositAndStakeFor(address dest) external payable {\n _WSGETH.deposit(_deposit(address(this)), dest);\n }\n\n function withdraw(uint256 amount) external {\n _withdraw(amount, msg.sender, msg.sender);\n }\n\n function withdrawTo(uint256 amount, address dest) external {\n _withdraw(amount, msg.sender, dest);\n }\n\n function unstakeAndWithdraw(uint256 amount, address dest) external {\n _withdraw(_WSGETH.redeem(amount, address(this), msg.sender), address(this), dest);\n }\n\n // migration function to accept old monies and copy over state\n // users should not use this as it just donates the money without minting veth or tracking donations\n function donate() external payable {} // solhint-disable-line\n\n /*//////////////////////////////////////////////////////////////\n ADMIN LOGIC\n //////////////////////////////////////////////////////////////*/\n\n // Batch deposit eth to the eth2 contract with preset creds\n // Data needs to be verified offchain to save gas\n function batchDepositToEth2(\n bytes[] calldata pubkeys,\n bytes[] calldata signatures,\n bytes32[] calldata depositDataRoots\n ) external onlyRole(NOR) {\n if (address(this).balance < (_depositAmount * pubkeys.length)) {\n revert AmountTooHigh(); // Not enough bal in contract to deploy all validators\n }\n _batchDeposit(pubkeys, signatures, depositDataRoots);\n validatorsCreated = validatorsCreated + pubkeys.length;\n }\n\n function setWithdrawalCredential(bytes memory _newWithdrawalCreds) external onlyRole(NOR) {\n // can only be called once\n _setWithdrawalCredential(_newWithdrawalCreds);\n }\n\n // Slashes the onchain staked sgETH to mirror CL validator slashings\n // modifies wsgeth virtual price\n function slash(uint256 amt) external onlyRole(GOV) {\n if (amt > curValidatorShares) {\n revert AmountTooHigh(); // Cannot slash more than minted\n }\n _SGETH.burn(address(_WSGETH), amt);\n }\n\n // Set fee calc address. if addr = 0 then fees are assumed to be 0\n function setFeeCalc(address _feeCalculatorAddr) external onlyRole(GOV) {\n _feeCalc = IFeeCalc(_feeCalculatorAddr);\n }\n\n function togglePause() external onlyRole(GOV) {\n bool paused = paused();\n if (paused) {\n _unpause();\n } else {\n _pause();\n }\n }\n\n // Used to migrate state over to new contract\n function migrateShares(uint256 shares) external onlyRole(GOV) {\n curValidatorShares = shares;\n }\n\n function toggleWithdrawRefund() external onlyRole(GOV) {\n refundFeesOnWithdraw = !refundFeesOnWithdraw;\n }\n\n function setNumValidators(uint256 _numValidators) external onlyRole(GOV) {\n if (_numValidators > 0) {\n numValidators = _numValidators;\n } else {\n revert NoValidators();\n }\n }\n\n function withdrawAdminFee(uint256 amount) external onlyRole(GOV) {\n address payable sender = payable(msg.sender);\n if (amount == 0) {\n amount = adminFeeTotal;\n }\n if (amount > adminFeeTotal) {\n revert AmountTooHigh();\n }\n adminFeeTotal = adminFeeTotal - amount;\n Address.sendValue(sender, amount);\n }\n\n /*//////////////////////////////////////////////////////////////\n ACCOUNTING LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function remainingSpaceInEpoch() external view returns (uint256) {\n // Helpful view function to gauge how much the user can send to the contract when it is near full\n uint256 remainingShares = maxValidatorShares() - curValidatorShares;\n uint256 valBeforeAdmin = (remainingShares * 1e18) / (((1 * 1e18) - (adminFee * 1e18) / costPerValidator));\n return valBeforeAdmin;\n }\n\n function maxValidatorShares() public view returns (uint256) {\n return 32 * 1e18 * numValidators;\n }\n\n function _depositAccounting() internal returns (uint256 value) {\n // input is whole, not / 1e18 , i.e. in 1 = 1 eth send when from etherscan\n value = msg.value;\n uint256 fee;\n\n if (address(_feeCalc) != address(0)) {\n (value, fee) = _feeCalc.processDeposit(value, msg.sender);\n adminFeeTotal = adminFeeTotal + fee;\n }\n\n uint256 newShareTotal = curValidatorShares + value;\n\n if (newShareTotal > buffer + maxValidatorShares()) {\n revert AmountTooHigh();\n }\n curValidatorShares = newShareTotal;\n }\n\n function _withdrawAccounting(uint256 amount) internal returns (uint256) {\n uint256 fee;\n if (address(_feeCalc) != address(0)) {\n (amount, fee) = _feeCalc.processWithdraw(amount, msg.sender);\n if (refundFeesOnWithdraw) {\n adminFeeTotal = adminFeeTotal - fee;\n } else {\n adminFeeTotal = adminFeeTotal + fee;\n }\n }\n if (address(this).balance < (amount + adminFeeTotal)) {\n revert AmountTooHigh();\n }\n\n curValidatorShares = curValidatorShares - amount;\n return amount;\n }\n\n function _deposit(address dest) internal nonReentrant whenNotPaused returns (uint256 amt) {\n amt = _depositAccounting();\n _SGETH.mint(dest, amt);\n }\n\n function _withdraw(uint256 amount, address origin, address dest) internal nonReentrant whenNotPaused {\n _SGETH.burn(origin, amount); // reverts if amount is too high\n uint256 assets = _withdrawAccounting(amount);\n\n address payable recv = payable(dest);\n Address.sendValue(recv, assets);\n }\n\n receive() external payable {} // solhint-disable-line\n\n fallback() external payable {} // solhint-disable-line\n}\n" + }, + "contracts/v2/core/WithdrawalQueue.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\nimport {IERC4626} from \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\nimport {AccessControl} from \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport {FIFOQueue} from \"../lib/FIFOQueue.sol\";\nimport {Errors} from \"../lib/Errors.sol\";\nimport {OperatorSettable} from \"../lib/OperatorSettable.sol\";\nimport {GranularPause} from \"../lib/GranularPause.sol\";\nimport {SharedDepositMinterV2} from \"./SharedDepositMinterV2.sol\";\n\n/**\n * @title WithdrawalQueue\n * @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\n * @dev -\n * ERC-7540 inspired withdrawal contract\n * This contract is designed to be used with SharedDepositMinterV2 contract\n * As a module extension that adds 7540 methods requestRedeem and redeem\n * Example flow ->\n * user calls requestRedeem(user, user, userShares)\n * user calls setOperator(admin OR protocol provided keeper, true)\n * admin can now call redeem on the users behalf if needed after epoch\n * user calls redeem(user, user, userShares) after waiting for epoch\n * Caveats:\n * If the user requests another redemption, before fulfillment,\n * this resets the epoch length clock for their request\n * Basic upgrade path:\n * 1. Call togglePause(1), this disables the requestRedeem fn so no new requests\n * 2. Deploy new contract, direct users to it\n * 3. Fulfill any remaining redeemRequests i.e. totalPendingRequest,\n * for all RedeemRequest events from requestsFulfilled to requestsCreated\n */\ncontract WithdrawalQueue is AccessControl, GranularPause, ReentrancyGuard, FIFOQueue, OperatorSettable {\n using Address for address payable;\n\n struct Request {\n address requester;\n uint256 shares;\n }\n // SharedDepositMinterV2 public immutable MINTER;\n address public immutable MINTER;\n address public immutable WSGETH;\n\n uint256 internal totalPendingRequest;\n uint256 internal requestsCreated;\n uint256 internal requestsFulfilled;\n uint256 public totalAssetsOut;\n\n bytes32 public constant GOV = keccak256(\"GOV\"); // Governance for settings - normally timelock controlled by multisig\n\n mapping(uint256 => Request) internal requests;\n mapping(address => uint256) public redeemRequests;\n\n event RedeemRequest(\n address indexed requester,\n address indexed owner,\n uint256 indexed requestId,\n address operator,\n uint256 assets\n );\n event Redeem(address indexed requester, address indexed receiver, uint256 shares, uint256 assets);\n\n constructor(address _minter, address _wsgEth, uint256 _epochLength) FIFOQueue(_epochLength) {\n MINTER = _minter;\n WSGETH = _wsgEth;\n\n uint256 maxUint256 = 2 ** 256 - 1;\n\n IERC20(WSGETH).approve(_minter, maxUint256);\n\n _grantRole(GOV, msg.sender);\n }\n\n function requestRedeem(\n uint256 shares,\n address requester,\n address owner\n ) external onlyOwnerOrOperator(owner) nonReentrant whenNotPaused(uint16(1)) returns (uint256 requestId) {\n if (shares == 0) {\n revert Errors.InvalidAmount();\n }\n IERC20(WSGETH).transferFrom(owner, address(this), shares); // asset here is the Vault underlying asset\n\n requestId = requestsCreated++;\n requests[requestId] = Request({requester: requester, shares: shares});\n // use assets for tracking\n uint256 assets = IERC4626(WSGETH).previewRedeem(shares);\n\n _stakeForWithdrawal(owner, assets);\n totalPendingRequest += assets;\n redeemRequests[requester] += assets; // underflow would revert if not enough claimable shares\n\n emit RedeemRequest(requester, owner, requestId, msg.sender, shares);\n }\n\n function redeem(\n uint256 shares,\n address receiver,\n address requester\n ) external onlyOwnerOrOperator(requester) nonReentrant whenNotPaused(uint16(2)) returns (uint256 assets) {\n if (shares == 0) {\n revert Errors.InvalidAmount();\n }\n\n assets = IERC4626(WSGETH).previewRedeem(shares);\n\n // checks if we have enough assets to fulfill the request and if epoch has passed\n if (claimableRedeemRequest(requester) < assets) {\n _checkWithdraw(requester, totalBalance(), assets);\n return 0; // should never happen. previous fn will generate a rich error\n }\n\n _withdraw(requester, assets);\n // Treat everything as claimableRedeemRequest and validate here if there's adequate funds\n redeemRequests[requester] -= assets; // underflow would revert if not enough claimable shares\n totalPendingRequest -= assets;\n // Track total returned\n totalAssetsOut += assets;\n requestsFulfilled++;\n\n uint256 minterBalance = MINTER.balance;\n // This feels suboptimal, but is the easiest way to always burn the token on redemptions\n if (assets > minterBalance) {\n uint256 diff = assets - minterBalance;\n // We need to use donate/transfer etc. cant deposit and mint more shares as that messes up accouting\n payable(MINTER).transfer(diff);\n }\n\n // Always burn redeemed tokens\n SharedDepositMinterV2(payable(MINTER)).unstakeAndWithdraw(shares, receiver);\n\n emit Redeem(requester, receiver, shares, assets);\n }\n\n function togglePause(uint16 func) external onlyRole(GOV) {\n bool paused = paused[func];\n if (paused) {\n _unpause(func);\n } else {\n _pause(func);\n }\n }\n\n function setEpochLength(uint256 value) external onlyRole(GOV) {\n _setEpochLength(value);\n }\n\n function pendingRedeemRequest(address owner) public view returns (uint256 shares) {\n return redeemRequests[owner];\n }\n\n // claimableRedeemRequest - returns owners shares in claimable state,\n // i.e. epoch has elapsed and sufficient funds exist\n function claimableRedeemRequest(address owner) public view returns (uint256 shares) {\n if (redeemRequests[owner] > 0 && _isWithdrawalAllowed(owner, totalBalance(), redeemRequests[owner])) {\n return redeemRequests[owner];\n } else {\n return 0;\n }\n }\n\n function totalBalance() internal view returns (uint256) {\n return address(this).balance + MINTER.balance;\n }\n\n receive() external payable {} // solhint-disable-line\n\n fallback() external payable {} // solhint-disable-line\n}\n" + }, + "contracts/v2/core/Withdrawals.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\n\nimport {RedemptionsBase} from \"../lib/RedemptionsBase.sol\";\n\n/// @title Withdrawals - ERC20 token to ETH redemption contract\n/// @author @ChimeraDefi - sharedstake.org\n/// @notice Withdrawals accepts an underlying ERC20 and redeems it for ETH\n/** @dev Deployer chooses static virtual price at launch in 1e18 and the underlying ERC20 token\n Users call deposit(amt) to stake their ERC20 and signal intent to exit\n When the contract has enough ETH to service the users debt\n Users call redeem() to redem for ETH = deposited shares * virtualPrice\n The user can further call withdraw() if they change their mind about redeeming for ETH\n**/\ncontract Withdrawals is RedemptionsBase {\n event Redemption(address indexed _from, uint256 val);\n\n constructor(address _underlying, uint256 _virtualPrice) payable RedemptionsBase(_underlying, _virtualPrice) {} // solhint-disable-line\n\n function _redeem(uint256 amountToReturn) internal override {\n if (amountToReturn > address(this).balance) {\n revert ContractBalanceTooLow();\n }\n emit Redemption(msg.sender, amountToReturn);\n\n payable(msg.sender).transfer(amountToReturn);\n }\n}\n" + }, + "contracts/v2/core/WSGEth.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\n\nimport {ERC4626, xERC4626} from \"../lib/xERC4626.sol\";\nimport {ERC20} from \"solmate/src/mixins/ERC4626.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\n/// @title ssgETH - Vault token for staked sgETH. ERC20 + ERC4626\n/// @author @ChimeraDefi - sharedstake.org - based on sfrxETH\n/// @notice Is a vault that takes sgETH and gives you ssgETH erc20 tokens\n/** @dev Exchange rate between sgETH and ssgETH floats, you can convert your ssgETH for more sgETH over time.\n Exchange rate increases as validator rewardSplitter mints new sgETH corresponding to the staking yield and drops it into this vault (ssgETH contract).\n There is a short time period, “cycles” which the exchange rate increases linearly over. This is to prevent gaming the exchange rate (MEV).\n The cycles are constant length, but calling syncRewards slightly into a would-be cycle keeps the same would-be endpoint (so cycle ends are every X seconds).\n Someone must call syncRewards, which queues any new ssgETH in the contract to be added to the redeemable amount.\n Mint vs Deposit\n mint() - deposit targeting a specific number of ssgETH out\n deposit() - deposit knowing a specific number of ssgETH in */\ncontract WSGETH is xERC4626, ReentrancyGuard {\n modifier andSync() {\n if (block.timestamp >= rewardsCycleEnd) {\n syncRewards();\n }\n _;\n }\n\n /* ========== CONSTRUCTOR ========== */\n constructor(\n ERC20 _underlying,\n uint32 _rewardsCycleLength\n ) ERC4626(_underlying, \"Wrapped SharedStake Governed Ether\", \"wsgETH\") xERC4626(_rewardsCycleLength) {} // solhint-disable-line\n\n /// @notice Approve and deposit() in one transaction\n function depositWithSignature(\n uint256 assets,\n address receiver,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 shares) {\n uint256 amount = approveMax ? type(uint256).max : assets;\n asset.permit(msg.sender, address(this), amount, deadline, v, r, s);\n return (deposit(assets, receiver));\n }\n\n /// @notice inlines syncRewards with deposits when able\n function deposit(uint256 assets, address receiver) public override nonReentrant andSync returns (uint256 shares) {\n return super.deposit(assets, receiver);\n }\n\n /// @notice inlines syncRewards with mints when able\n function mint(uint256 shares, address receiver) public override nonReentrant andSync returns (uint256 assets) {\n return super.mint(shares, receiver);\n }\n\n /// @notice inlines syncRewards with withdrawals when able\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public override nonReentrant andSync returns (uint256 shares) {\n return super.withdraw(assets, receiver, owner);\n }\n\n /// @notice inlines syncRewards with redemptions when able\n function redeem(uint256 shares, address receiver, address owner) public override andSync returns (uint256 assets) {\n return super.redeem(shares, receiver, owner);\n }\n\n /// @notice How much sgETH is 1E18 ssgETH worth. Price is in ETH, not USD\n function pricePerShare() public view returns (uint256) {\n return convertToAssets(1e18);\n }\n}\n" + }, + "contracts/v2/interfaces/IDepositContract.sol": { + "content": "pragma solidity ^0.8.0;\n\n// ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━\n// ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓\n// ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛\n// ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃┃━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━\n// ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓\n// ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n// SPDX-License-Identifier: CC0-1.0\n\n// This interface is designed to be compatible with the Vyper version.\n/// @notice This is the Ethereum 2.0 deposit contract interface.\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\ninterface IDepositContract {\n /// @notice A processed deposit event.\n event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);\n\n /// @notice Submit a Phase 0 DepositData object.\n /// @param pubkey A BLS12-381 public key.\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\n /// @param signature A BLS12-381 signature.\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\n /// Used as a protection against malformed input.\n function deposit(\n bytes calldata pubkey,\n bytes calldata withdrawal_credentials,\n bytes calldata signature,\n bytes32 deposit_data_root\n ) external payable;\n\n /// @notice Query the current deposit root hash.\n /// @return The deposit root hash.\n function get_deposit_root() external view returns (bytes32);\n\n /// @notice Query the current deposit count.\n /// @return The deposit count encoded as a little endian 64-bit number.\n function get_deposit_count() external view returns (bytes memory);\n}\n" + }, + "contracts/v2/interfaces/IERC20MintableBurnable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IERC20MintableBurnable {\n function mintingAllowedAfter() external view returns (uint256);\n\n /**\n * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`\n * @param account The address of the account holding the funds\n * @param spender The address of the account spending the funds\n * @return The number of tokens approved\n */\n function allowance(address account, address spender) external view returns (uint256);\n\n /**\n * @notice Get the number of tokens held by the `account`\n * @param account The address of the account to get the balance of\n * @return The number of tokens held\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(address spender, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Triggers an approval from owner to spends\n * @param owner The address to approve from\n * @param spender The address to be approved\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @param deadline The time at which to expire the signature\n * @param v The recovery byte of the signature\n * @param r Half of the ECDSA signature pair\n * @param s Half of the ECDSA signature pair\n */\n function permit(\n address owner,\n address spender,\n uint256 rawAmount,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(address dst, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(address src, address dst, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Mint new tokens\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to be minted\n */\n function mint(address dst, uint256 rawAmount) external;\n\n function burn(address src, uint256 rawAmount) external;\n function setMinter(address minter_) external;\n}\n" + }, + "contracts/v2/interfaces/IFeeCalc.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IFeeCalc {\n function processDeposit(uint256 amt, address who) external view returns (uint256, uint256);\n\n function processWithdraw(uint256 amt, address who) external view returns (uint256, uint256);\n}\n" + }, + "contracts/v2/interfaces/ISGEth.sol": { + "content": "// SPDX-License-Identifier: MIT\n// @ChimeraDefi Jun 2023\npragma solidity ^0.8.0;\n\ninterface ISGEth {\n function burn(address addr, uint256 amt) external;\n function approve(address spender, uint256 amount) external returns (bool);\n function mint(address addr, uint256 amt) external;\n}\n\n// | SharedDepositMinterV2 · 8.78 │\n" + }, + "contracts/v2/interfaces/ISharedDeposit.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface ISharedDeposit {\n function withdraw(uint256 amount) external;\n function withdraw(uint256 amount, address dest) external;\n\n function deposit() external payable;\n\n function remainingSpaceInEpoch() external;\n function depositAndStakeFor(address dest) external payable;\n}\n" + }, + "contracts/v2/interfaces/IWSGEth.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// Cloned from fei/rari ERC4626 impl https://github.com/fei-protocol/ERC4626/blob/main/src/interfaces/IxERC4626.sol\n// @ChimeraDefi Jun 2023\n\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)\n\npragma solidity ^0.8.0;\n\ninterface IWSGEth {\n // Takes X(n=assets) ETH and returns Y(n=shares) wsgETH\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n // Takes assets wsgETH and returns shares sgETH\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n" + }, + "contracts/v2/interfaces/IxERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// Cloned from fei/rari ERC4626 impl https://github.com/fei-protocol/ERC4626/blob/main/src/interfaces/IxERC4626.sol\n// @ChimeraDefi Jun 2023\n\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)\n\npragma solidity ^0.8.0;\n\n/** \n @title An xERC4626 Single Staking Contract Interface\n @notice This contract allows users to autocompound rewards denominated in an underlying reward token. \n It is fully compatible with [ERC4626](https://eips.ethereum.org/EIPS/eip-4626) allowing for DeFi composability.\n It maintains balances using internal accounting to prevent instantaneous changes in the exchange rate.\n NOTE: an exception is at contract creation, when a reward cycle begins before the first deposit. After the first deposit, exchange rate updates smoothly.\n\n Operates on \"cycles\" which distribute the rewards surplus over the internal balance to users linearly over the remainder of the cycle window.\n*/\ninterface IxERC4626 {\n /*////////////////////////////////////////////////////////\n Custom Errors\n ////////////////////////////////////////////////////////*/\n\n /// @dev thrown when syncing before cycle ends.\n error SyncError();\n\n /*////////////////////////////////////////////////////////\n Events\n ////////////////////////////////////////////////////////*/\n\n /// @dev emit every time a new rewards cycle starts\n event NewRewardsCycle(uint32 indexed cycleEnd, uint256 rewardAmount);\n\n /*////////////////////////////////////////////////////////\n View Methods\n ////////////////////////////////////////////////////////*/\n\n /// @notice the maximum length of a rewards cycle\n function rewardsCycleLength() external view returns (uint32);\n\n /// @notice the effective start of the current cycle\n /// NOTE: This will likely be after `rewardsCycleEnd - rewardsCycleLength` as this is set as block.timestamp of the last `syncRewards` call.\n function lastSync() external view returns (uint32);\n\n /// @notice the end of the current cycle. Will always be evenly divisible by `rewardsCycleLength`.\n function rewardsCycleEnd() external view returns (uint32);\n\n /// @notice the amount of rewards distributed in a the most recent cycle\n function lastRewardAmount() external view returns (uint192);\n\n /*////////////////////////////////////////////////////////\n State Changing Methods\n ////////////////////////////////////////////////////////*/\n\n /// @notice Distributes rewards to xERC4626 holders.\n /// All surplus `asset` balance of the contract over the internal balance becomes queued for the next cycle.\n function syncRewards() external;\n}\n" + }, + "contracts/v2/lib/ERC20MintableBurnableByMinter.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\nimport {ERC20Burnable} from \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\";\nimport {AccessControl} from\"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {ERC20, ERC20Permit} from \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol\";\n\n/// @title Parent contract for sgETH.sol\n/** @notice Based on ERC20PermitPermissionedMint - base contract for frxETH. \n Changed to reduce code footprint and rely on OZ primitives instead\n Using ownable and OZ AccessControl for minter management and standard underlying events instead of extra custom events\n Also includes a list of authorized minters \n Steps: 1. Deploy it. 2. Set new sgETH minter 3. Transfer ownership to multisig timelock 4. confirm accept ownership from timelock */\n/// @dev Adheres to EIP-712/EIP-2612 and can use permits\ncontract ERC20MintableBurnableByMinter is ERC20Burnable, ERC20Permit, AccessControl {\n bytes32 public constant MINTER = keccak256(\"MINTER\");\n\n /* ========== CONSTRUCTOR ========== */\n constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) ERC20Permit(_name) AccessControl() {}\n\n /* ========== RESTRICTED FUNCTIONS ========== */\n /// @notice burnFrom Used by minters when user redeems\n /// @param addr The address to burn from\n /// @param amt The amount to burn\n function burnFrom(address addr, uint256 amt) public override onlyRole(MINTER) {\n super.burnFrom(addr, amt);\n }\n\n function burn(address addr, uint256 amt) public onlyRole(MINTER) {\n super._burn(addr, amt);\n }\n\n /// @notice mint This function is what other minters will call to mint new tokens\n /// @param addr The address to mint to \n /// @param amt The amount to mint \n function mint(address addr, uint256 amt) public onlyRole(MINTER) {\n _mint(addr, amt);\n }\n}\n" + }, + "contracts/v2/lib/Errors.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\n/**\n * @title Errors\n * @author Sharedstake\n * @notice Contains all the custom errors\n */\nlibrary Errors {\n error ZeroAddress();\n error InvalidAmount();\n error PermissionDenied();\n error InsufficientBalance();\n error TooEarly();\n error FailedCall();\n}\n" + }, + "contracts/v2/lib/ETH2DepositWithdrawalCredentials.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\nimport {IDepositContract} from \"../interfaces/IDepositContract.sol\";\n\n/// @title A contract for holding a eth2 validator withrawal pubkey\n/// @author @chimeraDefi\n/// @notice A contract for holding a eth2 validator withrawal pubkey\n/// @dev Downstream contract needs to implement who can set the withdrawal address and set it\ncontract ETH2DepositWithdrawalCredentials {\n uint256 internal constant _depositAmount = 32 ether;\n IDepositContract public immutable DEPOSIT_CONTRACT;\n bytes public withdrawalPubKey; // Pubkey for ETH 2.0 withdrawal creds\n\n event WithdrawalCredentialSet(bytes _withdrawalCredential);\n\n constructor(address _dc) {\n DEPOSIT_CONTRACT = IDepositContract(_dc);\n }\n\n /// @notice A more streamlined variant of batch deposit for use with preset withdrawal addresses\n /// Submit index-matching arrays that form Phase 0 DepositData objects.\n /// Will create a deposit transaction per index of the arrays submitted.\n ///\n /// @param pubkeys - An array of BLS12-381 public keys.\n /// @param signatures - An array of BLS12-381 signatures.\n /// @param depositDataRoots - An array of the SHA-256 hash of the SSZ-encoded DepositData object.\n function _batchDeposit(\n bytes[] calldata pubkeys,\n bytes[] calldata signatures,\n bytes32[] calldata depositDataRoots\n ) internal {\n // optimizations https://ethereum.stackexchange.com/questions/113221/what-is-the-purpose-of-unchecked-in-solidity\n // https://medium.com/@bloqarl/solidity-gas-optimization-tips-with-assembly-you-havent-heard-yet-1381c77ff078\n // 30m gas / block roughly, say 10m max used so 100 validators a batch max \n // each deposit call costs roughly 128k https://etherscan.io/tx/0xa2acf6e6bde99b532125cc8026cd88eea345f296968ce732556945ab4705d03e\n uint256 i = pubkeys.length;\n uint256 _amt = _depositAmount;\n bytes memory wpk = withdrawalPubKey;\n\n while (i > 0) {\n unchecked {\n // While loop check prevents underflow.\n // --i is cheaper than i--\n // reverse while loop cheapest compared to while or for \n // Since we set the upper loop bound to the arr len, we decr 1st to not hit out of bounds\n --i;\n\n DEPOSIT_CONTRACT.deposit{value: _amt}(\n pubkeys[i],\n wpk,\n signatures[i],\n depositDataRoots[i]\n );\n }\n }\n }\n\n /// @notice sets curr_withdrawal_pubkey to be used when deploying validators\n function _setWithdrawalCredential(bytes memory newPk) internal {\n withdrawalPubKey = newPk;\n\n emit WithdrawalCredentialSet(newPk);\n }\n}\n" + }, + "contracts/v2/lib/FIFOQueue.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\nimport {Errors} from \"./Errors.sol\";\n\n// Simple First in first out queue\n// Uses a system of cascading locks based on the block number.\n// Users need to wait a minimum of epochLength blocks before withdrawing\n// Users past the epoch boundary can claim, allowing some time for earlier users to claim first\nabstract contract FIFOQueue {\n struct UserEntry {\n uint256 amount;\n uint256 blocknum;\n }\n mapping(address => UserEntry) public userEntries;\n\n uint256 public epochLength;\n\n constructor(uint256 _epochLength) {\n epochLength = _epochLength;\n }\n\n function _checkWithdraw(\n address sender,\n uint256 balanceOfSelf,\n uint256 amountToWithdraw\n ) public view returns (bool withdrawalAllowed) {\n UserEntry memory ue = userEntries[sender];\n\n if (!(amountToWithdraw <= balanceOfSelf && amountToWithdraw <= ue.amount)) {\n revert Errors.InvalidAmount();\n }\n\n if (!(block.number >= ue.blocknum + epochLength)) {\n revert Errors.TooEarly();\n }\n return true;\n }\n\n function _isWithdrawalAllowed(\n address sender,\n uint256 balanceOfSelf,\n uint256 amountToWithdraw\n ) public view returns (bool) {\n UserEntry memory ue = userEntries[sender];\n\n return (amountToWithdraw <= balanceOfSelf && amountToWithdraw <= ue.amount) && (block.number >= ue.blocknum + epochLength);\n }\n\n // should be admin only or used in a constructor upstream\n // set epoch length in blocks\n function _setEpochLength(uint256 _value) internal {\n if (_value == 0) {\n revert Errors.InvalidAmount();\n }\n epochLength = _value;\n }\n\n function _stakeForWithdrawal(address sender, uint256 amount) internal {\n UserEntry memory ue = userEntries[sender];\n ue.amount = ue.amount + amount;\n ue.blocknum = block.number;\n userEntries[sender] = ue;\n }\n\n function _withdraw(address sender, uint256 amount) internal {\n UserEntry memory ue = userEntries[sender];\n if (amount > ue.amount) {\n revert Errors.InvalidAmount();\n }\n\n if (amount == ue.amount) {\n delete userEntries[sender];\n } else {\n ue.amount = ue.amount - amount;\n ue.blocknum = block.number;\n userEntries[sender] = ue;\n }\n }\n}\n" + }, + "contracts/v2/lib/GranularPause.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\nimport {Context} from \"@openzeppelin/contracts/utils/Context.sol\";\n\n/// @title GranularPause \n/// @author ChimeraDefi - chimera_defi@protonmail.com\n/// @notice allows more granular control of pausing functions\n/// @dev Inherit in child contract, you need to number each function you want to pause\n\nabstract contract GranularPause is Context {\n mapping(uint16 => bool) public paused;\n\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account, uint16 item);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account, uint16 item);\n\n error IsPaused();\n error IsNotPaused();\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused(uint16 _id) {\n if (paused[_id]) {\n revert IsPaused();\n }\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused(uint16 _id) {\n if (!paused[_id]) {\n revert IsNotPaused();\n }\n _;\n }\n\n /// @notice pauses a function\n /// @param _id id of function to pause\n function _pause(uint16 _id) internal virtual {\n paused[_id] = true;\n emit Paused(_msgSender(), _id);\n }\n\n /// @notice unpauses a function\n /// @param _id id of function to unpause\n function _unpause(uint16 _id) internal virtual {\n paused[_id] = false;\n emit Unpaused(_msgSender(), _id);\n }\n}\n\n" + }, + "contracts/v2/lib/OperatorSettable.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\nimport {Errors} from \"./Errors.sol\";\n\n/**\n * @title OperatorSettable\n * @author Sharedstake\n * @notice Handles operators for ERC-7450 like contracts\n */\nabstract contract OperatorSettable {\n mapping(address requester => mapping(address operator => bool)) public isOperator;\n event OperatorSet(address indexed owner, address indexed operator, bool value);\n\n modifier onlyOwnerOrOperator(address owner) {\n if (owner != msg.sender && !isOperator[owner][msg.sender]) {\n revert Errors.PermissionDenied();\n }\n _;\n }\n\n function setOperator(address operator, bool approved) external returns (bool) {\n isOperator[msg.sender][operator] = approved;\n emit OperatorSet(msg.sender, operator, approved);\n return true;\n }\n}\n" + }, + "contracts/v2/lib/PaymentSplitter.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\n// OZ paymentsplitter with minor changes\n// private function _addPayee made internal for better inheritance flow\n// 0 payee chck in constructor removed to allow empty setup\n\n// OpenZeppelin Contracts (last updated v4.8.0) (finance/PaymentSplitter.sol)\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\nimport \"@openzeppelin/contracts/utils/Context.sol\";\n\n/**\n * @title PaymentSplitter\n * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware\n * that the Ether will be split in this way, since it is handled transparently by the contract.\n *\n * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each\n * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim\n * an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the\n * time of contract deployment and can't be updated thereafter.\n *\n * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the\n * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}\n * function.\n *\n * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and\n * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you\n * to run tests before sending real value to this contract.\n */\ncontract PaymentSplitter is Context {\n event PayeeAdded(address account, uint256 shares);\n event PaymentReleased(address to, uint256 amount);\n event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount);\n event PaymentReceived(address from, uint256 amount);\n\n uint256 private _totalShares;\n uint256 private _totalReleased;\n\n mapping(address => uint256) private _shares;\n mapping(address => uint256) private _released;\n address[] internal _payees;\n\n mapping(IERC20 => uint256) private _erc20TotalReleased;\n mapping(IERC20 => mapping(address => uint256)) private _erc20Released;\n\n /**\n * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at\n * the matching position in the `shares` array.\n *\n * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no\n * duplicates in `payees`.\n */\n constructor(address[] memory payees, uint256[] memory shares_) payable {\n require(payees.length == shares_.length, \"PaymentSplitter: payees and shares length mismatch\");\n // require(payees.length > 0, \"PaymentSplitter: no payees\");\n\n for (uint256 i = 0; i < payees.length; i++) {\n _addPayee(payees[i], shares_[i]);\n }\n }\n\n /**\n * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully\n * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the\n * reliability of the events, and not the actual splitting of Ether.\n *\n * To learn more about this see the Solidity documentation for\n * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback\n * functions].\n */\n receive() external payable virtual {\n emit PaymentReceived(_msgSender(), msg.value);\n }\n\n /**\n * @dev Getter for the total shares held by payees.\n */\n function totalShares() public view returns (uint256) {\n return _totalShares;\n }\n\n /**\n * @dev Getter for the total amount of Ether already released.\n */\n function totalReleased() public view returns (uint256) {\n return _totalReleased;\n }\n\n /**\n * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20\n * contract.\n */\n function totalReleased(IERC20 token) public view returns (uint256) {\n return _erc20TotalReleased[token];\n }\n\n /**\n * @dev Getter for the amount of shares held by an account.\n */\n function shares(address account) public view returns (uint256) {\n return _shares[account];\n }\n\n /**\n * @dev Getter for the amount of Ether already released to a payee.\n */\n function released(address account) public view returns (uint256) {\n return _released[account];\n }\n\n /**\n * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an\n * IERC20 contract.\n */\n function released(IERC20 token, address account) public view returns (uint256) {\n return _erc20Released[token][account];\n }\n\n /**\n * @dev Getter for the address of the payee number `index`.\n */\n function payee(uint256 index) public view returns (address) {\n return _payees[index];\n }\n\n /**\n * @dev Getter for the amount of payee's releasable Ether.\n */\n function releasable(address account) public view returns (uint256) {\n uint256 totalReceived = address(this).balance + totalReleased();\n return _pendingPayment(account, totalReceived, released(account));\n }\n\n /**\n * @dev Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an\n * IERC20 contract.\n */\n function releasable(IERC20 token, address account) public view returns (uint256) {\n uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token);\n return _pendingPayment(account, totalReceived, released(token, account));\n }\n\n /**\n * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the\n * total shares and their previous withdrawals.\n */\n function release(address payable account) public virtual {\n require(_shares[account] > 0, \"PaymentSplitter: account has no shares\");\n\n uint256 payment = releasable(account);\n\n require(payment != 0, \"PaymentSplitter: account is not due payment\");\n\n // _totalReleased is the sum of all values in _released.\n // If \"_totalReleased += payment\" does not overflow, then \"_released[account] += payment\" cannot overflow.\n _totalReleased += payment;\n unchecked {\n _released[account] += payment;\n }\n\n Address.sendValue(account, payment);\n emit PaymentReleased(account, payment);\n }\n\n /**\n * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their\n * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20\n * contract.\n */\n function release(IERC20 token, address account) public virtual {\n require(_shares[account] > 0, \"PaymentSplitter: account has no shares\");\n\n uint256 payment = releasable(token, account);\n\n require(payment != 0, \"PaymentSplitter: account is not due payment\");\n\n // _erc20TotalReleased[token] is the sum of all values in _erc20Released[token].\n // If \"_erc20TotalReleased[token] += payment\" does not overflow, then \"_erc20Released[token][account] += payment\"\n // cannot overflow.\n _erc20TotalReleased[token] += payment;\n unchecked {\n _erc20Released[token][account] += payment;\n }\n\n SafeERC20.safeTransfer(token, account, payment);\n emit ERC20PaymentReleased(token, account, payment);\n }\n\n /**\n * @dev internal logic for computing the pending payment of an `account` given the token historical balances and\n * already released amounts.\n */\n function _pendingPayment(\n address account,\n uint256 totalReceived,\n uint256 alreadyReleased\n ) private view returns (uint256) {\n return (totalReceived * _shares[account]) / _totalShares - alreadyReleased;\n }\n\n /**\n * @dev Add a new payee to the contract.\n * @param account The address of the payee to add.\n * @param shares_ The number of shares owned by the payee.\n */\n function _addPayee(address account, uint256 shares_) internal {\n require(account != address(0), \"PaymentSplitter: account is the zero address\");\n require(shares_ > 0, \"PaymentSplitter: shares are 0\");\n require(_shares[account] == 0, \"PaymentSplitter: account already has shares\");\n\n _payees.push(account);\n _shares[account] = shares_;\n _totalShares = _totalShares + shares_;\n emit PayeeAdded(account, shares_);\n }\n}" + }, + "contracts/v2/lib/RedemptionsBase.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\nimport {SafeMath} from \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport {SafeERC20, IERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\n/// @title RedemptionsBase - ERC20 token redemption base\n/// @author @ChimeraDefi - sharedstake.org\n/// @notice RedemptionsBase accepts an underlying ERC20 and redeems it for - child impl\n/** @dev Deployer chooses static virtual price at launch in 1e18 and the underlying ERC20 token\nUsers call deposit(amt) to stake their ERC20 and signal intent to exit\nWhen the contract has enough ETH to service the users debt\nUsers call redeem() to redem for ETH = deposited shares * virtualPrice\nThe user can further call withdraw() if they change their mind about redeeming for ETH\n**/\ncontract RedemptionsBase is ReentrancyGuard {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n struct UserEntry {\n uint256 amount;\n }\n\n error ContractBalanceTooLow();\n error UserAmountIsZero();\n\n mapping(address => UserEntry) public userEntries; // solhint-disable-line\n uint256 public totalOut;\n uint256 public immutable VIRTUALPRICE;\n IERC20 public immutable vEth2Token; // solhint-disable-line\n\n constructor(address _underlying, uint256 _virtualPrice) payable {\n vEth2Token = IERC20(_underlying);\n VIRTUALPRICE = _virtualPrice;\n }\n\n function deposit(uint256 amount) external nonReentrant {\n // vEth2 transfer from returns true otherwise reverts\n if (vEth2Token.transferFrom(msg.sender, address(this), amount)) {\n _stakeForWithdrawal(msg.sender, amount);\n }\n }\n\n function withdraw() external nonReentrant {\n uint256 amt = userEntries[msg.sender].amount;\n delete userEntries[msg.sender];\n\n vEth2Token.transferFrom(address(this), msg.sender, amt);\n }\n\n function redeem() external nonReentrant {\n address usr = msg.sender;\n uint256 amountToReturn = _getAmountGivenShares(userEntries[usr].amount, VIRTUALPRICE);\n if (amountToReturn == 0) {\n revert UserAmountIsZero();\n }\n delete userEntries[usr];\n totalOut += amountToReturn;\n _redeem(amountToReturn);\n }\n\n function _redeem(uint256 amountToReturn) internal virtual { // solhint-disable-line\n require(false, \"implement me\"); // solhint-disable-line\n }\n\n function _stakeForWithdrawal(address sender, uint256 amount) internal {\n UserEntry memory ue = userEntries[sender];\n ue.amount = ue.amount.add(amount);\n userEntries[sender] = ue;\n }\n\n function _getAmountGivenShares(uint256 shares, uint256 _vp) internal pure returns (uint256) {\n return shares.mul(_vp).div(1e18);\n }\n\n receive() external payable {} // solhint-disable-line\n fallback() external payable {} // solhint-disable-line\n}\n" + }, + "contracts/v2/lib/xERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// Cloned from fei/rari ERC4626 impl https://github.com/fei-protocol/ERC4626/blob/main/src/interfaces/IxERC4626.sol\n// In use by sfrxeth https://etherscan.io/address/0xac3e018457b222d93114458476f3e3416abbe38f#code\n// @ChimeraDefi Jun 2023\n\npragma solidity ^0.8.20;\n\nimport {ERC4626} from \"solmate/src/mixins/ERC4626.sol\";\nimport {SafeCastLib} from \"solmate/src/utils/SafeCastLib.sol\";\nimport {IxERC4626} from \"../interfaces/IxERC4626.sol\";\n\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)\n\n/**\n@title An xERC4626 Single Staking Contract\n@notice This contract allows users to autocompound rewards denominated in an underlying reward token.\n It is fully compatible with [ERC4626](https://eips.ethereum.org/EIPS/eip-4626) allowing for DeFi composability.\n It maintains balances using internal accounting to prevent instantaneous changes in the exchange rate.\n NOTE: an exception is at contract creation, when a reward cycle begins before the first deposit. After the first deposit, exchange rate updates smoothly.\n\n Operates on \"cycles\" which distribute the rewards surplus over the internal balance to users linearly over the remainder of the cycle window.\n*/\nabstract contract xERC4626 is IxERC4626, ERC4626 {\n using SafeCastLib for *;\n\n /// @notice the maximum length of a rewards cycle\n uint32 public immutable rewardsCycleLength;\n\n /// @notice the effective start of the current cycle\n uint32 public lastSync;\n\n /// @notice the end of the current cycle. Will always be evenly divisible by `rewardsCycleLength`.\n uint32 public rewardsCycleEnd;\n\n /// @notice the amount of rewards distributed in a the most recent cycle.\n uint192 public lastRewardAmount;\n\n uint256 internal storedTotalAssets;\n\n constructor(uint32 _rewardsCycleLength) {\n rewardsCycleLength = _rewardsCycleLength;\n // seed initial rewardsCycleEnd\n rewardsCycleEnd = (block.timestamp.safeCastTo32() / rewardsCycleLength) * rewardsCycleLength;\n }\n\n /// @notice Compute the amount of tokens available to share holders.\n /// Increases linearly during a reward distribution period from the sync call, not the cycle start.\n function totalAssets() public view override returns (uint256) {\n // cache global vars\n uint256 storedTotalAssets_ = storedTotalAssets;\n uint192 lastRewardAmount_ = lastRewardAmount;\n uint32 rewardsCycleEnd_ = rewardsCycleEnd;\n uint32 lastSync_ = lastSync;\n\n if (block.timestamp >= rewardsCycleEnd_) {\n // no rewards or rewards fully unlocked\n // entire reward amount is available\n return storedTotalAssets_ + lastRewardAmount_;\n }\n\n // rewards not fully unlocked\n // add unlocked rewards to stored total\n uint256 unlockedRewards = (lastRewardAmount_ * (block.timestamp - lastSync_)) / (rewardsCycleEnd_ - lastSync_);\n return storedTotalAssets_ + unlockedRewards;\n }\n\n // Update storedTotalAssets on withdraw/redeem\n function beforeWithdraw(uint256 amount, uint256 shares) internal virtual override {\n super.beforeWithdraw(amount, shares);\n storedTotalAssets -= amount;\n }\n\n // Update storedTotalAssets on deposit/mint\n function afterDeposit(uint256 amount, uint256 shares) internal virtual override {\n storedTotalAssets += amount;\n super.afterDeposit(amount, shares);\n }\n\n /// @notice Distributes rewards to xERC4626 holders.\n /// All surplus `asset` balance of the contract over the internal balance becomes queued for the next cycle.\n function syncRewards() public virtual {\n uint192 lastRewardAmount_ = lastRewardAmount;\n uint32 timestamp = block.timestamp.safeCastTo32();\n\n if (timestamp < rewardsCycleEnd) revert SyncError();\n\n uint256 storedTotalAssets_ = storedTotalAssets;\n uint256 nextRewards = asset.balanceOf(address(this)) - storedTotalAssets_ - lastRewardAmount_;\n\n storedTotalAssets = storedTotalAssets_ + lastRewardAmount_; // SSTORE\n\n uint32 end = ((timestamp + rewardsCycleLength) / rewardsCycleLength) * rewardsCycleLength;\n\n if (end - timestamp < rewardsCycleLength / 20) {\n end += rewardsCycleLength;\n }\n\n // Combined single SSTORE\n lastRewardAmount = nextRewards.safeCastTo192();\n lastSync = timestamp;\n rewardsCycleEnd = end;\n\n emit NewRewardsCycle(end, nextRewards);\n }\n}\n" + }, + "contracts/v2/lib/YieldDirectorBase.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n// Acts as the deposit contract for the reward receiver during normal functioning\n// 100% of recieved ETH from rewards is auto-compounded back into sgETH\n// 60% is immutably always transfered to wsgETH for staker rewards\n// 40% is transferred to a splitter the DAO can modulate for nor payments and other use cases\n\n// call work() to process eth\npragma solidity ^0.8.20;\n\nimport {ISharedDeposit} from \"../interfaces/ISharedDeposit.sol\";\nimport {IERC20, SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ncontract YieldDirectorBase {\n IERC20 public immutable SGETH;\n address public immutable WSGETH;\n address public feeSplitter;\n ISharedDeposit public immutable MINTER;\n\n constructor(address[] memory _addrs) payable {\n SGETH = IERC20(_addrs[0]);\n WSGETH = _addrs[1];\n feeSplitter = _addrs[2];\n MINTER = ISharedDeposit(_addrs[3]);\n }\n\n function _convertToSgETHAndTransfer() internal {\n // convert eth 2 sgETH\n MINTER.deposit{value: address(this).balance}();\n\n // Calc static split\n uint256 bal = SGETH.balanceOf(address(this));\n uint256 part1 = (bal * 40) / 100; // upto 40% for DAO direction. most reflected back\n uint256 part2 = bal - part1;\n\n // Send tokens\n SafeERC20.safeTransfer(SGETH, feeSplitter, part1);\n SafeERC20.safeTransfer(SGETH, WSGETH, part2);\n }\n}\n" + }, + "contracts/v2/periphery/ETHDepositGaurd.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\n// Modulate how much user ETH node operators can stake\n// Sliding scale starting at 100% user ETH going to protocol staking\n// Reducing to allow more ETH to flow to indie node operators and other staking vaults\n// Different staking vaults offer different possibilities such as DVT, different clients, operators etc\n// This contract will own the minter\n\ncontract ETHDepositScaler {\n constructor() {}\n}\n" + }, + "contracts/v2/periphery/FeeCalc.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.20;\n\nimport {Ownable2Step} from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\n\ncontract FeeCalc is Ownable2Step {\n struct Settings {\n uint256 adminFee;\n uint256 exitFee;\n bool refundFeesOnWithdraw;\n bool chargeOnDeposit;\n bool chargeOnExit;\n }\n Settings private config;\n uint256 public adminFee;\n uint256 public costPerValidator;\n\n uint256 private immutable BIPS = 10000;\n constructor(Settings memory _settings) Ownable2Step() {\n // admin fee in bips (10000 = 100%)\n adminFee = _settings.adminFee;\n config = _settings;\n costPerValidator = ((32 + (32 * adminFee)) * 1 ether) / BIPS;\n }\n\n function set(Settings calldata newSettings) external onlyOwner {\n config = newSettings;\n adminFee = newSettings.adminFee;\n }\n\n function setRefundFeesOnWithdraw(bool _refundFeesOnWithdraw) external onlyOwner {\n config.refundFeesOnWithdraw = _refundFeesOnWithdraw;\n }\n\n function setExitFee(uint256 _exitFee) external onlyOwner {\n config.exitFee = _exitFee;\n }\n\n function setAdminFee(uint256 amount) external onlyOwner {\n adminFee = amount;\n config.adminFee = amount;\n }\n\n function processDeposit(uint256 value, address _sender) external view returns (uint256 amt, uint256 fee) {\n // TODO: semder is currently unsused but can be used later to calculate a fee reduction based on token holdings\n if (config.chargeOnDeposit) {\n fee = (value * adminFee) / BIPS;\n amt = value - fee;\n }\n }\n\n function processWithdraw(uint256 value, address _sender) external view returns (uint256 amt, uint256 fee) {\n // TODO: semder is currently unsused but can be used later to calculate a fee reduction based on token holdings\n if (config.refundFeesOnWithdraw) {\n fee = (value * adminFee) / BIPS;\n amt = value + fee;\n } else if (config.chargeOnExit) {\n fee = (value * config.exitFee) / BIPS;\n amt = value - fee;\n } else {\n fee = 0;\n amt = value;\n }\n }\n}\n" + }, + "contracts/v2/periphery/UserDepositHelper.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.20;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {ISharedDeposit} from \"../../interfaces/ISharedDeposit.sol\";\n\n// User referral rewards tracking contract\n// Fires events on user deposits to assits attribution of rewards\n// Calls proper flow to retrieve interest bearing staked eth\n// TODO: Tests, scripts to aggregate events offchain and calc referral rewards\ncontract UserDepositHelper {\n ISharedDeposit private immutable MINTER;\n\n event Deposit(address indexed _from, uint256 _value);\n event ExtraDepositData(address indexed _from, uint256 _value, bytes32 data);\n event DepositRef(address indexed _from, uint256 _value, address ref);\n event DepositFrontend(address indexed _from, uint256 _value, address ref);\n\n constructor(address _sgEth, address _minter) {\n MINTER = ISharedDeposit(_minter);\n IERC20(_sgEth).approve(_minter, 2 ** 256 - 1);\n }\n\n // Deposit multiple users and amts from a single call with referral and frontend address emitted. useful for batch deposits to reduce gas costs\n // An external contract can buffer ETH and call this\n function depositMultipleWithReferral(\n address[] memory addrs,\n uint256[] memory amts,\n address ref,\n address frontend,\n bytes32[] memory bytesToBroadcast\n ) external payable {\n uint256 i = addrs.length;\n if (addrs.length != amts.length || addrs.length != bytesToBroadcast.length) {\n payable(msg.sender).transfer(msg.value);\n }\n while (i > 0) {\n unchecked {\n --i;\n\n emit Deposit(addrs[i], amts[i]);\n emit ExtraDepositData(msg.sender, msg.value, bytesToBroadcast[i]);\n emit DepositRef(msg.sender, msg.value, ref);\n emit DepositFrontend(msg.sender, msg.value, frontend);\n MINTER.depositAndStakeFor{value: amts[i]}(addrs[i]);\n }\n }\n }\n\n // User deposit helper. User needs to call this function.\n // Referral data can be filled in by frontend\n function depositWithEvents(address ref, address frontend, bytes32 data) external payable {\n MINTER.depositAndStakeFor{value: msg.value}(msg.sender);\n emit Deposit(msg.sender, msg.value);\n emit ExtraDepositData(msg.sender, msg.value, data);\n emit DepositRef(msg.sender, msg.value, ref);\n emit DepositFrontend(msg.sender, msg.value, frontend);\n }\n}\n" + }, + "contracts/v2/periphery/Zap.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity 0.8.20;\n\nimport {IERC20MintableBurnable} from \"../../interfaces/IERC20MintableBurnable.sol\";\nimport {IWSGEth} from \"../../interfaces/IWSGEth.sol\";\nimport {ISharedDeposit} from \"../../interfaces/ISharedDeposit.sol\";\n\ncontract Zap {\n IERC20MintableBurnable public sgeth;\n IWSGEth public wsgeth;\n ISharedDeposit public MINTER;\n\n constructor(IERC20MintableBurnable _sgETHAddr, IWSGEth _wsgETHAddr, ISharedDeposit _minter) {\n sgeth = _sgETHAddr;\n wsgeth = _wsgETHAddr;\n MINTER = _minter;\n uint256 MAX_INT = 2 ** 256 - 1;\n\n sgeth.approve(address(_wsgETHAddr), MAX_INT);\n sgeth.approve(address(_minter), MAX_INT);\n }\n\n function depositAndStake() external payable {\n uint256 amt = msg.value;\n MINTER.deposit{value: amt}();\n wsgeth.deposit(amt, msg.sender);\n }\n\n function unstakeAndWithdraw(uint256 amount) external {\n uint256 assets = wsgeth.redeem(amount, address(this), msg.sender);\n MINTER.withdraw(assets, msg.sender);\n }\n}\n" + }, + "solmate/src/mixins/ERC4626.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../tokens/ERC20.sol\";\nimport {SafeTransferLib} from \"../utils/SafeTransferLib.sol\";\nimport {FixedPointMathLib} from \"../utils/FixedPointMathLib.sol\";\n\n/// @notice Minimal ERC4626 tokenized Vault implementation.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/mixins/ERC4626.sol)\nabstract contract ERC4626 is ERC20 {\n using SafeTransferLib for ERC20;\n using FixedPointMathLib for uint256;\n\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /*//////////////////////////////////////////////////////////////\n IMMUTABLES\n //////////////////////////////////////////////////////////////*/\n\n ERC20 public immutable asset;\n\n constructor(\n ERC20 _asset,\n string memory _name,\n string memory _symbol\n ) ERC20(_name, _symbol, _asset.decimals()) {\n asset = _asset;\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function deposit(uint256 assets, address receiver) public virtual returns (uint256 shares) {\n // Check for rounding error since we round down in previewDeposit.\n require((shares = previewDeposit(assets)) != 0, \"ZERO_SHARES\");\n\n // Need to transfer before minting or ERC777s could reenter.\n asset.safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function mint(uint256 shares, address receiver) public virtual returns (uint256 assets) {\n assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.\n\n // Need to transfer before minting or ERC777s could reenter.\n asset.safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public virtual returns (uint256 shares) {\n shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.\n\n if (msg.sender != owner) {\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\n }\n\n beforeWithdraw(assets, shares);\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n asset.safeTransfer(receiver, assets);\n }\n\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) public virtual returns (uint256 assets) {\n if (msg.sender != owner) {\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\n }\n\n // Check for rounding error since we round down in previewRedeem.\n require((assets = previewRedeem(shares)) != 0, \"ZERO_ASSETS\");\n\n beforeWithdraw(assets, shares);\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n asset.safeTransfer(receiver, assets);\n }\n\n /*//////////////////////////////////////////////////////////////\n ACCOUNTING LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function totalAssets() public view virtual returns (uint256);\n\n function convertToShares(uint256 assets) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? assets : assets.mulDivDown(supply, totalAssets());\n }\n\n function convertToAssets(uint256 shares) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? shares : shares.mulDivDown(totalAssets(), supply);\n }\n\n function previewDeposit(uint256 assets) public view virtual returns (uint256) {\n return convertToShares(assets);\n }\n\n function previewMint(uint256 shares) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? shares : shares.mulDivUp(totalAssets(), supply);\n }\n\n function previewWithdraw(uint256 assets) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? assets : assets.mulDivUp(supply, totalAssets());\n }\n\n function previewRedeem(uint256 shares) public view virtual returns (uint256) {\n return convertToAssets(shares);\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LIMIT LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function maxDeposit(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n function maxMint(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n function maxWithdraw(address owner) public view virtual returns (uint256) {\n return convertToAssets(balanceOf[owner]);\n }\n\n function maxRedeem(address owner) public view virtual returns (uint256) {\n return balanceOf[owner];\n }\n\n /*//////////////////////////////////////////////////////////////\n INTERNAL HOOKS LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {}\n\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {}\n}\n" + }, + "solmate/src/tokens/ERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\nabstract contract ERC20 {\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n /*//////////////////////////////////////////////////////////////\n METADATA STORAGE\n //////////////////////////////////////////////////////////////*/\n\n string public name;\n\n string public symbol;\n\n uint8 public immutable decimals;\n\n /*//////////////////////////////////////////////////////////////\n ERC20 STORAGE\n //////////////////////////////////////////////////////////////*/\n\n uint256 public totalSupply;\n\n mapping(address => uint256) public balanceOf;\n\n mapping(address => mapping(address => uint256)) public allowance;\n\n /*//////////////////////////////////////////////////////////////\n EIP-2612 STORAGE\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal immutable INITIAL_CHAIN_ID;\n\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\n\n mapping(address => uint256) public nonces;\n\n /*//////////////////////////////////////////////////////////////\n CONSTRUCTOR\n //////////////////////////////////////////////////////////////*/\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals\n ) {\n name = _name;\n symbol = _symbol;\n decimals = _decimals;\n\n INITIAL_CHAIN_ID = block.chainid;\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\n }\n\n /*//////////////////////////////////////////////////////////////\n ERC20 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function approve(address spender, uint256 amount) public virtual returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n\n return true;\n }\n\n function transfer(address to, uint256 amount) public virtual returns (bool) {\n balanceOf[msg.sender] -= amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(msg.sender, to, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\n\n balanceOf[from] -= amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n return true;\n }\n\n /*//////////////////////////////////////////////////////////////\n EIP-2612 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual {\n require(deadline >= block.timestamp, \"PERMIT_DEADLINE_EXPIRED\");\n\n // Unchecked because the only math done is incrementing\n // the owner's nonce which cannot realistically overflow.\n unchecked {\n address recoveredAddress = ecrecover(\n keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n DOMAIN_SEPARATOR(),\n keccak256(\n abi.encode(\n keccak256(\n \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n ),\n owner,\n spender,\n value,\n nonces[owner]++,\n deadline\n )\n )\n )\n ),\n v,\n r,\n s\n );\n\n require(recoveredAddress != address(0) && recoveredAddress == owner, \"INVALID_SIGNER\");\n\n allowance[recoveredAddress][spender] = value;\n }\n\n emit Approval(owner, spender, value);\n }\n\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\n }\n\n function computeDomainSeparator() internal view virtual returns (bytes32) {\n return\n keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n keccak256(bytes(name)),\n keccak256(\"1\"),\n block.chainid,\n address(this)\n )\n );\n }\n\n /*//////////////////////////////////////////////////////////////\n INTERNAL MINT/BURN LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function _mint(address to, uint256 amount) internal virtual {\n totalSupply += amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(address(0), to, amount);\n }\n\n function _burn(address from, uint256 amount) internal virtual {\n balanceOf[from] -= amount;\n\n // Cannot underflow because a user's balance\n // will never be larger than the total supply.\n unchecked {\n totalSupply -= amount;\n }\n\n emit Transfer(from, address(0), amount);\n }\n}\n" + }, + "solmate/src/utils/FixedPointMathLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Arithmetic library with operations for fixed-point numbers.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)\n/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)\nlibrary FixedPointMathLib {\n /*//////////////////////////////////////////////////////////////\n SIMPLIFIED FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal constant MAX_UINT256 = 2**256 - 1;\n\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\n\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\n }\n\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\n }\n\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\n }\n\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\n }\n\n /*//////////////////////////////////////////////////////////////\n LOW LEVEL FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function mulDivDown(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\n if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\n revert(0, 0)\n }\n\n // Divide x * y by the denominator.\n z := div(mul(x, y), denominator)\n }\n }\n\n function mulDivUp(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\n if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\n revert(0, 0)\n }\n\n // If x * y modulo the denominator is strictly greater than 0,\n // 1 is added to round up the division of x * y by the denominator.\n z := add(gt(mod(mul(x, y), denominator), 0), div(mul(x, y), denominator))\n }\n }\n\n function rpow(\n uint256 x,\n uint256 n,\n uint256 scalar\n ) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n switch x\n case 0 {\n switch n\n case 0 {\n // 0 ** 0 = 1\n z := scalar\n }\n default {\n // 0 ** n = 0\n z := 0\n }\n }\n default {\n switch mod(n, 2)\n case 0 {\n // If n is even, store scalar in z for now.\n z := scalar\n }\n default {\n // If n is odd, store x in z for now.\n z := x\n }\n\n // Shifting right by 1 is like dividing by 2.\n let half := shr(1, scalar)\n\n for {\n // Shift n right by 1 before looping to halve it.\n n := shr(1, n)\n } n {\n // Shift n right by 1 each iteration to halve it.\n n := shr(1, n)\n } {\n // Revert immediately if x ** 2 would overflow.\n // Equivalent to iszero(eq(div(xx, x), x)) here.\n if shr(128, x) {\n revert(0, 0)\n }\n\n // Store x squared.\n let xx := mul(x, x)\n\n // Round to the nearest number.\n let xxRound := add(xx, half)\n\n // Revert if xx + half overflowed.\n if lt(xxRound, xx) {\n revert(0, 0)\n }\n\n // Set x to scaled xxRound.\n x := div(xxRound, scalar)\n\n // If n is even:\n if mod(n, 2) {\n // Compute z * x.\n let zx := mul(z, x)\n\n // If z * x overflowed:\n if iszero(eq(div(zx, x), z)) {\n // Revert if x is non-zero.\n if iszero(iszero(x)) {\n revert(0, 0)\n }\n }\n\n // Round to the nearest number.\n let zxRound := add(zx, half)\n\n // Revert if zx + half overflowed.\n if lt(zxRound, zx) {\n revert(0, 0)\n }\n\n // Return properly scaled zxRound.\n z := div(zxRound, scalar)\n }\n }\n }\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n GENERAL NUMBER UTILITIES\n //////////////////////////////////////////////////////////////*/\n\n function sqrt(uint256 x) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n let y := x // We start y at x, which will help us make our initial estimate.\n\n z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\n\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\n\n // We check y >= 2^(k + 8) but shift right by k bits\n // each branch to ensure that if x >= 256, then y >= 256.\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\n y := shr(128, y)\n z := shl(64, z)\n }\n if iszero(lt(y, 0x1000000000000000000)) {\n y := shr(64, y)\n z := shl(32, z)\n }\n if iszero(lt(y, 0x10000000000)) {\n y := shr(32, y)\n z := shl(16, z)\n }\n if iszero(lt(y, 0x1000000)) {\n y := shr(16, y)\n z := shl(8, z)\n }\n\n // Goal was to get z*z*y within a small factor of x. More iterations could\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\n\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\n\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\n\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\n\n // There is no overflow risk here since y < 2^136 after the first branch above.\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\n\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n\n // If x+1 is a perfect square, the Babylonian method cycles between\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\n z := sub(z, lt(div(x, z), z))\n }\n }\n\n function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n // Mod x by y. Note this will return\n // 0 instead of reverting if y is zero.\n z := mod(x, y)\n }\n }\n\n function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {\n /// @solidity memory-safe-assembly\n assembly {\n // Divide x by y. Note this will return\n // 0 instead of reverting if y is zero.\n r := div(x, y)\n }\n }\n\n function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n // Add 1 to x * y if x % y > 0. Note this will\n // return 0 instead of reverting if y is zero.\n z := add(gt(mod(x, y), 0), div(x, y))\n }\n }\n}\n" + }, + "solmate/src/utils/SafeCastLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Safe unsigned integer casting library that reverts on overflow.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeCastLib.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeCast.sol)\nlibrary SafeCastLib {\n function safeCastTo248(uint256 x) internal pure returns (uint248 y) {\n require(x < 1 << 248);\n\n y = uint248(x);\n }\n\n function safeCastTo224(uint256 x) internal pure returns (uint224 y) {\n require(x < 1 << 224);\n\n y = uint224(x);\n }\n\n function safeCastTo192(uint256 x) internal pure returns (uint192 y) {\n require(x < 1 << 192);\n\n y = uint192(x);\n }\n\n function safeCastTo160(uint256 x) internal pure returns (uint160 y) {\n require(x < 1 << 160);\n\n y = uint160(x);\n }\n\n function safeCastTo128(uint256 x) internal pure returns (uint128 y) {\n require(x < 1 << 128);\n\n y = uint128(x);\n }\n\n function safeCastTo96(uint256 x) internal pure returns (uint96 y) {\n require(x < 1 << 96);\n\n y = uint96(x);\n }\n\n function safeCastTo64(uint256 x) internal pure returns (uint64 y) {\n require(x < 1 << 64);\n\n y = uint64(x);\n }\n\n function safeCastTo32(uint256 x) internal pure returns (uint32 y) {\n require(x < 1 << 32);\n\n y = uint32(x);\n }\n\n function safeCastTo24(uint256 x) internal pure returns (uint24 y) {\n require(x < 1 << 24);\n\n y = uint24(x);\n }\n\n function safeCastTo16(uint256 x) internal pure returns (uint16 y) {\n require(x < 1 << 16);\n\n y = uint16(x);\n }\n\n function safeCastTo8(uint256 x) internal pure returns (uint8 y) {\n require(x < 1 << 8);\n\n y = uint8(x);\n }\n}\n" + }, + "solmate/src/utils/SafeTransferLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../tokens/ERC20.sol\";\n\n/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)\n/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.\n/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.\nlibrary SafeTransferLib {\n /*//////////////////////////////////////////////////////////////\n ETH OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function safeTransferETH(address to, uint256 amount) internal {\n bool success;\n\n /// @solidity memory-safe-assembly\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n\n require(success, \"ETH_TRANSFER_FAILED\");\n }\n\n /*//////////////////////////////////////////////////////////////\n ERC20 OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function safeTransferFrom(\n ERC20 token,\n address from,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n /// @solidity memory-safe-assembly\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), from) // Append the \"from\" argument.\n mstore(add(freeMemoryPointer, 36), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 68), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)\n )\n }\n\n require(success, \"TRANSFER_FROM_FAILED\");\n }\n\n function safeTransfer(\n ERC20 token,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n /// @solidity memory-safe-assembly\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\n )\n }\n\n require(success, \"TRANSFER_FAILED\");\n }\n\n function safeApprove(\n ERC20 token,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n /// @solidity memory-safe-assembly\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\n )\n }\n\n require(success, \"APPROVE_FAILED\");\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "storageLayout" + ], + "": ["ast"] + } + }, + "metadata": { + "useLiteralContent": true + }, + "libraries": { + "": { + "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" + } + } + } +} diff --git a/deployments/sepolia/solcInputs/b098c02b927c81fd02abb8247583d190.json b/deployments/sepolia/solcInputs/b098c02b927c81fd02abb8247583d190.json new file mode 100644 index 0000000..630b071 --- /dev/null +++ b/deployments/sepolia/solcInputs/b098c02b927c81fd02abb8247583d190.json @@ -0,0 +1,379 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlEnumerableUpgradeable.sol\";\nimport \"./AccessControlUpgradeable.sol\";\nimport \"../utils/structs/EnumerableSetUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {\n using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;\n\n mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;\n\n function __AccessControlEnumerable_init() internal onlyInitializing {\n }\n\n function __AccessControlEnumerable_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override {\n super._grantRole(role, account);\n _roleMembers[role].add(account);\n }\n\n /**\n * @dev Overload {_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override {\n super._revokeRole(role, account);\n _roleMembers[role].remove(account);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/IAccessControlEnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport {Initializable} from \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMathUpgradeable {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSetUpgradeable {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(account),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable2Step.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n}\n" + }, + "@openzeppelin/contracts/governance/utils/IVotes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotes {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at a specific moment in the past. If the `clock()` is\n * configured to use block numbers, this will return the value at the end of the corresponding block.\n */\n function getPastVotes(address account, uint256 timepoint) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is\n * configured to use block numbers, this will return the value at the end of the corresponding block.\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 timepoint) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed sender,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC5267.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC5267 {\n /**\n * @dev MAY be emitted to signal that the domain could have changed.\n */\n event EIP712DomainChanged();\n\n /**\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n * signature.\n */\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC5805.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5805.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../governance/utils/IVotes.sol\";\nimport \"./IERC6372.sol\";\n\ninterface IERC5805 is IERC6372, IVotes {}\n" + }, + "@openzeppelin/contracts/interfaces/IERC6372.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC6372.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC6372 {\n /**\n * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).\n */\n function clock() external view returns (uint48);\n\n /**\n * @dev Description of the clock\n */\n // solhint-disable-next-line func-name-mixedcase\n function CLOCK_MODE() external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts/security/Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n" + }, + "@openzeppelin/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n// EIP-2612 is Final as of 2022-11-01. This file is deprecated.\n\nimport \"./ERC20Permit.sol\";\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\n * tokens and those that they have an allowance for, in a way that can be\n * recognized off-chain (via event analysis).\n */\nabstract contract ERC20Burnable is Context, ERC20 {\n /**\n * @dev Destroys `amount` tokens from the caller.\n *\n * See {ERC20-_burn}.\n */\n function burn(uint256 amount) public virtual {\n _burn(_msgSender(), amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, deducting from the caller's\n * allowance.\n *\n * See {ERC20-_burn} and {ERC20-allowance}.\n *\n * Requirements:\n *\n * - the caller must have allowance for ``accounts``'s tokens of at least\n * `amount`.\n */\n function burnFrom(address account, uint256 amount) public virtual {\n _spendAllowance(account, _msgSender(), amount);\n _burn(account, amount);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Permit.sol\";\nimport \"../ERC20.sol\";\nimport \"../../../utils/cryptography/ECDSA.sol\";\nimport \"../../../utils/cryptography/EIP712.sol\";\nimport \"../../../utils/Counters.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * _Available since v3.4._\n */\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {\n using Counters for Counters.Counter;\n\n mapping(address => Counters.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n constructor(string memory name) EIP712(name, \"1\") {}\n\n /**\n * @inheritdoc IERC20Permit\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSA.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @inheritdoc IERC20Permit\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @inheritdoc IERC20Permit\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n Counters.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Votes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ERC20Permit.sol\";\nimport \"../../../interfaces/IERC5805.sol\";\nimport \"../../../utils/math/Math.sol\";\nimport \"../../../utils/math/SafeCast.sol\";\nimport \"../../../utils/cryptography/ECDSA.sol\";\n\n/**\n * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,\n * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.\n *\n * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.\n *\n * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either\n * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting\n * power can be queried through the public accessors {getVotes} and {getPastVotes}.\n *\n * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it\n * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.\n *\n * _Available since v4.2._\n */\nabstract contract ERC20Votes is ERC20Permit, IERC5805 {\n struct Checkpoint {\n uint32 fromBlock;\n uint224 votes;\n }\n\n bytes32 private constant _DELEGATION_TYPEHASH =\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n\n mapping(address => address) private _delegates;\n mapping(address => Checkpoint[]) private _checkpoints;\n Checkpoint[] private _totalSupplyCheckpoints;\n\n /**\n * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).\n */\n function clock() public view virtual override returns (uint48) {\n return SafeCast.toUint48(block.number);\n }\n\n /**\n * @dev Description of the clock\n */\n // solhint-disable-next-line func-name-mixedcase\n function CLOCK_MODE() public view virtual override returns (string memory) {\n // Check that the clock was not modified\n require(clock() == block.number, \"ERC20Votes: broken clock mode\");\n return \"mode=blocknumber&from=default\";\n }\n\n /**\n * @dev Get the `pos`-th checkpoint for `account`.\n */\n function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {\n return _checkpoints[account][pos];\n }\n\n /**\n * @dev Get number of checkpoints for `account`.\n */\n function numCheckpoints(address account) public view virtual returns (uint32) {\n return SafeCast.toUint32(_checkpoints[account].length);\n }\n\n /**\n * @dev Get the address `account` is currently delegating to.\n */\n function delegates(address account) public view virtual override returns (address) {\n return _delegates[account];\n }\n\n /**\n * @dev Gets the current votes balance for `account`\n */\n function getVotes(address account) public view virtual override returns (uint256) {\n uint256 pos = _checkpoints[account].length;\n unchecked {\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\n }\n }\n\n /**\n * @dev Retrieve the number of votes for `account` at the end of `timepoint`.\n *\n * Requirements:\n *\n * - `timepoint` must be in the past\n */\n function getPastVotes(address account, uint256 timepoint) public view virtual override returns (uint256) {\n require(timepoint < clock(), \"ERC20Votes: future lookup\");\n return _checkpointsLookup(_checkpoints[account], timepoint);\n }\n\n /**\n * @dev Retrieve the `totalSupply` at the end of `timepoint`. Note, this value is the sum of all balances.\n * It is NOT the sum of all the delegated votes!\n *\n * Requirements:\n *\n * - `timepoint` must be in the past\n */\n function getPastTotalSupply(uint256 timepoint) public view virtual override returns (uint256) {\n require(timepoint < clock(), \"ERC20Votes: future lookup\");\n return _checkpointsLookup(_totalSupplyCheckpoints, timepoint);\n }\n\n /**\n * @dev Lookup a value in a list of (sorted) checkpoints.\n */\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 timepoint) private view returns (uint256) {\n // We run a binary search to look for the last (most recent) checkpoint taken before (or at) `timepoint`.\n //\n // Initially we check if the block is recent to narrow the search range.\n // During the loop, the index of the wanted checkpoint remains in the range [low-1, high).\n // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.\n // - If the middle checkpoint is after `timepoint`, we look in [low, mid)\n // - If the middle checkpoint is before or equal to `timepoint`, we look in [mid+1, high)\n // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not\n // out of bounds (in which case we're looking too far in the past and the result is 0).\n // Note that if the latest checkpoint available is exactly for `timepoint`, we end up with an index that is\n // past the end of the array, so we technically don't find a checkpoint after `timepoint`, but it works out\n // the same.\n uint256 length = ckpts.length;\n\n uint256 low = 0;\n uint256 high = length;\n\n if (length > 5) {\n uint256 mid = length - Math.sqrt(length);\n if (_unsafeAccess(ckpts, mid).fromBlock > timepoint) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n while (low < high) {\n uint256 mid = Math.average(low, high);\n if (_unsafeAccess(ckpts, mid).fromBlock > timepoint) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n unchecked {\n return high == 0 ? 0 : _unsafeAccess(ckpts, high - 1).votes;\n }\n }\n\n /**\n * @dev Delegate votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) public virtual override {\n _delegate(_msgSender(), delegatee);\n }\n\n /**\n * @dev Delegates votes from signer to `delegatee`\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= expiry, \"ERC20Votes: signature expired\");\n address signer = ECDSA.recover(\n _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),\n v,\n r,\n s\n );\n require(nonce == _useNonce(signer), \"ERC20Votes: invalid nonce\");\n _delegate(signer, delegatee);\n }\n\n /**\n * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).\n */\n function _maxSupply() internal view virtual returns (uint224) {\n return type(uint224).max;\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been increased.\n */\n function _mint(address account, uint256 amount) internal virtual override {\n super._mint(account, amount);\n require(totalSupply() <= _maxSupply(), \"ERC20Votes: total supply risks overflowing votes\");\n\n _writeCheckpoint(_totalSupplyCheckpoints, _add, amount);\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been decreased.\n */\n function _burn(address account, uint256 amount) internal virtual override {\n super._burn(account, amount);\n\n _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);\n }\n\n /**\n * @dev Move voting power when tokens are transferred.\n *\n * Emits a {IVotes-DelegateVotesChanged} event.\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual override {\n super._afterTokenTransfer(from, to, amount);\n\n _moveVotingPower(delegates(from), delegates(to), amount);\n }\n\n /**\n * @dev Change delegation for `delegator` to `delegatee`.\n *\n * Emits events {IVotes-DelegateChanged} and {IVotes-DelegateVotesChanged}.\n */\n function _delegate(address delegator, address delegatee) internal virtual {\n address currentDelegate = delegates(delegator);\n uint256 delegatorBalance = balanceOf(delegator);\n _delegates[delegator] = delegatee;\n\n emit DelegateChanged(delegator, currentDelegate, delegatee);\n\n _moveVotingPower(currentDelegate, delegatee, delegatorBalance);\n }\n\n function _moveVotingPower(address src, address dst, uint256 amount) private {\n if (src != dst && amount > 0) {\n if (src != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);\n emit DelegateVotesChanged(src, oldWeight, newWeight);\n }\n\n if (dst != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);\n emit DelegateVotesChanged(dst, oldWeight, newWeight);\n }\n }\n }\n\n function _writeCheckpoint(\n Checkpoint[] storage ckpts,\n function(uint256, uint256) view returns (uint256) op,\n uint256 delta\n ) private returns (uint256 oldWeight, uint256 newWeight) {\n uint256 pos = ckpts.length;\n\n unchecked {\n Checkpoint memory oldCkpt = pos == 0 ? Checkpoint(0, 0) : _unsafeAccess(ckpts, pos - 1);\n\n oldWeight = oldCkpt.votes;\n newWeight = op(oldWeight, delta);\n\n if (pos > 0 && oldCkpt.fromBlock == clock()) {\n _unsafeAccess(ckpts, pos - 1).votes = SafeCast.toUint224(newWeight);\n } else {\n ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(clock()), votes: SafeCast.toUint224(newWeight)}));\n }\n }\n }\n\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\n return a + b;\n }\n\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.\n */\n function _unsafeAccess(Checkpoint[] storage ckpts, uint256 pos) private pure returns (Checkpoint storage result) {\n assembly {\n mstore(0, ckpts.slot)\n result.slot := add(keccak256(0, 0x20), pos)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n *\n * CAUTION: See Security Considerations above.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"./IERC721Enumerable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721Enumerable is ERC721, IERC721Enumerable {\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {\n return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Enumerable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n\n if (batchSize > 1) {\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\n revert(\"ERC721Enumerable: consecutive transfers not supported\");\n }\n\n uint256 tokenId = firstTokenId;\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Enumerable is IERC721 {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Counters.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary Counters {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./ECDSA.sol\";\nimport \"../ShortStrings.sol\";\nimport \"../../interfaces/IERC5267.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * _Available since v3.4._\n *\n * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n */\nabstract contract EIP712 is IERC5267 {\n using ShortStrings for *;\n\n bytes32 private constant _TYPE_HASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _cachedDomainSeparator;\n uint256 private immutable _cachedChainId;\n address private immutable _cachedThis;\n\n bytes32 private immutable _hashedName;\n bytes32 private immutable _hashedVersion;\n\n ShortString private immutable _name;\n ShortString private immutable _version;\n string private _nameFallback;\n string private _versionFallback;\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n _name = name.toShortStringWithFallback(_nameFallback);\n _version = version.toShortStringWithFallback(_versionFallback);\n _hashedName = keccak256(bytes(name));\n _hashedVersion = keccak256(bytes(version));\n\n _cachedChainId = block.chainid;\n _cachedDomainSeparator = _buildDomainSeparator();\n _cachedThis = address(this);\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\n return _cachedDomainSeparator;\n } else {\n return _buildDomainSeparator();\n }\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev See {EIP-5267}.\n *\n * _Available since v4.9._\n */\n function eip712Domain()\n public\n view\n virtual\n override\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n return (\n hex\"0f\", // 01111\n _name.toStringWithFallback(_nameFallback),\n _version.toStringWithFallback(_versionFallback),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/ShortStrings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./StorageSlot.sol\";\n\n// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |\n// | length | 0x BB |\ntype ShortString is bytes32;\n\n/**\n * @dev This library provides functions to convert short memory strings\n * into a `ShortString` type that can be used as an immutable variable.\n *\n * Strings of arbitrary length can be optimized using this library if\n * they are short enough (up to 31 bytes) by packing them with their\n * length (1 byte) in a single EVM word (32 bytes). Additionally, a\n * fallback mechanism can be used for every other case.\n *\n * Usage example:\n *\n * ```solidity\n * contract Named {\n * using ShortStrings for *;\n *\n * ShortString private immutable _name;\n * string private _nameFallback;\n *\n * constructor(string memory contractName) {\n * _name = contractName.toShortStringWithFallback(_nameFallback);\n * }\n *\n * function name() external view returns (string memory) {\n * return _name.toStringWithFallback(_nameFallback);\n * }\n * }\n * ```\n */\nlibrary ShortStrings {\n // Used as an identifier for strings longer than 31 bytes.\n bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n error StringTooLong(string str);\n error InvalidShortString();\n\n /**\n * @dev Encode a string of at most 31 chars into a `ShortString`.\n *\n * This will trigger a `StringTooLong` error is the input string is too long.\n */\n function toShortString(string memory str) internal pure returns (ShortString) {\n bytes memory bstr = bytes(str);\n if (bstr.length > 31) {\n revert StringTooLong(str);\n }\n return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n }\n\n /**\n * @dev Decode a `ShortString` back to a \"normal\" string.\n */\n function toString(ShortString sstr) internal pure returns (string memory) {\n uint256 len = byteLength(sstr);\n // using `new string(len)` would work locally but is not memory safe.\n string memory str = new string(32);\n /// @solidity memory-safe-assembly\n assembly {\n mstore(str, len)\n mstore(add(str, 0x20), sstr)\n }\n return str;\n }\n\n /**\n * @dev Return the length of a `ShortString`.\n */\n function byteLength(ShortString sstr) internal pure returns (uint256) {\n uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n if (result > 31) {\n revert InvalidShortString();\n }\n return result;\n }\n\n /**\n * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.\n */\n function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {\n if (bytes(value).length < 32) {\n return toShortString(value);\n } else {\n StorageSlot.getStringSlot(store).value = value;\n return ShortString.wrap(_FALLBACK_SENTINEL);\n }\n }\n\n /**\n * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\n */\n function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {\n if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {\n return toString(value);\n } else {\n return store;\n }\n }\n\n /**\n * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\n *\n * WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.\n */\n function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {\n if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {\n return byteLength(value);\n } else {\n return bytes(store).length;\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/drafts/Controller.sol": { + "content": "pragma solidity 0.8.20;\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controller is Ownable {\n struct Settings {\n address _addr;\n uint256 _val;\n }\n mapping(string => Settings) public settingsMap;\n // Settings public settings;\n Settings[] public settingsArr;\n\n constructor(\n address[] memory addresses,\n uint256[] memory vals,\n string[] memory names\n ) Ownable() {\n uint256 i = vals.length;\n while (i > 0) {\n unchecked {\n --i;\n _setSetting(names[i], addresses[i], vals[i]);\n }\n }\n }\n\n function get(string calldata name) public returns (address _a, uint256 _v) {\n Settings memory _s = settingsMap[name];\n _a = _s._addr;\n _v = _s._val;\n }\n\n function _setSetting(\n string memory name,\n address addr,\n uint256 val\n ) internal {\n Settings memory _s = Settings({_addr: addr, _val: val});\n\n settingsMap[name] = _s;\n }\n}\n" + }, + "contracts/governance/SGTv2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.7;\n\n// Inherit permit to allow a permit signed approval for gas savings\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol\";\n// Token needs to be burnable to allow the voteEscrow to burn self tokens as early withdraw penalyu\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\";\n\ncontract SGTv2 is ERC20Burnable, ERC20Permit {\n constructor(\n string memory name,\n string memory symbol,\n uint256 initialSupply,\n address owner\n ) ERC20(name, symbol) ERC20Permit(name) {\n _mint(owner, initialSupply);\n }\n}\n" + }, + "contracts/governance/voteEscrow.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.7;\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\nimport \"../interfaces/IVotingEscrow.sol\";\n\ncontract VoteEscrow is ERC20Votes, ReentrancyGuard, Ownable, IVotingEscrow {\n using SafeERC20 for IERC20;\n\n struct LockedBalance {\n uint256 amount;\n uint256 end;\n }\n // flags\n uint256 public constant MINDAYS = 7;\n uint256 public constant MAXDAYS = 3 * 365;\n\n uint256 public constant MAXTIME = MAXDAYS * 1 days; // 3 years\n uint256 public constant MAX_WITHDRAWAL_PENALTY = 50000; // 50%\n uint256 public constant PRECISION = 100000; // 5 decimals\n\n address public lockedToken;\n address public penaltyCollector;\n uint256 public minLockedAmount;\n uint256 public earlyWithdrawPenaltyRate;\n\n uint256 public override supply;\n\n mapping(address => LockedBalance) public locked;\n mapping(address => uint256) public mintedForLock;\n address public constant burn = 0x000000000000000000000000000000000000dEaD;\n\n /* =============== EVENTS ==================== */\n event Deposit(address indexed provider, uint256 value, uint256 locktime, uint256 timestamp);\n event Withdraw(address indexed provider, uint256 value, uint256 timestamp);\n event PenaltyCollectorSet(address indexed addr);\n event EarlyWithdrawPenaltySet(uint256 indexed penalty);\n event MinLockedAmountSet(uint256 indexed amount);\n\n constructor(\n string memory _name,\n string memory _symbol,\n address _lockedToken,\n uint256 _minLockedAmount\n ) ERC20(_name, _symbol) ERC20Permit(_name) {\n lockedToken = _lockedToken;\n minLockedAmount = _minLockedAmount;\n earlyWithdrawPenaltyRate = 30000; // 30%\n }\n\n function deposit_for(address _addr, uint256 _value) external override {\n require(_value >= minLockedAmount, \"VE:VL0\");\n _deposit_for(_addr, _value, 0);\n }\n\n function create_lock(uint256 _value, uint256 _days) external override {\n require(_value >= minLockedAmount, \"less than min amount\");\n require(locked[_msgSender()].amount == 0, \"Withdraw old tokens first\");\n require(_days >= MINDAYS, \"Voting lock can be 7 days min\");\n require(_days <= MAXDAYS, \"Voting lock can be 4 years max\");\n _deposit_for(_msgSender(), _value, _days);\n }\n\n function increase_amount(uint256 _value) external override {\n require(_value >= minLockedAmount, \"less than min amount\");\n _deposit_for(_msgSender(), _value, 0);\n }\n\n function increase_unlock_time(uint256 _days) external override {\n require(_days >= MINDAYS, \"Voting lock can be 7 days min\");\n require(_days <= MAXDAYS, \"Voting lock can be 4 years max\");\n _deposit_for(_msgSender(), 0, _days);\n }\n\n function withdraw() external override nonReentrant {\n LockedBalance storage _locked = locked[_msgSender()];\n uint256 _now = block.timestamp;\n require(_locked.amount > 0, \"Nothing to withdraw\");\n require(_now >= _locked.end, \"The lock didn't expire\");\n uint256 _amount = _locked.amount;\n _locked.end = 0;\n _locked.amount = 0;\n _burn(_msgSender(), mintedForLock[_msgSender()]);\n mintedForLock[_msgSender()] = 0;\n IERC20(lockedToken).safeTransfer(_msgSender(), _amount);\n\n emit Withdraw(_msgSender(), _amount, _now);\n }\n\n // This will charge PENALTY if lock is not expired yet\n function emergencyWithdraw() external nonReentrant {\n LockedBalance storage _locked = locked[_msgSender()];\n uint256 _now = block.timestamp;\n require(_locked.amount > 0, \"Nothing to withdraw\");\n uint256 _amount = _locked.amount;\n if (_now < _locked.end) {\n uint256 _fee = (_amount * earlyWithdrawPenaltyRate) / PRECISION;\n _penalize(_fee);\n _amount = _amount - _fee;\n }\n _locked.end = 0;\n supply -= _locked.amount;\n _locked.amount = 0;\n _burn(_msgSender(), mintedForLock[_msgSender()]);\n mintedForLock[_msgSender()] = 0;\n\n IERC20(lockedToken).safeTransfer(_msgSender(), _amount);\n\n emit Withdraw(_msgSender(), _amount, _now);\n }\n\n /* ========== RESTRICTED FUNCTIONS ========== */\n\n function setMinLockedAmount(uint256 _minLockedAmount) external onlyOwner {\n minLockedAmount = _minLockedAmount;\n emit MinLockedAmountSet(_minLockedAmount);\n }\n\n function setEarlyWithdrawPenaltyRate(uint256 _earlyWithdrawPenaltyRate) external onlyOwner {\n require(_earlyWithdrawPenaltyRate <= MAX_WITHDRAWAL_PENALTY, \"withdrawal penalty is too high\"); // <= 50%\n earlyWithdrawPenaltyRate = _earlyWithdrawPenaltyRate;\n emit EarlyWithdrawPenaltySet(_earlyWithdrawPenaltyRate);\n }\n\n function setPenaltyCollector(address _addr) external onlyOwner {\n penaltyCollector = _addr;\n emit PenaltyCollectorSet(_addr);\n }\n\n /* ========== PUBLIC FUNCTIONS ========== */\n\n function locked__of(address _addr) external view returns (uint256) {\n return locked[_addr].amount;\n }\n\n function locked__end(address _addr) external view returns (uint256) {\n return locked[_addr].end;\n }\n\n function voting_power_unlock_time(uint256 _value, uint256 _unlockTime) public view returns (uint256) {\n uint256 _now = block.timestamp;\n if (_unlockTime <= _now) return 0;\n uint256 _lockedSeconds = _unlockTime - _now;\n if (_lockedSeconds >= MAXTIME) {\n return _value;\n }\n return (_value * _lockedSeconds) / MAXTIME;\n }\n\n function voting_power_locked_days(uint256 _value, uint256 _days) public view returns (uint256) {\n if (_days >= MAXDAYS) {\n return _value;\n }\n return (_value * _days) / MAXDAYS;\n }\n\n /* ========== INTERNAL FUNCTIONS ========== */\n\n function _deposit_for(address _addr, uint256 _value, uint256 _days) internal nonReentrant {\n LockedBalance storage _locked = locked[_addr];\n uint256 _now = block.timestamp;\n uint256 _amount = _locked.amount;\n uint256 _end = _locked.end;\n uint256 _vp;\n if (_amount == 0) {\n _vp = voting_power_locked_days(_value, _days);\n _locked.amount = _value;\n _locked.end = _now + _days * 1 days;\n } else if (_days == 0) {\n _vp = voting_power_unlock_time(_value, _end);\n _locked.amount = _amount + _value;\n } else {\n require(_value == 0, \"Cannot increase amount and extend lock in the same time\");\n _vp = voting_power_locked_days(_amount, _days);\n _locked.end = _end + _days * 1 days;\n require(_locked.end - _now <= MAXTIME, \"Cannot extend lock to more than 4 years\");\n }\n require(_vp > 0, \"No benefit to lock\");\n if (_value > 0) {\n IERC20(lockedToken).safeTransferFrom(_msgSender(), address(this), _value);\n }\n _mint(_addr, _vp);\n mintedForLock[_addr] += _vp;\n supply += _value;\n\n emit Deposit(_addr, _locked.amount, _locked.end, _now);\n }\n\n function _penalize(uint256 _amount) internal {\n // TODO: we cannot burn univ2/sushi LP tokens, therefore they need to be sent to 0xdead or this needs to change\n if (penaltyCollector != address(0)) {\n // send to collector if `penaltyCollector` set\n IERC20(lockedToken).safeTransfer(penaltyCollector, _amount);\n } else {\n ERC20Burnable(lockedToken).burn(_amount);\n }\n }\n\n function _withdraw() internal {\n LockedBalance storage _locked = locked[_msgSender()];\n uint256 _now = block.timestamp;\n require(_locked.amount > 0, \"Nothing to withdraw\");\n uint256 _amount = _locked.amount;\n if (_now < _locked.end) {\n uint256 _fee = (_amount * earlyWithdrawPenaltyRate) / PRECISION;\n _penalize(_fee);\n _amount = _amount - _fee;\n }\n _locked.end = 0;\n _locked.amount = 0;\n _burn(_msgSender(), mintedForLock[_msgSender()]);\n mintedForLock[_msgSender()] = 0;\n supply -= _amount;\n\n IERC20(lockedToken).safeTransfer(_msgSender(), _amount);\n\n emit Withdraw(_msgSender(), _amount, _now);\n }\n}\n" + }, + "contracts/governance/VoteEscrowFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.7;\nimport \"./voteEscrow.sol\";\nimport \"../interfaces/IVotingEscrow.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract VoteEscrowFactory {\n event VoteEscrowCreated(\n address indexed addr,\n string name,\n string indexed symbol,\n address lockedToken,\n uint256 minLockedAmount\n );\n\n constructor() {}\n\n function createVoteEscrowContract(\n string memory _name,\n string memory _symbol,\n address _lockedToken,\n uint256 _minLockedAmount\n ) external returns (address ve) {\n ve = address(new VoteEscrow(_name, _symbol, _lockedToken, _minLockedAmount));\n Ownable(ve).transferOwnership(msg.sender);\n emit VoteEscrowCreated(ve, _name, _symbol, _lockedToken, _minLockedAmount);\n return ve;\n }\n}\n" + }, + "contracts/interfaces/IAllowlist.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IAllowlist {\n function inAllowlist(address _user) external returns (bool _isInAllowlist);\n}\n" + }, + "contracts/interfaces/IBlocklist.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IBlocklist {\n function inBlockList(address _user) external returns (bool _isInBlocklist);\n}\n" + }, + "contracts/interfaces/IDepositContract.sol": { + "content": "pragma solidity ^0.8.0;\n\n// ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━\n// ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓\n// ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛\n// ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃┃━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━\n// ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓\n// ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n// SPDX-License-Identifier: CC0-1.0\n\n// This interface is designed to be compatible with the Vyper version.\n/// @notice This is the Ethereum 2.0 deposit contract interface.\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\ninterface IDepositContract {\n /// @notice A processed deposit event.\n event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);\n\n /// @notice Submit a Phase 0 DepositData object.\n /// @param pubkey A BLS12-381 public key.\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\n /// @param signature A BLS12-381 signature.\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\n /// Used as a protection against malformed input.\n function deposit(\n bytes calldata pubkey,\n bytes calldata withdrawal_credentials,\n bytes calldata signature,\n bytes32 deposit_data_root\n ) external payable;\n\n /// @notice Query the current deposit root hash.\n /// @return The deposit root hash.\n function get_deposit_root() external view returns (bytes32);\n\n /// @notice Query the current deposit count.\n /// @return The deposit count encoded as a little endian 64-bit number.\n function get_deposit_count() external view returns (bytes memory);\n}\n" + }, + "contracts/interfaces/IERC20MintableBurnable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IERC20MintableBurnable {\n function mintingAllowedAfter() external view returns (uint256);\n\n /**\n * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`\n * @param account The address of the account holding the funds\n * @param spender The address of the account spending the funds\n * @return The number of tokens approved\n */\n function allowance(address account, address spender) external view returns (uint256);\n\n /**\n * @notice Get the number of tokens held by the `account`\n * @param account The address of the account to get the balance of\n * @return The number of tokens held\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(address spender, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Triggers an approval from owner to spends\n * @param owner The address to approve from\n * @param spender The address to be approved\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @param deadline The time at which to expire the signature\n * @param v The recovery byte of the signature\n * @param r Half of the ECDSA signature pair\n * @param s Half of the ECDSA signature pair\n */\n function permit(\n address owner,\n address spender,\n uint256 rawAmount,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(address dst, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(address src, address dst, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Mint new tokens\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to be minted\n */\n function mint(address dst, uint256 rawAmount) external;\n\n function burn(address src, uint256 rawAmount) external;\n function setMinter(address minter_) external;\n}\n" + }, + "contracts/interfaces/IFeeCalc.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IFeeCalc {\n function processDeposit(uint256 amt, address who) external view returns (uint256, uint256);\n\n function processWithdraw(uint256 amt, address who) external view returns (uint256, uint256);\n\n}" + }, + "contracts/interfaces/IFundDistributor.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFundDistributor {\n function distributeTo(address _receiver, uint256 _amount) external;\n}\n" + }, + "contracts/interfaces/IMasterChef.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\npragma experimental ABIEncoderV2;\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IMasterChef {\n struct UserInfo {\n uint256 amount; // How many LP tokens the user has provided.\n uint256 rewardDebt; // Reward debt. See explanation below.\n }\n\n struct PoolInfo {\n IERC20 lpToken; // Address of LP token contract.\n uint256 allocPoint; // How many allocation points assigned to this pool. SUSHI to distribute per block.\n uint256 lastRewardBlock; // Last block number that SUSHI distribution occurs.\n uint256 accSushiPerShare; // Accumulated SUSHI per share, times 1e12. See below.\n }\n\n function poolInfo(uint256 pid) external view returns (IMasterChef.PoolInfo memory);\n\n function totalAllocPoint() external view returns (uint256);\n\n function deposit(uint256 _pid, uint256 _amount) external;\n}\n" + }, + "contracts/interfaces/IMiniChefV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\npragma experimental ABIEncoderV2;\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IMiniChefV2 {\n struct UserInfo {\n uint256 amount;\n uint256 rewardDebt;\n }\n\n struct PoolInfo {\n uint128 accSushiPerShare;\n uint64 lastRewardTime;\n uint64 allocPoint;\n }\n\n function poolLength() external view returns (uint256);\n\n function updatePool(uint256 pid) external returns (IMiniChefV2.PoolInfo memory);\n\n function userInfo(uint256 _pid, address _user) external view returns (uint256, uint256);\n\n function deposit(\n uint256 pid,\n uint256 amount,\n address to\n ) external;\n\n function withdraw(\n uint256 pid,\n uint256 amount,\n address to\n ) external;\n\n function harvest(uint256 pid, address to) external;\n\n function withdrawAndHarvest(\n uint256 pid,\n uint256 amount,\n address to\n ) external;\n\n function emergencyWithdraw(uint256 pid, address to) external;\n\n function lpToken(uint256 _pid) external view returns (IERC20);\n}\n" + }, + "contracts/interfaces/IPriceOracle.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IPriceOracle {\n function setCostPerShare(uint256 shares) external;\n\n function getCostPerShare() external returns (uint256 _costPerShare);\n}\n" + }, + "contracts/interfaces/IRewarder.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IRewarder {\n function onReward(\n uint256 pid,\n address user,\n address recipient,\n uint256 rewardAmount,\n uint256 newLpAmount\n ) external;\n\n function pendingTokens(\n uint256 pid,\n address user,\n uint256 rewardAmount\n ) external view returns (IERC20[] memory, uint256[] memory);\n}\n" + }, + "contracts/interfaces/ISGEth.sol": { + "content": "// SPDX-License-Identifier: MIT\n// @ChimeraDefi Jun 2023\npragma solidity ^0.8.0;\n\ninterface ISGEth {\n function burn(address addr, uint256 amt) external;\n function approve(address spender, uint256 amount) external returns (bool);\n function mint(address addr, uint256 amt) external;\n}\n\n// | SharedDepositMinterV2 · 8.78 │" + }, + "contracts/interfaces/ISharedDeposit.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface ISharedDeposit {\n function withdraw(uint256 amount) external;\n function withdraw(uint256 amount, address dest) external;\n\n function deposit() payable external;\n\n function remainingSpaceInEpoch() external;\n function depositAndStakeFor(address dest) external payable;\n}\n" + }, + "contracts/interfaces/ITokenManager.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface ITokenManager {\n function donate(uint256 shares) external payable;\n\n function setTokenAddress(address _address) external;\n\n function mint(address recv, uint256 amt) external;\n\n function burn(address recv, uint256 amt) external;\n\n function petrifyMinterTransfer() external;\n\n function transferTokenMinterRights(address payable minter_) external;\n}\n" + }, + "contracts/interfaces/ITokenUtilityModule.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\n// A benefits module for token/nft holders\n// Externally calculate boosts and bonuses\ninterface ITokenUtilityModule {\n // Allow epoch length reduction\n function getEpochLength(\n address _sender,\n address _requestContract,\n uint256 amt,\n uint256 defaultVal\n ) external view returns (uint256);\n\n function getAdminFee(\n address _address,\n address _requestContract,\n uint256 amt,\n uint256 defaultVal\n ) external view returns (uint256);\n\n function getWithdrawalTotal(\n address _address,\n address _requestContract,\n uint256 amt,\n uint256 defaultVal\n ) external view returns (uint256);\n\n function getBoost(\n address _address,\n address _requestContract,\n uint256 amt,\n uint256 defaultVal\n ) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IvETH2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IvETH2 {\n function setMinter(address minter_) external;\n\n /**\n * @notice Mint new tokens\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to be minted\n */\n function mint(address dst, uint256 rawAmount) external;\n\n function burn(address src, uint256 rawAmount) external;\n\n function mintingAllowedAfter() external view returns (uint256);\n\n /**\n * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`\n * @param account The address of the account holding the funds\n * @param spender The address of the account spending the funds\n * @return The number of tokens approved\n */\n function allowance(address account, address spender) external view returns (uint256);\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(address spender, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Triggers an approval from owner to spends\n * @param owner The address to approve from\n * @param spender The address to be approved\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @param deadline The time at which to expire the signature\n * @param v The recovery byte of the signature\n * @param r Half of the ECDSA signature pair\n * @param s Half of the ECDSA signature pair\n */\n function permit(\n address owner,\n address spender,\n uint256 rawAmount,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @notice Get the number of tokens held by the `account`\n * @param account The address of the account to get the balance of\n * @return The number of tokens held\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(address dst, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(\n address src,\n address dst,\n uint256 rawAmount\n ) external returns (bool);\n\n function totalSupply() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IVotingEscrow.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\n// Standard Curvefi voting escrow interface\n// We want to use a standard iface to allow compatibility\npragma solidity ^0.8.0;\n\ninterface IVotingEscrow {\n // Following are used in Fee distribution contracts e.g.\n /*\n https://etherscan.io/address/0x74c6cade3ef61d64dcc9b97490d9fbb231e4bdcc#code\n */\n // struct Point {\n // int128 bias;\n // int128 slope;\n // uint256 ts;\n // uint256 blk;\n // }\n\n // function user_point_epoch(address addr) external view returns (uint256);\n\n // function epoch() external view returns (uint256);\n\n // function user_point_history(address addr, uint256 loc) external view returns (Point);\n\n // function checkpoint() external;\n\n /*\n https://etherscan.io/address/0x2e57627ACf6c1812F99e274d0ac61B786c19E74f#readContract\n */\n // Gauge proxy requires the following. inherit from ERC20\n // balanceOf\n // totalSupply\n\n function deposit_for(address _addr, uint256 _value) external;\n\n function create_lock(uint256 _value, uint256 _unlock_time) external;\n\n function increase_amount(uint256 _value) external;\n\n function increase_unlock_time(uint256 _unlock_time) external;\n\n function withdraw() external;\n\n // Extra required views\n function supply() external view returns (uint256);\n\n // function transferOwnership(address addr) external;\n}\n" + }, + "contracts/interfaces/IWSGEth.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// Cloned from fei/rari ERC4626 impl https://github.com/fei-protocol/ERC4626/blob/main/src/interfaces/IxERC4626.sol\n// @ChimeraDefi Jun 2023\n\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)\n\npragma solidity ^0.8.0;\n\ninterface IWSGEth {\n // Takes X(n=assets) ETH and returns Y(n=shares) wsgETH\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n // Takes assets wsgETH and returns shares sgETH\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n" + }, + "contracts/v1/GoerliETHRecov.sol": { + "content": "//SPDX-License-Identifier: Unlicensed\n\npragma solidity 0.8.20;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\ninterface ISharedDeposit {\n function donate(uint256 shares) external payable;\n}\n\ncontract GoerliETHRecov is ISharedDeposit {\n constructor() {}\n\n // Allows recovering ETH from old v1 goerli minter to test v2\n\n // needed to set this as a minter\n function donate(uint256 shares) external payable {\n uint256 incoming = msg.value;\n address payable recv = payable(0xa1feaF41d843d53d0F6bEd86a8cF592cE21C409e);\n\n if (incoming > 0) {\n Address.sendValue(recv, incoming);\n }\n\n uint256 bal = address(this).balance;\n if (bal > 0) {\n Address.sendValue(recv, bal);\n }\n }\n}\n" + }, + "contracts/v2/core/RewardsReceiver.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\n\n// Rewards receiver contract for ETH2 CL + RL rewards\n// Acts as withdrawals address\n// Sends recieved ETH to Deposits when system is healthy and buffer can process withdrawals\n// Sends all recieved ETH to withdrawals contract when system is shutting down and validators are being exited\n// normal deposit contract is ETH2sgETHYR to autocompound rewards\n// call work() to process ETH\n// DAO is set as owner. must call acceptOwnership. can call flipState\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {YieldDirectorBase} from \"../lib/YieldDirectorBase.sol\";\n\n/// @title RewardsReceiver - Rewards receiver contract for ETH2 CL + RL rewards\n/// @author @ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com\ncontract RewardsReceiver is Ownable, YieldDirectorBase {\n enum State {\n Deposits,\n Withdrawals\n }\n State public state;\n address payable public immutable WITHDRAWALS;\n\n constructor(\n address _withdrawalAddr,\n address[] memory yieldDirectorAddresses\n ) payable Ownable() YieldDirectorBase(yieldDirectorAddresses) {\n WITHDRAWALS = payable(_withdrawalAddr);\n state = State.Deposits;\n }\n\n function work() external payable {\n if (state == State.Deposits) {\n _convertToSgETHAndTransfer();\n } else if (state == State.Withdrawals) {\n WITHDRAWALS.transfer(address(this).balance);\n }\n }\n\n function flipState() external onlyOwner {\n if (state == State.Deposits) {\n state = State.Withdrawals;\n } else if (state == State.Withdrawals) {\n state = State.Deposits;\n }\n }\n\n // Allows upgrading/ changing the downstream DAO fee splitter only for easier fee tier changes in the future\n function setDAOFeeSplitter(address _feeSplitter) external onlyOwner {\n feeSplitter = _feeSplitter;\n }\n\n receive() external payable {} // solhint-disable-line\n\n fallback() external payable {} // solhint-disable-line\n}\n" + }, + "contracts/v2/core/Rollover.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\n\nimport {SafeERC20, SafeMath, IERC20, RedemptionsBase} from \"../lib/RedemptionsBase.sol\";\n\n/// @title Rollover - ERC20 token to ETH redemption contract\n/// @author @ChimeraDefi - sharedstake.org\n/// @notice Rollover accepts an underlying ERC20 and redeems it for another ERC20\n/** @dev Deployer chooses static virtual price at launch in 1e18 and the underlying ERC20 token\n Users call deposit(amt) to stake their ERC20 and signal intent to exit\n When the contract has enough ETH to service the users debt\n Users call redeem() to redem for ERC20 = deposited shares * virtualPrice\n The user can further call withdraw() if they change their mind about redeeming for ETH\n TODO Docs\n Test on goerli deployed at https://goerli.etherscan.io/address/0x4db116ad5cca33ba5d2956dba80d56f27b6b2455\n**/\ncontract Rollover is RedemptionsBase {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n IERC20 public immutable NEW_TOKEN;\n\n constructor(\n address _underlying,\n address _newToken,\n uint256 _virtualPrice\n ) payable RedemptionsBase(_underlying, _virtualPrice) {\n NEW_TOKEN = IERC20(_newToken);\n }\n\n function _redeem(uint256 amountToReturn) internal override {\n // make sure user has tokens to redeem offchain first by looking at userEntries otherwise this will just waste gas\n if (amountToReturn > NEW_TOKEN.balanceOf(address(this))) {\n revert ContractBalanceTooLow();\n }\n\n NEW_TOKEN.transfer(msg.sender, amountToReturn);\n }\n}\n" + }, + "contracts/v2/core/SgETH.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\nimport {ERC20MintableBurnableByMinter} from \"../lib/ERC20MintableBurnableByMinter.sol\";\nimport {Errors} from \"../lib/Errors.sol\";\n\n/// @title SgETH - SharedStake Governed Staked Ether\n/// @author @ChimeraDefi - admin@sharedstake.org - chimera_defi@protonmail.com\ncontract SgETH is ERC20MintableBurnableByMinter {\n constructor() ERC20MintableBurnableByMinter(\"SharedStake Governed Staked Ether\", \"sgETH\") {\n // Set the admin of the minter role; this causes the grant and revole role fns to gaurd to this admin role\n _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);\n }\n\n // Adds whitelisted minters - only callable by DEFAULT_ADMIN_ROLE enforced in OZ dep\n function addMinter(address minterAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {\n if (minterAddress != address(0)) {\n grantRole(MINTER, minterAddress);\n } else {\n revert Errors.ZeroAddress();\n }\n }\n\n // Remove a minter - only callable by DEFAULT_ADMIN_ROLE enforced internally\n function removeMinter(address minterAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {\n // oz uses maps so 0 address will return true but does not break anything\n revokeRole(MINTER, minterAddress);\n }\n\n // Transfer ownership of who can add/rm minters\n function transferOwnership(address newOwner) external onlyRole(DEFAULT_ADMIN_ROLE) {\n grantRole(DEFAULT_ADMIN_ROLE, newOwner);\n renounceRole(DEFAULT_ADMIN_ROLE, msg.sender); // permission gaurded via revert if called lacks role\n }\n}\n" + }, + "contracts/v2/core/SharedDepositMinterV2.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\n\n/// @title SharedDepositMinterV2 - minter for ETH LSD\n/// @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\n// v1 sharedstake veth2 minter with some code removed\n// user deposits eth to get minted token\n// The contract cannot move user ETH outside unless\n// 1. the user redeems 1:1\n// 2. the depositToEth2 or depositToEth2Batch fns are called which allow moving ETH to the mainnet deposit contract only\n// 3. The contract allows permissioned external actors to supply validator public keys\n// 4. Who's allowed to deposit how many validators is governed outside this contract\n// 5. The ability to provision validators for user ETH is portioned out by the DAO\n\n// Changes\n/**\n- Custom errors instead of revert strings\n- Granular management via AccessControl with GOV and NOR roles. Node operator can only deploy validators\n- Refactored to allow users to specify destination address for fns - for zaps\n- Added deposit+stake/unstake+withdraw combo convenience routes\n- Refactored fee calc out to external contract\n*/\nimport {IFeeCalc} from \"../interfaces/IFeeCalc.sol\";\nimport {IERC20MintableBurnable} from \"../interfaces/IERC20MintableBurnable.sol\";\nimport {IERC4626} from \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\n\nimport {AccessControl} from \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {Pausable} from \"@openzeppelin/contracts/security/Pausable.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport {ETH2DepositWithdrawalCredentials} from \"../lib/ETH2DepositWithdrawalCredentials.sol\";\n\n/// @title SharedDepositMinterV2\n/// @author ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\n/// @notice Mints LSD tokens for ETH deposited to the contract. Handles the depositing of ETH to the ETH2 deposit contract and validator creation\n/// @dev Deployment params: \n/// - addresses : [feeCalc, sgeth, wsgeth, gov]\ncontract SharedDepositMinterV2 is AccessControl, Pausable, ReentrancyGuard, ETH2DepositWithdrawalCredentials {\n /* ========== STATE VARIABLES ========== */\n uint256 public adminFee;\n uint256 public numValidators;\n uint256 public costPerValidator;\n\n // The validator shares created by this shared stake contract. 1 share costs >= 1 eth\n uint256 public curValidatorShares; //initialized to 0\n\n // The number of times the deposit to eth2 contract has been called to create validators\n uint256 public validatorsCreated; //initialized to 0\n\n // Total accrued admin fee\n uint256 public adminFeeTotal; //initialized to 0\n\n // Its hard to exactly hit the max deposit amount with small shares. this allows a small bit of overflow room\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token via a user withdraw\n uint256 public buffer;\n\n // Flash loan tokenomic protection in case of changes in admin fee with future lots\n bool public refundFeesOnWithdraw; //initialized to false\n\n // NEW\n IERC20MintableBurnable private immutable _SGETH;\n IERC4626 private immutable _WSGETH;\n IFeeCalc private _feeCalc;\n\n bytes32 public constant NOR = keccak256(\"NOR\"); // Node operator for deploying validators\n bytes32 public constant GOV = keccak256(\"GOV\"); // Governance for settings - normally timelock controlled by multisig\n\n //errors\n error AmountTooHigh();\n error NoValidators();\n\n constructor(\n uint256 _numValidators,\n uint256 _adminFee,\n address[] memory addresses\n ) AccessControl() Pausable() ReentrancyGuard() ETH2DepositWithdrawalCredentials(addresses[4]) {\n _feeCalc = IFeeCalc(addresses[0]);\n _SGETH = IERC20MintableBurnable(addresses[1]);\n _WSGETH = IERC4626(addresses[2]);\n\n _SGETH.approve(address(_WSGETH), 2 ** 256 - 1); // max approve wsgeth for deposit and stake\n\n adminFee = _adminFee; // Admin and infra fees\n numValidators = _numValidators; // The number of validators to create in this lot. Sets a max limit on deposits\n\n // Eth in the buffer cannot be withdrawn by an admin, only by burning the underlying token\n buffer = 10 * 1e18; // roughly equal to 10 eth.\n\n costPerValidator = (32 * 1e18) + adminFee;\n\n _grantRole(NOR, msg.sender);\n _grantRole(GOV, addresses[3]); // deployer will need it to set withdrawal creds. since the non-custodial withdrawal path depends on the minter.\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LOGIC\n //////////////////////////////////////////////////////////////*/\n\n // USER INTERACTIONS\n /*\n Shares minted = Z\n Principal deposit input = P\n AdminFee = a\n costPerValidator = 32 + a\n AdminFee as percent in 1e18 = a% = (a / costPerValidator) * 1e18\n AdminFee on tx in 1e18 = (P * a% / 1e18)\n\n on deposit:\n P - (P * a%) = Z\n\n on withdraw with admin fee refund:\n P = Z / (1 - a%)\n P = Z - Z*a%\n */\n\n function deposit() external payable {\n _deposit(msg.sender);\n }\n\n function depositFor(address dest) external payable {\n _deposit(dest);\n }\n\n function depositAndStake() external payable {\n _WSGETH.deposit(_deposit(address(this)), msg.sender);\n }\n\n function depositAndStakeFor(address dest) external payable {\n _WSGETH.deposit(_deposit(address(this)), dest);\n }\n\n function withdraw(uint256 amount) external {\n _withdraw(amount, msg.sender, msg.sender);\n }\n\n function withdrawTo(uint256 amount, address dest) external {\n _withdraw(amount, msg.sender, dest);\n }\n\n function unstakeAndWithdraw(uint256 amount, address dest) external {\n _withdraw(_WSGETH.redeem(amount, address(this), msg.sender), address(this), dest);\n }\n\n // migration function to accept old monies and copy over state\n // users should not use this as it just donates the money without minting veth or tracking donations\n function donate() external payable {} // solhint-disable-line\n\n /*//////////////////////////////////////////////////////////////\n ADMIN LOGIC\n //////////////////////////////////////////////////////////////*/\n\n // Batch deposit eth to the eth2 contract with preset creds\n // Data needs to be verified offchain to save gas\n function batchDepositToEth2(\n bytes[] calldata pubkeys,\n bytes[] calldata signatures,\n bytes32[] calldata depositDataRoots\n ) external onlyRole(NOR) {\n if (address(this).balance < (_depositAmount * pubkeys.length)) {\n revert AmountTooHigh(); // Not enough bal in contract to deploy all validators\n }\n _batchDeposit(pubkeys, signatures, depositDataRoots);\n validatorsCreated = validatorsCreated + pubkeys.length;\n }\n\n function setWithdrawalCredential(bytes memory _newWithdrawalCreds) external onlyRole(NOR) {\n // can only be called once\n _setWithdrawalCredential(_newWithdrawalCreds);\n }\n\n // Slashes the onchain staked sgETH to mirror CL validator slashings\n // modifies wsgeth virtual price\n function slash(uint256 amt) external onlyRole(GOV) {\n if (amt > curValidatorShares) {\n revert AmountTooHigh(); // Cannot slash more than minted\n }\n _SGETH.burn(address(_WSGETH), amt);\n }\n\n // Set fee calc address. if addr = 0 then fees are assumed to be 0\n function setFeeCalc(address _feeCalculatorAddr) external onlyRole(GOV) {\n _feeCalc = IFeeCalc(_feeCalculatorAddr);\n }\n\n function togglePause() external onlyRole(GOV) {\n bool paused = paused();\n if (paused) {\n _unpause();\n } else {\n _pause();\n }\n }\n\n // Used to migrate state over to new contract\n function migrateShares(uint256 shares) external onlyRole(GOV) {\n curValidatorShares = shares;\n }\n\n function toggleWithdrawRefund() external onlyRole(GOV) {\n refundFeesOnWithdraw = !refundFeesOnWithdraw;\n }\n\n function setNumValidators(uint256 _numValidators) external onlyRole(GOV) {\n if (_numValidators > 0) {\n numValidators = _numValidators;\n } else {\n revert NoValidators();\n }\n }\n\n function withdrawAdminFee(uint256 amount) external onlyRole(GOV) {\n address payable sender = payable(msg.sender);\n if (amount == 0) {\n amount = adminFeeTotal;\n }\n if (amount > adminFeeTotal) {\n revert AmountTooHigh();\n }\n adminFeeTotal = adminFeeTotal - amount;\n Address.sendValue(sender, amount);\n }\n\n /*//////////////////////////////////////////////////////////////\n ACCOUNTING LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function remainingSpaceInEpoch() external view returns (uint256) {\n // Helpful view function to gauge how much the user can send to the contract when it is near full\n uint256 remainingShares = maxValidatorShares() - curValidatorShares;\n uint256 valBeforeAdmin = (remainingShares * 1e18) / (((1 * 1e18) - (adminFee * 1e18) / costPerValidator));\n return valBeforeAdmin;\n }\n\n function maxValidatorShares() public view returns (uint256) {\n return 32 * 1e18 * numValidators;\n }\n\n function _depositAccounting() internal returns (uint256 value) {\n // input is whole, not / 1e18 , i.e. in 1 = 1 eth send when from etherscan\n value = msg.value;\n uint256 fee;\n\n if (address(_feeCalc) != address(0)) {\n (value, fee) = _feeCalc.processDeposit(value, msg.sender);\n adminFeeTotal = adminFeeTotal + fee;\n }\n\n uint256 newShareTotal = curValidatorShares + value;\n\n if (newShareTotal > buffer + maxValidatorShares()) {\n revert AmountTooHigh();\n }\n curValidatorShares = newShareTotal;\n }\n\n function _withdrawAccounting(uint256 amount) internal returns (uint256) {\n uint256 fee;\n if (address(_feeCalc) != address(0)) {\n (amount, fee) = _feeCalc.processWithdraw(amount, msg.sender);\n if (refundFeesOnWithdraw) {\n adminFeeTotal = adminFeeTotal - fee;\n } else {\n adminFeeTotal = adminFeeTotal + fee;\n }\n }\n if (address(this).balance < (amount + adminFeeTotal)) {\n revert AmountTooHigh();\n }\n\n curValidatorShares = curValidatorShares - amount;\n return amount;\n }\n\n function _deposit(address dest) internal nonReentrant whenNotPaused returns (uint256 amt) {\n amt = _depositAccounting();\n _SGETH.mint(dest, amt);\n }\n\n function _withdraw(uint256 amount, address origin, address dest) internal nonReentrant whenNotPaused {\n _SGETH.burn(origin, amount); // reverts if amount is too high\n uint256 assets = _withdrawAccounting(amount);\n\n address payable recv = payable(dest);\n Address.sendValue(recv, assets);\n }\n\n receive() external payable {} // solhint-disable-line\n\n fallback() external payable {} // solhint-disable-line\n}\n" + }, + "contracts/v2/core/WithdrawalQueue.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\nimport {IERC4626} from \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\nimport {AccessControl} from \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport {FIFOQueue} from \"../lib/FIFOQueue.sol\";\nimport {Errors} from \"../lib/Errors.sol\";\nimport {OperatorSettable} from \"../lib/OperatorSettable.sol\";\nimport {GranularPause} from \"../lib/GranularPause.sol\";\nimport {SharedDepositMinterV2} from \"./SharedDepositMinterV2.sol\";\n\n/**\n * @title WithdrawalQueue\n * @author @ChimeraDefi - chimera_defi@protonmail.com | sharedstake.org\n * @dev -\n * ERC-7540 inspired withdrawal contract\n * This contract is designed to be used with SharedDepositMinterV2 contract\n * As a module extension that adds 7540 methods requestRedeem and redeem\n * Example flow ->\n * user calls requestRedeem(user, user, userShares)\n * user calls setOperator(admin OR protocol provided keeper, true)\n * admin can now call redeem on the users behalf if needed after epoch\n * user calls redeem(user, user, userShares) after waiting for epoch\n * Caveats:\n * If the user requests another redemption, before fulfillment,\n * this resets the epoch length clock for their request\n * Basic upgrade path:\n * 1. Call togglePause(1), this disables the requestRedeem fn so no new requests\n * 2. Deploy new contract, direct users to it\n * 3. Fulfill any remaining redeemRequests i.e. totalPendingRequest,\n * for all RedeemRequest events from requestsFulfilled to requestsCreated\n */\ncontract WithdrawalQueue is AccessControl, ReentrancyGuard, GranularPause, FIFOQueue, OperatorSettable {\n using Address for address payable;\n\n struct Request {\n address requester;\n uint256 shares;\n }\n // SharedDepositMinterV2 public immutable MINTER;\n address public immutable MINTER;\n address public immutable WSGETH;\n\n uint256 internal totalPendingRequest;\n uint256 internal requestsCreated;\n uint256 internal requestsFulfilled;\n uint256 public totalAssetsOut;\n\n bytes32 public constant GOV = keccak256(\"GOV\"); // Governance for settings - normally timelock controlled by multisig\n\n mapping(uint256 => Request) internal requests;\n mapping(address => uint256) public redeemRequests;\n\n event RedeemRequest(\n address indexed requester,\n address indexed owner,\n uint256 indexed requestId,\n address operator,\n uint256 assets\n );\n event Redeem(address indexed requester, address indexed receiver, uint256 shares, uint256 assets);\n\n constructor(address _minter, address _wsgEth, uint256 _epochLength) FIFOQueue(_epochLength) {\n MINTER = _minter;\n WSGETH = _wsgEth;\n\n uint256 maxUint256 = 2 ** 256 - 1;\n\n IERC20(WSGETH).approve(_minter, maxUint256);\n\n _grantRole(GOV, msg.sender);\n }\n\n function requestRedeem(\n uint256 shares,\n address requester,\n address owner\n ) external onlyOwnerOrOperator(owner) nonReentrant whenNotPaused(uint16(1)) returns (uint256 requestId) {\n if (shares == 0) {\n revert Errors.InvalidAmount();\n }\n IERC20(WSGETH).transferFrom(owner, address(this), shares); // asset here is the Vault underlying asset\n\n requestId = requestsCreated++;\n requests[requestId] = Request({requester: requester, shares: shares});\n // use assets for tracking\n uint256 assets = IERC4626(WSGETH).previewRedeem(shares);\n\n _stakeForWithdrawal(owner, assets);\n totalPendingRequest += assets;\n redeemRequests[requester] += assets; // underflow would revert if not enough claimable shares\n\n emit RedeemRequest(requester, owner, requestId, msg.sender, shares);\n }\n\n function redeem(\n uint256 shares,\n address receiver,\n address requester\n ) external onlyOwnerOrOperator(requester) nonReentrant whenNotPaused(uint16(2)) returns (uint256 assets) {\n if (shares == 0) {\n revert Errors.InvalidAmount();\n }\n\n assets = IERC4626(WSGETH).previewRedeem(shares);\n\n // checks if we have enough assets to fulfill the request and if epoch has passed\n if (claimableRedeemRequest(requester) < assets) {\n _checkWithdraw(requester, totalBalance(), assets);\n return 0; // should never happen. previous fn will generate a rich error\n }\n\n _withdraw(requester, assets);\n // Treat everything as claimableRedeemRequest and validate here if there's adequate funds\n redeemRequests[requester] -= assets; // underflow would revert if not enough claimable shares\n totalPendingRequest -= assets;\n // Track total returned\n totalAssetsOut += assets;\n requestsFulfilled++;\n\n uint256 minterBalance = MINTER.balance;\n // This feels suboptimal, but is the easiest way to always burn the token on redemptions\n if (assets > minterBalance) {\n uint256 diff = assets - minterBalance;\n // We need to use donate/transfer etc. cant deposit and mint more shares as that messes up accouting\n payable(MINTER).transfer(diff);\n }\n\n // Always burn redeemed tokens\n SharedDepositMinterV2(payable(MINTER)).unstakeAndWithdraw(shares, receiver);\n\n emit Redeem(requester, receiver, shares, assets);\n }\n\n function togglePause(uint16 func) external onlyRole(GOV) {\n bool paused = paused[func];\n if (paused) {\n _unpause(func);\n } else {\n _pause(func);\n }\n }\n\n function setEpochLength(uint256 value) external onlyRole(GOV) {\n _setEpochLength(value);\n }\n\n function pendingRedeemRequest(address owner) public view returns (uint256 shares) {\n return redeemRequests[owner];\n }\n\n // claimableRedeemRequest - returns owners shares in claimable state,\n // i.e. epoch has elapsed and sufficient funds exist\n function claimableRedeemRequest(address owner) public view returns (uint256 shares) {\n if (redeemRequests[owner] > 0 && _isWithdrawalAllowed(owner, totalBalance(), redeemRequests[owner])) {\n return redeemRequests[owner];\n } else {\n return 0;\n }\n }\n\n function totalBalance() internal view returns (uint256) {\n return address(this).balance + MINTER.balance;\n }\n\n receive() external payable {} // solhint-disable-line\n\n fallback() external payable {} // solhint-disable-line\n}\n" + }, + "contracts/v2/core/Withdrawals.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\n\nimport {RedemptionsBase} from \"../lib/RedemptionsBase.sol\";\n\n/// @title Withdrawals - ERC20 token to ETH redemption contract\n/// @author @ChimeraDefi - sharedstake.org\n/// @notice Withdrawals accepts an underlying ERC20 and redeems it for ETH\n/** @dev Deployer chooses static virtual price at launch in 1e18 and the underlying ERC20 token\n Users call deposit(amt) to stake their ERC20 and signal intent to exit\n When the contract has enough ETH to service the users debt\n Users call redeem() to redem for ETH = deposited shares * virtualPrice\n The user can further call withdraw() if they change their mind about redeeming for ETH\n**/\ncontract Withdrawals is RedemptionsBase {\n event Redemption(address indexed _from, uint256 val);\n\n constructor(address _underlying, uint256 _virtualPrice) payable RedemptionsBase(_underlying, _virtualPrice) {} // solhint-disable-line\n\n function _redeem(uint256 amountToReturn) internal override {\n if (amountToReturn > address(this).balance) {\n revert ContractBalanceTooLow();\n }\n emit Redemption(msg.sender, amountToReturn);\n\n payable(msg.sender).transfer(amountToReturn);\n }\n}\n" + }, + "contracts/v2/core/WSGEth.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.20;\n\nimport {ERC4626, xERC4626} from \"../lib/xERC4626.sol\";\nimport {ERC20} from \"solmate/src/mixins/ERC4626.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\n/// @title ssgETH - Vault token for staked sgETH. ERC20 + ERC4626\n/// @author @ChimeraDefi - sharedstake.org - based on sfrxETH\n/// @notice Is a vault that takes sgETH and gives you ssgETH erc20 tokens\n/** @dev Exchange rate between sgETH and ssgETH floats, you can convert your ssgETH for more sgETH over time.\n Exchange rate increases as validator rewardSplitter mints new sgETH corresponding to the staking yield and drops it into this vault (ssgETH contract).\n There is a short time period, “cycles” which the exchange rate increases linearly over. This is to prevent gaming the exchange rate (MEV).\n The cycles are constant length, but calling syncRewards slightly into a would-be cycle keeps the same would-be endpoint (so cycle ends are every X seconds).\n Someone must call syncRewards, which queues any new ssgETH in the contract to be added to the redeemable amount.\n Mint vs Deposit\n mint() - deposit targeting a specific number of ssgETH out\n deposit() - deposit knowing a specific number of ssgETH in */\ncontract WSGETH is xERC4626, ReentrancyGuard {\n modifier andSync() {\n if (block.timestamp >= rewardsCycleEnd) {\n syncRewards();\n }\n _;\n }\n\n /* ========== CONSTRUCTOR ========== */\n constructor(\n ERC20 _underlying,\n uint32 _rewardsCycleLength\n ) ERC4626(_underlying, \"Wrapped SharedStake Governed Ether\", \"wsgETH\") xERC4626(_rewardsCycleLength) {} // solhint-disable-line\n\n /// @notice Approve and deposit() in one transaction\n function depositWithSignature(\n uint256 assets,\n address receiver,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 shares) {\n uint256 amount = approveMax ? type(uint256).max : assets;\n asset.permit(msg.sender, address(this), amount, deadline, v, r, s);\n return (deposit(assets, receiver));\n }\n\n /// @notice inlines syncRewards with deposits when able\n function deposit(uint256 assets, address receiver) public override nonReentrant andSync returns (uint256 shares) {\n return super.deposit(assets, receiver);\n }\n\n /// @notice inlines syncRewards with mints when able\n function mint(uint256 shares, address receiver) public override nonReentrant andSync returns (uint256 assets) {\n return super.mint(shares, receiver);\n }\n\n /// @notice inlines syncRewards with withdrawals when able\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public override nonReentrant andSync returns (uint256 shares) {\n return super.withdraw(assets, receiver, owner);\n }\n\n /// @notice inlines syncRewards with redemptions when able\n function redeem(uint256 shares, address receiver, address owner) public override andSync returns (uint256 assets) {\n return super.redeem(shares, receiver, owner);\n }\n\n /// @notice How much sgETH is 1E18 ssgETH worth. Price is in ETH, not USD\n function pricePerShare() public view returns (uint256) {\n return convertToAssets(1e18);\n }\n}\n" + }, + "contracts/v2/interfaces/IDepositContract.sol": { + "content": "pragma solidity ^0.8.0;\n\n// ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━\n// ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓\n// ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛\n// ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃┃━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━\n// ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓\n// ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n// SPDX-License-Identifier: CC0-1.0\n\n// This interface is designed to be compatible with the Vyper version.\n/// @notice This is the Ethereum 2.0 deposit contract interface.\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\ninterface IDepositContract {\n /// @notice A processed deposit event.\n event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);\n\n /// @notice Submit a Phase 0 DepositData object.\n /// @param pubkey A BLS12-381 public key.\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\n /// @param signature A BLS12-381 signature.\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\n /// Used as a protection against malformed input.\n function deposit(\n bytes calldata pubkey,\n bytes calldata withdrawal_credentials,\n bytes calldata signature,\n bytes32 deposit_data_root\n ) external payable;\n\n /// @notice Query the current deposit root hash.\n /// @return The deposit root hash.\n function get_deposit_root() external view returns (bytes32);\n\n /// @notice Query the current deposit count.\n /// @return The deposit count encoded as a little endian 64-bit number.\n function get_deposit_count() external view returns (bytes memory);\n}\n" + }, + "contracts/v2/interfaces/IERC20MintableBurnable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IERC20MintableBurnable {\n function mintingAllowedAfter() external view returns (uint256);\n\n /**\n * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`\n * @param account The address of the account holding the funds\n * @param spender The address of the account spending the funds\n * @return The number of tokens approved\n */\n function allowance(address account, address spender) external view returns (uint256);\n\n /**\n * @notice Get the number of tokens held by the `account`\n * @param account The address of the account to get the balance of\n * @return The number of tokens held\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(address spender, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Triggers an approval from owner to spends\n * @param owner The address to approve from\n * @param spender The address to be approved\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @param deadline The time at which to expire the signature\n * @param v The recovery byte of the signature\n * @param r Half of the ECDSA signature pair\n * @param s Half of the ECDSA signature pair\n */\n function permit(\n address owner,\n address spender,\n uint256 rawAmount,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(address dst, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(address src, address dst, uint256 rawAmount) external returns (bool);\n\n /**\n * @notice Mint new tokens\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to be minted\n */\n function mint(address dst, uint256 rawAmount) external;\n\n function burn(address src, uint256 rawAmount) external;\n function setMinter(address minter_) external;\n}\n" + }, + "contracts/v2/interfaces/IFeeCalc.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IFeeCalc {\n function processDeposit(uint256 amt, address who) external view returns (uint256, uint256);\n\n function processWithdraw(uint256 amt, address who) external view returns (uint256, uint256);\n}\n" + }, + "contracts/v2/interfaces/ISGEth.sol": { + "content": "// SPDX-License-Identifier: MIT\n// @ChimeraDefi Jun 2023\npragma solidity ^0.8.0;\n\ninterface ISGEth {\n function burn(address addr, uint256 amt) external;\n function approve(address spender, uint256 amount) external returns (bool);\n function mint(address addr, uint256 amt) external;\n}\n\n// | SharedDepositMinterV2 · 8.78 │\n" + }, + "contracts/v2/interfaces/ISharedDeposit.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface ISharedDeposit {\n function withdraw(uint256 amount) external;\n function withdraw(uint256 amount, address dest) external;\n\n function deposit() external payable;\n\n function remainingSpaceInEpoch() external;\n function depositAndStakeFor(address dest) external payable;\n}\n" + }, + "contracts/v2/interfaces/IWSGEth.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// Cloned from fei/rari ERC4626 impl https://github.com/fei-protocol/ERC4626/blob/main/src/interfaces/IxERC4626.sol\n// @ChimeraDefi Jun 2023\n\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)\n\npragma solidity ^0.8.0;\n\ninterface IWSGEth {\n // Takes X(n=assets) ETH and returns Y(n=shares) wsgETH\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n // Takes assets wsgETH and returns shares sgETH\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n" + }, + "contracts/v2/interfaces/IxERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// Cloned from fei/rari ERC4626 impl https://github.com/fei-protocol/ERC4626/blob/main/src/interfaces/IxERC4626.sol\n// @ChimeraDefi Jun 2023\n\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)\n\npragma solidity ^0.8.0;\n\n/** \n @title An xERC4626 Single Staking Contract Interface\n @notice This contract allows users to autocompound rewards denominated in an underlying reward token. \n It is fully compatible with [ERC4626](https://eips.ethereum.org/EIPS/eip-4626) allowing for DeFi composability.\n It maintains balances using internal accounting to prevent instantaneous changes in the exchange rate.\n NOTE: an exception is at contract creation, when a reward cycle begins before the first deposit. After the first deposit, exchange rate updates smoothly.\n\n Operates on \"cycles\" which distribute the rewards surplus over the internal balance to users linearly over the remainder of the cycle window.\n*/\ninterface IxERC4626 {\n /*////////////////////////////////////////////////////////\n Custom Errors\n ////////////////////////////////////////////////////////*/\n\n /// @dev thrown when syncing before cycle ends.\n error SyncError();\n\n /*////////////////////////////////////////////////////////\n Events\n ////////////////////////////////////////////////////////*/\n\n /// @dev emit every time a new rewards cycle starts\n event NewRewardsCycle(uint32 indexed cycleEnd, uint256 rewardAmount);\n\n /*////////////////////////////////////////////////////////\n View Methods\n ////////////////////////////////////////////////////////*/\n\n /// @notice the maximum length of a rewards cycle\n function rewardsCycleLength() external view returns (uint32);\n\n /// @notice the effective start of the current cycle\n /// NOTE: This will likely be after `rewardsCycleEnd - rewardsCycleLength` as this is set as block.timestamp of the last `syncRewards` call.\n function lastSync() external view returns (uint32);\n\n /// @notice the end of the current cycle. Will always be evenly divisible by `rewardsCycleLength`.\n function rewardsCycleEnd() external view returns (uint32);\n\n /// @notice the amount of rewards distributed in a the most recent cycle\n function lastRewardAmount() external view returns (uint192);\n\n /*////////////////////////////////////////////////////////\n State Changing Methods\n ////////////////////////////////////////////////////////*/\n\n /// @notice Distributes rewards to xERC4626 holders.\n /// All surplus `asset` balance of the contract over the internal balance becomes queued for the next cycle.\n function syncRewards() external;\n}\n" + }, + "contracts/v2/lib/ERC20MintableBurnableByMinter.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\nimport {ERC20Burnable} from \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\";\nimport {AccessControl} from\"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {ERC20, ERC20Permit} from \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol\";\n\n/// @title Parent contract for sgETH.sol\n/** @notice Based on ERC20PermitPermissionedMint - base contract for frxETH. \n Changed to reduce code footprint and rely on OZ primitives instead\n Using ownable and OZ AccessControl for minter management and standard underlying events instead of extra custom events\n Also includes a list of authorized minters \n Steps: 1. Deploy it. 2. Set new sgETH minter 3. Transfer ownership to multisig timelock 4. confirm accept ownership from timelock */\n/// @dev Adheres to EIP-712/EIP-2612 and can use permits\ncontract ERC20MintableBurnableByMinter is ERC20Burnable, ERC20Permit, AccessControl {\n bytes32 public constant MINTER = keccak256(\"MINTER\");\n\n /* ========== CONSTRUCTOR ========== */\n constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) ERC20Permit(_name) AccessControl() {}\n\n /* ========== RESTRICTED FUNCTIONS ========== */\n /// @notice burnFrom Used by minters when user redeems\n /// @param addr The address to burn from\n /// @param amt The amount to burn\n function burnFrom(address addr, uint256 amt) public override onlyRole(MINTER) {\n super.burnFrom(addr, amt);\n }\n\n function burn(address addr, uint256 amt) public onlyRole(MINTER) {\n super._burn(addr, amt);\n }\n\n /// @notice mint This function is what other minters will call to mint new tokens\n /// @param addr The address to mint to \n /// @param amt The amount to mint \n function mint(address addr, uint256 amt) public onlyRole(MINTER) {\n _mint(addr, amt);\n }\n}\n" + }, + "contracts/v2/lib/Errors.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\n/**\n * @title Errors\n * @author Sharedstake\n * @notice Contains all the custom errors\n */\nlibrary Errors {\n error ZeroAddress();\n error InvalidAmount();\n error PermissionDenied();\n error InsufficientBalance();\n error TooEarly();\n error FailedCall();\n}\n" + }, + "contracts/v2/lib/ETH2DepositWithdrawalCredentials.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\nimport {IDepositContract} from \"../interfaces/IDepositContract.sol\";\n\n/// @title A contract for holding a eth2 validator withrawal pubkey\n/// @author @chimeraDefi\n/// @notice A contract for holding a eth2 validator withrawal pubkey\n/// @dev Downstream contract needs to implement who can set the withdrawal address and set it\ncontract ETH2DepositWithdrawalCredentials {\n uint256 internal constant _depositAmount = 32 ether;\n IDepositContract public immutable DEPOSIT_CONTRACT;\n bytes public withdrawalPubKey; // Pubkey for ETH 2.0 withdrawal creds\n\n event WithdrawalCredentialSet(bytes _withdrawalCredential);\n\n constructor(address _dc) {\n DEPOSIT_CONTRACT = IDepositContract(_dc);\n }\n\n /// @notice A more streamlined variant of batch deposit for use with preset withdrawal addresses\n /// Submit index-matching arrays that form Phase 0 DepositData objects.\n /// Will create a deposit transaction per index of the arrays submitted.\n ///\n /// @param pubkeys - An array of BLS12-381 public keys.\n /// @param signatures - An array of BLS12-381 signatures.\n /// @param depositDataRoots - An array of the SHA-256 hash of the SSZ-encoded DepositData object.\n function _batchDeposit(\n bytes[] calldata pubkeys,\n bytes[] calldata signatures,\n bytes32[] calldata depositDataRoots\n ) internal {\n // optimizations https://ethereum.stackexchange.com/questions/113221/what-is-the-purpose-of-unchecked-in-solidity\n // https://medium.com/@bloqarl/solidity-gas-optimization-tips-with-assembly-you-havent-heard-yet-1381c77ff078\n // 30m gas / block roughly, say 10m max used so 100 validators a batch max \n // each deposit call costs roughly 128k https://etherscan.io/tx/0xa2acf6e6bde99b532125cc8026cd88eea345f296968ce732556945ab4705d03e\n uint256 i = pubkeys.length;\n uint256 _amt = _depositAmount;\n bytes memory wpk = withdrawalPubKey;\n\n while (i > 0) {\n unchecked {\n // While loop check prevents underflow.\n // --i is cheaper than i--\n // reverse while loop cheapest compared to while or for \n // Since we set the upper loop bound to the arr len, we decr 1st to not hit out of bounds\n --i;\n\n DEPOSIT_CONTRACT.deposit{value: _amt}(\n pubkeys[i],\n wpk,\n signatures[i],\n depositDataRoots[i]\n );\n }\n }\n }\n\n /// @notice sets curr_withdrawal_pubkey to be used when deploying validators\n function _setWithdrawalCredential(bytes memory newPk) internal {\n withdrawalPubKey = newPk;\n\n emit WithdrawalCredentialSet(newPk);\n }\n}\n" + }, + "contracts/v2/lib/FIFOQueue.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\nimport {Errors} from \"./Errors.sol\";\n\n// Simple First in first out queue\n// Uses a system of cascading locks based on the block number.\n// Users need to wait a minimum of epochLength blocks before withdrawing\n// Users past the epoch boundary can claim, allowing some time for earlier users to claim first\nabstract contract FIFOQueue {\n struct UserEntry {\n uint256 amount;\n uint256 blocknum;\n }\n mapping(address => UserEntry) public userEntries;\n\n uint256 public epochLength;\n\n constructor(uint256 _epochLength) {\n epochLength = _epochLength;\n }\n\n function _checkWithdraw(\n address sender,\n uint256 balanceOfSelf,\n uint256 amountToWithdraw\n ) public view returns (bool withdrawalAllowed) {\n UserEntry memory ue = userEntries[sender];\n\n if (!(amountToWithdraw <= balanceOfSelf && amountToWithdraw <= ue.amount)) {\n revert Errors.InvalidAmount();\n }\n\n if (!(block.number >= ue.blocknum + epochLength)) {\n revert Errors.TooEarly();\n }\n return true;\n }\n\n function _isWithdrawalAllowed(\n address sender,\n uint256 balanceOfSelf,\n uint256 amountToWithdraw\n ) public view returns (bool) {\n UserEntry memory ue = userEntries[sender];\n\n return (amountToWithdraw <= balanceOfSelf && amountToWithdraw <= ue.amount) && (block.number >= ue.blocknum + epochLength);\n }\n\n // should be admin only or used in a constructor upstream\n // set epoch length in blocks\n function _setEpochLength(uint256 _value) internal {\n if (_value == 0) {\n revert Errors.InvalidAmount();\n }\n epochLength = _value;\n }\n\n function _stakeForWithdrawal(address sender, uint256 amount) internal {\n UserEntry memory ue = userEntries[sender];\n ue.amount = ue.amount + amount;\n ue.blocknum = block.number;\n userEntries[sender] = ue;\n }\n\n function _withdraw(address sender, uint256 amount) internal {\n UserEntry memory ue = userEntries[sender];\n if (amount > ue.amount) {\n revert Errors.InvalidAmount();\n }\n\n if (amount == ue.amount) {\n delete userEntries[sender];\n } else {\n ue.amount = ue.amount - amount;\n ue.blocknum = block.number;\n userEntries[sender] = ue;\n }\n }\n}\n" + }, + "contracts/v2/lib/GranularPause.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\nimport {Context} from \"@openzeppelin/contracts/utils/Context.sol\";\n\n/// @title GranularPause \n/// @author ChimeraDefi - chimera_defi@protonmail.com\n/// @notice allows more granular control of pausing functions\n/// @dev Inherit in child contract, you need to number each function you want to pause\n\nabstract contract GranularPause is Context {\n mapping(uint16 => bool) public paused;\n\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account, uint16 item);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account, uint16 item);\n\n error IsPaused();\n error IsNotPaused();\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused(uint16 _id) {\n if (paused[_id]) {\n revert IsPaused();\n }\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused(uint16 _id) {\n if (!paused[_id]) {\n revert IsNotPaused();\n }\n _;\n }\n\n /// @notice pauses a function\n /// @param _id id of function to pause\n function _pause(uint16 _id) internal virtual {\n paused[_id] = true;\n emit Paused(_msgSender(), _id);\n }\n\n /// @notice unpauses a function\n /// @param _id id of function to unpause\n function _unpause(uint16 _id) internal virtual {\n paused[_id] = false;\n emit Unpaused(_msgSender(), _id);\n }\n}\n\n" + }, + "contracts/v2/lib/OperatorSettable.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\nimport {Errors} from \"./Errors.sol\";\n\n/**\n * @title OperatorSettable\n * @author Sharedstake\n * @notice Handles operators for ERC-7450 like contracts\n */\nabstract contract OperatorSettable {\n mapping(address requester => mapping(address operator => bool)) public isOperator;\n event OperatorSet(address indexed owner, address indexed operator, bool value);\n\n modifier onlyOwnerOrOperator(address owner) {\n if (owner != msg.sender && !isOperator[owner][msg.sender]) {\n revert Errors.PermissionDenied();\n }\n _;\n }\n\n function setOperator(address operator, bool approved) external returns (bool) {\n isOperator[msg.sender][operator] = approved;\n emit OperatorSet(msg.sender, operator, approved);\n return true;\n }\n}\n" + }, + "contracts/v2/lib/PaymentSplitter.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\n// OZ paymentsplitter with minor changes\n// private function _addPayee made internal for better inheritance flow\n// 0 payee chck in constructor removed to allow empty setup\n\n// OpenZeppelin Contracts (last updated v4.8.0) (finance/PaymentSplitter.sol)\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\nimport \"@openzeppelin/contracts/utils/Context.sol\";\n\n/**\n * @title PaymentSplitter\n * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware\n * that the Ether will be split in this way, since it is handled transparently by the contract.\n *\n * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each\n * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim\n * an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the\n * time of contract deployment and can't be updated thereafter.\n *\n * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the\n * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}\n * function.\n *\n * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and\n * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you\n * to run tests before sending real value to this contract.\n */\ncontract PaymentSplitter is Context {\n event PayeeAdded(address account, uint256 shares);\n event PaymentReleased(address to, uint256 amount);\n event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount);\n event PaymentReceived(address from, uint256 amount);\n\n uint256 private _totalShares;\n uint256 private _totalReleased;\n\n mapping(address => uint256) private _shares;\n mapping(address => uint256) private _released;\n address[] internal _payees;\n\n mapping(IERC20 => uint256) private _erc20TotalReleased;\n mapping(IERC20 => mapping(address => uint256)) private _erc20Released;\n\n /**\n * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at\n * the matching position in the `shares` array.\n *\n * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no\n * duplicates in `payees`.\n */\n constructor(address[] memory payees, uint256[] memory shares_) payable {\n require(payees.length == shares_.length, \"PaymentSplitter: payees and shares length mismatch\");\n // require(payees.length > 0, \"PaymentSplitter: no payees\");\n\n for (uint256 i = 0; i < payees.length; i++) {\n _addPayee(payees[i], shares_[i]);\n }\n }\n\n /**\n * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully\n * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the\n * reliability of the events, and not the actual splitting of Ether.\n *\n * To learn more about this see the Solidity documentation for\n * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback\n * functions].\n */\n receive() external payable virtual {\n emit PaymentReceived(_msgSender(), msg.value);\n }\n\n /**\n * @dev Getter for the total shares held by payees.\n */\n function totalShares() public view returns (uint256) {\n return _totalShares;\n }\n\n /**\n * @dev Getter for the total amount of Ether already released.\n */\n function totalReleased() public view returns (uint256) {\n return _totalReleased;\n }\n\n /**\n * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20\n * contract.\n */\n function totalReleased(IERC20 token) public view returns (uint256) {\n return _erc20TotalReleased[token];\n }\n\n /**\n * @dev Getter for the amount of shares held by an account.\n */\n function shares(address account) public view returns (uint256) {\n return _shares[account];\n }\n\n /**\n * @dev Getter for the amount of Ether already released to a payee.\n */\n function released(address account) public view returns (uint256) {\n return _released[account];\n }\n\n /**\n * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an\n * IERC20 contract.\n */\n function released(IERC20 token, address account) public view returns (uint256) {\n return _erc20Released[token][account];\n }\n\n /**\n * @dev Getter for the address of the payee number `index`.\n */\n function payee(uint256 index) public view returns (address) {\n return _payees[index];\n }\n\n /**\n * @dev Getter for the amount of payee's releasable Ether.\n */\n function releasable(address account) public view returns (uint256) {\n uint256 totalReceived = address(this).balance + totalReleased();\n return _pendingPayment(account, totalReceived, released(account));\n }\n\n /**\n * @dev Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an\n * IERC20 contract.\n */\n function releasable(IERC20 token, address account) public view returns (uint256) {\n uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token);\n return _pendingPayment(account, totalReceived, released(token, account));\n }\n\n /**\n * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the\n * total shares and their previous withdrawals.\n */\n function release(address payable account) public virtual {\n require(_shares[account] > 0, \"PaymentSplitter: account has no shares\");\n\n uint256 payment = releasable(account);\n\n require(payment != 0, \"PaymentSplitter: account is not due payment\");\n\n // _totalReleased is the sum of all values in _released.\n // If \"_totalReleased += payment\" does not overflow, then \"_released[account] += payment\" cannot overflow.\n _totalReleased += payment;\n unchecked {\n _released[account] += payment;\n }\n\n Address.sendValue(account, payment);\n emit PaymentReleased(account, payment);\n }\n\n /**\n * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their\n * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20\n * contract.\n */\n function release(IERC20 token, address account) public virtual {\n require(_shares[account] > 0, \"PaymentSplitter: account has no shares\");\n\n uint256 payment = releasable(token, account);\n\n require(payment != 0, \"PaymentSplitter: account is not due payment\");\n\n // _erc20TotalReleased[token] is the sum of all values in _erc20Released[token].\n // If \"_erc20TotalReleased[token] += payment\" does not overflow, then \"_erc20Released[token][account] += payment\"\n // cannot overflow.\n _erc20TotalReleased[token] += payment;\n unchecked {\n _erc20Released[token][account] += payment;\n }\n\n SafeERC20.safeTransfer(token, account, payment);\n emit ERC20PaymentReleased(token, account, payment);\n }\n\n /**\n * @dev internal logic for computing the pending payment of an `account` given the token historical balances and\n * already released amounts.\n */\n function _pendingPayment(\n address account,\n uint256 totalReceived,\n uint256 alreadyReleased\n ) private view returns (uint256) {\n return (totalReceived * _shares[account]) / _totalShares - alreadyReleased;\n }\n\n /**\n * @dev Add a new payee to the contract.\n * @param account The address of the payee to add.\n * @param shares_ The number of shares owned by the payee.\n */\n function _addPayee(address account, uint256 shares_) internal {\n require(account != address(0), \"PaymentSplitter: account is the zero address\");\n require(shares_ > 0, \"PaymentSplitter: shares are 0\");\n require(_shares[account] == 0, \"PaymentSplitter: account already has shares\");\n\n _payees.push(account);\n _shares[account] = shares_;\n _totalShares = _totalShares + shares_;\n emit PayeeAdded(account, shares_);\n }\n}" + }, + "contracts/v2/lib/RedemptionsBase.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.20;\n\nimport {SafeMath} from \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport {SafeERC20, IERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\n/// @title RedemptionsBase - ERC20 token redemption base\n/// @author @ChimeraDefi - sharedstake.org\n/// @notice RedemptionsBase accepts an underlying ERC20 and redeems it for - child impl\n/** @dev Deployer chooses static virtual price at launch in 1e18 and the underlying ERC20 token\nUsers call deposit(amt) to stake their ERC20 and signal intent to exit\nWhen the contract has enough ETH to service the users debt\nUsers call redeem() to redem for ETH = deposited shares * virtualPrice\nThe user can further call withdraw() if they change their mind about redeeming for ETH\n**/\ncontract RedemptionsBase is ReentrancyGuard {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n struct UserEntry {\n uint256 amount;\n }\n\n error ContractBalanceTooLow();\n error UserAmountIsZero();\n\n mapping(address => UserEntry) public userEntries; // solhint-disable-line\n uint256 public totalOut;\n uint256 public immutable VIRTUALPRICE;\n IERC20 public immutable vEth2Token; // solhint-disable-line\n\n constructor(address _underlying, uint256 _virtualPrice) payable {\n vEth2Token = IERC20(_underlying);\n VIRTUALPRICE = _virtualPrice;\n }\n\n function deposit(uint256 amount) external nonReentrant {\n // vEth2 transfer from returns true otherwise reverts\n if (vEth2Token.transferFrom(msg.sender, address(this), amount)) {\n _stakeForWithdrawal(msg.sender, amount);\n }\n }\n\n function withdraw() external nonReentrant {\n uint256 amt = userEntries[msg.sender].amount;\n delete userEntries[msg.sender];\n\n vEth2Token.transferFrom(address(this), msg.sender, amt);\n }\n\n function redeem() external nonReentrant {\n address usr = msg.sender;\n uint256 amountToReturn = _getAmountGivenShares(userEntries[usr].amount, VIRTUALPRICE);\n if (amountToReturn == 0) {\n revert UserAmountIsZero();\n }\n delete userEntries[usr];\n totalOut += amountToReturn;\n _redeem(amountToReturn);\n }\n\n function _redeem(uint256 amountToReturn) internal virtual { // solhint-disable-line\n require(false, \"implement me\"); // solhint-disable-line\n }\n\n function _stakeForWithdrawal(address sender, uint256 amount) internal {\n UserEntry memory ue = userEntries[sender];\n ue.amount = ue.amount.add(amount);\n userEntries[sender] = ue;\n }\n\n function _getAmountGivenShares(uint256 shares, uint256 _vp) internal pure returns (uint256) {\n return shares.mul(_vp).div(1e18);\n }\n\n receive() external payable {} // solhint-disable-line\n fallback() external payable {} // solhint-disable-line\n}\n" + }, + "contracts/v2/lib/xERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// Cloned from fei/rari ERC4626 impl https://github.com/fei-protocol/ERC4626/blob/main/src/interfaces/IxERC4626.sol\n// In use by sfrxeth https://etherscan.io/address/0xac3e018457b222d93114458476f3e3416abbe38f#code\n// @ChimeraDefi Jun 2023\n\npragma solidity ^0.8.20;\n\nimport {ERC4626} from \"solmate/src/mixins/ERC4626.sol\";\nimport {SafeCastLib} from \"solmate/src/utils/SafeCastLib.sol\";\nimport {IxERC4626} from \"../interfaces/IxERC4626.sol\";\n\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)\n\n/**\n@title An xERC4626 Single Staking Contract\n@notice This contract allows users to autocompound rewards denominated in an underlying reward token.\n It is fully compatible with [ERC4626](https://eips.ethereum.org/EIPS/eip-4626) allowing for DeFi composability.\n It maintains balances using internal accounting to prevent instantaneous changes in the exchange rate.\n NOTE: an exception is at contract creation, when a reward cycle begins before the first deposit. After the first deposit, exchange rate updates smoothly.\n\n Operates on \"cycles\" which distribute the rewards surplus over the internal balance to users linearly over the remainder of the cycle window.\n*/\nabstract contract xERC4626 is IxERC4626, ERC4626 {\n using SafeCastLib for *;\n\n /// @notice the maximum length of a rewards cycle\n uint32 public immutable rewardsCycleLength;\n\n /// @notice the effective start of the current cycle\n uint32 public lastSync;\n\n /// @notice the end of the current cycle. Will always be evenly divisible by `rewardsCycleLength`.\n uint32 public rewardsCycleEnd;\n\n /// @notice the amount of rewards distributed in a the most recent cycle.\n uint192 public lastRewardAmount;\n\n uint256 internal storedTotalAssets;\n\n constructor(uint32 _rewardsCycleLength) {\n rewardsCycleLength = _rewardsCycleLength;\n // seed initial rewardsCycleEnd\n rewardsCycleEnd = (block.timestamp.safeCastTo32() / rewardsCycleLength) * rewardsCycleLength;\n }\n\n /// @notice Compute the amount of tokens available to share holders.\n /// Increases linearly during a reward distribution period from the sync call, not the cycle start.\n function totalAssets() public view override returns (uint256) {\n // cache global vars\n uint256 storedTotalAssets_ = storedTotalAssets;\n uint192 lastRewardAmount_ = lastRewardAmount;\n uint32 rewardsCycleEnd_ = rewardsCycleEnd;\n uint32 lastSync_ = lastSync;\n\n if (block.timestamp >= rewardsCycleEnd_) {\n // no rewards or rewards fully unlocked\n // entire reward amount is available\n return storedTotalAssets_ + lastRewardAmount_;\n }\n\n // rewards not fully unlocked\n // add unlocked rewards to stored total\n uint256 unlockedRewards = (lastRewardAmount_ * (block.timestamp - lastSync_)) / (rewardsCycleEnd_ - lastSync_);\n return storedTotalAssets_ + unlockedRewards;\n }\n\n // Update storedTotalAssets on withdraw/redeem\n function beforeWithdraw(uint256 amount, uint256 shares) internal virtual override {\n super.beforeWithdraw(amount, shares);\n storedTotalAssets -= amount;\n }\n\n // Update storedTotalAssets on deposit/mint\n function afterDeposit(uint256 amount, uint256 shares) internal virtual override {\n storedTotalAssets += amount;\n super.afterDeposit(amount, shares);\n }\n\n /// @notice Distributes rewards to xERC4626 holders.\n /// All surplus `asset` balance of the contract over the internal balance becomes queued for the next cycle.\n function syncRewards() public virtual {\n uint192 lastRewardAmount_ = lastRewardAmount;\n uint32 timestamp = block.timestamp.safeCastTo32();\n\n if (timestamp < rewardsCycleEnd) revert SyncError();\n\n uint256 storedTotalAssets_ = storedTotalAssets;\n uint256 nextRewards = asset.balanceOf(address(this)) - storedTotalAssets_ - lastRewardAmount_;\n\n storedTotalAssets = storedTotalAssets_ + lastRewardAmount_; // SSTORE\n\n uint32 end = ((timestamp + rewardsCycleLength) / rewardsCycleLength) * rewardsCycleLength;\n\n if (end - timestamp < rewardsCycleLength / 20) {\n end += rewardsCycleLength;\n }\n\n // Combined single SSTORE\n lastRewardAmount = nextRewards.safeCastTo192();\n lastSync = timestamp;\n rewardsCycleEnd = end;\n\n emit NewRewardsCycle(end, nextRewards);\n }\n}\n" + }, + "contracts/v2/lib/YieldDirectorBase.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n// Acts as the deposit contract for the reward receiver during normal functioning\n// 100% of recieved ETH from rewards is auto-compounded back into sgETH\n// 60% is immutably always transfered to wsgETH for staker rewards\n// 40% is transferred to a splitter the DAO can modulate for nor payments and other use cases\n\n// call work() to process eth\npragma solidity ^0.8.20;\n\nimport {ISharedDeposit} from \"../interfaces/ISharedDeposit.sol\";\nimport {IERC20, SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ncontract YieldDirectorBase {\n IERC20 public immutable SGETH;\n address public immutable WSGETH;\n address public feeSplitter;\n ISharedDeposit public immutable MINTER;\n\n constructor(address[] memory _addrs) payable {\n SGETH = IERC20(_addrs[0]);\n WSGETH = _addrs[1];\n feeSplitter = _addrs[2];\n MINTER = ISharedDeposit(_addrs[3]);\n }\n\n function _convertToSgETHAndTransfer() internal {\n // convert eth 2 sgETH\n MINTER.deposit{value: address(this).balance}();\n\n // Calc static split\n uint256 bal = SGETH.balanceOf(address(this));\n uint256 part1 = (bal * 40) / 100; // upto 40% for DAO direction. most reflected back\n uint256 part2 = bal - part1;\n\n // Send tokens\n SafeERC20.safeTransfer(SGETH, feeSplitter, part1);\n SafeERC20.safeTransfer(SGETH, WSGETH, part2);\n }\n}\n" + }, + "contracts/v2/periphery/ETHDepositGaurd.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\n// Modulate how much user ETH node operators can stake\n// Sliding scale starting at 100% user ETH going to protocol staking\n// Reducing to allow more ETH to flow to indie node operators and other staking vaults\n// Different staking vaults offer different possibilities such as DVT, different clients, operators etc\n// This contract will own the minter\n\ncontract ETHDepositScaler {\n constructor() {}\n}\n" + }, + "contracts/v2/periphery/FeeCalc.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.20;\n\nimport {Ownable2Step} from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\n\ncontract FeeCalc is Ownable2Step {\n struct Settings {\n uint256 adminFee;\n uint256 exitFee;\n bool refundFeesOnWithdraw;\n bool chargeOnDeposit;\n bool chargeOnExit;\n }\n Settings private config;\n uint256 public adminFee;\n uint256 public costPerValidator;\n\n uint256 private immutable BIPS = 10000;\n constructor(Settings memory _settings) Ownable2Step() {\n // admin fee in bips (10000 = 100%)\n adminFee = _settings.adminFee;\n config = _settings;\n costPerValidator = ((32 + (32 * adminFee)) * 1 ether) / BIPS;\n }\n\n function set(Settings calldata newSettings) external onlyOwner {\n config = newSettings;\n adminFee = newSettings.adminFee;\n }\n\n function setRefundFeesOnWithdraw(bool _refundFeesOnWithdraw) external onlyOwner {\n config.refundFeesOnWithdraw = _refundFeesOnWithdraw;\n }\n\n function setExitFee(uint256 _exitFee) external onlyOwner {\n config.exitFee = _exitFee;\n }\n\n function setAdminFee(uint256 amount) external onlyOwner {\n adminFee = amount;\n config.adminFee = amount;\n }\n\n function processDeposit(uint256 value, address _sender) external view returns (uint256 amt, uint256 fee) {\n // TODO: semder is currently unsused but can be used later to calculate a fee reduction based on token holdings\n if (config.chargeOnDeposit) {\n fee = (value * adminFee) / BIPS;\n amt = value - fee;\n }\n }\n\n function processWithdraw(uint256 value, address _sender) external view returns (uint256 amt, uint256 fee) {\n // TODO: semder is currently unsused but can be used later to calculate a fee reduction based on token holdings\n if (config.refundFeesOnWithdraw) {\n fee = (value * adminFee) / BIPS;\n amt = value + fee;\n } else if (config.chargeOnExit) {\n fee = (value * config.exitFee) / BIPS;\n amt = value - fee;\n } else {\n fee = 0;\n amt = value;\n }\n }\n}\n" + }, + "contracts/v2/periphery/UserDepositHelper.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.20;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {ISharedDeposit} from \"../../interfaces/ISharedDeposit.sol\";\n\n// User referral rewards tracking contract\n// Fires events on user deposits to assits attribution of rewards\n// Calls proper flow to retrieve interest bearing staked eth\n// TODO: Tests, scripts to aggregate events offchain and calc referral rewards\ncontract UserDepositHelper {\n ISharedDeposit private immutable MINTER;\n\n event Deposit(address indexed _from, uint256 _value);\n event ExtraDepositData(address indexed _from, uint256 _value, bytes32 data);\n event DepositRef(address indexed _from, uint256 _value, address ref);\n event DepositFrontend(address indexed _from, uint256 _value, address ref);\n\n constructor(address _sgEth, address _minter) {\n MINTER = ISharedDeposit(_minter);\n IERC20(_sgEth).approve(_minter, 2 ** 256 - 1);\n }\n\n // Deposit multiple users and amts from a single call with referral and frontend address emitted. useful for batch deposits to reduce gas costs\n // An external contract can buffer ETH and call this\n function depositMultipleWithReferral(\n address[] memory addrs,\n uint256[] memory amts,\n address ref,\n address frontend,\n bytes32[] memory bytesToBroadcast\n ) external payable {\n uint256 i = addrs.length;\n if (addrs.length != amts.length || addrs.length != bytesToBroadcast.length) {\n payable(msg.sender).transfer(msg.value);\n }\n while (i > 0) {\n unchecked {\n --i;\n\n emit Deposit(addrs[i], amts[i]);\n emit ExtraDepositData(msg.sender, msg.value, bytesToBroadcast[i]);\n emit DepositRef(msg.sender, msg.value, ref);\n emit DepositFrontend(msg.sender, msg.value, frontend);\n MINTER.depositAndStakeFor{value: amts[i]}(addrs[i]);\n }\n }\n }\n\n // User deposit helper. User needs to call this function.\n // Referral data can be filled in by frontend\n function depositWithEvents(address ref, address frontend, bytes32 data) external payable {\n MINTER.depositAndStakeFor{value: msg.value}(msg.sender);\n emit Deposit(msg.sender, msg.value);\n emit ExtraDepositData(msg.sender, msg.value, data);\n emit DepositRef(msg.sender, msg.value, ref);\n emit DepositFrontend(msg.sender, msg.value, frontend);\n }\n}\n" + }, + "contracts/v2/periphery/Zap.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity 0.8.20;\n\nimport {IERC20MintableBurnable} from \"../../interfaces/IERC20MintableBurnable.sol\";\nimport {IWSGEth} from \"../../interfaces/IWSGEth.sol\";\nimport {ISharedDeposit} from \"../../interfaces/ISharedDeposit.sol\";\n\ncontract Zap {\n IERC20MintableBurnable public sgeth;\n IWSGEth public wsgeth;\n ISharedDeposit public MINTER;\n\n constructor(IERC20MintableBurnable _sgETHAddr, IWSGEth _wsgETHAddr, ISharedDeposit _minter) {\n sgeth = _sgETHAddr;\n wsgeth = _wsgETHAddr;\n MINTER = _minter;\n uint256 MAX_INT = 2 ** 256 - 1;\n\n sgeth.approve(address(_wsgETHAddr), MAX_INT);\n sgeth.approve(address(_minter), MAX_INT);\n }\n\n function depositAndStake() external payable {\n uint256 amt = msg.value;\n MINTER.deposit{value: amt}();\n wsgeth.deposit(amt, msg.sender);\n }\n\n function unstakeAndWithdraw(uint256 amount) external {\n uint256 assets = wsgeth.redeem(amount, address(this), msg.sender);\n MINTER.withdraw(assets, msg.sender);\n }\n}\n" + }, + "solmate/src/mixins/ERC4626.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../tokens/ERC20.sol\";\nimport {SafeTransferLib} from \"../utils/SafeTransferLib.sol\";\nimport {FixedPointMathLib} from \"../utils/FixedPointMathLib.sol\";\n\n/// @notice Minimal ERC4626 tokenized Vault implementation.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/mixins/ERC4626.sol)\nabstract contract ERC4626 is ERC20 {\n using SafeTransferLib for ERC20;\n using FixedPointMathLib for uint256;\n\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /*//////////////////////////////////////////////////////////////\n IMMUTABLES\n //////////////////////////////////////////////////////////////*/\n\n ERC20 public immutable asset;\n\n constructor(\n ERC20 _asset,\n string memory _name,\n string memory _symbol\n ) ERC20(_name, _symbol, _asset.decimals()) {\n asset = _asset;\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function deposit(uint256 assets, address receiver) public virtual returns (uint256 shares) {\n // Check for rounding error since we round down in previewDeposit.\n require((shares = previewDeposit(assets)) != 0, \"ZERO_SHARES\");\n\n // Need to transfer before minting or ERC777s could reenter.\n asset.safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function mint(uint256 shares, address receiver) public virtual returns (uint256 assets) {\n assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.\n\n // Need to transfer before minting or ERC777s could reenter.\n asset.safeTransferFrom(msg.sender, address(this), assets);\n\n _mint(receiver, shares);\n\n emit Deposit(msg.sender, receiver, assets, shares);\n\n afterDeposit(assets, shares);\n }\n\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public virtual returns (uint256 shares) {\n shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.\n\n if (msg.sender != owner) {\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\n }\n\n beforeWithdraw(assets, shares);\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n asset.safeTransfer(receiver, assets);\n }\n\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) public virtual returns (uint256 assets) {\n if (msg.sender != owner) {\n uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;\n }\n\n // Check for rounding error since we round down in previewRedeem.\n require((assets = previewRedeem(shares)) != 0, \"ZERO_ASSETS\");\n\n beforeWithdraw(assets, shares);\n\n _burn(owner, shares);\n\n emit Withdraw(msg.sender, receiver, owner, assets, shares);\n\n asset.safeTransfer(receiver, assets);\n }\n\n /*//////////////////////////////////////////////////////////////\n ACCOUNTING LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function totalAssets() public view virtual returns (uint256);\n\n function convertToShares(uint256 assets) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? assets : assets.mulDivDown(supply, totalAssets());\n }\n\n function convertToAssets(uint256 shares) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? shares : shares.mulDivDown(totalAssets(), supply);\n }\n\n function previewDeposit(uint256 assets) public view virtual returns (uint256) {\n return convertToShares(assets);\n }\n\n function previewMint(uint256 shares) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? shares : shares.mulDivUp(totalAssets(), supply);\n }\n\n function previewWithdraw(uint256 assets) public view virtual returns (uint256) {\n uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.\n\n return supply == 0 ? assets : assets.mulDivUp(supply, totalAssets());\n }\n\n function previewRedeem(uint256 shares) public view virtual returns (uint256) {\n return convertToAssets(shares);\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL LIMIT LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function maxDeposit(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n function maxMint(address) public view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n function maxWithdraw(address owner) public view virtual returns (uint256) {\n return convertToAssets(balanceOf[owner]);\n }\n\n function maxRedeem(address owner) public view virtual returns (uint256) {\n return balanceOf[owner];\n }\n\n /*//////////////////////////////////////////////////////////////\n INTERNAL HOOKS LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {}\n\n function afterDeposit(uint256 assets, uint256 shares) internal virtual {}\n}\n" + }, + "solmate/src/tokens/ERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\nabstract contract ERC20 {\n /*//////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////*/\n\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n /*//////////////////////////////////////////////////////////////\n METADATA STORAGE\n //////////////////////////////////////////////////////////////*/\n\n string public name;\n\n string public symbol;\n\n uint8 public immutable decimals;\n\n /*//////////////////////////////////////////////////////////////\n ERC20 STORAGE\n //////////////////////////////////////////////////////////////*/\n\n uint256 public totalSupply;\n\n mapping(address => uint256) public balanceOf;\n\n mapping(address => mapping(address => uint256)) public allowance;\n\n /*//////////////////////////////////////////////////////////////\n EIP-2612 STORAGE\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal immutable INITIAL_CHAIN_ID;\n\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\n\n mapping(address => uint256) public nonces;\n\n /*//////////////////////////////////////////////////////////////\n CONSTRUCTOR\n //////////////////////////////////////////////////////////////*/\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals\n ) {\n name = _name;\n symbol = _symbol;\n decimals = _decimals;\n\n INITIAL_CHAIN_ID = block.chainid;\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\n }\n\n /*//////////////////////////////////////////////////////////////\n ERC20 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function approve(address spender, uint256 amount) public virtual returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n\n return true;\n }\n\n function transfer(address to, uint256 amount) public virtual returns (bool) {\n balanceOf[msg.sender] -= amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(msg.sender, to, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\n\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\n\n balanceOf[from] -= amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n return true;\n }\n\n /*//////////////////////////////////////////////////////////////\n EIP-2612 LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual {\n require(deadline >= block.timestamp, \"PERMIT_DEADLINE_EXPIRED\");\n\n // Unchecked because the only math done is incrementing\n // the owner's nonce which cannot realistically overflow.\n unchecked {\n address recoveredAddress = ecrecover(\n keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n DOMAIN_SEPARATOR(),\n keccak256(\n abi.encode(\n keccak256(\n \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n ),\n owner,\n spender,\n value,\n nonces[owner]++,\n deadline\n )\n )\n )\n ),\n v,\n r,\n s\n );\n\n require(recoveredAddress != address(0) && recoveredAddress == owner, \"INVALID_SIGNER\");\n\n allowance[recoveredAddress][spender] = value;\n }\n\n emit Approval(owner, spender, value);\n }\n\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\n }\n\n function computeDomainSeparator() internal view virtual returns (bytes32) {\n return\n keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n keccak256(bytes(name)),\n keccak256(\"1\"),\n block.chainid,\n address(this)\n )\n );\n }\n\n /*//////////////////////////////////////////////////////////////\n INTERNAL MINT/BURN LOGIC\n //////////////////////////////////////////////////////////////*/\n\n function _mint(address to, uint256 amount) internal virtual {\n totalSupply += amount;\n\n // Cannot overflow because the sum of all user\n // balances can't exceed the max uint256 value.\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(address(0), to, amount);\n }\n\n function _burn(address from, uint256 amount) internal virtual {\n balanceOf[from] -= amount;\n\n // Cannot underflow because a user's balance\n // will never be larger than the total supply.\n unchecked {\n totalSupply -= amount;\n }\n\n emit Transfer(from, address(0), amount);\n }\n}\n" + }, + "solmate/src/utils/FixedPointMathLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Arithmetic library with operations for fixed-point numbers.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)\n/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)\nlibrary FixedPointMathLib {\n /*//////////////////////////////////////////////////////////////\n SIMPLIFIED FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal constant MAX_UINT256 = 2**256 - 1;\n\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\n\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\n }\n\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\n }\n\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\n }\n\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\n }\n\n /*//////////////////////////////////////////////////////////////\n LOW LEVEL FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function mulDivDown(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\n if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\n revert(0, 0)\n }\n\n // Divide x * y by the denominator.\n z := div(mul(x, y), denominator)\n }\n }\n\n function mulDivUp(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\n if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\n revert(0, 0)\n }\n\n // If x * y modulo the denominator is strictly greater than 0,\n // 1 is added to round up the division of x * y by the denominator.\n z := add(gt(mod(mul(x, y), denominator), 0), div(mul(x, y), denominator))\n }\n }\n\n function rpow(\n uint256 x,\n uint256 n,\n uint256 scalar\n ) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n switch x\n case 0 {\n switch n\n case 0 {\n // 0 ** 0 = 1\n z := scalar\n }\n default {\n // 0 ** n = 0\n z := 0\n }\n }\n default {\n switch mod(n, 2)\n case 0 {\n // If n is even, store scalar in z for now.\n z := scalar\n }\n default {\n // If n is odd, store x in z for now.\n z := x\n }\n\n // Shifting right by 1 is like dividing by 2.\n let half := shr(1, scalar)\n\n for {\n // Shift n right by 1 before looping to halve it.\n n := shr(1, n)\n } n {\n // Shift n right by 1 each iteration to halve it.\n n := shr(1, n)\n } {\n // Revert immediately if x ** 2 would overflow.\n // Equivalent to iszero(eq(div(xx, x), x)) here.\n if shr(128, x) {\n revert(0, 0)\n }\n\n // Store x squared.\n let xx := mul(x, x)\n\n // Round to the nearest number.\n let xxRound := add(xx, half)\n\n // Revert if xx + half overflowed.\n if lt(xxRound, xx) {\n revert(0, 0)\n }\n\n // Set x to scaled xxRound.\n x := div(xxRound, scalar)\n\n // If n is even:\n if mod(n, 2) {\n // Compute z * x.\n let zx := mul(z, x)\n\n // If z * x overflowed:\n if iszero(eq(div(zx, x), z)) {\n // Revert if x is non-zero.\n if iszero(iszero(x)) {\n revert(0, 0)\n }\n }\n\n // Round to the nearest number.\n let zxRound := add(zx, half)\n\n // Revert if zx + half overflowed.\n if lt(zxRound, zx) {\n revert(0, 0)\n }\n\n // Return properly scaled zxRound.\n z := div(zxRound, scalar)\n }\n }\n }\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n GENERAL NUMBER UTILITIES\n //////////////////////////////////////////////////////////////*/\n\n function sqrt(uint256 x) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n let y := x // We start y at x, which will help us make our initial estimate.\n\n z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\n\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\n\n // We check y >= 2^(k + 8) but shift right by k bits\n // each branch to ensure that if x >= 256, then y >= 256.\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\n y := shr(128, y)\n z := shl(64, z)\n }\n if iszero(lt(y, 0x1000000000000000000)) {\n y := shr(64, y)\n z := shl(32, z)\n }\n if iszero(lt(y, 0x10000000000)) {\n y := shr(32, y)\n z := shl(16, z)\n }\n if iszero(lt(y, 0x1000000)) {\n y := shr(16, y)\n z := shl(8, z)\n }\n\n // Goal was to get z*z*y within a small factor of x. More iterations could\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\n\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\n\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\n\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\n\n // There is no overflow risk here since y < 2^136 after the first branch above.\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\n\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n\n // If x+1 is a perfect square, the Babylonian method cycles between\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\n z := sub(z, lt(div(x, z), z))\n }\n }\n\n function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n // Mod x by y. Note this will return\n // 0 instead of reverting if y is zero.\n z := mod(x, y)\n }\n }\n\n function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {\n /// @solidity memory-safe-assembly\n assembly {\n // Divide x by y. Note this will return\n // 0 instead of reverting if y is zero.\n r := div(x, y)\n }\n }\n\n function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n // Add 1 to x * y if x % y > 0. Note this will\n // return 0 instead of reverting if y is zero.\n z := add(gt(mod(x, y), 0), div(x, y))\n }\n }\n}\n" + }, + "solmate/src/utils/SafeCastLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Safe unsigned integer casting library that reverts on overflow.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeCastLib.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeCast.sol)\nlibrary SafeCastLib {\n function safeCastTo248(uint256 x) internal pure returns (uint248 y) {\n require(x < 1 << 248);\n\n y = uint248(x);\n }\n\n function safeCastTo224(uint256 x) internal pure returns (uint224 y) {\n require(x < 1 << 224);\n\n y = uint224(x);\n }\n\n function safeCastTo192(uint256 x) internal pure returns (uint192 y) {\n require(x < 1 << 192);\n\n y = uint192(x);\n }\n\n function safeCastTo160(uint256 x) internal pure returns (uint160 y) {\n require(x < 1 << 160);\n\n y = uint160(x);\n }\n\n function safeCastTo128(uint256 x) internal pure returns (uint128 y) {\n require(x < 1 << 128);\n\n y = uint128(x);\n }\n\n function safeCastTo96(uint256 x) internal pure returns (uint96 y) {\n require(x < 1 << 96);\n\n y = uint96(x);\n }\n\n function safeCastTo64(uint256 x) internal pure returns (uint64 y) {\n require(x < 1 << 64);\n\n y = uint64(x);\n }\n\n function safeCastTo32(uint256 x) internal pure returns (uint32 y) {\n require(x < 1 << 32);\n\n y = uint32(x);\n }\n\n function safeCastTo24(uint256 x) internal pure returns (uint24 y) {\n require(x < 1 << 24);\n\n y = uint24(x);\n }\n\n function safeCastTo16(uint256 x) internal pure returns (uint16 y) {\n require(x < 1 << 16);\n\n y = uint16(x);\n }\n\n function safeCastTo8(uint256 x) internal pure returns (uint8 y) {\n require(x < 1 << 8);\n\n y = uint8(x);\n }\n}\n" + }, + "solmate/src/utils/SafeTransferLib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../tokens/ERC20.sol\";\n\n/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)\n/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.\n/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.\nlibrary SafeTransferLib {\n /*//////////////////////////////////////////////////////////////\n ETH OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function safeTransferETH(address to, uint256 amount) internal {\n bool success;\n\n /// @solidity memory-safe-assembly\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n\n require(success, \"ETH_TRANSFER_FAILED\");\n }\n\n /*//////////////////////////////////////////////////////////////\n ERC20 OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function safeTransferFrom(\n ERC20 token,\n address from,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n /// @solidity memory-safe-assembly\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), from) // Append the \"from\" argument.\n mstore(add(freeMemoryPointer, 36), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 68), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)\n )\n }\n\n require(success, \"TRANSFER_FROM_FAILED\");\n }\n\n function safeTransfer(\n ERC20 token,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n /// @solidity memory-safe-assembly\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\n )\n }\n\n require(success, \"TRANSFER_FAILED\");\n }\n\n function safeApprove(\n ERC20 token,\n address to,\n uint256 amount\n ) internal {\n bool success;\n\n /// @solidity memory-safe-assembly\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\n\n success := and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\n )\n }\n\n require(success, \"APPROVE_FAILED\");\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "storageLayout" + ], + "": ["ast"] + } + }, + "metadata": { + "useLiteralContent": true + }, + "libraries": { + "": { + "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" + } + } + } +} diff --git a/hardhat.config.ts b/hardhat.config.ts index 08daeaa..f993911 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -36,15 +36,18 @@ const MAINNET_RPC_URL = `https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}`; const MAINNET_PRIVATE_KEY = process.env.MAINNET_PRIVATE_KEY ? process.env.MAINNET_PRIVATE_KEY : GOERLIPK; // Your API key for Etherscan // Obtain one at https://etherscan.io/ -// apiKey: secrets.ETHERSCAN_API, const ETHERSCAN_API = process.env.ETHERSCAN_API ? process.env.ETHERSCAN_API : false; -// sepolia = {}; const ALCHEMY_SEPOLIA_KEY = process.env.ALCHEMY_SEPOLIA_KEY ? process.env.ALCHEMY_SEPOLIA_KEY : ""; -const SEPOLIA_RPC_URL = `https://eth-sepolia.g.alchemy.com/v2/${ALCHEMY_SEPOLIA_KEY}`; +const SEPOLIA_RPC_URL = process.env.SEPOLIA_RPC_URL + ? process.env.SEPOLIA_RPC_URL + : `https://eth-sepolia.g.alchemy.com/v2/${ALCHEMY_SEPOLIA_KEY}`; const SEPOLIA_PRIVATE_KEY = process.env.SEPOLIA_PRIVATE_KEY ? process.env.SEPOLIA_PRIVATE_KEY : GOERLIPK; +// const ACTIVE_DEPLOYER_PK = SEPOLIA_PRIVATE_KEY; // use for real deploys +const ACTIVE_DEPLOYER_PK = GOERLIPK; // use for test + // END required user input const path = require("path"); @@ -57,7 +60,7 @@ const chainIds = { mainnet: 1, rinkeby: 4, ropsten: 3, - sepolia: 11155111, + sepolia: 11155111, // hex: 0xaa36a7 }; // You need to export an object to set up your config @@ -158,7 +161,7 @@ const config: HardhatUserConfig = { target: "ethers-v6", }, namedAccounts: { - deployer: 0, + deployer: `privatekey://0x${ACTIVE_DEPLOYER_PK}`, multiSig: 1, alice: 3, bob: 4, diff --git a/scripts/v2/1_deploy_minterv2.js b/scripts/v2/1_deploy_minterv2.js index 2289f57..ffe3932 100644 --- a/scripts/v2/1_deploy_minterv2.js +++ b/scripts/v2/1_deploy_minterv2.js @@ -3,8 +3,7 @@ let {DeployHelper} = require("./lib/DeployHelper.js"); let {deployMinterV2, setWithdrawalCredential, addMinter} = require("./lib/minter_deploy_utils.js"); let genParams = require("./lib/opts.js"); -let OA = require("./lib/onchain_actions.js"); -const {network, ethers} = require("hardhat"); +const {network} = require("hardhat"); require("dotenv").config(); @@ -13,7 +12,6 @@ async function main() { deployer = dh.deployer; await dh.init(); - let oa = new OA(dh); let params = genParams(dh); dh.multisig_address = params.multisigAddr; @@ -39,14 +37,15 @@ async function main() { let wsgETHAddr = dh.addressOf(wsgETH); params.wsgETH = wsgETHAddr; - - await dh.deployContract("FeeCalc", "FeeCalc", [{ - adminFee: 10, - exitFee: 0, - refundFeesOnWithdraw: true, - chargeOnDeposit: true, - chargeOnExit: false - }]); + await dh.deployContract("FeeCalc", "FeeCalc", [ + { + adminFee: 10, + exitFee: 0, + refundFeesOnWithdraw: true, + chargeOnDeposit: true, + chargeOnExit: false, + }, + ]); params.feeCalcAddr = dh.addressOf("FeeCalc"); await deployMinterV2(dh, params); @@ -118,23 +117,23 @@ async function main() { // Set the withdrawal contract now that we have it - i.e the rewards recvr await setWithdrawalCredential(dh, params); - await oa.transferRewardsRecvrToMultisig(params); + await dh.transferRewardsRecvrToMultisig(params); await dh.waitIfNotLocalHost(); - await oa.transferSgETHToMultisig(params); + await dh.transferSgETHToMultisig(params); await dh.waitIfNotLocalHost(); // test deposit withdraw flow - await oa.e2e(params); - -// starting sgeth bal 0.0 -// Deposited Eth, got sgETH: 0.01 0.01 -// new sgETH bal post withdraw 0.0 -// warmed up deposit/withdraw -// starting wsgeth bal 0.0 -// Staked Eth, got wsgETH: 0.01 0.01 -// Unstaked wsgETH, new wsgETH bal: 0.005 -// warmed up stake/unstake + await dh.e2e(params); + + // starting sgeth bal 0.0 + // Deposited Eth, got sgETH: 0.01 0.01 + // new sgETH bal post withdraw 0.0 + // warmed up deposit/withdraw + // starting wsgeth bal 0.0 + // Staked Eth, got wsgETH: 0.01 0.01 + // Unstaked wsgETH, new wsgETH bal: 0.005 + // warmed up stake/unstake } // We recommend this pattern to be able to use async/await everywhere diff --git a/scripts/v2/deploy_minterv2_follow.js b/scripts/v2/deploy_minterv2_follow.js index ccf8ccd..e255feb 100644 --- a/scripts/v2/deploy_minterv2_follow.js +++ b/scripts/v2/deploy_minterv2_follow.js @@ -3,7 +3,6 @@ let {DeployHelper} = require("./lib/deploy_utils.js"); let {deployMinterV2, setWithdrawalCredential, addMinter} = require("./lib/minter_deploy_utils.js"); let genParams = require("./lib/opts.js"); -let OA = require("./lib/onchain_actions.js"); require("dotenv").config(); @@ -13,7 +12,6 @@ async function main() { let dh = new DeployHelper(network.name, deployer.address); await dh.init(deployer.address, deployer); - let oa = new OA(dh); let params = genParams(dh); dh.multisig_address = params.multisigAddr; @@ -34,14 +32,14 @@ async function main() { await dh.waitIfNotLocalHost(); // Transfer ownership of any owned components to the multisig - await oa.transferRewardsRecvrToMultisig(params); + await dh.transferRewardsRecvrToMultisig(params); await dh.waitIfNotLocalHost(); - await oa.transferSgETHToMultisig(params); + await dh.transferSgETHToMultisig(params); await dh.waitIfNotLocalHost(); // test deposit withdraw flow - await oa.e2e(params); + await dh.e2e(params); await dh.waitIfNotLocalHost(); diff --git a/scripts/v2/goerli_eth_recov.js b/scripts/v2/goerli_eth_recov.js index 2595f75..650c697 100644 --- a/scripts/v2/goerli_eth_recov.js +++ b/scripts/v2/goerli_eth_recov.js @@ -1,7 +1,6 @@ // export GOERLIPK='private key'; // npx hardhat run --network goerli --verbose deploy/deploy_minterv2.js let {DeployHelper} = require("../deploy_utils.js"); -let OA = require("./lib/onchain_actions.js"); let genParams = require("./lib/opts.js"); require("dotenv").config(); @@ -10,7 +9,6 @@ async function main() { let dh = new DeployHelper(network.name, deployer.address); await dh.init(deployer.address, deployer); - let oa = new OA(dh); let params = genParams(dh); let name = "GoerliETHRecov"; diff --git a/scripts/v2/goerli_test_depositEth2.js b/scripts/v2/goerli_test_depositEth2.js index 174eff6..55e8dbf 100644 --- a/scripts/v2/goerli_test_depositEth2.js +++ b/scripts/v2/goerli_test_depositEth2.js @@ -1,7 +1,6 @@ // export GOERLIPK='private key'; // npx hardhat run --network goerli --verbose deploy/deploy_minterv2.js let {DeployHelper} = require("../deploy_utils.js"); -let OA = require("./lib/onchain_actions.js"); let genParams = require("./lib/opts.js"); let creds = require("./lib/goerli_deposit_data.json"); @@ -13,12 +12,11 @@ async function main() { let dh = new DeployHelper(network.name, deployer.address); await dh.init(deployer.address, deployer); - let oa = new OA(dh); let params = genParams(dh); let validators = creds; - await oa.depositEth2(params, validators); + await dh.depositEth2(params, validators); await dh.postRun(); } diff --git a/scripts/v2/lib/DeployHelper.js b/scripts/v2/lib/DeployHelper.js index 3c8cd6d..e973da4 100644 --- a/scripts/v2/lib/DeployHelper.js +++ b/scripts/v2/lib/DeployHelper.js @@ -15,8 +15,11 @@ let { log, } = require("./deploy_utils.js"); -class DeployHelper { +let {OnchainActions} = require("./OnchainActions.js"); + +class DeployHelper extends OnchainActions { constructor(launchNetwork, multisig_address = '') { + super(null); this.contracts = {}; this.launchNetwork = launchNetwork; this.initialBalance = 0; @@ -25,6 +28,7 @@ class DeployHelper { this.multisig_address = multisig_address; this.deployer = _parsePrivateKeyToDeployer(); this.hre = hre; + this.dh = this; // used to float the deploy helper methods to the onchain actions lib } async init(address='') { this.address = address?.length > 0 ? address : this.deployer.address; @@ -36,14 +40,14 @@ class DeployHelper { this.overrides = await this.getOverrides(); // cache the overrides inititally to reduce api calls log( - `Initial balance of deployer at ${this.address} is: ${this.initialBalance?.toString()} at block timestamp : ${this.currentBlockTime + `Initial balance of deployer at ${this.address} is: ${ethers.formatUnits(this.initialBalance)?.toString()} ETH at block timestamp : ${this.currentBlockTime } on network: ${this.launchNetwork}`, ); if (this.launchNetwork === "sepolia") { // we can get away with less gas on sepolia maybe - this.overrides.maxFeePerGas = this.overrides.maxFeePerGas.div(20); - this.overrides.maxPriorityFeePerGas = this.overrides.maxPriorityFeePerGas.div(20); + this.overrides.maxFeePerGas = this.overrides.maxFeePerGas / ethers.getUint(2); + this.overrides.maxPriorityFeePerGas = this.overrides.maxPriorityFeePerGas / ethers.getUint(2); } log(`Using gas settings: ${ethers.formatUnits((this.overrides.maxFeePerGas).toString(), "gwei")} gwei & bribe: ${ethers.formatUnits(this.overrides.maxPriorityFeePerGas, "gwei")} gwei`); @@ -142,8 +146,8 @@ class DeployHelper { console.log(o); } - log(txt) { - log(txt); + log(txt, ...etc) { + log(txt, ...etc); } parseEther(n) { diff --git a/scripts/v2/lib/OnchainActions.js b/scripts/v2/lib/OnchainActions.js new file mode 100644 index 0000000..3a49b6a --- /dev/null +++ b/scripts/v2/lib/OnchainActions.js @@ -0,0 +1,237 @@ +// onchain actions +// Helpers for triggering transactions for deploy/test +// we keep passing params in as they may change during execution +// instead of caching them in the class +class OnchainActions { + constructor(dh) { + this.dh = dh; + // this.minter = this.dh.getContract('SharedDepositMinterV2'); + } + + async deposit(params = { + names: { + minter: 'SharedDepositMinterV2' + } + }, amt) { + let dh = this.dh; + let c = params.names.minter; + await dh.getContract(c).deposit({ value: amt, ...dh.overrides }); + }; + + async withdraw(params = { + names: { + minter: 'SharedDepositMinterV2' + } + }, amt) { + let dh = this.dh; + let c = params.names.minter; + await dh.getContract(c).withdraw(amt, dh.overrides); + }; + + async withdrawAdminFee(params = { + names: { + minter: 'SharedDepositMinterV2' + } + }, amt) { + let dh = this.dh; + let c = params.names.minter; + await dh.getContract(c).withdrawAdminFee(amt, dh.overrides); + } + + async depositAndStake(params = { + names: { + minter: 'SharedDepositMinterV2' + } + }, amt) { + let dh = this.dh; + let c = params.names.minter; + await dh.getContract(c).depositAndStake({ value: amt, ...dh.overrides }); + }; + + async unstakeAndWithdraw(params = { + names: { + minter: 'SharedDepositMinterV2' + }, + wsgETH: 'addr' + }, amt) { + let dh = this.dh; + let c = params.names.minter; + let wsgeth = await dh.getContractAt(params.names.wsgETH, params.wsgETH); + await wsgeth.approve(dh.addressOf(c), amt); + await dh.getContract(c).unstakeAndWithdraw(amt, dh.address, dh.overrides); + }; + + async getWSGEthBal(params) { + let wsgeth = await this.dh.getContractAt(params.names.wsgETH, params.wsgETH); + let bal = await wsgeth.balanceOf(this.dh.address); + return bal; + } + + async getSGEthBal(params) { + let sgeth = await this.dh.getContractAt("SgETH", params.sgETH); + let bal = await sgeth.balanceOf(this.dh.address); + return bal; + } + + async getSGEthTotal(params) { + let sgeth = await this.dh.getContractAt("SgETH", params.sgETH); + let bal = await sgeth.totalSupply(); + return bal; + } + + async e2e(params = { + names: { + minter: 'SharedDepositMinterV2' + }, + principal: 0 + }) { + params.wsgETH = params.wsgETH?.length > 0 ? params.wsgETH : this.dh.addressOf(params.names.minter) + let amt = params.principal > 0 ? params.principal : this.dh.parseEther("0.01"); + let recv; + let dh = this.dh; + let m = this.dh.getContract(params.names.minter); + + recv = await this.getSGEthBal(params); + dh.log("starting sgeth bal", this.dh.formatEther(recv)); + + await m.deposit({ value: amt, ...dh.overrides }); + + recv = await this.getSGEthBal(params); + dh.log("Deposited Eth, got sgETH:", this.dh.formatEther(amt), this.dh.formatEther(recv)); + + await m.withdraw(amt, dh.overrides); + recv = await this.getSGEthBal(params); + dh.log("new sgETH bal post withdraw", this.dh.formatEther(recv)); + dh.log("warmed up deposit/withdraw"); + await new Promise(resolve => setTimeout(resolve, 10000)); // avoid upstream timeouts / rate limits + + recv = await this.getWSGEthBal(params); + dh.log("starting wsgeth bal", this.dh.formatEther(recv)); + await this.depositAndStake(params, amt); + recv = await this.getWSGEthBal(params); + dh.log("Staked Eth, got wsgETH:", this.dh.formatEther(amt), this.dh.formatEther(recv)); + await this.unstakeAndWithdraw(params, amt.toString() / 2); // leave abit int the wsgeth + recv = await this.getWSGEthBal(params); + + // check admin fee + await m.withdrawAdminFee(this.dh.parseEther("0"), dh.overrides); + + dh.log("Unstaked wsgETH, new wsgETH bal:", this.dh.formatEther(recv)); + dh.log("warmed up stake/unstake"); + } + + async deployNonCustodialStakingPipeline(params = { + sgETH: 'addr', + daoFeeSplitterDistro: { + addresses: [], + values: [] + }, + names: { + yd: '', + rewardsReceiver: '', + withdrawals: '', + daoFeeSplitter: '' + } + }) { + let dh = this.dh; + + await dh.deployContract(params.names.daoFeeSplitter, params.names.daoFeeSplitter, [ + params.daoFeeSplitterDistro.addresses, + params.daoFeeSplitterDistro.values, + ]); + params.daoFeeSplitter = dh.addressOf(params.names.daoFeeSplitter); + + await dh.deployContract("Withdrawals", "Withdrawals", [params.sgETH, params.sgETHVirtualPrice]); + params.withdrawals = dh.addressOf("Withdrawals"); + + await dh.deployContract("RewardsReceiver", "RewardsReceiver", [params.withdrawals, [params.sgETH, params.wsgETH, params.daoFeeSplitter, params.minter]]); + params.rewardsReceiver = dh.addressOf("RewardsReceiver"); + + return params; + } + + async transferRewardsRecvrToMultisig(params = { + names: { + rewardsReceiver: '' + }, + rewardsReceiver: '0xaddr', + multisigAddr: '0xaddr' + }) { + let dh = this.dh; + await dh.transferOwnershipToMultisig(params.names.rewardsReceiver) + dh.log(`Ownership for ${params.names.rewardsReceiver} transferred to Multisig at: ${params.multisigAddr}`); + return params; + } + + async transferSgETHToMultisig(params = { + names: { + sgeth: '' + }, + sgeth: '0xaddr', + multisigAddr: '0xaddr' + }) { + let dh = this.dh; + await dh.transferOwnershipToMultisig(params.names.sgETH) + dh.log(`Ownership for ${params.names.sgETH} transferred to Multisig at: ${params.multisigAddr}`); + return params; + } + + async calcSeedRewardAmt(params) { + let total = await getSGEthTotal(params.wsgETH) + // convert total to expected 5% yield + total = this.dh.parseEther(total.toString()) + total = total.dividedBy(20); + // convert from 5% apr to daily + total = total.dividedBy(365); + return total; + } + + async seedRewards(params, amt) { + let dh = this.dh; + amt = this.dh.parseEther(amt); + let rr = await dh.getContractAt(params.names.rewardsReceiver, params.rewardsReceiver) + let daoFeeSplitter = await dh.getContractAt(params.names.daoFeeSplitter, params.daoFeeSplitter) + let wsgETH = await dh.getContractAt(params.names.wsgETH, params.wsgETH); + let pps = await wsgETH.pricePerShare(); + dh.log('Initial price per share:', pps.toString() / 1e18); + await rr.work({value: amt}); + + // https://github.com/ethers-io/ethers.js/discussions/2345 + // need to spec full fn sig since OZ contract has 2 release fns + let fnSig = 'release(address,address)'; + await daoFeeSplitter[fnSig](params.sgETH, params.wsgETH) + pps = await wsgETH.pricePerShare(); + dh.log("seeded rewards; Amt: ", amt.toString() / 1e18, "Price per share: ", pps.toString() / 1e18) + } + + async depositEth2(params, validators) { + let _make = (validators) => { + let o = { + pubkeys: [], + sigs: [], + ddrs: [] + } + + validators.forEach(v => { + o.pubkeys.push(this.dh.prepend0x(v.pubkey)); + o.sigs.push(this.dh.prepend0x(v.signature)); + o.ddrs.push(this.dh.prepend0x(v.deposit_data_root)); + }); + + return o; + } + + let args = _make(validators); + + let minter = await this.dh.getContractAt(params.names.minter, params.minter); + let bal = await this.dh.getBalance(params.minter); + + await minter.batchDepositToEth2(args.pubkeys, args.sigs, args.ddrs) + + let bal2 = await this.dh.getBalance(params.minter) + + dh.log(`Starting Balance: ${bal.toString() / 1e18} \n Ending Balance: ${bal2.toString() / 1e18}`) + } +} + +module.exports = {OnchainActions}; diff --git a/scripts/v2/lib/deploy_utils.js b/scripts/v2/lib/deploy_utils.js index 54cf672..ec7fc81 100644 --- a/scripts/v2/lib/deploy_utils.js +++ b/scripts/v2/lib/deploy_utils.js @@ -1,12 +1,13 @@ const hre = require("hardhat"); const fs = require("fs"); -// const hreEther = { ethers } = hre; -// const {ethers} = require("ethers"); const {ethers} = hre; -// const { connect } = require("http2"); -const log = txt => { - txt = txt + " \n"; +// const WAITGAS = 15000; + +const WAITGAS = 0; + +const log = (txt, ...etc) => { + txt = txt + [' ', ...etc].join(' ') + " \n"; console.log(txt); fs.writeFileSync("log.txt", txt, { flag: "a" }); }; @@ -27,7 +28,10 @@ const isMainnet = launchNetwork => { // some behaviours need to be tested with a mainnet fork which behaves the same as mainnet return launchNetwork == "localhost" || launchNetwork == "mainnet"; }; -const _wait = async ms => await new Promise(resolve => setTimeout(resolve, ms)); +const _wait = async ms => { + log(`Waiting ${ms} ms`); + await new Promise(resolve => setTimeout(resolve, ms)); +} const _printOverrides = o => { return { type: 2, @@ -36,28 +40,43 @@ const _printOverrides = o => { gasLimit: o.gasLimit, }; }; + +const asMill = (n) => n * 1e7; + +const defaultGas = { + type: 2, + maxFeePerGas: ethers.parseUnits("25", "gwei"), + maxPriorityFeePerGas: ethers.parseUnits("1", "gwei"), +}; + const _getOverrides = async () => { const overridesForEIP1559 = { type: 2, maxFeePerGas: ethers.parseUnits("25", "gwei"), maxPriorityFeePerGas: ethers.parseUnits("2", "gwei"), - gasLimit: 2500000, + // gasLimit: asMill(15), }; // const gasPrice = await hre.ethers.provider.getGasPrice(); // overridesForEIP1559.maxFeePerGas = gasPrice; - let gas = await hre.ethers.provider.getFeeData(); + let gas = await ethers.provider.getFeeData(); // todo we want to keep waiting for gas to drop. or some max time. // manually set expected max gas // check and wait if gas spike is hit let omfpg = overridesForEIP1559.maxFeePerGas; let mfpg = gas.maxFeePerGas; if (mfpg >= (omfpg)) { - let waitTime = 15000; + let waitTime = WAITGAS; console.log("gas spike hit?! current gas in gwei:", ethers.formatUnits(mfpg.toString(), "gwei")); console.log("waiting for ", waitTime); await _wait(waitTime); - gas = await hre.ethers.provider.getFeeData(); + + gas = await ethers.provider.getFeeData(); + mfpg = gas.maxFeePerGas; + // if (mfpg >= defaultGas.maxFeePerGas) { + // gas = defaultGas; + // } + console.log("Done waiting for gas resolution; new gas settings: ", ethers.formatUnits(mfpg.toString(), "gwei")); } overridesForEIP1559.maxPriorityFeePerGas = overridesForEIP1559.maxPriorityFeePerGas >= (gas.maxPriorityFeePerGas) ? gas.maxPriorityFeePerGas @@ -84,6 +103,16 @@ const _verifyBase = async (contract, launchNetwork, cArgs) => { } }; +const _estimateDeploymentGasLimit = async (contractDeployTx) => { + // const deploymentData = contract.interface.encodeDeploy(cArgs) + // const estimatedGas = await ethers.provider.estimateGas({ data: deploymentData }); + const estimatedGas = await ethers.provider.estimateGas(contractDeployTx) + log(`Estimated gas for cdtx: ${Object.keys(contractDeployTx).join(' ')} \n ${Object.values(contractDeployTx).join(' ')}`); + log(`Estimated gas: ${Object.keys(estimatedGas).join(' ')} \n ${Object.values(estimatedGas).join(' ')}`); + + return estimatedGas; +} + const _verify = async (contract, launchNetwork, cArgs) => { if (!launchNetwork || launchNetwork == "hardhat") return; await new Promise(resolve => setTimeout(resolve, 10000)); @@ -91,12 +120,24 @@ const _verify = async (contract, launchNetwork, cArgs) => { }; const _deployContract = async (name, launchNetwork = false, cArgs = [], cachedOverrides) => { + log(`\n Deploying ${name} \n on ${launchNetwork}. `); const overridesForEIP1559 = cachedOverrides ? cachedOverrides : await _getOverrides(); - const factory = await hre.ethers.getContractFactory(name); + const factory = await ethers.getContractFactory(name); + // const factory = await ethers.ContractFactory + // let cdtx = await factory.getDeployTransaction(...cArgs, overridesForEIP1559); + // let estimate = await _estimateDeploymentGasLimit(cdtx); + // log(` estimate with settings: \n ${Object.keys(estimate).join(' ')} \n ${Object.values(estimate).join(' ')} from ${cdtx}`) + // over write our custom gas limit with what the tx should take + // overridesForEIP1559.gasLimit = cdtx.gasLimit > 0 && cdtx.gasLimit < overridesForEIP1559.gasLimit ? cdtx.gasLimit : overridesForEIP1559.gasLimit; + // log(` Deploying with settings: \n ${Object.keys(overridesForEIP1559).join(' ')} \n ${Object.values(overridesForEIP1559).join(' ')}`) + const contract = await factory.deploy(...cArgs, overridesForEIP1559); - cdtx = await factory.getDeployTransaction(...cArgs, overridesForEIP1559); - await contract.deploymentTransaction().wait(1); + await _wait(10000); + console.log("deployment done, now to waitForDeployment") await contract.waitForDeployment(); + log(`\n waitForDeployment wait for ${name} \n on ${launchNetwork}. `); + await contract.deploymentTransaction().wait(1); + log(`\n deploymentTransaction wait for ${name} \n on ${launchNetwork}. `); contract.address = contract.target; log(`\n Deployed ${name} to ${contract.address} \n on ${launchNetwork}. `); @@ -116,7 +157,6 @@ const _verifyAll = async (allContracts, launchNetwork) => { let num = 60000; // 60s log(`Waiting ${num} ms to make sure everything has propagated on etherscan`); await _wait(num); - // wait 10s to make sure everything has propagated on etherscan let contractArr = [], verifyAttemtLog = {}; diff --git a/scripts/v2/seed_rewards.js b/scripts/v2/seed_rewards.js index 0696199..ce0c3d0 100644 --- a/scripts/v2/seed_rewards.js +++ b/scripts/v2/seed_rewards.js @@ -1,7 +1,6 @@ // export GOERLIPK='private key'; // npx hardhat run --network goerli --verbose deploy/deploy_minterv2.js let {DeployHelper} = require("../lib/DeployHelper.js"); -let OA = require("./lib/onchain_actions.js"); let genParams = require("./lib/opts.js"); require("dotenv").config(); @@ -11,15 +10,14 @@ async function main() { let dh = new DeployHelper(network.name, deployer.address); await dh.init(deployer.address, deployer); - let oa = new OA(dh); let params = genParams(dh); // let amt = dh.parseEther("0.0042069"); - let amt = oa.calcSeedRewardAmt(params); + let amt = dh.calcSeedRewardAmt(params); - await oa.seedRewards(params, amt); + await dh.seedRewards(params, amt); - await oa.e2e(params); + await dh.e2e(params); await dh.postRun(); } diff --git a/scripts/v2/steps/1_tokens.js b/scripts/v2/steps/1_tokens.js index 7be79ba..769d731 100644 --- a/scripts/v2/steps/1_tokens.js +++ b/scripts/v2/steps/1_tokens.js @@ -2,7 +2,6 @@ // npx hardhat run --network goerli --verbose deploy/deploy_minterv2.js let {DeployHelper} = require("../lib/DeployHelper.js"); let genParams = require("../lib/opts.js"); -let OA = require("../lib/onchain_actions.js"); require("dotenv").config(); @@ -10,7 +9,6 @@ async function main() { let dh = new DeployHelper(network.name); await dh.init(); - let oa = new OA(dh); let params = genParams(dh); dh.multisig_address = params.multisigAddr; @@ -25,10 +23,10 @@ async function main() { let sgETHAddrs = dh.addressOf(sgETH); params.sgETH = sgETHAddrs; - let wsgETH = params.names.wsgETH; - await dh.deployContract(wsgETH, wsgETH, [sgETHAddrs, params.epochLen]); - let wsgETHAddr = dh.addressOf(wsgETH); - params.wsgETH = wsgETHAddr; + // let wsgETH = params.names.wsgETH; + // await dh.deployContract(wsgETH, wsgETH, [sgETHAddrs, params.epochLen]); + // let wsgETHAddr = dh.addressOf(wsgETH); + // params.wsgETH = wsgETHAddr; await dh.postRun(); } diff --git a/scripts/v2/upgrade_minter.js b/scripts/v2/upgrade_minter.js index 00fe2b4..6c14339 100644 --- a/scripts/v2/upgrade_minter.js +++ b/scripts/v2/upgrade_minter.js @@ -7,7 +7,6 @@ let { addMinter, deployWithdrawalsCredentialPipeline, } = require("./lib/minter_deploy_utils.js"); -let OA = require("./lib/onchain_actions.js"); let genParams = require("./lib/opts.js"); require("dotenv").config(); @@ -17,7 +16,6 @@ async function main() { let dh = new DeployHelper(network.name, deployer.address); await dh.init(deployer.address, deployer); - let oa = new OA(dh); let params = genParams(dh); params = await deployMinterV2(dh, params); @@ -29,7 +27,7 @@ async function main() { console.log("WC set"); await dh.waitIfNotLocalHost(); - await oa.e2e(params); + await dh.e2e(params); await dh.waitIfNotLocalHost(); // await oa.seedRewards(params, "0.005");