diff --git a/deployments/mainnet/AcceleratingDistributor.json b/deployments/mainnet/AcceleratingDistributor.json new file mode 100644 index 0000000..311b79e --- /dev/null +++ b/deployments/mainnet/AcceleratingDistributor.json @@ -0,0 +1,1078 @@ +{ + "address": "0x9040e41eF5E8b281535a96D9a48aCb8cfaBD9a48", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokenCumulativeStaked", + "type": "uint256" + } + ], + "name": "Exit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RecoverToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardsToSend", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokenLastUpdateTime", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokenRewardPerTokenStored", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "userRewardsOutstanding", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "userRewardsPaidPerToken", + "type": "uint256" + } + ], + "name": "RewardsWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "averageDepositTime", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cumulativeBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokenCumulativeStaked", + "type": "uint256" + } + ], + "name": "Stake", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "baseEmissionRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "maxMultiplier", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "secondsToMaxMultiplier", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lastUpdateTime", + "type": "uint256" + } + ], + "name": "TokenConfiguredForStaking", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "remainingCumulativeBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokenCumulativeStaked", + "type": "uint256" + } + ], + "name": "Unstake", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakedToken", + "type": "address" + } + ], + "name": "baseRewardPerToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakedToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "baseEmissionRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxMultiplier", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "secondsToMaxMultiplier", + "type": "uint256" + } + ], + "name": "configureStakingToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakedToken", + "type": "address" + } + ], + "name": "exit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakedToken", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "getAverageDepositTimePostDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakedToken", + "type": "address" + } + ], + "name": "getCumulativeStaked", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCurrentTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakedToken", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getOutstandingRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakedToken", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getTimeSinceAverageDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakedToken", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getUserRewardMultiplier", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakedToken", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getUserStake", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "cumulativeBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "averageDepositTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardsAccumulatedPerToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardsOutstanding", + "type": "uint256" + } + ], + "internalType": "struct AcceleratingDistributor.UserDeposit", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "recoverToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardToken", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakedToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakedToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "stakeFor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "stakingTokens", + "outputs": [ + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "baseEmissionRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxMultiplier", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "secondsToMaxMultiplier", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "cumulativeStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardPerTokenStored", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTime", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakedToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "unstake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakedToken", + "type": "address" + } + ], + "name": "withdrawReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xa1e56a50bd0a65a9b354f8070a08bf83c552ba2a69063f20411934c046de3ce6", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0x9040e41eF5E8b281535a96D9a48aCb8cfaBD9a48", + "transactionIndex": 111, + "gasUsed": "2133088", + "logsBloom": "0x00000000000000000000000000000000000000200000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000040000400000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000020000001000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xac32ef6a20295c34ee46cff91ac75fe09ec576b5f97c504287d098933099ad14", + "transactionHash": "0xa1e56a50bd0a65a9b354f8070a08bf83c552ba2a69063f20411934c046de3ce6", + "logs": [ + { + "transactionIndex": 111, + "blockNumber": 15977129, + "transactionHash": "0xa1e56a50bd0a65a9b354f8070a08bf83c552ba2a69063f20411934c046de3ce6", + "address": "0x9040e41eF5E8b281535a96D9a48aCb8cfaBD9a48", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" + ], + "data": "0x", + "logIndex": 165, + "blockHash": "0xac32ef6a20295c34ee46cff91ac75fe09ec576b5f97c504287d098933099ad14" + } + ], + "blockNumber": 15977129, + "cumulativeGasUsed": "9628901", + "status": 1, + "byzantium": true + }, + "args": ["0x44108f0223A3C3028F5Fe7AEC7f9bb2E66beF82F"], + "numDeployments": 1, + "solcInputHash": "17686732f199602ed40e6e94df0fb034", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_rewardToken\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenCumulativeStaked\",\"type\":\"uint256\"}],\"name\":\"Exit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RecoverToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardsToSend\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenLastUpdateTime\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenRewardPerTokenStored\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"userRewardsOutstanding\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"userRewardsPaidPerToken\",\"type\":\"uint256\"}],\"name\":\"RewardsWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"averageDepositTime\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cumulativeBalance\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenCumulativeStaked\",\"type\":\"uint256\"}],\"name\":\"Stake\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"baseEmissionRate\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxMultiplier\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"secondsToMaxMultiplier\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lastUpdateTime\",\"type\":\"uint256\"}],\"name\":\"TokenConfiguredForStaking\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remainingCumulativeBalance\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenCumulativeStaked\",\"type\":\"uint256\"}],\"name\":\"Unstake\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakedToken\",\"type\":\"address\"}],\"name\":\"baseRewardPerToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakedToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"baseEmissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxMultiplier\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"secondsToMaxMultiplier\",\"type\":\"uint256\"}],\"name\":\"configureStakingToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakedToken\",\"type\":\"address\"}],\"name\":\"exit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakedToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"getAverageDepositTimePostDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakedToken\",\"type\":\"address\"}],\"name\":\"getCumulativeStaked\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakedToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getOutstandingRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakedToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getTimeSinceAverageDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakedToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getUserRewardMultiplier\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakedToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getUserStake\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"cumulativeBalance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"averageDepositTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rewardsAccumulatedPerToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rewardsOutstanding\",\"type\":\"uint256\"}],\"internalType\":\"struct AcceleratingDistributor.UserDeposit\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"recoverToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardToken\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakedToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakedToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"beneficiary\",\"type\":\"address\"}],\"name\":\"stakeFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"stakingTokens\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"baseEmissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxMultiplier\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"secondsToMaxMultiplier\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cumulativeStaked\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rewardPerTokenStored\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastUpdateTime\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakedToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"unstake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakedToken\",\"type\":\"address\"}],\"name\":\"withdrawReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"baseRewardPerToken(address)\":{\"details\":\"the value returned is represented by a uint256 with fixed precision of 18 decimals.\",\"params\":{\"stakedToken\":\"The address of the staked token to query.\"},\"returns\":{\"_0\":\"uint256 Total base reward per token that will be applied, pro-rata, to stakers.\"}},\"configureStakingToken(address,bool,uint256,uint256,uint256)\":{\"details\":\"The owner should ensure that the token enabled is a standard ERC20 token to ensure correct functionality.\",\"params\":{\"baseEmissionRate\":\"The base emission rate for staking the token. This is split pro-rata between all users.\",\"enabled\":\"Whether the token is enabled for staking.\",\"maxMultiplier\":\"The maximum multiplier for staking which increases your rewards the longer you stake.\",\"secondsToMaxMultiplier\":\"The number of seconds needed to stake to reach the maximum multiplier.\",\"stakedToken\":\"The address of the token that can be staked.\"}},\"exit(address)\":{\"details\":\"Calling this method will reset the caller's reward multiplier.\",\"params\":{\"stakedToken\":\"The address of the token to get rewards for.\"}},\"getAverageDepositTimePostDeposit(address,address,uint256)\":{\"params\":{\"account\":\"The address of the user to query.\",\"stakedToken\":\"The address of the staked token to query.\"},\"returns\":{\"_0\":\"uint256 Average post deposit time, considering all deposits to date.\"}},\"getCumulativeStaked(address)\":{\"params\":{\"stakedToken\":\"The address of the staked token to query.\"},\"returns\":{\"_0\":\"uint256 Total amount staked of the stakedToken.\"}},\"getOutstandingRewards(address,address)\":{\"params\":{\"account\":\"The address of the user to query.\",\"stakedToken\":\"The address of the staked token to query.\"},\"returns\":{\"_0\":\"uint256 Total outstanding rewards entitled to user.\"}},\"getTimeSinceAverageDeposit(address,address)\":{\"params\":{\"account\":\"The address of the user to query.\",\"stakedToken\":\"The address of the staked token to query.\"},\"returns\":{\"_0\":\"uint256 Time, in seconds, between the users average deposit time and the current time.\"}},\"getUserRewardMultiplier(address,address)\":{\"details\":\"the value returned is represented by a uint256 with fixed precision of 18 decimals.\",\"params\":{\"account\":\"The address of the user to query.\",\"stakedToken\":\"The address of the staked token to query.\"},\"returns\":{\"_0\":\"uint256 User multiplier, applied to the baseRewardPerToken, when claiming rewards.\"}},\"getUserStake(address,address)\":{\"params\":{\"account\":\"The address of user to query.\",\"stakedToken\":\"The address of the staked token to query.\"},\"returns\":{\"_0\":\"UserDeposit Struct with: {cumulativeBalance,averageDepositTime,rewardsAccumulatedPerToken,rewardsOutstanding}\"}},\"multicall(bytes[])\":{\"details\":\"Receives and executes a batch of function calls on this contract.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"recoverToken(address)\":{\"params\":{\"token\":\"The address of the token to skim.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"stake(address,uint256)\":{\"details\":\"The caller of this function must approve this contract to spend amount of stakedToken.\",\"params\":{\"amount\":\"The amount of the token to stake.\",\"stakedToken\":\"The address of the token to stake.\"}},\"stakeFor(address,uint256,address)\":{\"details\":\"The caller of this function must approve this contract to spend amount of stakedToken.The caller of this function is effectively donating their tokens to the beneficiary. The beneficiary can then unstake or claim rewards as they wish.\",\"params\":{\"amount\":\"The amount of the token to stake.\",\"beneficiary\":\"User that caller wants to stake on behalf of.\",\"stakedToken\":\"The address of the token to stake.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"unstake(address,uint256)\":{\"params\":{\"amount\":\"The amount of the token to withdraw.\",\"stakedToken\":\"The address of the token to withdraw.\"}},\"withdrawReward(address)\":{\"details\":\"Calling this method will reset the caller's reward multiplier.\",\"params\":{\"stakedToken\":\"The address of the token to get rewards for.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"baseRewardPerToken(address)\":{\"notice\":\"Returns the base rewards per staked token for a given staking token. This factors in the last time any internal logic was called on this contract to correctly attribute retroactive cumulative rewards.\"},\"configureStakingToken(address,bool,uint256,uint256,uint256)\":{\"notice\":\"Enable a token for staking.\"},\"exit(address)\":{\"notice\":\"Exits a staking position by unstaking and getting rewards. This totally exits the staking position.\"},\"getAverageDepositTimePostDeposit(address,address,uint256)\":{\"notice\":\"Returns a users new average deposit time, considering the addition of a new deposit. This factors in the cumulative previous deposits, new deposit and time from the last deposit.\"},\"getCumulativeStaked(address)\":{\"notice\":\"Returns the total staked for a given stakedToken.\"},\"getOutstandingRewards(address,address)\":{\"notice\":\"Returns the total outstanding rewards entitled to a user for a given staking token. This factors in the users staking duration (and therefore reward multiplier) and their pro-rata share of the total rewards.\"},\"getTimeSinceAverageDeposit(address,address)\":{\"notice\":\"Returns the time that has elapsed between the current time and the last users average deposit time.\"},\"getUserRewardMultiplier(address,address)\":{\"notice\":\"Returns the multiplier applied to the base reward per staked token for a given staking token and account. The longer a user stakes the higher their multiplier up to maxMultiplier for that given staking token. any internal logic was called on this contract to correctly attribute retroactive cumulative rewards.\"},\"getUserStake(address,address)\":{\"notice\":\"Returns all the information associated with a user's stake.\"},\"recoverToken(address)\":{\"notice\":\"Enables the owner to recover tokens dropped onto the contract. This could be used to remove unclaimed staking rewards or recover excess LP tokens that were inadvertently dropped onto the contract. Importantly, the contract will only let the owner recover staked excess tokens above what the contract thinks it should have. i.e the owner cant use this method to steal staked tokens, only recover excess ones mistakenly sent to the contract.\"},\"stake(address,uint256)\":{\"notice\":\"Stake tokens for rewards.\"},\"stakeFor(address,uint256,address)\":{\"notice\":\"Stake tokens for rewards on behalf of `beneficiary`.\"},\"unstake(address,uint256)\":{\"notice\":\"Withdraw staked tokens.\"},\"withdrawReward(address)\":{\"notice\":\"Get entitled rewards for the staker.\"}},\"notice\":\"Across token distribution contract. Contract is inspired by Synthetix staking contract and Ampleforth geyser. Stakers start by earning their pro-rata share of a baseEmissionRate per second which increases based on how long they have staked in the contract, up to a max emission rate of baseEmissionRate * maxMultiplier. Multiple LP tokens can be staked in this contract enabling depositors to batch stake and claim via multicall. Note that this contract is only compatible with standard ERC20 tokens, and not tokens that charge fees on transfers, dynamically change balance, or have double entry-points. It's up to the contract owner to ensure they only add supported tokens.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/AcceleratingDistributor.sol\":\"AcceleratingDistributor\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.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 anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing 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\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\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\",\"keccak256\":\"0x0e9621f60b2faabe65549f7ed0f24e8853a45c1b7990d47e8160e523683f3935\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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 */\\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 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\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Multicall.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Address.sol\\\";\\n\\n/**\\n * @dev Provides a function to batch together multiple calls in a single external call.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract Multicall {\\n /**\\n * @dev Receives and executes a batch of function calls on this contract.\\n */\\n function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {\\n results = new bytes[](data.length);\\n for (uint256 i = 0; i < data.length; i++) {\\n results[i] = Address.functionDelegateCall(address(this), data[i]);\\n }\\n return results;\\n }\\n}\\n\",\"keccak256\":\"0x35e30a35e23f856cbcee3558b7efdd83f6017a8f1b419710645143d98e892463\",\"license\":\"MIT\"},\"contracts/AcceleratingDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Multicall.sol\\\";\\n\\n/**\\n * @notice Across token distribution contract. Contract is inspired by Synthetix staking contract and Ampleforth geyser.\\n * Stakers start by earning their pro-rata share of a baseEmissionRate per second which increases based on how long\\n * they have staked in the contract, up to a max emission rate of baseEmissionRate * maxMultiplier. Multiple LP tokens\\n * can be staked in this contract enabling depositors to batch stake and claim via multicall. Note that this contract is\\n * only compatible with standard ERC20 tokens, and not tokens that charge fees on transfers, dynamically change\\n * balance, or have double entry-points. It's up to the contract owner to ensure they only add supported tokens.\\n */\\n\\ncontract AcceleratingDistributor is ReentrancyGuard, Ownable, Multicall {\\n using SafeERC20 for IERC20;\\n\\n IERC20 public immutable rewardToken;\\n\\n // Each User deposit is tracked with the information below.\\n struct UserDeposit {\\n uint256 cumulativeBalance;\\n uint256 averageDepositTime;\\n uint256 rewardsAccumulatedPerToken;\\n uint256 rewardsOutstanding;\\n }\\n\\n struct StakingToken {\\n bool enabled;\\n uint256 baseEmissionRate;\\n uint256 maxMultiplier;\\n uint256 secondsToMaxMultiplier;\\n uint256 cumulativeStaked;\\n uint256 rewardPerTokenStored;\\n uint256 lastUpdateTime;\\n mapping(address => UserDeposit) stakingBalances;\\n }\\n\\n mapping(address => StakingToken) public stakingTokens;\\n\\n modifier onlyEnabled(address stakedToken) {\\n require(stakingTokens[stakedToken].enabled, \\\"stakedToken not enabled\\\");\\n _;\\n }\\n\\n modifier onlyInitialized(address stakedToken) {\\n require(stakingTokens[stakedToken].lastUpdateTime != 0, \\\"stakedToken not initialized\\\");\\n _;\\n }\\n\\n constructor(address _rewardToken) {\\n rewardToken = IERC20(_rewardToken);\\n }\\n\\n function getCurrentTime() public view virtual returns (uint256) {\\n return block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n /**************************************\\n * EVENTS *\\n **************************************/\\n\\n event TokenConfiguredForStaking(\\n address indexed token,\\n bool enabled,\\n uint256 baseEmissionRate,\\n uint256 maxMultiplier,\\n uint256 secondsToMaxMultiplier,\\n uint256 lastUpdateTime\\n );\\n event RecoverToken(address indexed token, uint256 amount);\\n event Stake(\\n address indexed token,\\n address indexed user,\\n uint256 amount,\\n uint256 averageDepositTime,\\n uint256 cumulativeBalance,\\n uint256 tokenCumulativeStaked\\n );\\n event Unstake(\\n address indexed token,\\n address indexed user,\\n uint256 amount,\\n uint256 remainingCumulativeBalance,\\n uint256 tokenCumulativeStaked\\n );\\n event RewardsWithdrawn(\\n address indexed token,\\n address indexed user,\\n uint256 rewardsToSend,\\n uint256 tokenLastUpdateTime,\\n uint256 tokenRewardPerTokenStored,\\n uint256 userRewardsOutstanding,\\n uint256 userRewardsPaidPerToken\\n );\\n event Exit(address indexed token, address indexed user, uint256 tokenCumulativeStaked);\\n\\n /**************************************\\n * ADMIN FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Enable a token for staking.\\n * @dev The owner should ensure that the token enabled is a standard ERC20 token to ensure correct functionality.\\n * @param stakedToken The address of the token that can be staked.\\n * @param enabled Whether the token is enabled for staking.\\n * @param baseEmissionRate The base emission rate for staking the token. This is split pro-rata between all users.\\n * @param maxMultiplier The maximum multiplier for staking which increases your rewards the longer you stake.\\n * @param secondsToMaxMultiplier The number of seconds needed to stake to reach the maximum multiplier.\\n */\\n function configureStakingToken(\\n address stakedToken,\\n bool enabled,\\n uint256 baseEmissionRate,\\n uint256 maxMultiplier,\\n uint256 secondsToMaxMultiplier\\n ) external onlyOwner {\\n // Validate input to ensure system stability and avoid unexpected behavior. Note we dont place a lower bound on\\n // the baseEmissionRate. If this value is less than 1e18 then you will slowly loose your staking rewards over time.\\n // Because of the way balances are managed, the staked token cannot be the reward token. Otherwise, reward\\n // payouts could eat into user balances. We choose not to constrain `maxMultiplier` to be > 1e18 so that\\n // admin can choose to allow decreasing emissions over time. This is not the intended use case, but we see no\\n // benefit to removing this additional flexibility. If set < 1e18, then user's rewards outstanding will\\n // decrease over time. Incentives for stakers would look different if `maxMultiplier` were set < 1e18\\n require(stakedToken != address(rewardToken), \\\"Staked token is reward token\\\");\\n require(maxMultiplier < 1e36, \\\"maxMultiplier can not be set too large\\\");\\n require(secondsToMaxMultiplier > 0, \\\"secondsToMaxMultiplier must be greater than 0\\\");\\n require(baseEmissionRate < 1e27, \\\"baseEmissionRate can not be set too large\\\");\\n\\n StakingToken storage stakingToken = stakingTokens[stakedToken];\\n\\n // If this token is already initialized, make sure we update the rewards before modifying any params.\\n if (stakingToken.lastUpdateTime != 0) _updateReward(stakedToken, address(0));\\n\\n stakingToken.enabled = enabled;\\n stakingToken.baseEmissionRate = baseEmissionRate;\\n stakingToken.maxMultiplier = maxMultiplier;\\n stakingToken.secondsToMaxMultiplier = secondsToMaxMultiplier;\\n stakingToken.lastUpdateTime = getCurrentTime();\\n\\n emit TokenConfiguredForStaking(\\n stakedToken,\\n enabled,\\n baseEmissionRate,\\n maxMultiplier,\\n secondsToMaxMultiplier,\\n stakingToken.lastUpdateTime\\n );\\n }\\n\\n /**\\n * @notice Enables the owner to recover tokens dropped onto the contract. This could be used to remove unclaimed\\n * staking rewards or recover excess LP tokens that were inadvertently dropped onto the contract. Importantly, the\\n * contract will only let the owner recover staked excess tokens above what the contract thinks it should have. i.e\\n * the owner cant use this method to steal staked tokens, only recover excess ones mistakenly sent to the contract.\\n * @param token The address of the token to skim.\\n */\\n function recoverToken(address token) external onlyOwner {\\n // If the token is an enabled staking token then we want to preform a skim action where we send back any extra\\n // tokens that are not accounted for in the cumulativeStaked variable. This lets the owner recover extra tokens\\n // sent to the contract that were not explicitly staked. if the token is not enabled for staking then we simply\\n // send back the full amount of tokens that the contract has.\\n uint256 amount = IERC20(token).balanceOf(address(this));\\n if (stakingTokens[token].lastUpdateTime != 0) amount -= stakingTokens[token].cumulativeStaked;\\n require(amount > 0, \\\"Can't recover 0 tokens\\\");\\n IERC20(token).safeTransfer(owner(), amount);\\n emit RecoverToken(token, amount);\\n }\\n\\n /**************************************\\n * STAKER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Stake tokens for rewards.\\n * @dev The caller of this function must approve this contract to spend amount of stakedToken.\\n * @param stakedToken The address of the token to stake.\\n * @param amount The amount of the token to stake.\\n */\\n function stake(address stakedToken, uint256 amount) external nonReentrant onlyEnabled(stakedToken) {\\n _stake(stakedToken, amount, msg.sender);\\n }\\n\\n /**\\n * @notice Stake tokens for rewards on behalf of `beneficiary`.\\n * @dev The caller of this function must approve this contract to spend amount of stakedToken.\\n * @dev The caller of this function is effectively donating their tokens to the beneficiary. The beneficiary\\n * can then unstake or claim rewards as they wish.\\n * @param stakedToken The address of the token to stake.\\n * @param amount The amount of the token to stake.\\n * @param beneficiary User that caller wants to stake on behalf of.\\n */\\n function stakeFor(\\n address stakedToken,\\n uint256 amount,\\n address beneficiary\\n ) external nonReentrant onlyEnabled(stakedToken) {\\n _stake(stakedToken, amount, beneficiary);\\n }\\n\\n /**\\n * @notice Withdraw staked tokens.\\n * @param stakedToken The address of the token to withdraw.\\n * @param amount The amount of the token to withdraw.\\n */\\n function unstake(address stakedToken, uint256 amount) public nonReentrant onlyInitialized(stakedToken) {\\n _updateReward(stakedToken, msg.sender);\\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[msg.sender];\\n\\n // Note: these will revert if underflow so you cant unstake more than your cumulativeBalance.\\n userDeposit.cumulativeBalance -= amount;\\n stakingTokens[stakedToken].cumulativeStaked -= amount;\\n\\n IERC20(stakedToken).safeTransfer(msg.sender, amount);\\n\\n emit Unstake(\\n stakedToken,\\n msg.sender,\\n amount,\\n userDeposit.cumulativeBalance,\\n stakingTokens[stakedToken].cumulativeStaked\\n );\\n }\\n\\n /**\\n * @notice Get entitled rewards for the staker.\\n * @dev Calling this method will reset the caller's reward multiplier.\\n * @param stakedToken The address of the token to get rewards for.\\n */\\n function withdrawReward(address stakedToken) public nonReentrant onlyInitialized(stakedToken) {\\n _updateReward(stakedToken, msg.sender);\\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[msg.sender];\\n\\n uint256 rewardsToSend = userDeposit.rewardsOutstanding;\\n if (rewardsToSend > 0) {\\n userDeposit.rewardsOutstanding = 0;\\n userDeposit.averageDepositTime = getCurrentTime();\\n rewardToken.safeTransfer(msg.sender, rewardsToSend);\\n }\\n\\n emit RewardsWithdrawn(\\n stakedToken,\\n msg.sender,\\n rewardsToSend,\\n stakingTokens[stakedToken].lastUpdateTime,\\n stakingTokens[stakedToken].rewardPerTokenStored,\\n userDeposit.rewardsOutstanding,\\n userDeposit.rewardsAccumulatedPerToken\\n );\\n }\\n\\n /**\\n * @notice Exits a staking position by unstaking and getting rewards. This totally exits the staking position.\\n * @dev Calling this method will reset the caller's reward multiplier.\\n * @param stakedToken The address of the token to get rewards for.\\n */\\n function exit(address stakedToken) external onlyInitialized(stakedToken) {\\n _updateReward(stakedToken, msg.sender);\\n unstake(stakedToken, stakingTokens[stakedToken].stakingBalances[msg.sender].cumulativeBalance);\\n withdrawReward(stakedToken);\\n\\n emit Exit(stakedToken, msg.sender, stakingTokens[stakedToken].cumulativeStaked);\\n }\\n\\n /**************************************\\n * VIEW FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Returns the total staked for a given stakedToken.\\n * @param stakedToken The address of the staked token to query.\\n * @return uint256 Total amount staked of the stakedToken.\\n */\\n function getCumulativeStaked(address stakedToken) external view returns (uint256) {\\n return stakingTokens[stakedToken].cumulativeStaked;\\n }\\n\\n /**\\n * @notice Returns all the information associated with a user's stake.\\n * @param stakedToken The address of the staked token to query.\\n * @param account The address of user to query.\\n * @return UserDeposit Struct with: {cumulativeBalance,averageDepositTime,rewardsAccumulatedPerToken,rewardsOutstanding}\\n */\\n function getUserStake(address stakedToken, address account) external view returns (UserDeposit memory) {\\n return stakingTokens[stakedToken].stakingBalances[account];\\n }\\n\\n /**\\n * @notice Returns the base rewards per staked token for a given staking token. This factors in the last time\\n * any internal logic was called on this contract to correctly attribute retroactive cumulative rewards.\\n * @dev the value returned is represented by a uint256 with fixed precision of 18 decimals.\\n * @param stakedToken The address of the staked token to query.\\n * @return uint256 Total base reward per token that will be applied, pro-rata, to stakers.\\n */\\n function baseRewardPerToken(address stakedToken) public view returns (uint256) {\\n StakingToken storage stakingToken = stakingTokens[stakedToken];\\n if (stakingToken.cumulativeStaked == 0) return stakingToken.rewardPerTokenStored;\\n\\n return\\n stakingToken.rewardPerTokenStored +\\n ((getCurrentTime() - stakingToken.lastUpdateTime) * stakingToken.baseEmissionRate * 1e18) /\\n stakingToken.cumulativeStaked;\\n }\\n\\n /**\\n * @notice Returns the multiplier applied to the base reward per staked token for a given staking token and account.\\n * The longer a user stakes the higher their multiplier up to maxMultiplier for that given staking token.\\n * any internal logic was called on this contract to correctly attribute retroactive cumulative rewards.\\n * @dev the value returned is represented by a uint256 with fixed precision of 18 decimals.\\n * @param stakedToken The address of the staked token to query.\\n * @param account The address of the user to query.\\n * @return uint256 User multiplier, applied to the baseRewardPerToken, when claiming rewards.\\n */\\n function getUserRewardMultiplier(address stakedToken, address account) public view returns (uint256) {\\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[account];\\n if (userDeposit.averageDepositTime == 0 || userDeposit.cumulativeBalance == 0) return 1e18;\\n uint256 fractionOfMaxMultiplier = ((getTimeSinceAverageDeposit(stakedToken, account)) * 1e18) /\\n stakingTokens[stakedToken].secondsToMaxMultiplier;\\n\\n // At maximum, the multiplier should be equal to the maxMultiplier.\\n if (fractionOfMaxMultiplier > 1e18) fractionOfMaxMultiplier = 1e18;\\n return 1e18 + (fractionOfMaxMultiplier * (stakingTokens[stakedToken].maxMultiplier - 1e18)) / (1e18);\\n }\\n\\n /**\\n * @notice Returns the total outstanding rewards entitled to a user for a given staking token. This factors in the\\n * users staking duration (and therefore reward multiplier) and their pro-rata share of the total rewards.\\n * @param stakedToken The address of the staked token to query.\\n * @param account The address of the user to query.\\n * @return uint256 Total outstanding rewards entitled to user.\\n */\\n function getOutstandingRewards(address stakedToken, address account) public view returns (uint256) {\\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[account];\\n\\n uint256 userRewardMultiplier = getUserRewardMultiplier(stakedToken, account);\\n\\n uint256 newUserRewards = (userDeposit.cumulativeBalance *\\n (baseRewardPerToken(stakedToken) - userDeposit.rewardsAccumulatedPerToken) *\\n userRewardMultiplier) / (1e18 * 1e18);\\n\\n return newUserRewards + userDeposit.rewardsOutstanding;\\n }\\n\\n /**\\n * @notice Returns the time that has elapsed between the current time and the last users average deposit time.\\n * @param stakedToken The address of the staked token to query.\\n * @param account The address of the user to query.\\n *@return uint256 Time, in seconds, between the users average deposit time and the current time.\\n */\\n function getTimeSinceAverageDeposit(address stakedToken, address account) public view returns (uint256) {\\n return getCurrentTime() - stakingTokens[stakedToken].stakingBalances[account].averageDepositTime;\\n }\\n\\n /**\\n * @notice Returns a users new average deposit time, considering the addition of a new deposit. This factors in the\\n * cumulative previous deposits, new deposit and time from the last deposit.\\n * @param stakedToken The address of the staked token to query.\\n * @param account The address of the user to query.\\n * @return uint256 Average post deposit time, considering all deposits to date.\\n */\\n function getAverageDepositTimePostDeposit(\\n address stakedToken,\\n address account,\\n uint256 amount\\n ) public view returns (uint256) {\\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[account];\\n if (amount == 0) return userDeposit.averageDepositTime;\\n uint256 amountWeightedTime = (((amount * 1e18) / (userDeposit.cumulativeBalance + amount)) *\\n (getTimeSinceAverageDeposit(stakedToken, account))) / 1e18;\\n return userDeposit.averageDepositTime + amountWeightedTime;\\n }\\n\\n /**************************************\\n * INTERNAL FUNCTIONS *\\n **************************************/\\n\\n // Update the internal counters for a given stakedToken and user.\\n function _updateReward(address stakedToken, address account) internal {\\n StakingToken storage stakingToken = stakingTokens[stakedToken];\\n stakingToken.rewardPerTokenStored = baseRewardPerToken(stakedToken);\\n stakingToken.lastUpdateTime = getCurrentTime();\\n if (account != address(0)) {\\n UserDeposit storage userDeposit = stakingToken.stakingBalances[account];\\n userDeposit.rewardsOutstanding = getOutstandingRewards(stakedToken, account);\\n userDeposit.rewardsAccumulatedPerToken = stakingToken.rewardPerTokenStored;\\n }\\n }\\n\\n function _stake(\\n address stakedToken,\\n uint256 amount,\\n address staker\\n ) internal {\\n _updateReward(stakedToken, staker);\\n\\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[staker];\\n\\n uint256 averageDepositTime = getAverageDepositTimePostDeposit(stakedToken, staker, amount);\\n\\n userDeposit.averageDepositTime = averageDepositTime;\\n userDeposit.cumulativeBalance += amount;\\n stakingTokens[stakedToken].cumulativeStaked += amount;\\n\\n IERC20(stakedToken).safeTransferFrom(msg.sender, address(this), amount);\\n emit Stake(\\n stakedToken,\\n staker,\\n amount,\\n averageDepositTime,\\n userDeposit.cumulativeBalance,\\n stakingTokens[stakedToken].cumulativeStaked\\n );\\n }\\n}\\n\",\"keccak256\":\"0xbc67be1719f5719497d5afe7a039bdcabe0a1af453e6dec683dc5a312df047de\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60a06040523480156200001157600080fd5b50604051620025f9380380620025f98339810160408190526200003491620000a8565b6001600055620000443362000056565b6001600160a01b0316608052620000da565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060208284031215620000bb57600080fd5b81516001600160a01b0381168114620000d357600080fd5b9392505050565b6080516124f562000104600039600081816103ff01528181611028015261131b01526124f56000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c80638da5cb5b116100d8578063b42652e91161008c578063d8f8083f11610066578063d8f8083f146103d4578063f2fde38b146103e7578063f7c618c1146103fa57600080fd5b8063b42652e91461039b578063b86e321c146103ae578063c2a672e0146103c157600080fd5b80639be65a60116100bd5780639be65a6014610355578063ac9650d814610368578063adc9772e1461038857600080fd5b80638da5cb5b146103035780639b8f04b71461034257600080fd5b806342129a501161012f5780636616af07116101145780636616af07146102ad578063715018a6146102e65780637229d982146102f057600080fd5b806342129a501461021457806348a94dc91461029a57600080fd5b806329cb924d1161016057806329cb924d146101b55780632bfb323f146101bb5780633710d4c7146101ce57600080fd5b80630700f7a11461017c5780630f86107c146101a2575b600080fd5b61018f61018a366004611fda565b610421565b6040519081526020015b60405180910390f35b61018f6101b036600461200d565b610470565b4261018f565b61018f6101c9366004611fda565b61052a565b6101e16101dc366004611fda565b6105d6565b60405161019991908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610263610222366004612049565b6002602081905260009182526040909120805460018201549282015460038301546004840154600585015460069095015460ff909416959492939192909187565b6040805197151588526020880196909652948601939093526060850191909152608084015260a083015260c082015260e001610199565b61018f6102a8366004612049565b61066d565b61018f6102bb366004612049565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090206004015490565b6102ee6106f5565b005b61018f6102fe366004611fda565b610709565b60015473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610199565b6102ee610350366004612064565b610841565b6102ee610363366004612049565b61095e565b61037b6103763660046120a0565b610b5c565b6040516101999190612183565b6102ee610396366004612203565b610c51565b6102ee6103a9366004612049565b610d68565b6102ee6103bc366004612049565b610eb6565b6102ee6103cf366004612203565b6110eb565b6102ee6103e236600461223b565b611311565b6102ee6103f5366004612049565b61168a565b61031d7f000000000000000000000000000000000000000000000000000000000000000081565b73ffffffffffffffffffffffffffffffffffffffff82811660009081526002602090815260408083209385168352600790930190529081206001015461046790426122b9565b90505b92915050565b73ffffffffffffffffffffffffffffffffffffffff80841660009081526002602090815260408083209386168352600790930190529081208282036104ba57600101549050610523565b6000670de0b6b3a76400006104cf8787610421565b83546104dc9087906122cc565b6104ee87670de0b6b3a76400006122df565b6104f891906122f6565b61050291906122df565b61050c91906122f6565b905080826001015461051e91906122cc565b925050505b9392505050565b73ffffffffffffffffffffffffffffffffffffffff80831660009081526002602090815260408083209385168352600790930190529081208161056d8585610709565b905060006ec097ce7bc90715b34b9f10000000008284600201546105908961066d565b61059a91906122b9565b85546105a691906122df565b6105b091906122df565b6105ba91906122f6565b90508260030154816105cc91906122cc565b9695505050505050565b6106016040518060800160405280600081526020016000815260200160008152602001600081525090565b5073ffffffffffffffffffffffffffffffffffffffff918216600090815260026020818152604080842094909516835260079093018352908390208351608081018552815481526001820154938101939093529081015492820192909252600390910154606082015290565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600260205260408120600481015482036106a7576005015492915050565b6004810154600182015460068301546106c090426122b9565b6106ca91906122df565b6106dc90670de0b6b3a76400006122df565b6106e691906122f6565b816005015461052391906122cc565b6106fd611741565b61070760006117c2565b565b73ffffffffffffffffffffffffffffffffffffffff80831660009081526002602090815260408083209385168352600790930190529081206001810154158061075157508054155b1561076757670de0b6b3a764000091505061046a565b73ffffffffffffffffffffffffffffffffffffffff841660009081526002602052604081206003015461079a8686610421565b6107ac90670de0b6b3a76400006122df565b6107b691906122f6565b9050670de0b6b3a76400008111156107d35750670de0b6b3a76400005b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602081905260409091200154670de0b6b3a7640000906108129082906122b9565b61081c90836122df565b61082691906122f6565b61083890670de0b6b3a76400006122cc565b95945050505050565b6002600054036108b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600081815573ffffffffffffffffffffffffffffffffffffffff851681526020919091526040902054839060ff16610948576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f7374616b6564546f6b656e206e6f7420656e61626c656400000000000000000060448201526064016108a9565b610953848484611839565b505060016000555050565b610966611741565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa1580156109d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f79190612331565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602052604090206006015490915015610a5e5773ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902060040154610a5b90826122b9565b90505b60008111610ac8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616e2774207265636f766572203020746f6b656e730000000000000000000060448201526064016108a9565b610b08610aea60015473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff8416908361198a565b8173ffffffffffffffffffffffffffffffffffffffff167ffba2d3bdfb2d601eb66a89783a2c614856101cadce71556753c2edadd60c831c82604051610b5091815260200190565b60405180910390a25050565b60608167ffffffffffffffff811115610b7757610b7761234a565b604051908082528060200260200182016040528015610baa57816020015b6060815260200190600190039081610b955790505b50905060005b82811015610c4a57610c1a30858584818110610bce57610bce612379565b9050602002810190610be091906123a8565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a6392505050565b828281518110610c2c57610c2c612379565b60200260200101819052508080610c4290612414565b915050610bb0565b5092915050565b600260005403610cbd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108a9565b6002600081815573ffffffffffffffffffffffffffffffffffffffff841681526020919091526040902054829060ff16610d53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f7374616b6564546f6b656e206e6f7420656e61626c656400000000000000000060448201526064016108a9565b610d5e838333611839565b5050600160005550565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040812060060154829103610dfa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f7374616b6564546f6b656e206e6f7420696e697469616c697a6564000000000060448201526064016108a9565b610e048233611a88565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600260209081526040808320338452600701909152902054610e439083906110eb565b610e4c82610eb6565b73ffffffffffffffffffffffffffffffffffffffff8216600081815260026020526040908190206004015490513392917fbc2a67d422c268da6fe45f3e7d194e1d98906d221f1cfad62a5c80f2cd209f4c91610eaa91815260200190565b60405180910390a35050565b600260005403610f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108a9565b6002600081815573ffffffffffffffffffffffffffffffffffffffff831681526020919091526040812060060154829103610fb9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f7374616b6564546f6b656e206e6f7420696e697469616c697a6564000000000060448201526064016108a9565b610fc38233611a88565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020908152604080832033845260070190915290206003810154801561104f576000600383015542600183015561104f73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016338361198a565b73ffffffffffffffffffffffffffffffffffffffff8416600081815260026020818152604092839020600681015460059091015460038801549388015485518881529384019290925293820193909352606081019190915260808101919091523391907f72d2511ac7dd6d1171d9b798c2662417660eb70235ed1b47dfe9a015929cdf409060a0015b60405180910390a3505060016000555050565b600260005403611157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108a9565b6002600081815573ffffffffffffffffffffffffffffffffffffffff8416815260209190915260408120600601548391036111ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f7374616b6564546f6b656e206e6f7420696e697469616c697a6564000000000060448201526064016108a9565b6111f88333611a88565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600260209081526040808320338452600701909152812080549091849183919061123f9084906122b9565b909155505073ffffffffffffffffffffffffffffffffffffffff84166000908152600260205260408120600401805485929061127c9084906122b9565b909155506112a3905073ffffffffffffffffffffffffffffffffffffffff8516338561198a565b805473ffffffffffffffffffffffffffffffffffffffff8516600081815260026020908152604091829020600401548251888152918201949094529081019290925233917ffe7007b2e89d80edda76299251df08366480cac22e5e260f5e662e850b1f7a32906060016110d8565b611319611741565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16036113ce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5374616b656420746f6b656e2069732072657761726420746f6b656e0000000060448201526064016108a9565b6ec097ce7bc90715b34b9f1000000000821061146c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f6d61784d756c7469706c6965722063616e206e6f742062652073657420746f6f60448201527f206c61726765000000000000000000000000000000000000000000000000000060648201526084016108a9565b600081116114fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f7365636f6e6473546f4d61784d756c7469706c696572206d757374206265206760448201527f726561746572207468616e20300000000000000000000000000000000000000060648201526084016108a9565b6b033b2e3c9fd0803ce80000008310611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f62617365456d697373696f6e526174652063616e206e6f74206265207365742060448201527f746f6f206c61726765000000000000000000000000000000000000000000000060648201526084016108a9565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602052604090206006810154156115d1576115d1866000611a88565b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151517815560018101849055600281018390556003810182905542600682018190556040805187151581526020810187905290810185905260608101849052608081019190915273ffffffffffffffffffffffffffffffffffffffff8716907fdf80da729e79c8aa520a27834205fd35a54135f495b79561e19bd67166250a079060a00160405180910390a2505050505050565b611692611741565b73ffffffffffffffffffffffffffffffffffffffff8116611735576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016108a9565b61173e816117c2565b50565b60015473ffffffffffffffffffffffffffffffffffffffff163314610707576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108a9565b6001805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6118438382611a88565b73ffffffffffffffffffffffffffffffffffffffff808416600090815260026020908152604080832093851683526007909301905290812090611887858486610470565b9050808260010181905550838260000160008282546118a691906122cc565b909155505073ffffffffffffffffffffffffffffffffffffffff8516600090815260026020526040812060040180548692906118e39084906122cc565b9091555061190b905073ffffffffffffffffffffffffffffffffffffffff8616333087611b23565b815473ffffffffffffffffffffffffffffffffffffffff8681166000818152600260209081526040918290206004015482518a8152918201879052918101949094526060840152908516917f249b692ff3a1553daecb2b56a807466cab98a0acdca470f0d18c1064e89b57329060800160405180910390a35050505050565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052611a5e9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611b87565b505050565b6060610467838360405180606001604052806027815260200161249960279139611c93565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600260205260409020611ab68361066d565b600582015542600682015573ffffffffffffffffffffffffffffffffffffffff821615611a5e5773ffffffffffffffffffffffffffffffffffffffff821660009081526007820160205260409020611b0e848461052a565b60038201556005820154600290910155505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611b819085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016119dc565b50505050565b6000611be9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611db19092919063ffffffff16565b805190915015611a5e5780806020019051810190611c07919061244c565b611a5e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016108a9565b606073ffffffffffffffffffffffffffffffffffffffff84163b611d39576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016108a9565b6000808573ffffffffffffffffffffffffffffffffffffffff1685604051611d619190612469565b600060405180830381855af49150503d8060008114611d9c576040519150601f19603f3d011682016040523d82523d6000602084013e611da1565b606091505b509150915061051e828286611dc8565b6060611dc08484600085611e1b565b949350505050565b60608315611dd7575081610523565b825115611de75782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108a99190612485565b606082471015611ead576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016108a9565b73ffffffffffffffffffffffffffffffffffffffff85163b611f2b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108a9565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611f549190612469565b60006040518083038185875af1925050503d8060008114611f91576040519150601f19603f3d011682016040523d82523d6000602084013e611f96565b606091505b5091509150611fa6828286611dc8565b979650505050505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611fd557600080fd5b919050565b60008060408385031215611fed57600080fd5b611ff683611fb1565b915061200460208401611fb1565b90509250929050565b60008060006060848603121561202257600080fd5b61202b84611fb1565b925061203960208501611fb1565b9150604084013590509250925092565b60006020828403121561205b57600080fd5b61046782611fb1565b60008060006060848603121561207957600080fd5b61208284611fb1565b92506020840135915061209760408501611fb1565b90509250925092565b600080602083850312156120b357600080fd5b823567ffffffffffffffff808211156120cb57600080fd5b818501915085601f8301126120df57600080fd5b8135818111156120ee57600080fd5b8660208260051b850101111561210357600080fd5b60209290920196919550909350505050565b60005b83811015612130578181015183820152602001612118565b50506000910152565b60008151808452612151816020860160208601612115565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156121f6577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526121e4858351612139565b945092850192908501906001016121aa565b5092979650505050505050565b6000806040838503121561221657600080fd5b61221f83611fb1565b946020939093013593505050565b801515811461173e57600080fd5b600080600080600060a0868803121561225357600080fd5b61225c86611fb1565b9450602086013561226c8161222d565b94979496505050506040830135926060810135926080909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561046a5761046a61228a565b8082018082111561046a5761046a61228a565b808202811582820484141761046a5761046a61228a565b60008261232c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60006020828403121561234357600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123dd57600080fd5b83018035915067ffffffffffffffff8211156123f857600080fd5b60200191503681900382131561240d57600080fd5b9250929050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036124455761244561228a565b5060010190565b60006020828403121561245e57600080fd5b81516105238161222d565b6000825161247b818460208701612115565b9190910192915050565b602081526000610467602083018461213956fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122058279542ff02b69f397882804650d6aba2916365bc7a2e34a5b6c3ee54ecfa2964736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101775760003560e01c80638da5cb5b116100d8578063b42652e91161008c578063d8f8083f11610066578063d8f8083f146103d4578063f2fde38b146103e7578063f7c618c1146103fa57600080fd5b8063b42652e91461039b578063b86e321c146103ae578063c2a672e0146103c157600080fd5b80639be65a60116100bd5780639be65a6014610355578063ac9650d814610368578063adc9772e1461038857600080fd5b80638da5cb5b146103035780639b8f04b71461034257600080fd5b806342129a501161012f5780636616af07116101145780636616af07146102ad578063715018a6146102e65780637229d982146102f057600080fd5b806342129a501461021457806348a94dc91461029a57600080fd5b806329cb924d1161016057806329cb924d146101b55780632bfb323f146101bb5780633710d4c7146101ce57600080fd5b80630700f7a11461017c5780630f86107c146101a2575b600080fd5b61018f61018a366004611fda565b610421565b6040519081526020015b60405180910390f35b61018f6101b036600461200d565b610470565b4261018f565b61018f6101c9366004611fda565b61052a565b6101e16101dc366004611fda565b6105d6565b60405161019991908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610263610222366004612049565b6002602081905260009182526040909120805460018201549282015460038301546004840154600585015460069095015460ff909416959492939192909187565b6040805197151588526020880196909652948601939093526060850191909152608084015260a083015260c082015260e001610199565b61018f6102a8366004612049565b61066d565b61018f6102bb366004612049565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090206004015490565b6102ee6106f5565b005b61018f6102fe366004611fda565b610709565b60015473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610199565b6102ee610350366004612064565b610841565b6102ee610363366004612049565b61095e565b61037b6103763660046120a0565b610b5c565b6040516101999190612183565b6102ee610396366004612203565b610c51565b6102ee6103a9366004612049565b610d68565b6102ee6103bc366004612049565b610eb6565b6102ee6103cf366004612203565b6110eb565b6102ee6103e236600461223b565b611311565b6102ee6103f5366004612049565b61168a565b61031d7f000000000000000000000000000000000000000000000000000000000000000081565b73ffffffffffffffffffffffffffffffffffffffff82811660009081526002602090815260408083209385168352600790930190529081206001015461046790426122b9565b90505b92915050565b73ffffffffffffffffffffffffffffffffffffffff80841660009081526002602090815260408083209386168352600790930190529081208282036104ba57600101549050610523565b6000670de0b6b3a76400006104cf8787610421565b83546104dc9087906122cc565b6104ee87670de0b6b3a76400006122df565b6104f891906122f6565b61050291906122df565b61050c91906122f6565b905080826001015461051e91906122cc565b925050505b9392505050565b73ffffffffffffffffffffffffffffffffffffffff80831660009081526002602090815260408083209385168352600790930190529081208161056d8585610709565b905060006ec097ce7bc90715b34b9f10000000008284600201546105908961066d565b61059a91906122b9565b85546105a691906122df565b6105b091906122df565b6105ba91906122f6565b90508260030154816105cc91906122cc565b9695505050505050565b6106016040518060800160405280600081526020016000815260200160008152602001600081525090565b5073ffffffffffffffffffffffffffffffffffffffff918216600090815260026020818152604080842094909516835260079093018352908390208351608081018552815481526001820154938101939093529081015492820192909252600390910154606082015290565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600260205260408120600481015482036106a7576005015492915050565b6004810154600182015460068301546106c090426122b9565b6106ca91906122df565b6106dc90670de0b6b3a76400006122df565b6106e691906122f6565b816005015461052391906122cc565b6106fd611741565b61070760006117c2565b565b73ffffffffffffffffffffffffffffffffffffffff80831660009081526002602090815260408083209385168352600790930190529081206001810154158061075157508054155b1561076757670de0b6b3a764000091505061046a565b73ffffffffffffffffffffffffffffffffffffffff841660009081526002602052604081206003015461079a8686610421565b6107ac90670de0b6b3a76400006122df565b6107b691906122f6565b9050670de0b6b3a76400008111156107d35750670de0b6b3a76400005b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602081905260409091200154670de0b6b3a7640000906108129082906122b9565b61081c90836122df565b61082691906122f6565b61083890670de0b6b3a76400006122cc565b95945050505050565b6002600054036108b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600081815573ffffffffffffffffffffffffffffffffffffffff851681526020919091526040902054839060ff16610948576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f7374616b6564546f6b656e206e6f7420656e61626c656400000000000000000060448201526064016108a9565b610953848484611839565b505060016000555050565b610966611741565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa1580156109d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f79190612331565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602052604090206006015490915015610a5e5773ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902060040154610a5b90826122b9565b90505b60008111610ac8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616e2774207265636f766572203020746f6b656e730000000000000000000060448201526064016108a9565b610b08610aea60015473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff8416908361198a565b8173ffffffffffffffffffffffffffffffffffffffff167ffba2d3bdfb2d601eb66a89783a2c614856101cadce71556753c2edadd60c831c82604051610b5091815260200190565b60405180910390a25050565b60608167ffffffffffffffff811115610b7757610b7761234a565b604051908082528060200260200182016040528015610baa57816020015b6060815260200190600190039081610b955790505b50905060005b82811015610c4a57610c1a30858584818110610bce57610bce612379565b9050602002810190610be091906123a8565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a6392505050565b828281518110610c2c57610c2c612379565b60200260200101819052508080610c4290612414565b915050610bb0565b5092915050565b600260005403610cbd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108a9565b6002600081815573ffffffffffffffffffffffffffffffffffffffff841681526020919091526040902054829060ff16610d53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f7374616b6564546f6b656e206e6f7420656e61626c656400000000000000000060448201526064016108a9565b610d5e838333611839565b5050600160005550565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040812060060154829103610dfa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f7374616b6564546f6b656e206e6f7420696e697469616c697a6564000000000060448201526064016108a9565b610e048233611a88565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600260209081526040808320338452600701909152902054610e439083906110eb565b610e4c82610eb6565b73ffffffffffffffffffffffffffffffffffffffff8216600081815260026020526040908190206004015490513392917fbc2a67d422c268da6fe45f3e7d194e1d98906d221f1cfad62a5c80f2cd209f4c91610eaa91815260200190565b60405180910390a35050565b600260005403610f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108a9565b6002600081815573ffffffffffffffffffffffffffffffffffffffff831681526020919091526040812060060154829103610fb9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f7374616b6564546f6b656e206e6f7420696e697469616c697a6564000000000060448201526064016108a9565b610fc38233611a88565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020908152604080832033845260070190915290206003810154801561104f576000600383015542600183015561104f73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016338361198a565b73ffffffffffffffffffffffffffffffffffffffff8416600081815260026020818152604092839020600681015460059091015460038801549388015485518881529384019290925293820193909352606081019190915260808101919091523391907f72d2511ac7dd6d1171d9b798c2662417660eb70235ed1b47dfe9a015929cdf409060a0015b60405180910390a3505060016000555050565b600260005403611157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108a9565b6002600081815573ffffffffffffffffffffffffffffffffffffffff8416815260209190915260408120600601548391036111ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f7374616b6564546f6b656e206e6f7420696e697469616c697a6564000000000060448201526064016108a9565b6111f88333611a88565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600260209081526040808320338452600701909152812080549091849183919061123f9084906122b9565b909155505073ffffffffffffffffffffffffffffffffffffffff84166000908152600260205260408120600401805485929061127c9084906122b9565b909155506112a3905073ffffffffffffffffffffffffffffffffffffffff8516338561198a565b805473ffffffffffffffffffffffffffffffffffffffff8516600081815260026020908152604091829020600401548251888152918201949094529081019290925233917ffe7007b2e89d80edda76299251df08366480cac22e5e260f5e662e850b1f7a32906060016110d8565b611319611741565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16036113ce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5374616b656420746f6b656e2069732072657761726420746f6b656e0000000060448201526064016108a9565b6ec097ce7bc90715b34b9f1000000000821061146c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f6d61784d756c7469706c6965722063616e206e6f742062652073657420746f6f60448201527f206c61726765000000000000000000000000000000000000000000000000000060648201526084016108a9565b600081116114fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f7365636f6e6473546f4d61784d756c7469706c696572206d757374206265206760448201527f726561746572207468616e20300000000000000000000000000000000000000060648201526084016108a9565b6b033b2e3c9fd0803ce80000008310611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f62617365456d697373696f6e526174652063616e206e6f74206265207365742060448201527f746f6f206c61726765000000000000000000000000000000000000000000000060648201526084016108a9565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602052604090206006810154156115d1576115d1866000611a88565b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151517815560018101849055600281018390556003810182905542600682018190556040805187151581526020810187905290810185905260608101849052608081019190915273ffffffffffffffffffffffffffffffffffffffff8716907fdf80da729e79c8aa520a27834205fd35a54135f495b79561e19bd67166250a079060a00160405180910390a2505050505050565b611692611741565b73ffffffffffffffffffffffffffffffffffffffff8116611735576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016108a9565b61173e816117c2565b50565b60015473ffffffffffffffffffffffffffffffffffffffff163314610707576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108a9565b6001805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6118438382611a88565b73ffffffffffffffffffffffffffffffffffffffff808416600090815260026020908152604080832093851683526007909301905290812090611887858486610470565b9050808260010181905550838260000160008282546118a691906122cc565b909155505073ffffffffffffffffffffffffffffffffffffffff8516600090815260026020526040812060040180548692906118e39084906122cc565b9091555061190b905073ffffffffffffffffffffffffffffffffffffffff8616333087611b23565b815473ffffffffffffffffffffffffffffffffffffffff8681166000818152600260209081526040918290206004015482518a8152918201879052918101949094526060840152908516917f249b692ff3a1553daecb2b56a807466cab98a0acdca470f0d18c1064e89b57329060800160405180910390a35050505050565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052611a5e9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611b87565b505050565b6060610467838360405180606001604052806027815260200161249960279139611c93565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600260205260409020611ab68361066d565b600582015542600682015573ffffffffffffffffffffffffffffffffffffffff821615611a5e5773ffffffffffffffffffffffffffffffffffffffff821660009081526007820160205260409020611b0e848461052a565b60038201556005820154600290910155505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611b819085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016119dc565b50505050565b6000611be9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611db19092919063ffffffff16565b805190915015611a5e5780806020019051810190611c07919061244c565b611a5e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016108a9565b606073ffffffffffffffffffffffffffffffffffffffff84163b611d39576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016108a9565b6000808573ffffffffffffffffffffffffffffffffffffffff1685604051611d619190612469565b600060405180830381855af49150503d8060008114611d9c576040519150601f19603f3d011682016040523d82523d6000602084013e611da1565b606091505b509150915061051e828286611dc8565b6060611dc08484600085611e1b565b949350505050565b60608315611dd7575081610523565b825115611de75782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108a99190612485565b606082471015611ead576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016108a9565b73ffffffffffffffffffffffffffffffffffffffff85163b611f2b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108a9565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611f549190612469565b60006040518083038185875af1925050503d8060008114611f91576040519150601f19603f3d011682016040523d82523d6000602084013e611f96565b606091505b5091509150611fa6828286611dc8565b979650505050505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611fd557600080fd5b919050565b60008060408385031215611fed57600080fd5b611ff683611fb1565b915061200460208401611fb1565b90509250929050565b60008060006060848603121561202257600080fd5b61202b84611fb1565b925061203960208501611fb1565b9150604084013590509250925092565b60006020828403121561205b57600080fd5b61046782611fb1565b60008060006060848603121561207957600080fd5b61208284611fb1565b92506020840135915061209760408501611fb1565b90509250925092565b600080602083850312156120b357600080fd5b823567ffffffffffffffff808211156120cb57600080fd5b818501915085601f8301126120df57600080fd5b8135818111156120ee57600080fd5b8660208260051b850101111561210357600080fd5b60209290920196919550909350505050565b60005b83811015612130578181015183820152602001612118565b50506000910152565b60008151808452612151816020860160208601612115565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156121f6577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526121e4858351612139565b945092850192908501906001016121aa565b5092979650505050505050565b6000806040838503121561221657600080fd5b61221f83611fb1565b946020939093013593505050565b801515811461173e57600080fd5b600080600080600060a0868803121561225357600080fd5b61225c86611fb1565b9450602086013561226c8161222d565b94979496505050506040830135926060810135926080909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561046a5761046a61228a565b8082018082111561046a5761046a61228a565b808202811582820484141761046a5761046a61228a565b60008261232c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60006020828403121561234357600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123dd57600080fd5b83018035915067ffffffffffffffff8211156123f857600080fd5b60200191503681900382131561240d57600080fd5b9250929050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036124455761244561228a565b5060010190565b60006020828403121561245e57600080fd5b81516105238161222d565b6000825161247b818460208701612115565b9190910192915050565b602081526000610467602083018461213956fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122058279542ff02b69f397882804650d6aba2916365bc7a2e34a5b6c3ee54ecfa2964736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "baseRewardPerToken(address)": { + "details": "the value returned is represented by a uint256 with fixed precision of 18 decimals.", + "params": { + "stakedToken": "The address of the staked token to query." + }, + "returns": { + "_0": "uint256 Total base reward per token that will be applied, pro-rata, to stakers." + } + }, + "configureStakingToken(address,bool,uint256,uint256,uint256)": { + "details": "The owner should ensure that the token enabled is a standard ERC20 token to ensure correct functionality.", + "params": { + "baseEmissionRate": "The base emission rate for staking the token. This is split pro-rata between all users.", + "enabled": "Whether the token is enabled for staking.", + "maxMultiplier": "The maximum multiplier for staking which increases your rewards the longer you stake.", + "secondsToMaxMultiplier": "The number of seconds needed to stake to reach the maximum multiplier.", + "stakedToken": "The address of the token that can be staked." + } + }, + "exit(address)": { + "details": "Calling this method will reset the caller's reward multiplier.", + "params": { + "stakedToken": "The address of the token to get rewards for." + } + }, + "getAverageDepositTimePostDeposit(address,address,uint256)": { + "params": { + "account": "The address of the user to query.", + "stakedToken": "The address of the staked token to query." + }, + "returns": { + "_0": "uint256 Average post deposit time, considering all deposits to date." + } + }, + "getCumulativeStaked(address)": { + "params": { + "stakedToken": "The address of the staked token to query." + }, + "returns": { + "_0": "uint256 Total amount staked of the stakedToken." + } + }, + "getOutstandingRewards(address,address)": { + "params": { + "account": "The address of the user to query.", + "stakedToken": "The address of the staked token to query." + }, + "returns": { + "_0": "uint256 Total outstanding rewards entitled to user." + } + }, + "getTimeSinceAverageDeposit(address,address)": { + "params": { + "account": "The address of the user to query.", + "stakedToken": "The address of the staked token to query." + }, + "returns": { + "_0": "uint256 Time, in seconds, between the users average deposit time and the current time." + } + }, + "getUserRewardMultiplier(address,address)": { + "details": "the value returned is represented by a uint256 with fixed precision of 18 decimals.", + "params": { + "account": "The address of the user to query.", + "stakedToken": "The address of the staked token to query." + }, + "returns": { + "_0": "uint256 User multiplier, applied to the baseRewardPerToken, when claiming rewards." + } + }, + "getUserStake(address,address)": { + "params": { + "account": "The address of user to query.", + "stakedToken": "The address of the staked token to query." + }, + "returns": { + "_0": "UserDeposit Struct with: {cumulativeBalance,averageDepositTime,rewardsAccumulatedPerToken,rewardsOutstanding}" + } + }, + "multicall(bytes[])": { + "details": "Receives and executes a batch of function calls on this contract." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "recoverToken(address)": { + "params": { + "token": "The address of the token to skim." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "stake(address,uint256)": { + "details": "The caller of this function must approve this contract to spend amount of stakedToken.", + "params": { + "amount": "The amount of the token to stake.", + "stakedToken": "The address of the token to stake." + } + }, + "stakeFor(address,uint256,address)": { + "details": "The caller of this function must approve this contract to spend amount of stakedToken.The caller of this function is effectively donating their tokens to the beneficiary. The beneficiary can then unstake or claim rewards as they wish.", + "params": { + "amount": "The amount of the token to stake.", + "beneficiary": "User that caller wants to stake on behalf of.", + "stakedToken": "The address of the token to stake." + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "unstake(address,uint256)": { + "params": { + "amount": "The amount of the token to withdraw.", + "stakedToken": "The address of the token to withdraw." + } + }, + "withdrawReward(address)": { + "details": "Calling this method will reset the caller's reward multiplier.", + "params": { + "stakedToken": "The address of the token to get rewards for." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "baseRewardPerToken(address)": { + "notice": "Returns the base rewards per staked token for a given staking token. This factors in the last time any internal logic was called on this contract to correctly attribute retroactive cumulative rewards." + }, + "configureStakingToken(address,bool,uint256,uint256,uint256)": { + "notice": "Enable a token for staking." + }, + "exit(address)": { + "notice": "Exits a staking position by unstaking and getting rewards. This totally exits the staking position." + }, + "getAverageDepositTimePostDeposit(address,address,uint256)": { + "notice": "Returns a users new average deposit time, considering the addition of a new deposit. This factors in the cumulative previous deposits, new deposit and time from the last deposit." + }, + "getCumulativeStaked(address)": { + "notice": "Returns the total staked for a given stakedToken." + }, + "getOutstandingRewards(address,address)": { + "notice": "Returns the total outstanding rewards entitled to a user for a given staking token. This factors in the users staking duration (and therefore reward multiplier) and their pro-rata share of the total rewards." + }, + "getTimeSinceAverageDeposit(address,address)": { + "notice": "Returns the time that has elapsed between the current time and the last users average deposit time." + }, + "getUserRewardMultiplier(address,address)": { + "notice": "Returns the multiplier applied to the base reward per staked token for a given staking token and account. The longer a user stakes the higher their multiplier up to maxMultiplier for that given staking token. any internal logic was called on this contract to correctly attribute retroactive cumulative rewards." + }, + "getUserStake(address,address)": { + "notice": "Returns all the information associated with a user's stake." + }, + "recoverToken(address)": { + "notice": "Enables the owner to recover tokens dropped onto the contract. This could be used to remove unclaimed staking rewards or recover excess LP tokens that were inadvertently dropped onto the contract. Importantly, the contract will only let the owner recover staked excess tokens above what the contract thinks it should have. i.e the owner cant use this method to steal staked tokens, only recover excess ones mistakenly sent to the contract." + }, + "stake(address,uint256)": { + "notice": "Stake tokens for rewards." + }, + "stakeFor(address,uint256,address)": { + "notice": "Stake tokens for rewards on behalf of `beneficiary`." + }, + "unstake(address,uint256)": { + "notice": "Withdraw staked tokens." + }, + "withdrawReward(address)": { + "notice": "Get entitled rewards for the staker." + } + }, + "notice": "Across token distribution contract. Contract is inspired by Synthetix staking contract and Ampleforth geyser. Stakers start by earning their pro-rata share of a baseEmissionRate per second which increases based on how long they have staked in the contract, up to a max emission rate of baseEmissionRate * maxMultiplier. Multiple LP tokens can be staked in this contract enabling depositors to batch stake and claim via multicall. Note that this contract is only compatible with standard ERC20 tokens, and not tokens that charge fees on transfers, dynamically change balance, or have double entry-points. It's up to the contract owner to ensure they only add supported tokens.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 303, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "_status", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 187, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "_owner", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 2852, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "stakingTokens", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_struct(StakingToken)2847_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_struct(StakingToken)2847_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct AcceleratingDistributor.StakingToken)", + "numberOfBytes": "32", + "value": "t_struct(StakingToken)2847_storage" + }, + "t_mapping(t_address,t_struct(UserDeposit)2827_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct AcceleratingDistributor.UserDeposit)", + "numberOfBytes": "32", + "value": "t_struct(UserDeposit)2827_storage" + }, + "t_struct(StakingToken)2847_storage": { + "encoding": "inplace", + "label": "struct AcceleratingDistributor.StakingToken", + "members": [ + { + "astId": 2829, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "enabled", + "offset": 0, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 2831, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "baseEmissionRate", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 2833, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "maxMultiplier", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 2835, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "secondsToMaxMultiplier", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 2837, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "cumulativeStaked", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 2839, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "rewardPerTokenStored", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 2841, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "lastUpdateTime", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 2846, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "stakingBalances", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_address,t_struct(UserDeposit)2827_storage)" + } + ], + "numberOfBytes": "256" + }, + "t_struct(UserDeposit)2827_storage": { + "encoding": "inplace", + "label": "struct AcceleratingDistributor.UserDeposit", + "members": [ + { + "astId": 2820, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "cumulativeBalance", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 2822, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "averageDepositTime", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 2824, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "rewardsAccumulatedPerToken", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 2826, + "contract": "contracts/AcceleratingDistributor.sol:AcceleratingDistributor", + "label": "rewardsOutstanding", + "offset": 0, + "slot": "3", + "type": "t_uint256" + } + ], + "numberOfBytes": "128" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/deployments/mainnet/AcrossMerkleDistributor.json b/deployments/mainnet/AcrossMerkleDistributor.json new file mode 100644 index 0000000..f9b723a --- /dev/null +++ b/deployments/mainnet/AcrossMerkleDistributor.json @@ -0,0 +1,894 @@ +{ + "address": "0xE50b2cEAC4f60E840Ae513924033E753e2366487", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "windowIndex", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + } + ], + "name": "ClaimFor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "windowIndex", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "windowIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardsDeposited", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "CreatedWindow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "windowIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "DeleteWindow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "claimer", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "whitelist", + "type": "bool" + } + ], + "name": "WhitelistedClaimer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "currency", + "type": "address" + } + ], + "name": "WithdrawRewards", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "windowIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accountIndex", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32[]", + "name": "merkleProof", + "type": "bytes32[]" + } + ], + "internalType": "struct MerkleDistributorInterface.Claim", + "name": "_claim", + "type": "tuple" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "windowIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accountIndex", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32[]", + "name": "merkleProof", + "type": "bytes32[]" + } + ], + "internalType": "struct MerkleDistributorInterface.Claim", + "name": "_claim", + "type": "tuple" + } + ], + "name": "claimFor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "windowIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accountIndex", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32[]", + "name": "merkleProof", + "type": "bytes32[]" + } + ], + "internalType": "struct MerkleDistributorInterface.Claim[]", + "name": "claims", + "type": "tuple[]" + } + ], + "name": "claimMulti", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "windowIndex", + "type": "uint256" + } + ], + "name": "deleteWindow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "windowIndex", + "type": "uint256" + } + ], + "name": "getRewardTokenForWindow", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "windowIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accountIndex", + "type": "uint256" + } + ], + "name": "isClaimed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "merkleWindows", + "outputs": [ + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "remainingAmount", + "type": "uint256" + }, + { + "internalType": "contract IERC20", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "string", + "name": "ipfsHash", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextCreatedIndex", + "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": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "rewardsToDeposit", + "type": "uint256" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "ipfsHash", + "type": "string" + } + ], + "name": "setWindow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "windowIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accountIndex", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32[]", + "name": "merkleProof", + "type": "bytes32[]" + } + ], + "internalType": "struct MerkleDistributorInterface.Claim", + "name": "_claim", + "type": "tuple" + } + ], + "name": "verifyClaim", + "outputs": [ + { + "internalType": "bool", + "name": "valid", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newContract", + "type": "address" + }, + { + "internalType": "bool", + "name": "whitelist", + "type": "bool" + } + ], + "name": "whitelistClaimer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "whitelistedClaimers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "rewardCurrency", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x793bcac596391f99fa5040b2a798fb894dd93a3ae28c5219a7bebf922b5684c0", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0xE50b2cEAC4f60E840Ae513924033E753e2366487", + "transactionIndex": 112, + "gasUsed": "1673936", + "logsBloom": "0x00200000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000004000000000000000040000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000040000000000000000000000000000000000020000001000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x39ba10c1a258d237420fedc063f8e1a504976ac32b2f89c406a468c88223e285", + "transactionHash": "0x793bcac596391f99fa5040b2a798fb894dd93a3ae28c5219a7bebf922b5684c0", + "logs": [ + { + "transactionIndex": 112, + "blockNumber": 15977130, + "transactionHash": "0x793bcac596391f99fa5040b2a798fb894dd93a3ae28c5219a7bebf922b5684c0", + "address": "0xE50b2cEAC4f60E840Ae513924033E753e2366487", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" + ], + "data": "0x", + "logIndex": 159, + "blockHash": "0x39ba10c1a258d237420fedc063f8e1a504976ac32b2f89c406a468c88223e285" + } + ], + "blockNumber": 15977130, + "cumulativeGasUsed": "9271311", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "17686732f199602ed40e6e94df0fb034", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"windowIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"accountIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"}],\"name\":\"ClaimFor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"windowIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"accountIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"windowIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardsDeposited\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"CreatedWindow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"windowIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"DeleteWindow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"claimer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"whitelist\",\"type\":\"bool\"}],\"name\":\"WhitelistedClaimer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"currency\",\"type\":\"address\"}],\"name\":\"WithdrawRewards\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"windowIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"accountIndex\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"merkleProof\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct MerkleDistributorInterface.Claim\",\"name\":\"_claim\",\"type\":\"tuple\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"windowIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"accountIndex\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"merkleProof\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct MerkleDistributorInterface.Claim\",\"name\":\"_claim\",\"type\":\"tuple\"}],\"name\":\"claimFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"windowIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"accountIndex\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"merkleProof\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct MerkleDistributorInterface.Claim[]\",\"name\":\"claims\",\"type\":\"tuple[]\"}],\"name\":\"claimMulti\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"windowIndex\",\"type\":\"uint256\"}],\"name\":\"deleteWindow\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"windowIndex\",\"type\":\"uint256\"}],\"name\":\"getRewardTokenForWindow\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"windowIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"accountIndex\",\"type\":\"uint256\"}],\"name\":\"isClaimed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"merkleWindows\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"remainingAmount\",\"type\":\"uint256\"},{\"internalType\":\"contract IERC20\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"ipfsHash\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextCreatedIndex\",\"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\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"rewardsToDeposit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"ipfsHash\",\"type\":\"string\"}],\"name\":\"setWindow\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"windowIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"accountIndex\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"merkleProof\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct MerkleDistributorInterface.Claim\",\"name\":\"_claim\",\"type\":\"tuple\"}],\"name\":\"verifyClaim\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newContract\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"whitelist\",\"type\":\"bool\"}],\"name\":\"whitelistClaimer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"whitelistedClaimers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"rewardCurrency\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"claim((uint256,uint256,uint256,address,bytes32[]))\":{\"details\":\"Claim recipient must be equal to msg.sender.\",\"params\":{\"_claim\":\"claim object describing amount, accountIndex, account, window index, and merkle proof.\"}},\"claimFor((uint256,uint256,uint256,address,bytes32[]))\":{\"details\":\"Caller must be in whitelistedClaimers struct set to \\\"true\\\".\",\"params\":{\"_claim\":\"leaf to claim.\"}},\"claimMulti((uint256,uint256,uint256,address,bytes32[])[])\":{\"details\":\"All claim recipients must be equal to msg.sender.\",\"params\":{\"claims\":\"array of claims to claim.\"}},\"deleteWindow(uint256)\":{\"details\":\"Callable only by owner. Likely to be followed by a withdrawRewards call to clear contract state.\",\"params\":{\"windowIndex\":\"merkle root index to delete.\"}},\"getRewardTokenForWindow(uint256)\":{\"params\":{\"windowIndex\":\"merkle root to check.\"},\"returns\":{\"_0\":\"address Reward token address\"}},\"isClaimed(uint256,uint256)\":{\"details\":\"This method will only work as intended if all `accountIndex`'s are unique for a given `windowIndex`. The onus is on the Owner of this contract to submit only valid Merkle roots.\",\"params\":{\"accountIndex\":\"account index to check within window index.\",\"windowIndex\":\"merkle root to check.\"},\"returns\":{\"_0\":\"True if claim has been executed already, False otherwise.\"}},\"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 anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setWindow(uint256,address,bytes32,string)\":{\"params\":{\"ipfsHash\":\"hash of IPFS object, conveniently stored for clients\",\"merkleRoot\":\"merkle root describing allocation.\",\"rewardToken\":\"ERC20 reward token.\",\"rewardsToDeposit\":\"amount of rewards to deposit to seed this allocation.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"verifyClaim((uint256,uint256,uint256,address,bytes32[]))\":{\"params\":{\"_claim\":\"claim object describing amount, accountIndex, account, window index, and merkle proof.\"},\"returns\":{\"valid\":\"True if leaf exists.\"}},\"whitelistClaimer(address,bool)\":{\"details\":\"Callable only by owner.\",\"params\":{\"newContract\":\"Reset claimer contract to this address.\",\"whitelist\":\"True to whitelist claimer, False otherwise.\"}},\"withdrawRewards(address,uint256)\":{\"details\":\"Callable only by owner.\",\"params\":{\"amount\":\"amount of rewards to withdraw.\",\"rewardCurrency\":\"rewards to withdraw from contract.\"}}},\"title\":\"Extended MerkleDistributor contract.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"claim((uint256,uint256,uint256,address,bytes32[]))\":{\"notice\":\"Claim amount of reward tokens for account, as described by Claim input object.\"},\"claimFor((uint256,uint256,uint256,address,bytes32[]))\":{\"notice\":\"Executes merkle leaf claim on behaf of user. This can only be called by a trusted claimer address. This function is designed to be called atomically with other transactions that ultimately return the claimed amount to the rightful recipient. For example, AcceleratingDistributor could call this function and then stake atomically on behalf of the user.\"},\"claimMulti((uint256,uint256,uint256,address,bytes32[])[])\":{\"notice\":\"Batch claims to reduce gas versus individual submitting all claims. Method will fail if any individual claims within the batch would fail.\"},\"deleteWindow(uint256)\":{\"notice\":\"Delete merkle root at window index.\"},\"getRewardTokenForWindow(uint256)\":{\"notice\":\"Returns rewardToken set by admin for windowIndex.\"},\"isClaimed(uint256,uint256)\":{\"notice\":\"Returns True if the claim for `accountIndex` has already been completed for the Merkle root at `windowIndex`.\"},\"setWindow(uint256,address,bytes32,string)\":{\"notice\":\"Set merkle root for the next available window index and seed allocations.Callable only by owner of this contract. Caller must have approved this contract to transfer `rewardsToDeposit` amount of `rewardToken` or this call will fail. Importantly, we assume that the owner of this contract correctly chooses an amount `rewardsToDeposit` that is sufficient to cover all claims within the `merkleRoot`.\"},\"verifyClaim((uint256,uint256,uint256,address,bytes32[]))\":{\"notice\":\"Returns True if leaf described by {account, amount, accountIndex} is stored in Merkle root at given window index.\"},\"whitelistClaimer(address,bool)\":{\"notice\":\"Updates whitelisted claimer status.\"},\"withdrawRewards(address,uint256)\":{\"notice\":\"Emergency method that transfers rewards out of the contract if the contract was configured improperly.\"}},\"notice\":\"Adds additional constraints governing who can claim leaves from merkle windows.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol\":\"AcrossMerkleDistributor\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@uma/core/contracts/merkle-distributor/implementation/MerkleDistributor.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n * @title Extended MerkleDistributor contract.\\n * @notice Adds additional constraints governing who can claim leaves from merkle windows.\\n */\\ncontract AcrossMerkleDistributor is MerkleDistributor {\\n using SafeERC20 for IERC20;\\n\\n // Addresses that can claim on user's behalf.\\n mapping(address => bool) public whitelistedClaimers;\\n\\n /****************************************\\n * EVENTS\\n ****************************************/\\n event WhitelistedClaimer(address indexed claimer, bool indexed whitelist);\\n event ClaimFor(\\n address indexed caller,\\n uint256 windowIndex,\\n address indexed account,\\n uint256 accountIndex,\\n uint256 amount,\\n address indexed rewardToken\\n );\\n\\n /****************************\\n * ADMIN FUNCTIONS\\n ****************************/\\n\\n /**\\n * @notice Updates whitelisted claimer status.\\n * @dev Callable only by owner.\\n * @param newContract Reset claimer contract to this address.\\n * @param whitelist True to whitelist claimer, False otherwise.\\n */\\n function whitelistClaimer(address newContract, bool whitelist) external onlyOwner {\\n whitelistedClaimers[newContract] = whitelist;\\n emit WhitelistedClaimer(newContract, whitelist);\\n }\\n\\n /****************************\\n * NON-ADMIN FUNCTIONS\\n ****************************/\\n\\n /**\\n * @notice Batch claims to reduce gas versus individual submitting all claims. Method will fail\\n * if any individual claims within the batch would fail.\\n * @dev All claim recipients must be equal to msg.sender.\\n * @param claims array of claims to claim.\\n */\\n function claimMulti(Claim[] memory claims) public override {\\n uint256 claimCount = claims.length;\\n for (uint256 i = 0; i < claimCount; i++) {\\n require(claims[i].account == msg.sender, \\\"invalid claimer\\\");\\n }\\n super.claimMulti(claims);\\n }\\n\\n /**\\n * @notice Claim amount of reward tokens for account, as described by Claim input object.\\n * @dev Claim recipient must be equal to msg.sender.\\n * @param _claim claim object describing amount, accountIndex, account, window index, and merkle proof.\\n */\\n function claim(Claim memory _claim) public override {\\n require(_claim.account == msg.sender, \\\"invalid claimer\\\");\\n super.claim(_claim);\\n }\\n\\n /**\\n * @notice Executes merkle leaf claim on behaf of user. This can only be called by a trusted\\n * claimer address. This function is designed to be called atomically with other transactions\\n * that ultimately return the claimed amount to the rightful recipient. For example,\\n * AcceleratingDistributor could call this function and then stake atomically on behalf of the user.\\n * @dev Caller must be in whitelistedClaimers struct set to \\\"true\\\".\\n * @param _claim leaf to claim.\\n */\\n\\n function claimFor(Claim memory _claim) public {\\n require(whitelistedClaimers[msg.sender], \\\"unwhitelisted claimer\\\");\\n _verifyAndMarkClaimed(_claim);\\n merkleWindows[_claim.windowIndex].rewardToken.safeTransfer(msg.sender, _claim.amount);\\n emit ClaimFor(\\n msg.sender,\\n _claim.windowIndex,\\n _claim.account,\\n _claim.accountIndex,\\n _claim.amount,\\n address(merkleWindows[_claim.windowIndex].rewardToken)\\n );\\n }\\n}\\n\",\"keccak256\":\"0x770e7f0986351870b1223a1214aaa3084b7cba9f438d7906c62c016ebd11b2c3\",\"license\":\"AGPL-3.0-only\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.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 anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing 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\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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 */\\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 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\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Tree proofs.\\n *\\n * The proofs can be generated using the JavaScript library\\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\\n *\\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\\n *\\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\\n * hashing, or use a hash function other than keccak256 for hashing leaves.\\n * This is because the concatenation of a sorted pair of internal nodes in\\n * the merkle tree could be reinterpreted as a leaf value.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Calldata version of {verify}\\n *\\n * _Available since v4.7._\\n */\\n function verifyCalldata(\\n bytes32[] calldata proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProofCalldata(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n computedHash = _hashPair(computedHash, proof[i]);\\n }\\n return computedHash;\\n }\\n\\n /**\\n * @dev Calldata version of {processProof}\\n *\\n * _Available since v4.7._\\n */\\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n computedHash = _hashPair(computedHash, proof[i]);\\n }\\n return computedHash;\\n }\\n\\n /**\\n * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by\\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\\n *\\n * _Available since v4.7._\\n */\\n function multiProofVerify(\\n bytes32[] memory proof,\\n bool[] memory proofFlags,\\n bytes32 root,\\n bytes32[] memory leaves\\n ) internal pure returns (bool) {\\n return processMultiProof(proof, proofFlags, leaves) == root;\\n }\\n\\n /**\\n * @dev Calldata version of {multiProofVerify}\\n *\\n * _Available since v4.7._\\n */\\n function multiProofVerifyCalldata(\\n bytes32[] calldata proof,\\n bool[] calldata proofFlags,\\n bytes32 root,\\n bytes32[] memory leaves\\n ) internal pure returns (bool) {\\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\\n }\\n\\n /**\\n * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`,\\n * consuming from one or the other at each step according to the instructions given by\\n * `proofFlags`.\\n *\\n * _Available since v4.7._\\n */\\n function processMultiProof(\\n bytes32[] memory proof,\\n bool[] memory proofFlags,\\n bytes32[] memory leaves\\n ) internal pure returns (bytes32 merkleRoot) {\\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\\n // the merkle tree.\\n uint256 leavesLen = leaves.length;\\n uint256 totalHashes = proofFlags.length;\\n\\n // Check proof validity.\\n require(leavesLen + proof.length - 1 == totalHashes, \\\"MerkleProof: invalid multiproof\\\");\\n\\n // The xxxPos values are \\\"pointers\\\" to the next value to consume in each array. All accesses are done using\\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \\\"pop\\\".\\n bytes32[] memory hashes = new bytes32[](totalHashes);\\n uint256 leafPos = 0;\\n uint256 hashPos = 0;\\n uint256 proofPos = 0;\\n // At each step, we compute the next hash using two values:\\n // - a value from the \\\"main queue\\\". If not all leaves have been consumed, we get the next leaf, otherwise we\\n // get the next hash.\\n // - depending on the flag, either another value for the \\\"main queue\\\" (merging branches) or an element from the\\n // `proof` array.\\n for (uint256 i = 0; i < totalHashes; i++) {\\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\\n hashes[i] = _hashPair(a, b);\\n }\\n\\n if (totalHashes > 0) {\\n return hashes[totalHashes - 1];\\n } else if (leavesLen > 0) {\\n return leaves[0];\\n } else {\\n return proof[0];\\n }\\n }\\n\\n /**\\n * @dev Calldata version of {processMultiProof}\\n *\\n * _Available since v4.7._\\n */\\n function processMultiProofCalldata(\\n bytes32[] calldata proof,\\n bool[] calldata proofFlags,\\n bytes32[] memory leaves\\n ) internal pure returns (bytes32 merkleRoot) {\\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\\n // the merkle tree.\\n uint256 leavesLen = leaves.length;\\n uint256 totalHashes = proofFlags.length;\\n\\n // Check proof validity.\\n require(leavesLen + proof.length - 1 == totalHashes, \\\"MerkleProof: invalid multiproof\\\");\\n\\n // The xxxPos values are \\\"pointers\\\" to the next value to consume in each array. All accesses are done using\\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \\\"pop\\\".\\n bytes32[] memory hashes = new bytes32[](totalHashes);\\n uint256 leafPos = 0;\\n uint256 hashPos = 0;\\n uint256 proofPos = 0;\\n // At each step, we compute the next hash using two values:\\n // - a value from the \\\"main queue\\\". If not all leaves have been consumed, we get the next leaf, otherwise we\\n // get the next hash.\\n // - depending on the flag, either another value for the \\\"main queue\\\" (merging branches) or an element from the\\n // `proof` array.\\n for (uint256 i = 0; i < totalHashes; i++) {\\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\\n hashes[i] = _hashPair(a, b);\\n }\\n\\n if (totalHashes > 0) {\\n return hashes[totalHashes - 1];\\n } else if (leavesLen > 0) {\\n return leaves[0];\\n } else {\\n return proof[0];\\n }\\n }\\n\\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\\n }\\n\\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, a)\\n mstore(0x20, b)\\n value := keccak256(0x00, 0x40)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x596ed72a251d391b814a4aa19d7acb02ebdcc92ba27d3fff74a6f0c158b12ab7\",\"license\":\"MIT\"},\"@uma/core/contracts/merkle-distributor/implementation/MerkleDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./MerkleDistributorInterface.sol\\\";\\n\\n/**\\n * Inspired by:\\n * - https://github.com/pie-dao/vested-token-migration-app\\n * - https://github.com/Uniswap/merkle-distributor\\n * - https://github.com/balancer-labs/erc20-redeemable\\n *\\n * @title MerkleDistributor contract.\\n * @notice Allows an owner to distribute any reward ERC20 to claimants according to Merkle roots. The owner can specify\\n * multiple Merkle roots distributions with customized reward currencies.\\n * @dev The Merkle trees are not validated in any way, so the system assumes the contract owner behaves honestly.\\n */\\ncontract MerkleDistributor is MerkleDistributorInterface, Ownable {\\n using SafeERC20 for IERC20;\\n\\n // Windows are mapped to arbitrary indices.\\n mapping(uint256 => Window) public merkleWindows;\\n\\n // Index of next created Merkle root.\\n uint256 public nextCreatedIndex;\\n\\n // Track which accounts have claimed for each window index.\\n // Note: uses a packed array of bools for gas optimization on tracking certain claims. Copied from Uniswap's contract.\\n mapping(uint256 => mapping(uint256 => uint256)) private claimedBitMap;\\n\\n /****************************************\\n * EVENTS\\n ****************************************/\\n event Claimed(\\n address indexed caller,\\n uint256 windowIndex,\\n address indexed account,\\n uint256 accountIndex,\\n uint256 amount,\\n address indexed rewardToken\\n );\\n event CreatedWindow(\\n uint256 indexed windowIndex,\\n uint256 rewardsDeposited,\\n address indexed rewardToken,\\n address owner\\n );\\n event WithdrawRewards(address indexed owner, uint256 amount, address indexed currency);\\n event DeleteWindow(uint256 indexed windowIndex, address owner);\\n\\n /****************************\\n * ADMIN FUNCTIONS\\n ****************************/\\n\\n /**\\n * @notice Set merkle root for the next available window index and seed allocations.\\n * @notice Callable only by owner of this contract. Caller must have approved this contract to transfer\\n * `rewardsToDeposit` amount of `rewardToken` or this call will fail. Importantly, we assume that the\\n * owner of this contract correctly chooses an amount `rewardsToDeposit` that is sufficient to cover all\\n * claims within the `merkleRoot`.\\n * @param rewardsToDeposit amount of rewards to deposit to seed this allocation.\\n * @param rewardToken ERC20 reward token.\\n * @param merkleRoot merkle root describing allocation.\\n * @param ipfsHash hash of IPFS object, conveniently stored for clients\\n */\\n function setWindow(\\n uint256 rewardsToDeposit,\\n address rewardToken,\\n bytes32 merkleRoot,\\n string calldata ipfsHash\\n ) external onlyOwner {\\n uint256 indexToSet = nextCreatedIndex;\\n nextCreatedIndex = indexToSet + 1;\\n\\n _setWindow(indexToSet, rewardsToDeposit, rewardToken, merkleRoot, ipfsHash);\\n }\\n\\n /**\\n * @notice Delete merkle root at window index.\\n * @dev Callable only by owner. Likely to be followed by a withdrawRewards call to clear contract state.\\n * @param windowIndex merkle root index to delete.\\n */\\n function deleteWindow(uint256 windowIndex) external onlyOwner {\\n delete merkleWindows[windowIndex];\\n emit DeleteWindow(windowIndex, msg.sender);\\n }\\n\\n /**\\n * @notice Emergency method that transfers rewards out of the contract if the contract was configured improperly.\\n * @dev Callable only by owner.\\n * @param rewardCurrency rewards to withdraw from contract.\\n * @param amount amount of rewards to withdraw.\\n */\\n function withdrawRewards(IERC20 rewardCurrency, uint256 amount) external onlyOwner {\\n rewardCurrency.safeTransfer(msg.sender, amount);\\n emit WithdrawRewards(msg.sender, amount, address(rewardCurrency));\\n }\\n\\n /****************************\\n * NON-ADMIN FUNCTIONS\\n ****************************/\\n\\n /**\\n * @notice Batch claims to reduce gas versus individual submitting all claims. Method will fail\\n * if any individual claims within the batch would fail.\\n * @dev Optimistically tries to batch together consecutive claims for the same account and same\\n * reward token to reduce gas. Therefore, the most gas-cost-optimal way to use this method\\n * is to pass in an array of claims sorted by account and reward currency. It also reverts\\n * when any of individual `_claim`'s `amount` exceeds `remainingAmount` for its window.\\n * @param claims array of claims to claim.\\n */\\n function claimMulti(Claim[] memory claims) public virtual override {\\n uint256 batchedAmount;\\n uint256 claimCount = claims.length;\\n for (uint256 i = 0; i < claimCount; i++) {\\n Claim memory _claim = claims[i];\\n _verifyAndMarkClaimed(_claim);\\n batchedAmount += _claim.amount;\\n\\n // If the next claim is NOT the same account or the same token (or this claim is the last one),\\n // then disburse the `batchedAmount` to the current claim's account for the current claim's reward token.\\n uint256 nextI = i + 1;\\n IERC20 currentRewardToken = merkleWindows[_claim.windowIndex].rewardToken;\\n if (\\n nextI == claimCount ||\\n // This claim is last claim.\\n claims[nextI].account != _claim.account ||\\n // Next claim account is different than current one.\\n merkleWindows[claims[nextI].windowIndex].rewardToken != currentRewardToken\\n // Next claim reward token is different than current one.\\n ) {\\n currentRewardToken.safeTransfer(_claim.account, batchedAmount);\\n batchedAmount = 0;\\n }\\n }\\n }\\n\\n /**\\n * @notice Claim amount of reward tokens for account, as described by Claim input object.\\n * @dev If the `_claim`'s `amount`, `accountIndex`, and `account` do not exactly match the\\n * values stored in the merkle root for the `_claim`'s `windowIndex` this method\\n * will revert. It also reverts when `_claim`'s `amount` exceeds `remainingAmount` for the window.\\n * @param _claim claim object describing amount, accountIndex, account, window index, and merkle proof.\\n */\\n function claim(Claim memory _claim) public virtual override {\\n _verifyAndMarkClaimed(_claim);\\n merkleWindows[_claim.windowIndex].rewardToken.safeTransfer(_claim.account, _claim.amount);\\n }\\n\\n /**\\n * @notice Returns True if the claim for `accountIndex` has already been completed for the Merkle root at\\n * `windowIndex`.\\n * @dev This method will only work as intended if all `accountIndex`'s are unique for a given `windowIndex`.\\n * The onus is on the Owner of this contract to submit only valid Merkle roots.\\n * @param windowIndex merkle root to check.\\n * @param accountIndex account index to check within window index.\\n * @return True if claim has been executed already, False otherwise.\\n */\\n function isClaimed(uint256 windowIndex, uint256 accountIndex) public view returns (bool) {\\n uint256 claimedWordIndex = accountIndex / 256;\\n uint256 claimedBitIndex = accountIndex % 256;\\n uint256 claimedWord = claimedBitMap[windowIndex][claimedWordIndex];\\n uint256 mask = (1 << claimedBitIndex);\\n return claimedWord & mask == mask;\\n }\\n\\n /**\\n * @notice Returns rewardToken set by admin for windowIndex.\\n * @param windowIndex merkle root to check.\\n * @return address Reward token address\\n */\\n function getRewardTokenForWindow(uint256 windowIndex) public view override returns (address) {\\n return address(merkleWindows[windowIndex].rewardToken);\\n }\\n\\n /**\\n * @notice Returns True if leaf described by {account, amount, accountIndex} is stored in Merkle root at given\\n * window index.\\n * @param _claim claim object describing amount, accountIndex, account, window index, and merkle proof.\\n * @return valid True if leaf exists.\\n */\\n function verifyClaim(Claim memory _claim) public view returns (bool valid) {\\n bytes32 leaf = keccak256(abi.encodePacked(_claim.account, _claim.amount, _claim.accountIndex));\\n return MerkleProof.verify(_claim.merkleProof, merkleWindows[_claim.windowIndex].merkleRoot, leaf);\\n }\\n\\n /****************************\\n * PRIVATE FUNCTIONS\\n ****************************/\\n\\n // Mark claim as completed for `accountIndex` for Merkle root at `windowIndex`.\\n function _setClaimed(uint256 windowIndex, uint256 accountIndex) private {\\n uint256 claimedWordIndex = accountIndex / 256;\\n uint256 claimedBitIndex = accountIndex % 256;\\n claimedBitMap[windowIndex][claimedWordIndex] =\\n claimedBitMap[windowIndex][claimedWordIndex] |\\n (1 << claimedBitIndex);\\n }\\n\\n // Store new Merkle root at `windowindex`. Pull `rewardsDeposited` from caller to seed distribution for this root.\\n function _setWindow(\\n uint256 windowIndex,\\n uint256 rewardsDeposited,\\n address rewardToken,\\n bytes32 merkleRoot,\\n string memory ipfsHash\\n ) private {\\n Window storage window = merkleWindows[windowIndex];\\n window.merkleRoot = merkleRoot;\\n window.remainingAmount = rewardsDeposited;\\n window.rewardToken = IERC20(rewardToken);\\n window.ipfsHash = ipfsHash;\\n\\n emit CreatedWindow(windowIndex, rewardsDeposited, rewardToken, msg.sender);\\n\\n window.rewardToken.safeTransferFrom(msg.sender, address(this), rewardsDeposited);\\n }\\n\\n // Verify claim is valid and mark it as completed in this contract.\\n function _verifyAndMarkClaimed(Claim memory _claim) internal {\\n // Check claimed proof against merkle window at given index.\\n require(verifyClaim(_claim), \\\"Incorrect merkle proof\\\");\\n // Check the account has not yet claimed for this window.\\n require(!isClaimed(_claim.windowIndex, _claim.accountIndex), \\\"Account has already claimed for this window\\\");\\n\\n // Proof is correct and claim has not occurred yet, mark claimed complete.\\n _setClaimed(_claim.windowIndex, _claim.accountIndex);\\n merkleWindows[_claim.windowIndex].remainingAmount -= _claim.amount;\\n emit Claimed(\\n msg.sender,\\n _claim.windowIndex,\\n _claim.account,\\n _claim.accountIndex,\\n _claim.amount,\\n address(merkleWindows[_claim.windowIndex].rewardToken)\\n );\\n }\\n}\\n\",\"keccak256\":\"0x45ba14976c04b585ff82098ef0340ae062d9da7a3a2076b2535dbd194d254fc7\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/merkle-distributor/implementation/MerkleDistributorInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n * @notice Concise list of functions in MerkleDistributor implementation that would be called by\\n * a consuming external contract (such as the Across Protocol's AcceleratingDistributor).\\n */\\ninterface MerkleDistributorInterface {\\n // A Window maps a Merkle root to a reward token address.\\n struct Window {\\n // Merkle root describing the distribution.\\n bytes32 merkleRoot;\\n // Remaining amount of deposited rewards that have not yet been claimed.\\n uint256 remainingAmount;\\n // Currency in which reward is processed.\\n IERC20 rewardToken;\\n // IPFS hash of the merkle tree. Can be used to independently fetch recipient proofs and tree. Note that the canonical\\n // data type for storing an IPFS hash is a multihash which is the concatenation of \\n // . We opted to store this in a string type to make it easier\\n // for users to query the ipfs data without needing to reconstruct the multihash. to view the IPFS data simply\\n // go to https://cloudflare-ipfs.com/ipfs/.\\n string ipfsHash;\\n }\\n\\n // Represents an account's claim for `amount` within the Merkle root located at the `windowIndex`.\\n struct Claim {\\n uint256 windowIndex;\\n uint256 amount;\\n uint256 accountIndex; // Used only for bitmap. Assumed to be unique for each claim.\\n address account;\\n bytes32[] merkleProof;\\n }\\n\\n function claim(Claim memory _claim) external;\\n\\n function claimMulti(Claim[] memory claims) external;\\n\\n function getRewardTokenForWindow(uint256 windowIndex) external view returns (address);\\n}\\n\",\"keccak256\":\"0x0d6527f44b268c3801d45bc1fc6021f22a80070a21d4066430a4d6566e3ff5e7\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611d048061007e6000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80638da5cb5b11610097578063d6ef7af011610066578063d6ef7af01461026b578063e2e441a31461027e578063f2fde38b14610295578063f364c90c146102a857600080fd5b80638da5cb5b146102145780639f5a967214610232578063a198496c14610245578063d45118681461025857600080fd5b8063743817a0116100d3578063743817a01461016d578063761b42971461018057806388f038a2146101de578063891b0d71146101f157600080fd5b80634f512151146101055780636be651791461012d57806370b53aee14610142578063715018a614610165575b600080fd5b6101186101133660046116c2565b6102bb565b60405190151581526020015b60405180910390f35b61014061013b3660046116f7565b610377565b005b6101186101503660046117a8565b60046020526000908152604090205460ff1681565b61014061045b565b61014061017b3660046117d3565b61046f565b6101b961018e36600461180c565b60009081526001602052604090206002015473ffffffffffffffffffffffffffffffffffffffff1690565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610124565b6101406101ec3660046116c2565b6104f6565b6102046101ff36600461180c565b61063e565b6040516101249493929190611893565b60005473ffffffffffffffffffffffffffffffffffffffff166101b9565b61014061024036600461180c565b610707565b6101406102533660046116c2565b61079a565b6101406102663660046118d8565b610829565b61014061027936600461196e565b610890565b61028760025481565b604051908152602001610124565b6101406102a33660046117a8565b61090a565b6101186102b636600461199a565b6109be565b6000808260600151836020015184604001516040516020016103179392919060609390931b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001683526014830191909152603482015260540190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181528151602092830120608086015186516000908152600190945291909220549192506103709183610a0e565b9392505050565b805160005b8181101561044d573373ffffffffffffffffffffffffffffffffffffffff168382815181106103ad576103ad6119bc565b60200260200101516060015173ffffffffffffffffffffffffffffffffffffffff161461043b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f696e76616c696420636c61696d6572000000000000000000000000000000000060448201526064015b60405180910390fd5b8061044581611a1a565b91505061037c565b5061045782610a24565b5050565b610463610bb8565b61046d6000610c39565b565b610477610bb8565b73ffffffffffffffffffffffffffffffffffffffff821660008181526004602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915590519092917fbaa2323ab54d3ecd5bd63d3c3cfc23d7ef896edcbc927b7b7867407f32a3ba2991a35050565b3360009081526004602052604090205460ff1661056f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f756e77686974656c697374656420636c61696d657200000000000000000000006044820152606401610432565b61057881610cae565b6020808201518251600090815260019092526040909120600201546105b79173ffffffffffffffffffffffffffffffffffffffff909116903390610e81565b805160009081526001602090815260409182902060020154606080850151855185870151858801518751928352958201529485019390935273ffffffffffffffffffffffffffffffffffffffff91821693919092169133917fcfb930b6b49765485460cb1c6853ec3437a78b18d8c9a25b9fed2eea3b6756a991015b60405180910390a450565b60016020819052600091825260409091208054918101546002820154600383018054929373ffffffffffffffffffffffffffffffffffffffff9092169261068490611a52565b80601f01602080910402602001604051908101604052809291908181526020018280546106b090611a52565b80156106fd5780601f106106d2576101008083540402835291602001916106fd565b820191906000526020600020905b8154815290600101906020018083116106e057829003601f168201915b5050505050905084565b61070f610bb8565b600081815260016020819052604082208281559081018290556002810180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690559061076060038301826114b5565b505060405133815281907f8fea52000ecb40f2262c672496dfadccc9d6290439bac487e084de8c57682d669060200160405180910390a250565b606081015173ffffffffffffffffffffffffffffffffffffffff16331461081d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f696e76616c696420636c61696d657200000000000000000000000000000000006044820152606401610432565b61082681610f5a565b50565b610831610bb8565b60025461083f816001611aa5565b6002819055506108888187878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610fa592505050565b505050505050565b610898610bb8565b6108b973ffffffffffffffffffffffffffffffffffffffff83163383610e81565b60405181815273ffffffffffffffffffffffffffffffffffffffff83169033907ffb0872526787ac1be379aa37eaa9913b47d6d50c3f5fe5ec67ffe4282493670e9060200160405180910390a35050565b610912610bb8565b73ffffffffffffffffffffffffffffffffffffffff81166109b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610432565b61082681610c39565b6000806109cd61010084611ae7565b905060006109dd61010085611afb565b60008681526003602090815260408083209583529490529290922054600190921b9182169091149150505b92915050565b600082610a1b8584611089565b14949350505050565b8051600090815b81811015610bb2576000848281518110610a4757610a476119bc565b60200260200101519050610a5a81610cae565b6020810151610a699085611aa5565b93506000610a78836001611aa5565b825160009081526001602052604090206002015490915073ffffffffffffffffffffffffffffffffffffffff1684821480610b005750826060015173ffffffffffffffffffffffffffffffffffffffff16878381518110610adb57610adb6119bc565b60200260200101516060015173ffffffffffffffffffffffffffffffffffffffff1614155b80610b6b57508073ffffffffffffffffffffffffffffffffffffffff1660016000898581518110610b3357610b336119bc565b6020908102919091018101515182528101919091526040016000206002015473ffffffffffffffffffffffffffffffffffffffff1614155b15610b9c576060830151610b979073ffffffffffffffffffffffffffffffffffffffff83169088610e81565b600095505b5050508080610baa90611a1a565b915050610a2b565b50505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461046d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610432565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610cb7816102bb565b610d1d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f496e636f7272656374206d65726b6c652070726f6f66000000000000000000006044820152606401610432565b610d2f816000015182604001516109be565b15610dbc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4163636f756e742068617320616c726561647920636c61696d656420666f722060448201527f746869732077696e646f770000000000000000000000000000000000000000006064820152608401610432565b610dce816000015182604001516110d6565b806020015160016000836000015181526020019081526020016000206001016000828254610dfc9190611b0f565b9091555050805160009081526001602090815260409182902060020154606080850151855185870151858801518751928352958201529485019390935273ffffffffffffffffffffffffffffffffffffffff91821693919092169133917f18bdb6adb84039f917775d1fb8e7b7e7737ad5915d12eef0e4654b85e18d07b49101610633565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610f559084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261111f565b505050565b610f6381610cae565b60608101516020808301518351600090815260019092526040909120600201546108269273ffffffffffffffffffffffffffffffffffffffff90911691610e81565b60008581526001602081905260409091208381559081018590556002810180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86161790556003810161100f8382611b68565b506040805186815233602082015273ffffffffffffffffffffffffffffffffffffffff86169188917f521fe5bce65ac6af752c1083ec77facc5b6c13f40693e96eeca3747726fee9ad910160405180910390a360028101546108889073ffffffffffffffffffffffffffffffffffffffff1633308861122b565b600081815b84518110156110ce576110ba828683815181106110ad576110ad6119bc565b6020026020010151611289565b9150806110c681611a1a565b91505061108e565b509392505050565b60006110e461010083611ae7565b905060006110f461010084611afb565b6000948552600360209081526040808720948752939052919093208054600190921b90911790555050565b6000611181826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166112b59092919063ffffffff16565b805190915015610f55578080602001905181019061119f9190611c82565b610f55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610432565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052610bb29085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610ed3565b60008183106112a5576000828152602084905260409020610370565b5060009182526020526040902090565b60606112c484846000856112cc565b949350505050565b60608247101561135e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610432565b73ffffffffffffffffffffffffffffffffffffffff85163b6113dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610432565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114059190611c9f565b60006040518083038185875af1925050503d8060008114611442576040519150601f19603f3d011682016040523d82523d6000602084013e611447565b606091505b5091509150611457828286611462565b979650505050505050565b60608315611471575081610370565b8251156114815782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104329190611cbb565b5080546114c190611a52565b6000825580601f106114d1575050565b601f01602090049060005260206000209081019061082691905b808211156114ff57600081556001016114eb565b5090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160a0810167ffffffffffffffff8111828210171561155557611555611503565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156115a2576115a2611503565b604052919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461082657600080fd5b600067ffffffffffffffff8211156115e6576115e6611503565b5060051b60200190565b600060a0828403121561160257600080fd5b61160a611532565b90508135815260208083013581830152604083013560408301526060830135611632816115aa565b6060830152608083013567ffffffffffffffff81111561165157600080fd5b8301601f8101851361166257600080fd5b8035611675611670826115cc565b61155b565b81815260059190911b8201830190838101908783111561169457600080fd5b928401925b828410156116b257833582529284019290840190611699565b6080860152509295945050505050565b6000602082840312156116d457600080fd5b813567ffffffffffffffff8111156116eb57600080fd5b6112c4848285016115f0565b6000602080838503121561170a57600080fd5b823567ffffffffffffffff8082111561172257600080fd5b818501915085601f83011261173657600080fd5b8135611744611670826115cc565b81815260059190911b8301840190848101908883111561176357600080fd5b8585015b8381101561179b5780358581111561177f5760008081fd5b61178d8b89838a01016115f0565b845250918601918601611767565b5098975050505050505050565b6000602082840312156117ba57600080fd5b8135610370816115aa565b801515811461082657600080fd5b600080604083850312156117e657600080fd5b82356117f1816115aa565b91506020830135611801816117c5565b809150509250929050565b60006020828403121561181e57600080fd5b5035919050565b60005b83811015611840578181015183820152602001611828565b50506000910152565b60008151808452611861816020860160208601611825565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b84815283602082015273ffffffffffffffffffffffffffffffffffffffff831660408201526080606082015260006118ce6080830184611849565b9695505050505050565b6000806000806000608086880312156118f057600080fd5b853594506020860135611902816115aa565b935060408601359250606086013567ffffffffffffffff8082111561192657600080fd5b818801915088601f83011261193a57600080fd5b81358181111561194957600080fd5b89602082850101111561195b57600080fd5b9699959850939650602001949392505050565b6000806040838503121561198157600080fd5b823561198c816115aa565b946020939093013593505050565b600080604083850312156119ad57600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611a4b57611a4b6119eb565b5060010190565b600181811c90821680611a6657607f821691505b602082108103611a9f577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b80820180821115610a0857610a086119eb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082611af657611af6611ab8565b500490565b600082611b0a57611b0a611ab8565b500690565b81810381811115610a0857610a086119eb565b601f821115610f5557600081815260208120601f850160051c81016020861015611b495750805b601f850160051c820191505b8181101561088857828155600101611b55565b815167ffffffffffffffff811115611b8257611b82611503565b611b9681611b908454611a52565b84611b22565b602080601f831160018114611be95760008415611bb35750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b178555610888565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b82811015611c3657888601518255948401946001909101908401611c17565b5085821015611c7257878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215611c9457600080fd5b8151610370816117c5565b60008251611cb1818460208701611825565b9190910192915050565b602081526000610370602083018461184956fea264697066735822122016c92f86d2815d5a69fb0146bd5085692389c02daebd3b98eb9b5b653d3ad56264736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638da5cb5b11610097578063d6ef7af011610066578063d6ef7af01461026b578063e2e441a31461027e578063f2fde38b14610295578063f364c90c146102a857600080fd5b80638da5cb5b146102145780639f5a967214610232578063a198496c14610245578063d45118681461025857600080fd5b8063743817a0116100d3578063743817a01461016d578063761b42971461018057806388f038a2146101de578063891b0d71146101f157600080fd5b80634f512151146101055780636be651791461012d57806370b53aee14610142578063715018a614610165575b600080fd5b6101186101133660046116c2565b6102bb565b60405190151581526020015b60405180910390f35b61014061013b3660046116f7565b610377565b005b6101186101503660046117a8565b60046020526000908152604090205460ff1681565b61014061045b565b61014061017b3660046117d3565b61046f565b6101b961018e36600461180c565b60009081526001602052604090206002015473ffffffffffffffffffffffffffffffffffffffff1690565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610124565b6101406101ec3660046116c2565b6104f6565b6102046101ff36600461180c565b61063e565b6040516101249493929190611893565b60005473ffffffffffffffffffffffffffffffffffffffff166101b9565b61014061024036600461180c565b610707565b6101406102533660046116c2565b61079a565b6101406102663660046118d8565b610829565b61014061027936600461196e565b610890565b61028760025481565b604051908152602001610124565b6101406102a33660046117a8565b61090a565b6101186102b636600461199a565b6109be565b6000808260600151836020015184604001516040516020016103179392919060609390931b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001683526014830191909152603482015260540190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181528151602092830120608086015186516000908152600190945291909220549192506103709183610a0e565b9392505050565b805160005b8181101561044d573373ffffffffffffffffffffffffffffffffffffffff168382815181106103ad576103ad6119bc565b60200260200101516060015173ffffffffffffffffffffffffffffffffffffffff161461043b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f696e76616c696420636c61696d6572000000000000000000000000000000000060448201526064015b60405180910390fd5b8061044581611a1a565b91505061037c565b5061045782610a24565b5050565b610463610bb8565b61046d6000610c39565b565b610477610bb8565b73ffffffffffffffffffffffffffffffffffffffff821660008181526004602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915590519092917fbaa2323ab54d3ecd5bd63d3c3cfc23d7ef896edcbc927b7b7867407f32a3ba2991a35050565b3360009081526004602052604090205460ff1661056f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f756e77686974656c697374656420636c61696d657200000000000000000000006044820152606401610432565b61057881610cae565b6020808201518251600090815260019092526040909120600201546105b79173ffffffffffffffffffffffffffffffffffffffff909116903390610e81565b805160009081526001602090815260409182902060020154606080850151855185870151858801518751928352958201529485019390935273ffffffffffffffffffffffffffffffffffffffff91821693919092169133917fcfb930b6b49765485460cb1c6853ec3437a78b18d8c9a25b9fed2eea3b6756a991015b60405180910390a450565b60016020819052600091825260409091208054918101546002820154600383018054929373ffffffffffffffffffffffffffffffffffffffff9092169261068490611a52565b80601f01602080910402602001604051908101604052809291908181526020018280546106b090611a52565b80156106fd5780601f106106d2576101008083540402835291602001916106fd565b820191906000526020600020905b8154815290600101906020018083116106e057829003601f168201915b5050505050905084565b61070f610bb8565b600081815260016020819052604082208281559081018290556002810180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690559061076060038301826114b5565b505060405133815281907f8fea52000ecb40f2262c672496dfadccc9d6290439bac487e084de8c57682d669060200160405180910390a250565b606081015173ffffffffffffffffffffffffffffffffffffffff16331461081d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f696e76616c696420636c61696d657200000000000000000000000000000000006044820152606401610432565b61082681610f5a565b50565b610831610bb8565b60025461083f816001611aa5565b6002819055506108888187878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610fa592505050565b505050505050565b610898610bb8565b6108b973ffffffffffffffffffffffffffffffffffffffff83163383610e81565b60405181815273ffffffffffffffffffffffffffffffffffffffff83169033907ffb0872526787ac1be379aa37eaa9913b47d6d50c3f5fe5ec67ffe4282493670e9060200160405180910390a35050565b610912610bb8565b73ffffffffffffffffffffffffffffffffffffffff81166109b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610432565b61082681610c39565b6000806109cd61010084611ae7565b905060006109dd61010085611afb565b60008681526003602090815260408083209583529490529290922054600190921b9182169091149150505b92915050565b600082610a1b8584611089565b14949350505050565b8051600090815b81811015610bb2576000848281518110610a4757610a476119bc565b60200260200101519050610a5a81610cae565b6020810151610a699085611aa5565b93506000610a78836001611aa5565b825160009081526001602052604090206002015490915073ffffffffffffffffffffffffffffffffffffffff1684821480610b005750826060015173ffffffffffffffffffffffffffffffffffffffff16878381518110610adb57610adb6119bc565b60200260200101516060015173ffffffffffffffffffffffffffffffffffffffff1614155b80610b6b57508073ffffffffffffffffffffffffffffffffffffffff1660016000898581518110610b3357610b336119bc565b6020908102919091018101515182528101919091526040016000206002015473ffffffffffffffffffffffffffffffffffffffff1614155b15610b9c576060830151610b979073ffffffffffffffffffffffffffffffffffffffff83169088610e81565b600095505b5050508080610baa90611a1a565b915050610a2b565b50505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461046d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610432565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610cb7816102bb565b610d1d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f496e636f7272656374206d65726b6c652070726f6f66000000000000000000006044820152606401610432565b610d2f816000015182604001516109be565b15610dbc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4163636f756e742068617320616c726561647920636c61696d656420666f722060448201527f746869732077696e646f770000000000000000000000000000000000000000006064820152608401610432565b610dce816000015182604001516110d6565b806020015160016000836000015181526020019081526020016000206001016000828254610dfc9190611b0f565b9091555050805160009081526001602090815260409182902060020154606080850151855185870151858801518751928352958201529485019390935273ffffffffffffffffffffffffffffffffffffffff91821693919092169133917f18bdb6adb84039f917775d1fb8e7b7e7737ad5915d12eef0e4654b85e18d07b49101610633565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610f559084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261111f565b505050565b610f6381610cae565b60608101516020808301518351600090815260019092526040909120600201546108269273ffffffffffffffffffffffffffffffffffffffff90911691610e81565b60008581526001602081905260409091208381559081018590556002810180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86161790556003810161100f8382611b68565b506040805186815233602082015273ffffffffffffffffffffffffffffffffffffffff86169188917f521fe5bce65ac6af752c1083ec77facc5b6c13f40693e96eeca3747726fee9ad910160405180910390a360028101546108889073ffffffffffffffffffffffffffffffffffffffff1633308861122b565b600081815b84518110156110ce576110ba828683815181106110ad576110ad6119bc565b6020026020010151611289565b9150806110c681611a1a565b91505061108e565b509392505050565b60006110e461010083611ae7565b905060006110f461010084611afb565b6000948552600360209081526040808720948752939052919093208054600190921b90911790555050565b6000611181826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166112b59092919063ffffffff16565b805190915015610f55578080602001905181019061119f9190611c82565b610f55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610432565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052610bb29085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610ed3565b60008183106112a5576000828152602084905260409020610370565b5060009182526020526040902090565b60606112c484846000856112cc565b949350505050565b60608247101561135e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610432565b73ffffffffffffffffffffffffffffffffffffffff85163b6113dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610432565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114059190611c9f565b60006040518083038185875af1925050503d8060008114611442576040519150601f19603f3d011682016040523d82523d6000602084013e611447565b606091505b5091509150611457828286611462565b979650505050505050565b60608315611471575081610370565b8251156114815782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104329190611cbb565b5080546114c190611a52565b6000825580601f106114d1575050565b601f01602090049060005260206000209081019061082691905b808211156114ff57600081556001016114eb565b5090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160a0810167ffffffffffffffff8111828210171561155557611555611503565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156115a2576115a2611503565b604052919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461082657600080fd5b600067ffffffffffffffff8211156115e6576115e6611503565b5060051b60200190565b600060a0828403121561160257600080fd5b61160a611532565b90508135815260208083013581830152604083013560408301526060830135611632816115aa565b6060830152608083013567ffffffffffffffff81111561165157600080fd5b8301601f8101851361166257600080fd5b8035611675611670826115cc565b61155b565b81815260059190911b8201830190838101908783111561169457600080fd5b928401925b828410156116b257833582529284019290840190611699565b6080860152509295945050505050565b6000602082840312156116d457600080fd5b813567ffffffffffffffff8111156116eb57600080fd5b6112c4848285016115f0565b6000602080838503121561170a57600080fd5b823567ffffffffffffffff8082111561172257600080fd5b818501915085601f83011261173657600080fd5b8135611744611670826115cc565b81815260059190911b8301840190848101908883111561176357600080fd5b8585015b8381101561179b5780358581111561177f5760008081fd5b61178d8b89838a01016115f0565b845250918601918601611767565b5098975050505050505050565b6000602082840312156117ba57600080fd5b8135610370816115aa565b801515811461082657600080fd5b600080604083850312156117e657600080fd5b82356117f1816115aa565b91506020830135611801816117c5565b809150509250929050565b60006020828403121561181e57600080fd5b5035919050565b60005b83811015611840578181015183820152602001611828565b50506000910152565b60008151808452611861816020860160208601611825565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b84815283602082015273ffffffffffffffffffffffffffffffffffffffff831660408201526080606082015260006118ce6080830184611849565b9695505050505050565b6000806000806000608086880312156118f057600080fd5b853594506020860135611902816115aa565b935060408601359250606086013567ffffffffffffffff8082111561192657600080fd5b818801915088601f83011261193a57600080fd5b81358181111561194957600080fd5b89602082850101111561195b57600080fd5b9699959850939650602001949392505050565b6000806040838503121561198157600080fd5b823561198c816115aa565b946020939093013593505050565b600080604083850312156119ad57600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611a4b57611a4b6119eb565b5060010190565b600181811c90821680611a6657607f821691505b602082108103611a9f577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b80820180821115610a0857610a086119eb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082611af657611af6611ab8565b500490565b600082611b0a57611b0a611ab8565b500690565b81810381811115610a0857610a086119eb565b601f821115610f5557600081815260208120601f850160051c81016020861015611b495750805b601f850160051c820191505b8181101561088857828155600101611b55565b815167ffffffffffffffff811115611b8257611b82611503565b611b9681611b908454611a52565b84611b22565b602080601f831160018114611be95760008415611bb35750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b178555610888565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b82811015611c3657888601518255948401946001909101908401611c17565b5085821015611c7257878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215611c9457600080fd5b8151610370816117c5565b60008251611cb1818460208701611825565b9190910192915050565b602081526000610370602083018461184956fea264697066735822122016c92f86d2815d5a69fb0146bd5085692389c02daebd3b98eb9b5b653d3ad56264736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "claim((uint256,uint256,uint256,address,bytes32[]))": { + "details": "Claim recipient must be equal to msg.sender.", + "params": { + "_claim": "claim object describing amount, accountIndex, account, window index, and merkle proof." + } + }, + "claimFor((uint256,uint256,uint256,address,bytes32[]))": { + "details": "Caller must be in whitelistedClaimers struct set to \"true\".", + "params": { + "_claim": "leaf to claim." + } + }, + "claimMulti((uint256,uint256,uint256,address,bytes32[])[])": { + "details": "All claim recipients must be equal to msg.sender.", + "params": { + "claims": "array of claims to claim." + } + }, + "deleteWindow(uint256)": { + "details": "Callable only by owner. Likely to be followed by a withdrawRewards call to clear contract state.", + "params": { + "windowIndex": "merkle root index to delete." + } + }, + "getRewardTokenForWindow(uint256)": { + "params": { + "windowIndex": "merkle root to check." + }, + "returns": { + "_0": "address Reward token address" + } + }, + "isClaimed(uint256,uint256)": { + "details": "This method will only work as intended if all `accountIndex`'s are unique for a given `windowIndex`. The onus is on the Owner of this contract to submit only valid Merkle roots.", + "params": { + "accountIndex": "account index to check within window index.", + "windowIndex": "merkle root to check." + }, + "returns": { + "_0": "True if claim has been executed already, False otherwise." + } + }, + "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 anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "setWindow(uint256,address,bytes32,string)": { + "params": { + "ipfsHash": "hash of IPFS object, conveniently stored for clients", + "merkleRoot": "merkle root describing allocation.", + "rewardToken": "ERC20 reward token.", + "rewardsToDeposit": "amount of rewards to deposit to seed this allocation." + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "verifyClaim((uint256,uint256,uint256,address,bytes32[]))": { + "params": { + "_claim": "claim object describing amount, accountIndex, account, window index, and merkle proof." + }, + "returns": { + "valid": "True if leaf exists." + } + }, + "whitelistClaimer(address,bool)": { + "details": "Callable only by owner.", + "params": { + "newContract": "Reset claimer contract to this address.", + "whitelist": "True to whitelist claimer, False otherwise." + } + }, + "withdrawRewards(address,uint256)": { + "details": "Callable only by owner.", + "params": { + "amount": "amount of rewards to withdraw.", + "rewardCurrency": "rewards to withdraw from contract." + } + } + }, + "title": "Extended MerkleDistributor contract.", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "claim((uint256,uint256,uint256,address,bytes32[]))": { + "notice": "Claim amount of reward tokens for account, as described by Claim input object." + }, + "claimFor((uint256,uint256,uint256,address,bytes32[]))": { + "notice": "Executes merkle leaf claim on behaf of user. This can only be called by a trusted claimer address. This function is designed to be called atomically with other transactions that ultimately return the claimed amount to the rightful recipient. For example, AcceleratingDistributor could call this function and then stake atomically on behalf of the user." + }, + "claimMulti((uint256,uint256,uint256,address,bytes32[])[])": { + "notice": "Batch claims to reduce gas versus individual submitting all claims. Method will fail if any individual claims within the batch would fail." + }, + "deleteWindow(uint256)": { + "notice": "Delete merkle root at window index." + }, + "getRewardTokenForWindow(uint256)": { + "notice": "Returns rewardToken set by admin for windowIndex." + }, + "isClaimed(uint256,uint256)": { + "notice": "Returns True if the claim for `accountIndex` has already been completed for the Merkle root at `windowIndex`." + }, + "setWindow(uint256,address,bytes32,string)": { + "notice": "Set merkle root for the next available window index and seed allocations.Callable only by owner of this contract. Caller must have approved this contract to transfer `rewardsToDeposit` amount of `rewardToken` or this call will fail. Importantly, we assume that the owner of this contract correctly chooses an amount `rewardsToDeposit` that is sufficient to cover all claims within the `merkleRoot`." + }, + "verifyClaim((uint256,uint256,uint256,address,bytes32[]))": { + "notice": "Returns True if leaf described by {account, amount, accountIndex} is stored in Merkle root at given window index." + }, + "whitelistClaimer(address,bool)": { + "notice": "Updates whitelisted claimer status." + }, + "withdrawRewards(address,uint256)": { + "notice": "Emergency method that transfers rewards out of the contract if the contract was configured improperly." + } + }, + "notice": "Adds additional constraints governing who can claim leaves from merkle windows.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 187, + "contract": "@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol:AcrossMerkleDistributor", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 2233, + "contract": "@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol:AcrossMerkleDistributor", + "label": "merkleWindows", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_struct(Window)2764_storage)" + }, + { + "astId": 2235, + "contract": "@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol:AcrossMerkleDistributor", + "label": "nextCreatedIndex", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 2241, + "contract": "@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol:AcrossMerkleDistributor", + "label": "claimedBitMap", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 15, + "contract": "@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol:AcrossMerkleDistributor", + "label": "whitelistedClaimers", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_bool)" + } + ], + "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_contract(IERC20)996": { + "encoding": "inplace", + "label": "contract IERC20", + "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_uint256,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_uint256,t_struct(Window)2764_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct MerkleDistributorInterface.Window)", + "numberOfBytes": "32", + "value": "t_struct(Window)2764_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Window)2764_storage": { + "encoding": "inplace", + "label": "struct MerkleDistributorInterface.Window", + "members": [ + { + "astId": 2756, + "contract": "@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol:AcrossMerkleDistributor", + "label": "merkleRoot", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 2758, + "contract": "@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol:AcrossMerkleDistributor", + "label": "remainingAmount", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 2761, + "contract": "@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol:AcrossMerkleDistributor", + "label": "rewardToken", + "offset": 0, + "slot": "2", + "type": "t_contract(IERC20)996" + }, + { + "astId": 2763, + "contract": "@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol:AcrossMerkleDistributor", + "label": "ipfsHash", + "offset": 0, + "slot": "3", + "type": "t_string_storage" + } + ], + "numberOfBytes": "128" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/deployments/mainnet/ClaimAndStake.json b/deployments/mainnet/ClaimAndStake.json new file mode 100644 index 0000000..684e67d --- /dev/null +++ b/deployments/mainnet/ClaimAndStake.json @@ -0,0 +1,172 @@ +{ + "address": "0x985e8A89Dd6Af8896Ef075c8dd93512433dc5829", + "abi": [ + { + "inputs": [ + { + "internalType": "contract AcrossMerkleDistributor", + "name": "_merkleDistributor", + "type": "address" + }, + { + "internalType": "contract AcceleratingDistributor", + "name": "_acceleratingDistributor", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "acceleratingDistributor", + "outputs": [ + { + "internalType": "contract AcceleratingDistributor", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "windowIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accountIndex", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32[]", + "name": "merkleProof", + "type": "bytes32[]" + } + ], + "internalType": "struct MerkleDistributorInterface.Claim", + "name": "_claim", + "type": "tuple" + } + ], + "name": "claimAndStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "merkleDistributor", + "outputs": [ + { + "internalType": "contract AcrossMerkleDistributor", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x81f64e35b730cfe2efa013d2145244fc829021c6f4bacb560ee7f4f509cf0007", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0x985e8A89Dd6Af8896Ef075c8dd93512433dc5829", + "transactionIndex": 91, + "gasUsed": "993939", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xf326ac33e20a1661739a09e550ca8435e73f1a781273097b361b7f763774625a", + "transactionHash": "0x81f64e35b730cfe2efa013d2145244fc829021c6f4bacb560ee7f4f509cf0007", + "logs": [], + "blockNumber": 15977131, + "cumulativeGasUsed": "6916642", + "status": 1, + "byzantium": true + }, + "args": ["0xE50b2cEAC4f60E840Ae513924033E753e2366487", "0x9040e41eF5E8b281535a96D9a48aCb8cfaBD9a48"], + "numDeployments": 1, + "solcInputHash": "17686732f199602ed40e6e94df0fb034", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract AcrossMerkleDistributor\",\"name\":\"_merkleDistributor\",\"type\":\"address\"},{\"internalType\":\"contract AcceleratingDistributor\",\"name\":\"_acceleratingDistributor\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"acceleratingDistributor\",\"outputs\":[{\"internalType\":\"contract AcceleratingDistributor\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"windowIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"accountIndex\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"merkleProof\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct MerkleDistributorInterface.Claim\",\"name\":\"_claim\",\"type\":\"tuple\"}],\"name\":\"claimAndStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"merkleDistributor\",\"outputs\":[{\"internalType\":\"contract AcrossMerkleDistributor\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"claimAndStake((uint256,uint256,uint256,address,bytes32[]))\":{\"details\":\"Will revert if `merkleDistributor` is not set to valid MerkleDistributor contract.Will revert if the claim recipient account is not equal to caller, or if the reward token for claim is not a valid staking token.Will revert if this contract is not a \\\"whitelisted claimer\\\" on the MerkleDistributor contract.\",\"params\":{\"_claim\":\"Claim leaf to retrieve from MerkleDistributor.\"}},\"multicall(bytes[])\":{\"details\":\"Receives and executes a batch of function calls on this contract.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"claimAndStake((uint256,uint256,uint256,address,bytes32[]))\":{\"notice\":\"Claim tokens from a MerkleDistributor contract and stake them for rewards in AcceleratingDistributor.\"}},\"notice\":\"Allows claimer to claim tokens from AcrossMerkleDistributor and stake into AcceleratingDistributor atomically in a single transaction. This intermediary contract also removes the need for claimer to approve AcceleratingDistributor to spend its staking tokens.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ClaimAndStake.sol\":\"ClaimAndStake\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@uma/core/contracts/merkle-distributor/implementation/MerkleDistributor.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n * @title Extended MerkleDistributor contract.\\n * @notice Adds additional constraints governing who can claim leaves from merkle windows.\\n */\\ncontract AcrossMerkleDistributor is MerkleDistributor {\\n using SafeERC20 for IERC20;\\n\\n // Addresses that can claim on user's behalf.\\n mapping(address => bool) public whitelistedClaimers;\\n\\n /****************************************\\n * EVENTS\\n ****************************************/\\n event WhitelistedClaimer(address indexed claimer, bool indexed whitelist);\\n event ClaimFor(\\n address indexed caller,\\n uint256 windowIndex,\\n address indexed account,\\n uint256 accountIndex,\\n uint256 amount,\\n address indexed rewardToken\\n );\\n\\n /****************************\\n * ADMIN FUNCTIONS\\n ****************************/\\n\\n /**\\n * @notice Updates whitelisted claimer status.\\n * @dev Callable only by owner.\\n * @param newContract Reset claimer contract to this address.\\n * @param whitelist True to whitelist claimer, False otherwise.\\n */\\n function whitelistClaimer(address newContract, bool whitelist) external onlyOwner {\\n whitelistedClaimers[newContract] = whitelist;\\n emit WhitelistedClaimer(newContract, whitelist);\\n }\\n\\n /****************************\\n * NON-ADMIN FUNCTIONS\\n ****************************/\\n\\n /**\\n * @notice Batch claims to reduce gas versus individual submitting all claims. Method will fail\\n * if any individual claims within the batch would fail.\\n * @dev All claim recipients must be equal to msg.sender.\\n * @param claims array of claims to claim.\\n */\\n function claimMulti(Claim[] memory claims) public override {\\n uint256 claimCount = claims.length;\\n for (uint256 i = 0; i < claimCount; i++) {\\n require(claims[i].account == msg.sender, \\\"invalid claimer\\\");\\n }\\n super.claimMulti(claims);\\n }\\n\\n /**\\n * @notice Claim amount of reward tokens for account, as described by Claim input object.\\n * @dev Claim recipient must be equal to msg.sender.\\n * @param _claim claim object describing amount, accountIndex, account, window index, and merkle proof.\\n */\\n function claim(Claim memory _claim) public override {\\n require(_claim.account == msg.sender, \\\"invalid claimer\\\");\\n super.claim(_claim);\\n }\\n\\n /**\\n * @notice Executes merkle leaf claim on behaf of user. This can only be called by a trusted\\n * claimer address. This function is designed to be called atomically with other transactions\\n * that ultimately return the claimed amount to the rightful recipient. For example,\\n * AcceleratingDistributor could call this function and then stake atomically on behalf of the user.\\n * @dev Caller must be in whitelistedClaimers struct set to \\\"true\\\".\\n * @param _claim leaf to claim.\\n */\\n\\n function claimFor(Claim memory _claim) public {\\n require(whitelistedClaimers[msg.sender], \\\"unwhitelisted claimer\\\");\\n _verifyAndMarkClaimed(_claim);\\n merkleWindows[_claim.windowIndex].rewardToken.safeTransfer(msg.sender, _claim.amount);\\n emit ClaimFor(\\n msg.sender,\\n _claim.windowIndex,\\n _claim.account,\\n _claim.accountIndex,\\n _claim.amount,\\n address(merkleWindows[_claim.windowIndex].rewardToken)\\n );\\n }\\n}\\n\",\"keccak256\":\"0x770e7f0986351870b1223a1214aaa3084b7cba9f438d7906c62c016ebd11b2c3\",\"license\":\"AGPL-3.0-only\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.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 anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing 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\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\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\",\"keccak256\":\"0x0e9621f60b2faabe65549f7ed0f24e8853a45c1b7990d47e8160e523683f3935\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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 */\\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 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\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Multicall.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Address.sol\\\";\\n\\n/**\\n * @dev Provides a function to batch together multiple calls in a single external call.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract Multicall {\\n /**\\n * @dev Receives and executes a batch of function calls on this contract.\\n */\\n function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {\\n results = new bytes[](data.length);\\n for (uint256 i = 0; i < data.length; i++) {\\n results[i] = Address.functionDelegateCall(address(this), data[i]);\\n }\\n return results;\\n }\\n}\\n\",\"keccak256\":\"0x35e30a35e23f856cbcee3558b7efdd83f6017a8f1b419710645143d98e892463\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Tree proofs.\\n *\\n * The proofs can be generated using the JavaScript library\\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\\n *\\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\\n *\\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\\n * hashing, or use a hash function other than keccak256 for hashing leaves.\\n * This is because the concatenation of a sorted pair of internal nodes in\\n * the merkle tree could be reinterpreted as a leaf value.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Calldata version of {verify}\\n *\\n * _Available since v4.7._\\n */\\n function verifyCalldata(\\n bytes32[] calldata proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProofCalldata(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n computedHash = _hashPair(computedHash, proof[i]);\\n }\\n return computedHash;\\n }\\n\\n /**\\n * @dev Calldata version of {processProof}\\n *\\n * _Available since v4.7._\\n */\\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n computedHash = _hashPair(computedHash, proof[i]);\\n }\\n return computedHash;\\n }\\n\\n /**\\n * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by\\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\\n *\\n * _Available since v4.7._\\n */\\n function multiProofVerify(\\n bytes32[] memory proof,\\n bool[] memory proofFlags,\\n bytes32 root,\\n bytes32[] memory leaves\\n ) internal pure returns (bool) {\\n return processMultiProof(proof, proofFlags, leaves) == root;\\n }\\n\\n /**\\n * @dev Calldata version of {multiProofVerify}\\n *\\n * _Available since v4.7._\\n */\\n function multiProofVerifyCalldata(\\n bytes32[] calldata proof,\\n bool[] calldata proofFlags,\\n bytes32 root,\\n bytes32[] memory leaves\\n ) internal pure returns (bool) {\\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\\n }\\n\\n /**\\n * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`,\\n * consuming from one or the other at each step according to the instructions given by\\n * `proofFlags`.\\n *\\n * _Available since v4.7._\\n */\\n function processMultiProof(\\n bytes32[] memory proof,\\n bool[] memory proofFlags,\\n bytes32[] memory leaves\\n ) internal pure returns (bytes32 merkleRoot) {\\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\\n // the merkle tree.\\n uint256 leavesLen = leaves.length;\\n uint256 totalHashes = proofFlags.length;\\n\\n // Check proof validity.\\n require(leavesLen + proof.length - 1 == totalHashes, \\\"MerkleProof: invalid multiproof\\\");\\n\\n // The xxxPos values are \\\"pointers\\\" to the next value to consume in each array. All accesses are done using\\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \\\"pop\\\".\\n bytes32[] memory hashes = new bytes32[](totalHashes);\\n uint256 leafPos = 0;\\n uint256 hashPos = 0;\\n uint256 proofPos = 0;\\n // At each step, we compute the next hash using two values:\\n // - a value from the \\\"main queue\\\". If not all leaves have been consumed, we get the next leaf, otherwise we\\n // get the next hash.\\n // - depending on the flag, either another value for the \\\"main queue\\\" (merging branches) or an element from the\\n // `proof` array.\\n for (uint256 i = 0; i < totalHashes; i++) {\\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\\n hashes[i] = _hashPair(a, b);\\n }\\n\\n if (totalHashes > 0) {\\n return hashes[totalHashes - 1];\\n } else if (leavesLen > 0) {\\n return leaves[0];\\n } else {\\n return proof[0];\\n }\\n }\\n\\n /**\\n * @dev Calldata version of {processMultiProof}\\n *\\n * _Available since v4.7._\\n */\\n function processMultiProofCalldata(\\n bytes32[] calldata proof,\\n bool[] calldata proofFlags,\\n bytes32[] memory leaves\\n ) internal pure returns (bytes32 merkleRoot) {\\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\\n // the merkle tree.\\n uint256 leavesLen = leaves.length;\\n uint256 totalHashes = proofFlags.length;\\n\\n // Check proof validity.\\n require(leavesLen + proof.length - 1 == totalHashes, \\\"MerkleProof: invalid multiproof\\\");\\n\\n // The xxxPos values are \\\"pointers\\\" to the next value to consume in each array. All accesses are done using\\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \\\"pop\\\".\\n bytes32[] memory hashes = new bytes32[](totalHashes);\\n uint256 leafPos = 0;\\n uint256 hashPos = 0;\\n uint256 proofPos = 0;\\n // At each step, we compute the next hash using two values:\\n // - a value from the \\\"main queue\\\". If not all leaves have been consumed, we get the next leaf, otherwise we\\n // get the next hash.\\n // - depending on the flag, either another value for the \\\"main queue\\\" (merging branches) or an element from the\\n // `proof` array.\\n for (uint256 i = 0; i < totalHashes; i++) {\\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\\n hashes[i] = _hashPair(a, b);\\n }\\n\\n if (totalHashes > 0) {\\n return hashes[totalHashes - 1];\\n } else if (leavesLen > 0) {\\n return leaves[0];\\n } else {\\n return proof[0];\\n }\\n }\\n\\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\\n }\\n\\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, a)\\n mstore(0x20, b)\\n value := keccak256(0x00, 0x40)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x596ed72a251d391b814a4aa19d7acb02ebdcc92ba27d3fff74a6f0c158b12ab7\",\"license\":\"MIT\"},\"@uma/core/contracts/merkle-distributor/implementation/MerkleDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./MerkleDistributorInterface.sol\\\";\\n\\n/**\\n * Inspired by:\\n * - https://github.com/pie-dao/vested-token-migration-app\\n * - https://github.com/Uniswap/merkle-distributor\\n * - https://github.com/balancer-labs/erc20-redeemable\\n *\\n * @title MerkleDistributor contract.\\n * @notice Allows an owner to distribute any reward ERC20 to claimants according to Merkle roots. The owner can specify\\n * multiple Merkle roots distributions with customized reward currencies.\\n * @dev The Merkle trees are not validated in any way, so the system assumes the contract owner behaves honestly.\\n */\\ncontract MerkleDistributor is MerkleDistributorInterface, Ownable {\\n using SafeERC20 for IERC20;\\n\\n // Windows are mapped to arbitrary indices.\\n mapping(uint256 => Window) public merkleWindows;\\n\\n // Index of next created Merkle root.\\n uint256 public nextCreatedIndex;\\n\\n // Track which accounts have claimed for each window index.\\n // Note: uses a packed array of bools for gas optimization on tracking certain claims. Copied from Uniswap's contract.\\n mapping(uint256 => mapping(uint256 => uint256)) private claimedBitMap;\\n\\n /****************************************\\n * EVENTS\\n ****************************************/\\n event Claimed(\\n address indexed caller,\\n uint256 windowIndex,\\n address indexed account,\\n uint256 accountIndex,\\n uint256 amount,\\n address indexed rewardToken\\n );\\n event CreatedWindow(\\n uint256 indexed windowIndex,\\n uint256 rewardsDeposited,\\n address indexed rewardToken,\\n address owner\\n );\\n event WithdrawRewards(address indexed owner, uint256 amount, address indexed currency);\\n event DeleteWindow(uint256 indexed windowIndex, address owner);\\n\\n /****************************\\n * ADMIN FUNCTIONS\\n ****************************/\\n\\n /**\\n * @notice Set merkle root for the next available window index and seed allocations.\\n * @notice Callable only by owner of this contract. Caller must have approved this contract to transfer\\n * `rewardsToDeposit` amount of `rewardToken` or this call will fail. Importantly, we assume that the\\n * owner of this contract correctly chooses an amount `rewardsToDeposit` that is sufficient to cover all\\n * claims within the `merkleRoot`.\\n * @param rewardsToDeposit amount of rewards to deposit to seed this allocation.\\n * @param rewardToken ERC20 reward token.\\n * @param merkleRoot merkle root describing allocation.\\n * @param ipfsHash hash of IPFS object, conveniently stored for clients\\n */\\n function setWindow(\\n uint256 rewardsToDeposit,\\n address rewardToken,\\n bytes32 merkleRoot,\\n string calldata ipfsHash\\n ) external onlyOwner {\\n uint256 indexToSet = nextCreatedIndex;\\n nextCreatedIndex = indexToSet + 1;\\n\\n _setWindow(indexToSet, rewardsToDeposit, rewardToken, merkleRoot, ipfsHash);\\n }\\n\\n /**\\n * @notice Delete merkle root at window index.\\n * @dev Callable only by owner. Likely to be followed by a withdrawRewards call to clear contract state.\\n * @param windowIndex merkle root index to delete.\\n */\\n function deleteWindow(uint256 windowIndex) external onlyOwner {\\n delete merkleWindows[windowIndex];\\n emit DeleteWindow(windowIndex, msg.sender);\\n }\\n\\n /**\\n * @notice Emergency method that transfers rewards out of the contract if the contract was configured improperly.\\n * @dev Callable only by owner.\\n * @param rewardCurrency rewards to withdraw from contract.\\n * @param amount amount of rewards to withdraw.\\n */\\n function withdrawRewards(IERC20 rewardCurrency, uint256 amount) external onlyOwner {\\n rewardCurrency.safeTransfer(msg.sender, amount);\\n emit WithdrawRewards(msg.sender, amount, address(rewardCurrency));\\n }\\n\\n /****************************\\n * NON-ADMIN FUNCTIONS\\n ****************************/\\n\\n /**\\n * @notice Batch claims to reduce gas versus individual submitting all claims. Method will fail\\n * if any individual claims within the batch would fail.\\n * @dev Optimistically tries to batch together consecutive claims for the same account and same\\n * reward token to reduce gas. Therefore, the most gas-cost-optimal way to use this method\\n * is to pass in an array of claims sorted by account and reward currency. It also reverts\\n * when any of individual `_claim`'s `amount` exceeds `remainingAmount` for its window.\\n * @param claims array of claims to claim.\\n */\\n function claimMulti(Claim[] memory claims) public virtual override {\\n uint256 batchedAmount;\\n uint256 claimCount = claims.length;\\n for (uint256 i = 0; i < claimCount; i++) {\\n Claim memory _claim = claims[i];\\n _verifyAndMarkClaimed(_claim);\\n batchedAmount += _claim.amount;\\n\\n // If the next claim is NOT the same account or the same token (or this claim is the last one),\\n // then disburse the `batchedAmount` to the current claim's account for the current claim's reward token.\\n uint256 nextI = i + 1;\\n IERC20 currentRewardToken = merkleWindows[_claim.windowIndex].rewardToken;\\n if (\\n nextI == claimCount ||\\n // This claim is last claim.\\n claims[nextI].account != _claim.account ||\\n // Next claim account is different than current one.\\n merkleWindows[claims[nextI].windowIndex].rewardToken != currentRewardToken\\n // Next claim reward token is different than current one.\\n ) {\\n currentRewardToken.safeTransfer(_claim.account, batchedAmount);\\n batchedAmount = 0;\\n }\\n }\\n }\\n\\n /**\\n * @notice Claim amount of reward tokens for account, as described by Claim input object.\\n * @dev If the `_claim`'s `amount`, `accountIndex`, and `account` do not exactly match the\\n * values stored in the merkle root for the `_claim`'s `windowIndex` this method\\n * will revert. It also reverts when `_claim`'s `amount` exceeds `remainingAmount` for the window.\\n * @param _claim claim object describing amount, accountIndex, account, window index, and merkle proof.\\n */\\n function claim(Claim memory _claim) public virtual override {\\n _verifyAndMarkClaimed(_claim);\\n merkleWindows[_claim.windowIndex].rewardToken.safeTransfer(_claim.account, _claim.amount);\\n }\\n\\n /**\\n * @notice Returns True if the claim for `accountIndex` has already been completed for the Merkle root at\\n * `windowIndex`.\\n * @dev This method will only work as intended if all `accountIndex`'s are unique for a given `windowIndex`.\\n * The onus is on the Owner of this contract to submit only valid Merkle roots.\\n * @param windowIndex merkle root to check.\\n * @param accountIndex account index to check within window index.\\n * @return True if claim has been executed already, False otherwise.\\n */\\n function isClaimed(uint256 windowIndex, uint256 accountIndex) public view returns (bool) {\\n uint256 claimedWordIndex = accountIndex / 256;\\n uint256 claimedBitIndex = accountIndex % 256;\\n uint256 claimedWord = claimedBitMap[windowIndex][claimedWordIndex];\\n uint256 mask = (1 << claimedBitIndex);\\n return claimedWord & mask == mask;\\n }\\n\\n /**\\n * @notice Returns rewardToken set by admin for windowIndex.\\n * @param windowIndex merkle root to check.\\n * @return address Reward token address\\n */\\n function getRewardTokenForWindow(uint256 windowIndex) public view override returns (address) {\\n return address(merkleWindows[windowIndex].rewardToken);\\n }\\n\\n /**\\n * @notice Returns True if leaf described by {account, amount, accountIndex} is stored in Merkle root at given\\n * window index.\\n * @param _claim claim object describing amount, accountIndex, account, window index, and merkle proof.\\n * @return valid True if leaf exists.\\n */\\n function verifyClaim(Claim memory _claim) public view returns (bool valid) {\\n bytes32 leaf = keccak256(abi.encodePacked(_claim.account, _claim.amount, _claim.accountIndex));\\n return MerkleProof.verify(_claim.merkleProof, merkleWindows[_claim.windowIndex].merkleRoot, leaf);\\n }\\n\\n /****************************\\n * PRIVATE FUNCTIONS\\n ****************************/\\n\\n // Mark claim as completed for `accountIndex` for Merkle root at `windowIndex`.\\n function _setClaimed(uint256 windowIndex, uint256 accountIndex) private {\\n uint256 claimedWordIndex = accountIndex / 256;\\n uint256 claimedBitIndex = accountIndex % 256;\\n claimedBitMap[windowIndex][claimedWordIndex] =\\n claimedBitMap[windowIndex][claimedWordIndex] |\\n (1 << claimedBitIndex);\\n }\\n\\n // Store new Merkle root at `windowindex`. Pull `rewardsDeposited` from caller to seed distribution for this root.\\n function _setWindow(\\n uint256 windowIndex,\\n uint256 rewardsDeposited,\\n address rewardToken,\\n bytes32 merkleRoot,\\n string memory ipfsHash\\n ) private {\\n Window storage window = merkleWindows[windowIndex];\\n window.merkleRoot = merkleRoot;\\n window.remainingAmount = rewardsDeposited;\\n window.rewardToken = IERC20(rewardToken);\\n window.ipfsHash = ipfsHash;\\n\\n emit CreatedWindow(windowIndex, rewardsDeposited, rewardToken, msg.sender);\\n\\n window.rewardToken.safeTransferFrom(msg.sender, address(this), rewardsDeposited);\\n }\\n\\n // Verify claim is valid and mark it as completed in this contract.\\n function _verifyAndMarkClaimed(Claim memory _claim) internal {\\n // Check claimed proof against merkle window at given index.\\n require(verifyClaim(_claim), \\\"Incorrect merkle proof\\\");\\n // Check the account has not yet claimed for this window.\\n require(!isClaimed(_claim.windowIndex, _claim.accountIndex), \\\"Account has already claimed for this window\\\");\\n\\n // Proof is correct and claim has not occurred yet, mark claimed complete.\\n _setClaimed(_claim.windowIndex, _claim.accountIndex);\\n merkleWindows[_claim.windowIndex].remainingAmount -= _claim.amount;\\n emit Claimed(\\n msg.sender,\\n _claim.windowIndex,\\n _claim.account,\\n _claim.accountIndex,\\n _claim.amount,\\n address(merkleWindows[_claim.windowIndex].rewardToken)\\n );\\n }\\n}\\n\",\"keccak256\":\"0x45ba14976c04b585ff82098ef0340ae062d9da7a3a2076b2535dbd194d254fc7\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/merkle-distributor/implementation/MerkleDistributorInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n * @notice Concise list of functions in MerkleDistributor implementation that would be called by\\n * a consuming external contract (such as the Across Protocol's AcceleratingDistributor).\\n */\\ninterface MerkleDistributorInterface {\\n // A Window maps a Merkle root to a reward token address.\\n struct Window {\\n // Merkle root describing the distribution.\\n bytes32 merkleRoot;\\n // Remaining amount of deposited rewards that have not yet been claimed.\\n uint256 remainingAmount;\\n // Currency in which reward is processed.\\n IERC20 rewardToken;\\n // IPFS hash of the merkle tree. Can be used to independently fetch recipient proofs and tree. Note that the canonical\\n // data type for storing an IPFS hash is a multihash which is the concatenation of \\n // . We opted to store this in a string type to make it easier\\n // for users to query the ipfs data without needing to reconstruct the multihash. to view the IPFS data simply\\n // go to https://cloudflare-ipfs.com/ipfs/.\\n string ipfsHash;\\n }\\n\\n // Represents an account's claim for `amount` within the Merkle root located at the `windowIndex`.\\n struct Claim {\\n uint256 windowIndex;\\n uint256 amount;\\n uint256 accountIndex; // Used only for bitmap. Assumed to be unique for each claim.\\n address account;\\n bytes32[] merkleProof;\\n }\\n\\n function claim(Claim memory _claim) external;\\n\\n function claimMulti(Claim[] memory claims) external;\\n\\n function getRewardTokenForWindow(uint256 windowIndex) external view returns (address);\\n}\\n\",\"keccak256\":\"0x0d6527f44b268c3801d45bc1fc6021f22a80070a21d4066430a4d6566e3ff5e7\",\"license\":\"GPL-3.0-only\"},\"contracts/AcceleratingDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Multicall.sol\\\";\\n\\n/**\\n * @notice Across token distribution contract. Contract is inspired by Synthetix staking contract and Ampleforth geyser.\\n * Stakers start by earning their pro-rata share of a baseEmissionRate per second which increases based on how long\\n * they have staked in the contract, up to a max emission rate of baseEmissionRate * maxMultiplier. Multiple LP tokens\\n * can be staked in this contract enabling depositors to batch stake and claim via multicall. Note that this contract is\\n * only compatible with standard ERC20 tokens, and not tokens that charge fees on transfers, dynamically change\\n * balance, or have double entry-points. It's up to the contract owner to ensure they only add supported tokens.\\n */\\n\\ncontract AcceleratingDistributor is ReentrancyGuard, Ownable, Multicall {\\n using SafeERC20 for IERC20;\\n\\n IERC20 public immutable rewardToken;\\n\\n // Each User deposit is tracked with the information below.\\n struct UserDeposit {\\n uint256 cumulativeBalance;\\n uint256 averageDepositTime;\\n uint256 rewardsAccumulatedPerToken;\\n uint256 rewardsOutstanding;\\n }\\n\\n struct StakingToken {\\n bool enabled;\\n uint256 baseEmissionRate;\\n uint256 maxMultiplier;\\n uint256 secondsToMaxMultiplier;\\n uint256 cumulativeStaked;\\n uint256 rewardPerTokenStored;\\n uint256 lastUpdateTime;\\n mapping(address => UserDeposit) stakingBalances;\\n }\\n\\n mapping(address => StakingToken) public stakingTokens;\\n\\n modifier onlyEnabled(address stakedToken) {\\n require(stakingTokens[stakedToken].enabled, \\\"stakedToken not enabled\\\");\\n _;\\n }\\n\\n modifier onlyInitialized(address stakedToken) {\\n require(stakingTokens[stakedToken].lastUpdateTime != 0, \\\"stakedToken not initialized\\\");\\n _;\\n }\\n\\n constructor(address _rewardToken) {\\n rewardToken = IERC20(_rewardToken);\\n }\\n\\n function getCurrentTime() public view virtual returns (uint256) {\\n return block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n /**************************************\\n * EVENTS *\\n **************************************/\\n\\n event TokenConfiguredForStaking(\\n address indexed token,\\n bool enabled,\\n uint256 baseEmissionRate,\\n uint256 maxMultiplier,\\n uint256 secondsToMaxMultiplier,\\n uint256 lastUpdateTime\\n );\\n event RecoverToken(address indexed token, uint256 amount);\\n event Stake(\\n address indexed token,\\n address indexed user,\\n uint256 amount,\\n uint256 averageDepositTime,\\n uint256 cumulativeBalance,\\n uint256 tokenCumulativeStaked\\n );\\n event Unstake(\\n address indexed token,\\n address indexed user,\\n uint256 amount,\\n uint256 remainingCumulativeBalance,\\n uint256 tokenCumulativeStaked\\n );\\n event RewardsWithdrawn(\\n address indexed token,\\n address indexed user,\\n uint256 rewardsToSend,\\n uint256 tokenLastUpdateTime,\\n uint256 tokenRewardPerTokenStored,\\n uint256 userRewardsOutstanding,\\n uint256 userRewardsPaidPerToken\\n );\\n event Exit(address indexed token, address indexed user, uint256 tokenCumulativeStaked);\\n\\n /**************************************\\n * ADMIN FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Enable a token for staking.\\n * @dev The owner should ensure that the token enabled is a standard ERC20 token to ensure correct functionality.\\n * @param stakedToken The address of the token that can be staked.\\n * @param enabled Whether the token is enabled for staking.\\n * @param baseEmissionRate The base emission rate for staking the token. This is split pro-rata between all users.\\n * @param maxMultiplier The maximum multiplier for staking which increases your rewards the longer you stake.\\n * @param secondsToMaxMultiplier The number of seconds needed to stake to reach the maximum multiplier.\\n */\\n function configureStakingToken(\\n address stakedToken,\\n bool enabled,\\n uint256 baseEmissionRate,\\n uint256 maxMultiplier,\\n uint256 secondsToMaxMultiplier\\n ) external onlyOwner {\\n // Validate input to ensure system stability and avoid unexpected behavior. Note we dont place a lower bound on\\n // the baseEmissionRate. If this value is less than 1e18 then you will slowly loose your staking rewards over time.\\n // Because of the way balances are managed, the staked token cannot be the reward token. Otherwise, reward\\n // payouts could eat into user balances. We choose not to constrain `maxMultiplier` to be > 1e18 so that\\n // admin can choose to allow decreasing emissions over time. This is not the intended use case, but we see no\\n // benefit to removing this additional flexibility. If set < 1e18, then user's rewards outstanding will\\n // decrease over time. Incentives for stakers would look different if `maxMultiplier` were set < 1e18\\n require(stakedToken != address(rewardToken), \\\"Staked token is reward token\\\");\\n require(maxMultiplier < 1e36, \\\"maxMultiplier can not be set too large\\\");\\n require(secondsToMaxMultiplier > 0, \\\"secondsToMaxMultiplier must be greater than 0\\\");\\n require(baseEmissionRate < 1e27, \\\"baseEmissionRate can not be set too large\\\");\\n\\n StakingToken storage stakingToken = stakingTokens[stakedToken];\\n\\n // If this token is already initialized, make sure we update the rewards before modifying any params.\\n if (stakingToken.lastUpdateTime != 0) _updateReward(stakedToken, address(0));\\n\\n stakingToken.enabled = enabled;\\n stakingToken.baseEmissionRate = baseEmissionRate;\\n stakingToken.maxMultiplier = maxMultiplier;\\n stakingToken.secondsToMaxMultiplier = secondsToMaxMultiplier;\\n stakingToken.lastUpdateTime = getCurrentTime();\\n\\n emit TokenConfiguredForStaking(\\n stakedToken,\\n enabled,\\n baseEmissionRate,\\n maxMultiplier,\\n secondsToMaxMultiplier,\\n stakingToken.lastUpdateTime\\n );\\n }\\n\\n /**\\n * @notice Enables the owner to recover tokens dropped onto the contract. This could be used to remove unclaimed\\n * staking rewards or recover excess LP tokens that were inadvertently dropped onto the contract. Importantly, the\\n * contract will only let the owner recover staked excess tokens above what the contract thinks it should have. i.e\\n * the owner cant use this method to steal staked tokens, only recover excess ones mistakenly sent to the contract.\\n * @param token The address of the token to skim.\\n */\\n function recoverToken(address token) external onlyOwner {\\n // If the token is an enabled staking token then we want to preform a skim action where we send back any extra\\n // tokens that are not accounted for in the cumulativeStaked variable. This lets the owner recover extra tokens\\n // sent to the contract that were not explicitly staked. if the token is not enabled for staking then we simply\\n // send back the full amount of tokens that the contract has.\\n uint256 amount = IERC20(token).balanceOf(address(this));\\n if (stakingTokens[token].lastUpdateTime != 0) amount -= stakingTokens[token].cumulativeStaked;\\n require(amount > 0, \\\"Can't recover 0 tokens\\\");\\n IERC20(token).safeTransfer(owner(), amount);\\n emit RecoverToken(token, amount);\\n }\\n\\n /**************************************\\n * STAKER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Stake tokens for rewards.\\n * @dev The caller of this function must approve this contract to spend amount of stakedToken.\\n * @param stakedToken The address of the token to stake.\\n * @param amount The amount of the token to stake.\\n */\\n function stake(address stakedToken, uint256 amount) external nonReentrant onlyEnabled(stakedToken) {\\n _stake(stakedToken, amount, msg.sender);\\n }\\n\\n /**\\n * @notice Stake tokens for rewards on behalf of `beneficiary`.\\n * @dev The caller of this function must approve this contract to spend amount of stakedToken.\\n * @dev The caller of this function is effectively donating their tokens to the beneficiary. The beneficiary\\n * can then unstake or claim rewards as they wish.\\n * @param stakedToken The address of the token to stake.\\n * @param amount The amount of the token to stake.\\n * @param beneficiary User that caller wants to stake on behalf of.\\n */\\n function stakeFor(\\n address stakedToken,\\n uint256 amount,\\n address beneficiary\\n ) external nonReentrant onlyEnabled(stakedToken) {\\n _stake(stakedToken, amount, beneficiary);\\n }\\n\\n /**\\n * @notice Withdraw staked tokens.\\n * @param stakedToken The address of the token to withdraw.\\n * @param amount The amount of the token to withdraw.\\n */\\n function unstake(address stakedToken, uint256 amount) public nonReentrant onlyInitialized(stakedToken) {\\n _updateReward(stakedToken, msg.sender);\\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[msg.sender];\\n\\n // Note: these will revert if underflow so you cant unstake more than your cumulativeBalance.\\n userDeposit.cumulativeBalance -= amount;\\n stakingTokens[stakedToken].cumulativeStaked -= amount;\\n\\n IERC20(stakedToken).safeTransfer(msg.sender, amount);\\n\\n emit Unstake(\\n stakedToken,\\n msg.sender,\\n amount,\\n userDeposit.cumulativeBalance,\\n stakingTokens[stakedToken].cumulativeStaked\\n );\\n }\\n\\n /**\\n * @notice Get entitled rewards for the staker.\\n * @dev Calling this method will reset the caller's reward multiplier.\\n * @param stakedToken The address of the token to get rewards for.\\n */\\n function withdrawReward(address stakedToken) public nonReentrant onlyInitialized(stakedToken) {\\n _updateReward(stakedToken, msg.sender);\\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[msg.sender];\\n\\n uint256 rewardsToSend = userDeposit.rewardsOutstanding;\\n if (rewardsToSend > 0) {\\n userDeposit.rewardsOutstanding = 0;\\n userDeposit.averageDepositTime = getCurrentTime();\\n rewardToken.safeTransfer(msg.sender, rewardsToSend);\\n }\\n\\n emit RewardsWithdrawn(\\n stakedToken,\\n msg.sender,\\n rewardsToSend,\\n stakingTokens[stakedToken].lastUpdateTime,\\n stakingTokens[stakedToken].rewardPerTokenStored,\\n userDeposit.rewardsOutstanding,\\n userDeposit.rewardsAccumulatedPerToken\\n );\\n }\\n\\n /**\\n * @notice Exits a staking position by unstaking and getting rewards. This totally exits the staking position.\\n * @dev Calling this method will reset the caller's reward multiplier.\\n * @param stakedToken The address of the token to get rewards for.\\n */\\n function exit(address stakedToken) external onlyInitialized(stakedToken) {\\n _updateReward(stakedToken, msg.sender);\\n unstake(stakedToken, stakingTokens[stakedToken].stakingBalances[msg.sender].cumulativeBalance);\\n withdrawReward(stakedToken);\\n\\n emit Exit(stakedToken, msg.sender, stakingTokens[stakedToken].cumulativeStaked);\\n }\\n\\n /**************************************\\n * VIEW FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Returns the total staked for a given stakedToken.\\n * @param stakedToken The address of the staked token to query.\\n * @return uint256 Total amount staked of the stakedToken.\\n */\\n function getCumulativeStaked(address stakedToken) external view returns (uint256) {\\n return stakingTokens[stakedToken].cumulativeStaked;\\n }\\n\\n /**\\n * @notice Returns all the information associated with a user's stake.\\n * @param stakedToken The address of the staked token to query.\\n * @param account The address of user to query.\\n * @return UserDeposit Struct with: {cumulativeBalance,averageDepositTime,rewardsAccumulatedPerToken,rewardsOutstanding}\\n */\\n function getUserStake(address stakedToken, address account) external view returns (UserDeposit memory) {\\n return stakingTokens[stakedToken].stakingBalances[account];\\n }\\n\\n /**\\n * @notice Returns the base rewards per staked token for a given staking token. This factors in the last time\\n * any internal logic was called on this contract to correctly attribute retroactive cumulative rewards.\\n * @dev the value returned is represented by a uint256 with fixed precision of 18 decimals.\\n * @param stakedToken The address of the staked token to query.\\n * @return uint256 Total base reward per token that will be applied, pro-rata, to stakers.\\n */\\n function baseRewardPerToken(address stakedToken) public view returns (uint256) {\\n StakingToken storage stakingToken = stakingTokens[stakedToken];\\n if (stakingToken.cumulativeStaked == 0) return stakingToken.rewardPerTokenStored;\\n\\n return\\n stakingToken.rewardPerTokenStored +\\n ((getCurrentTime() - stakingToken.lastUpdateTime) * stakingToken.baseEmissionRate * 1e18) /\\n stakingToken.cumulativeStaked;\\n }\\n\\n /**\\n * @notice Returns the multiplier applied to the base reward per staked token for a given staking token and account.\\n * The longer a user stakes the higher their multiplier up to maxMultiplier for that given staking token.\\n * any internal logic was called on this contract to correctly attribute retroactive cumulative rewards.\\n * @dev the value returned is represented by a uint256 with fixed precision of 18 decimals.\\n * @param stakedToken The address of the staked token to query.\\n * @param account The address of the user to query.\\n * @return uint256 User multiplier, applied to the baseRewardPerToken, when claiming rewards.\\n */\\n function getUserRewardMultiplier(address stakedToken, address account) public view returns (uint256) {\\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[account];\\n if (userDeposit.averageDepositTime == 0 || userDeposit.cumulativeBalance == 0) return 1e18;\\n uint256 fractionOfMaxMultiplier = ((getTimeSinceAverageDeposit(stakedToken, account)) * 1e18) /\\n stakingTokens[stakedToken].secondsToMaxMultiplier;\\n\\n // At maximum, the multiplier should be equal to the maxMultiplier.\\n if (fractionOfMaxMultiplier > 1e18) fractionOfMaxMultiplier = 1e18;\\n return 1e18 + (fractionOfMaxMultiplier * (stakingTokens[stakedToken].maxMultiplier - 1e18)) / (1e18);\\n }\\n\\n /**\\n * @notice Returns the total outstanding rewards entitled to a user for a given staking token. This factors in the\\n * users staking duration (and therefore reward multiplier) and their pro-rata share of the total rewards.\\n * @param stakedToken The address of the staked token to query.\\n * @param account The address of the user to query.\\n * @return uint256 Total outstanding rewards entitled to user.\\n */\\n function getOutstandingRewards(address stakedToken, address account) public view returns (uint256) {\\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[account];\\n\\n uint256 userRewardMultiplier = getUserRewardMultiplier(stakedToken, account);\\n\\n uint256 newUserRewards = (userDeposit.cumulativeBalance *\\n (baseRewardPerToken(stakedToken) - userDeposit.rewardsAccumulatedPerToken) *\\n userRewardMultiplier) / (1e18 * 1e18);\\n\\n return newUserRewards + userDeposit.rewardsOutstanding;\\n }\\n\\n /**\\n * @notice Returns the time that has elapsed between the current time and the last users average deposit time.\\n * @param stakedToken The address of the staked token to query.\\n * @param account The address of the user to query.\\n *@return uint256 Time, in seconds, between the users average deposit time and the current time.\\n */\\n function getTimeSinceAverageDeposit(address stakedToken, address account) public view returns (uint256) {\\n return getCurrentTime() - stakingTokens[stakedToken].stakingBalances[account].averageDepositTime;\\n }\\n\\n /**\\n * @notice Returns a users new average deposit time, considering the addition of a new deposit. This factors in the\\n * cumulative previous deposits, new deposit and time from the last deposit.\\n * @param stakedToken The address of the staked token to query.\\n * @param account The address of the user to query.\\n * @return uint256 Average post deposit time, considering all deposits to date.\\n */\\n function getAverageDepositTimePostDeposit(\\n address stakedToken,\\n address account,\\n uint256 amount\\n ) public view returns (uint256) {\\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[account];\\n if (amount == 0) return userDeposit.averageDepositTime;\\n uint256 amountWeightedTime = (((amount * 1e18) / (userDeposit.cumulativeBalance + amount)) *\\n (getTimeSinceAverageDeposit(stakedToken, account))) / 1e18;\\n return userDeposit.averageDepositTime + amountWeightedTime;\\n }\\n\\n /**************************************\\n * INTERNAL FUNCTIONS *\\n **************************************/\\n\\n // Update the internal counters for a given stakedToken and user.\\n function _updateReward(address stakedToken, address account) internal {\\n StakingToken storage stakingToken = stakingTokens[stakedToken];\\n stakingToken.rewardPerTokenStored = baseRewardPerToken(stakedToken);\\n stakingToken.lastUpdateTime = getCurrentTime();\\n if (account != address(0)) {\\n UserDeposit storage userDeposit = stakingToken.stakingBalances[account];\\n userDeposit.rewardsOutstanding = getOutstandingRewards(stakedToken, account);\\n userDeposit.rewardsAccumulatedPerToken = stakingToken.rewardPerTokenStored;\\n }\\n }\\n\\n function _stake(\\n address stakedToken,\\n uint256 amount,\\n address staker\\n ) internal {\\n _updateReward(stakedToken, staker);\\n\\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[staker];\\n\\n uint256 averageDepositTime = getAverageDepositTimePostDeposit(stakedToken, staker, amount);\\n\\n userDeposit.averageDepositTime = averageDepositTime;\\n userDeposit.cumulativeBalance += amount;\\n stakingTokens[stakedToken].cumulativeStaked += amount;\\n\\n IERC20(stakedToken).safeTransferFrom(msg.sender, address(this), amount);\\n emit Stake(\\n stakedToken,\\n staker,\\n amount,\\n averageDepositTime,\\n userDeposit.cumulativeBalance,\\n stakingTokens[stakedToken].cumulativeStaked\\n );\\n }\\n}\\n\",\"keccak256\":\"0xbc67be1719f5719497d5afe7a039bdcabe0a1af453e6dec683dc5a312df047de\",\"license\":\"GPL-3.0-only\"},\"contracts/ClaimAndStake.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Multicall.sol\\\";\\nimport \\\"@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol\\\";\\nimport \\\"./AcceleratingDistributor.sol\\\";\\n\\n/**\\n * @notice Allows claimer to claim tokens from AcrossMerkleDistributor and stake into AcceleratingDistributor\\n * atomically in a single transaction. This intermediary contract also removes the need for claimer to approve\\n * AcceleratingDistributor to spend its staking tokens.\\n */\\n\\ncontract ClaimAndStake is ReentrancyGuard, Multicall {\\n using SafeERC20 for IERC20;\\n\\n // Contract which rewards tokens to users that they can then stake.\\n AcrossMerkleDistributor public immutable merkleDistributor;\\n\\n // Contract that user stakes claimed tokens into.\\n AcceleratingDistributor public immutable acceleratingDistributor;\\n\\n constructor(AcrossMerkleDistributor _merkleDistributor, AcceleratingDistributor _acceleratingDistributor) {\\n merkleDistributor = _merkleDistributor;\\n acceleratingDistributor = _acceleratingDistributor;\\n }\\n\\n /**************************************\\n * ADMIN FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Claim tokens from a MerkleDistributor contract and stake them for rewards in AcceleratingDistributor.\\n * @dev Will revert if `merkleDistributor` is not set to valid MerkleDistributor contract.\\n * @dev Will revert if the claim recipient account is not equal to caller, or if the reward token\\n * for claim is not a valid staking token.\\n * @dev Will revert if this contract is not a \\\"whitelisted claimer\\\" on the MerkleDistributor contract.\\n * @param _claim Claim leaf to retrieve from MerkleDistributor.\\n */\\n function claimAndStake(MerkleDistributorInterface.Claim memory _claim) external nonReentrant {\\n require(_claim.account == msg.sender, \\\"claim account not caller\\\");\\n address stakedToken = merkleDistributor.getRewardTokenForWindow(_claim.windowIndex);\\n merkleDistributor.claimFor(_claim);\\n IERC20(stakedToken).safeIncreaseAllowance(address(acceleratingDistributor), _claim.amount);\\n acceleratingDistributor.stakeFor(stakedToken, _claim.amount, msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xa1b7fc229e5f9db68a5ce61c456d483258d30223212b4c1597e3c6975d0b8190\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b5060405161118d38038061118d83398101604081905261002f91610063565b60016000556001600160a01b039182166080521660a05261009d565b6001600160a01b038116811461006057600080fd5b50565b6000806040838503121561007657600080fd5b82516100818161004b565b60208401519092506100928161004b565b809150509250929050565b60805160a0516110b16100dc6000396000818160560152818161037b01526103f801526000818160dc0152818161023901526102f101526110b16000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063096116341461005157806365837fac146100a2578063ac9650d8146100b7578063f4537f78146100d7575b600080fd5b6100787f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100b56100b0366004610bc1565b6100fe565b005b6100ca6100c5366004610cc5565b61045f565b6040516100999190610da8565b6100787f000000000000000000000000000000000000000000000000000000000000000081565b60026000540361016f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600055606081015173ffffffffffffffffffffffffffffffffffffffff1633146101f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f636c61696d206163636f756e74206e6f742063616c6c657200000000000000006044820152606401610166565b80516040517f761b429700000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169163761b4297916102709160040190815260200190565b602060405180830381865afa15801561028d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b19190610e28565b6040517f88f038a200000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906388f038a290610326908590600401610e45565b600060405180830381600087803b15801561034057600080fd5b505af1158015610354573d6000803e3d6000fd5b50505060208301516103a0915073ffffffffffffffffffffffffffffffffffffffff8316907f000000000000000000000000000000000000000000000000000000000000000090610555565b60208201516040517f9b8f04b700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015260248201929092523360448201527f000000000000000000000000000000000000000000000000000000000000000090911690639b8f04b790606401600060405180830381600087803b15801561043e57600080fd5b505af1158015610452573d6000803e3d6000fd5b5050600160005550505050565b60608167ffffffffffffffff81111561047a5761047a610af5565b6040519080825280602002602001820160405280156104ad57816020015b60608152602001906001900390816104985790505b50905060005b8281101561054d5761051d308585848181106104d1576104d1610ed5565b90506020028101906104e39190610f04565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061069092505050565b82828151811061052f5761052f610ed5565b6020026020010181905250808061054590610f9f565b9150506104b3565b505b92915050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156105cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f09190610fd7565b6105fa9190610ff0565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061068a9085906106bc565b50505050565b60606106b58383604051806060016040528060278152602001611055602791396107cd565b9392505050565b600061071e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166108f59092919063ffffffff16565b8051909150156107c8578080602001905181019061073c9190611003565b6107c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610166565b505050565b606073ffffffffffffffffffffffffffffffffffffffff84163b610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152608401610166565b6000808573ffffffffffffffffffffffffffffffffffffffff168560405161089b9190611025565b600060405180830381855af49150503d80600081146108d6576040519150601f19603f3d011682016040523d82523d6000602084013e6108db565b606091505b50915091506108eb82828661090c565b9695505050505050565b6060610904848460008561095f565b949350505050565b6060831561091b5750816106b5565b82511561092b5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101669190611041565b6060824710156109f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610166565b73ffffffffffffffffffffffffffffffffffffffff85163b610a6f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610166565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610a989190611025565b60006040518083038185875af1925050503d8060008114610ad5576040519150601f19603f3d011682016040523d82523d6000602084013e610ada565b606091505b5091509150610aea82828661090c565b979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160a0810167ffffffffffffffff81118282101715610b4757610b47610af5565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610b9457610b94610af5565b604052919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610bbe57600080fd5b50565b60006020808385031215610bd457600080fd5b823567ffffffffffffffff80821115610bec57600080fd5b9084019060a08287031215610c0057600080fd5b610c08610b24565b823581528383013584820152604083013560408201526060830135610c2c81610b9c565b6060820152608083013582811115610c4357600080fd5b80840193505086601f840112610c5857600080fd5b823582811115610c6a57610c6a610af5565b8060051b9250610c7b858401610b4d565b8181529284018501928581019089851115610c9557600080fd5b948601945b84861015610cb357853582529486019490860190610c9a565b60808401525090979650505050505050565b60008060208385031215610cd857600080fd5b823567ffffffffffffffff80821115610cf057600080fd5b818501915085601f830112610d0457600080fd5b813581811115610d1357600080fd5b8660208260051b8501011115610d2857600080fd5b60209290920196919550909350505050565b60005b83811015610d55578181015183820152602001610d3d565b50506000910152565b60008151808452610d76816020860160208601610d3a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015610e1b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452610e09858351610d5e565b94509285019290850190600101610dcf565b5092979650505050505050565b600060208284031215610e3a57600080fd5b81516106b581610b9c565b6000602080835260c083018451828501528185015160408501526040850151606085015273ffffffffffffffffffffffffffffffffffffffff6060860151166080850152608085015160a08086015281815180845260e0870191508483019350600092505b80831015610eca5783518252928401926001929092019190840190610eaa565b509695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112610f3957600080fd5b83018035915067ffffffffffffffff821115610f5457600080fd5b602001915036819003821315610f6957600080fd5b9250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610fd057610fd0610f70565b5060010190565b600060208284031215610fe957600080fd5b5051919050565b8082018082111561054f5761054f610f70565b60006020828403121561101557600080fd5b815180151581146106b557600080fd5b60008251611037818460208701610d3a565b9190910192915050565b6020815260006106b56020830184610d5e56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212203281adf218ef4b2d43c377ea564b96bd1fea9bec6e607d56a2cb0d6bc4a9cddf64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063096116341461005157806365837fac146100a2578063ac9650d8146100b7578063f4537f78146100d7575b600080fd5b6100787f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100b56100b0366004610bc1565b6100fe565b005b6100ca6100c5366004610cc5565b61045f565b6040516100999190610da8565b6100787f000000000000000000000000000000000000000000000000000000000000000081565b60026000540361016f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600055606081015173ffffffffffffffffffffffffffffffffffffffff1633146101f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f636c61696d206163636f756e74206e6f742063616c6c657200000000000000006044820152606401610166565b80516040517f761b429700000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169163761b4297916102709160040190815260200190565b602060405180830381865afa15801561028d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b19190610e28565b6040517f88f038a200000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906388f038a290610326908590600401610e45565b600060405180830381600087803b15801561034057600080fd5b505af1158015610354573d6000803e3d6000fd5b50505060208301516103a0915073ffffffffffffffffffffffffffffffffffffffff8316907f000000000000000000000000000000000000000000000000000000000000000090610555565b60208201516040517f9b8f04b700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015260248201929092523360448201527f000000000000000000000000000000000000000000000000000000000000000090911690639b8f04b790606401600060405180830381600087803b15801561043e57600080fd5b505af1158015610452573d6000803e3d6000fd5b5050600160005550505050565b60608167ffffffffffffffff81111561047a5761047a610af5565b6040519080825280602002602001820160405280156104ad57816020015b60608152602001906001900390816104985790505b50905060005b8281101561054d5761051d308585848181106104d1576104d1610ed5565b90506020028101906104e39190610f04565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061069092505050565b82828151811061052f5761052f610ed5565b6020026020010181905250808061054590610f9f565b9150506104b3565b505b92915050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156105cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f09190610fd7565b6105fa9190610ff0565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061068a9085906106bc565b50505050565b60606106b58383604051806060016040528060278152602001611055602791396107cd565b9392505050565b600061071e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166108f59092919063ffffffff16565b8051909150156107c8578080602001905181019061073c9190611003565b6107c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610166565b505050565b606073ffffffffffffffffffffffffffffffffffffffff84163b610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152608401610166565b6000808573ffffffffffffffffffffffffffffffffffffffff168560405161089b9190611025565b600060405180830381855af49150503d80600081146108d6576040519150601f19603f3d011682016040523d82523d6000602084013e6108db565b606091505b50915091506108eb82828661090c565b9695505050505050565b6060610904848460008561095f565b949350505050565b6060831561091b5750816106b5565b82511561092b5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101669190611041565b6060824710156109f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610166565b73ffffffffffffffffffffffffffffffffffffffff85163b610a6f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610166565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610a989190611025565b60006040518083038185875af1925050503d8060008114610ad5576040519150601f19603f3d011682016040523d82523d6000602084013e610ada565b606091505b5091509150610aea82828661090c565b979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160a0810167ffffffffffffffff81118282101715610b4757610b47610af5565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610b9457610b94610af5565b604052919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610bbe57600080fd5b50565b60006020808385031215610bd457600080fd5b823567ffffffffffffffff80821115610bec57600080fd5b9084019060a08287031215610c0057600080fd5b610c08610b24565b823581528383013584820152604083013560408201526060830135610c2c81610b9c565b6060820152608083013582811115610c4357600080fd5b80840193505086601f840112610c5857600080fd5b823582811115610c6a57610c6a610af5565b8060051b9250610c7b858401610b4d565b8181529284018501928581019089851115610c9557600080fd5b948601945b84861015610cb357853582529486019490860190610c9a565b60808401525090979650505050505050565b60008060208385031215610cd857600080fd5b823567ffffffffffffffff80821115610cf057600080fd5b818501915085601f830112610d0457600080fd5b813581811115610d1357600080fd5b8660208260051b8501011115610d2857600080fd5b60209290920196919550909350505050565b60005b83811015610d55578181015183820152602001610d3d565b50506000910152565b60008151808452610d76816020860160208601610d3a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015610e1b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452610e09858351610d5e565b94509285019290850190600101610dcf565b5092979650505050505050565b600060208284031215610e3a57600080fd5b81516106b581610b9c565b6000602080835260c083018451828501528185015160408501526040850151606085015273ffffffffffffffffffffffffffffffffffffffff6060860151166080850152608085015160a08086015281815180845260e0870191508483019350600092505b80831015610eca5783518252928401926001929092019190840190610eaa565b509695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112610f3957600080fd5b83018035915067ffffffffffffffff821115610f5457600080fd5b602001915036819003821315610f6957600080fd5b9250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610fd057610fd0610f70565b5060010190565b600060208284031215610fe957600080fd5b5051919050565b8082018082111561054f5761054f610f70565b60006020828403121561101557600080fd5b815180151581146106b557600080fd5b60008251611037818460208701610d3a565b9190910192915050565b6020815260006106b56020830184610d5e56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212203281adf218ef4b2d43c377ea564b96bd1fea9bec6e607d56a2cb0d6bc4a9cddf64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "claimAndStake((uint256,uint256,uint256,address,bytes32[]))": { + "details": "Will revert if `merkleDistributor` is not set to valid MerkleDistributor contract.Will revert if the claim recipient account is not equal to caller, or if the reward token for claim is not a valid staking token.Will revert if this contract is not a \"whitelisted claimer\" on the MerkleDistributor contract.", + "params": { + "_claim": "Claim leaf to retrieve from MerkleDistributor." + } + }, + "multicall(bytes[])": { + "details": "Receives and executes a batch of function calls on this contract." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "claimAndStake((uint256,uint256,uint256,address,bytes32[]))": { + "notice": "Claim tokens from a MerkleDistributor contract and stake them for rewards in AcceleratingDistributor." + } + }, + "notice": "Allows claimer to claim tokens from AcrossMerkleDistributor and stake into AcceleratingDistributor atomically in a single transaction. This intermediary contract also removes the need for claimer to approve AcceleratingDistributor to spend its staking tokens.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 303, + "contract": "contracts/ClaimAndStake.sol:ClaimAndStake", + "label": "_status", + "offset": 0, + "slot": "0", + "type": "t_uint256" + } + ], + "types": { + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/deployments/mainnet/solcInputs/17686732f199602ed40e6e94df0fb034.json b/deployments/mainnet/solcInputs/17686732f199602ed40e6e94df0fb034.json new file mode 100644 index 0000000..1c7ca8f --- /dev/null +++ b/deployments/mainnet/solcInputs/17686732f199602ed40e6e94df0fb034.json @@ -0,0 +1,96 @@ +{ + "language": "Solidity", + "sources": { + "contracts/AcceleratingDistributor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/Multicall.sol\";\n\n/**\n * @notice Across token distribution contract. Contract is inspired by Synthetix staking contract and Ampleforth geyser.\n * Stakers start by earning their pro-rata share of a baseEmissionRate per second which increases based on how long\n * they have staked in the contract, up to a max emission rate of baseEmissionRate * maxMultiplier. Multiple LP tokens\n * can be staked in this contract enabling depositors to batch stake and claim via multicall. Note that this contract is\n * only compatible with standard ERC20 tokens, and not tokens that charge fees on transfers, dynamically change\n * balance, or have double entry-points. It's up to the contract owner to ensure they only add supported tokens.\n */\n\ncontract AcceleratingDistributor is ReentrancyGuard, Ownable, Multicall {\n using SafeERC20 for IERC20;\n\n IERC20 public immutable rewardToken;\n\n // Each User deposit is tracked with the information below.\n struct UserDeposit {\n uint256 cumulativeBalance;\n uint256 averageDepositTime;\n uint256 rewardsAccumulatedPerToken;\n uint256 rewardsOutstanding;\n }\n\n struct StakingToken {\n bool enabled;\n uint256 baseEmissionRate;\n uint256 maxMultiplier;\n uint256 secondsToMaxMultiplier;\n uint256 cumulativeStaked;\n uint256 rewardPerTokenStored;\n uint256 lastUpdateTime;\n mapping(address => UserDeposit) stakingBalances;\n }\n\n mapping(address => StakingToken) public stakingTokens;\n\n modifier onlyEnabled(address stakedToken) {\n require(stakingTokens[stakedToken].enabled, \"stakedToken not enabled\");\n _;\n }\n\n modifier onlyInitialized(address stakedToken) {\n require(stakingTokens[stakedToken].lastUpdateTime != 0, \"stakedToken not initialized\");\n _;\n }\n\n constructor(address _rewardToken) {\n rewardToken = IERC20(_rewardToken);\n }\n\n function getCurrentTime() public view virtual returns (uint256) {\n return block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /**************************************\n * EVENTS *\n **************************************/\n\n event TokenConfiguredForStaking(\n address indexed token,\n bool enabled,\n uint256 baseEmissionRate,\n uint256 maxMultiplier,\n uint256 secondsToMaxMultiplier,\n uint256 lastUpdateTime\n );\n event RecoverToken(address indexed token, uint256 amount);\n event Stake(\n address indexed token,\n address indexed user,\n uint256 amount,\n uint256 averageDepositTime,\n uint256 cumulativeBalance,\n uint256 tokenCumulativeStaked\n );\n event Unstake(\n address indexed token,\n address indexed user,\n uint256 amount,\n uint256 remainingCumulativeBalance,\n uint256 tokenCumulativeStaked\n );\n event RewardsWithdrawn(\n address indexed token,\n address indexed user,\n uint256 rewardsToSend,\n uint256 tokenLastUpdateTime,\n uint256 tokenRewardPerTokenStored,\n uint256 userRewardsOutstanding,\n uint256 userRewardsPaidPerToken\n );\n event Exit(address indexed token, address indexed user, uint256 tokenCumulativeStaked);\n\n /**************************************\n * ADMIN FUNCTIONS *\n **************************************/\n\n /**\n * @notice Enable a token for staking.\n * @dev The owner should ensure that the token enabled is a standard ERC20 token to ensure correct functionality.\n * @param stakedToken The address of the token that can be staked.\n * @param enabled Whether the token is enabled for staking.\n * @param baseEmissionRate The base emission rate for staking the token. This is split pro-rata between all users.\n * @param maxMultiplier The maximum multiplier for staking which increases your rewards the longer you stake.\n * @param secondsToMaxMultiplier The number of seconds needed to stake to reach the maximum multiplier.\n */\n function configureStakingToken(\n address stakedToken,\n bool enabled,\n uint256 baseEmissionRate,\n uint256 maxMultiplier,\n uint256 secondsToMaxMultiplier\n ) external onlyOwner {\n // Validate input to ensure system stability and avoid unexpected behavior. Note we dont place a lower bound on\n // the baseEmissionRate. If this value is less than 1e18 then you will slowly loose your staking rewards over time.\n // Because of the way balances are managed, the staked token cannot be the reward token. Otherwise, reward\n // payouts could eat into user balances. We choose not to constrain `maxMultiplier` to be > 1e18 so that\n // admin can choose to allow decreasing emissions over time. This is not the intended use case, but we see no\n // benefit to removing this additional flexibility. If set < 1e18, then user's rewards outstanding will\n // decrease over time. Incentives for stakers would look different if `maxMultiplier` were set < 1e18\n require(stakedToken != address(rewardToken), \"Staked token is reward token\");\n require(maxMultiplier < 1e36, \"maxMultiplier can not be set too large\");\n require(secondsToMaxMultiplier > 0, \"secondsToMaxMultiplier must be greater than 0\");\n require(baseEmissionRate < 1e27, \"baseEmissionRate can not be set too large\");\n\n StakingToken storage stakingToken = stakingTokens[stakedToken];\n\n // If this token is already initialized, make sure we update the rewards before modifying any params.\n if (stakingToken.lastUpdateTime != 0) _updateReward(stakedToken, address(0));\n\n stakingToken.enabled = enabled;\n stakingToken.baseEmissionRate = baseEmissionRate;\n stakingToken.maxMultiplier = maxMultiplier;\n stakingToken.secondsToMaxMultiplier = secondsToMaxMultiplier;\n stakingToken.lastUpdateTime = getCurrentTime();\n\n emit TokenConfiguredForStaking(\n stakedToken,\n enabled,\n baseEmissionRate,\n maxMultiplier,\n secondsToMaxMultiplier,\n stakingToken.lastUpdateTime\n );\n }\n\n /**\n * @notice Enables the owner to recover tokens dropped onto the contract. This could be used to remove unclaimed\n * staking rewards or recover excess LP tokens that were inadvertently dropped onto the contract. Importantly, the\n * contract will only let the owner recover staked excess tokens above what the contract thinks it should have. i.e\n * the owner cant use this method to steal staked tokens, only recover excess ones mistakenly sent to the contract.\n * @param token The address of the token to skim.\n */\n function recoverToken(address token) external onlyOwner {\n // If the token is an enabled staking token then we want to preform a skim action where we send back any extra\n // tokens that are not accounted for in the cumulativeStaked variable. This lets the owner recover extra tokens\n // sent to the contract that were not explicitly staked. if the token is not enabled for staking then we simply\n // send back the full amount of tokens that the contract has.\n uint256 amount = IERC20(token).balanceOf(address(this));\n if (stakingTokens[token].lastUpdateTime != 0) amount -= stakingTokens[token].cumulativeStaked;\n require(amount > 0, \"Can't recover 0 tokens\");\n IERC20(token).safeTransfer(owner(), amount);\n emit RecoverToken(token, amount);\n }\n\n /**************************************\n * STAKER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Stake tokens for rewards.\n * @dev The caller of this function must approve this contract to spend amount of stakedToken.\n * @param stakedToken The address of the token to stake.\n * @param amount The amount of the token to stake.\n */\n function stake(address stakedToken, uint256 amount) external nonReentrant onlyEnabled(stakedToken) {\n _stake(stakedToken, amount, msg.sender);\n }\n\n /**\n * @notice Stake tokens for rewards on behalf of `beneficiary`.\n * @dev The caller of this function must approve this contract to spend amount of stakedToken.\n * @dev The caller of this function is effectively donating their tokens to the beneficiary. The beneficiary\n * can then unstake or claim rewards as they wish.\n * @param stakedToken The address of the token to stake.\n * @param amount The amount of the token to stake.\n * @param beneficiary User that caller wants to stake on behalf of.\n */\n function stakeFor(\n address stakedToken,\n uint256 amount,\n address beneficiary\n ) external nonReentrant onlyEnabled(stakedToken) {\n _stake(stakedToken, amount, beneficiary);\n }\n\n /**\n * @notice Withdraw staked tokens.\n * @param stakedToken The address of the token to withdraw.\n * @param amount The amount of the token to withdraw.\n */\n function unstake(address stakedToken, uint256 amount) public nonReentrant onlyInitialized(stakedToken) {\n _updateReward(stakedToken, msg.sender);\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[msg.sender];\n\n // Note: these will revert if underflow so you cant unstake more than your cumulativeBalance.\n userDeposit.cumulativeBalance -= amount;\n stakingTokens[stakedToken].cumulativeStaked -= amount;\n\n IERC20(stakedToken).safeTransfer(msg.sender, amount);\n\n emit Unstake(\n stakedToken,\n msg.sender,\n amount,\n userDeposit.cumulativeBalance,\n stakingTokens[stakedToken].cumulativeStaked\n );\n }\n\n /**\n * @notice Get entitled rewards for the staker.\n * @dev Calling this method will reset the caller's reward multiplier.\n * @param stakedToken The address of the token to get rewards for.\n */\n function withdrawReward(address stakedToken) public nonReentrant onlyInitialized(stakedToken) {\n _updateReward(stakedToken, msg.sender);\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[msg.sender];\n\n uint256 rewardsToSend = userDeposit.rewardsOutstanding;\n if (rewardsToSend > 0) {\n userDeposit.rewardsOutstanding = 0;\n userDeposit.averageDepositTime = getCurrentTime();\n rewardToken.safeTransfer(msg.sender, rewardsToSend);\n }\n\n emit RewardsWithdrawn(\n stakedToken,\n msg.sender,\n rewardsToSend,\n stakingTokens[stakedToken].lastUpdateTime,\n stakingTokens[stakedToken].rewardPerTokenStored,\n userDeposit.rewardsOutstanding,\n userDeposit.rewardsAccumulatedPerToken\n );\n }\n\n /**\n * @notice Exits a staking position by unstaking and getting rewards. This totally exits the staking position.\n * @dev Calling this method will reset the caller's reward multiplier.\n * @param stakedToken The address of the token to get rewards for.\n */\n function exit(address stakedToken) external onlyInitialized(stakedToken) {\n _updateReward(stakedToken, msg.sender);\n unstake(stakedToken, stakingTokens[stakedToken].stakingBalances[msg.sender].cumulativeBalance);\n withdrawReward(stakedToken);\n\n emit Exit(stakedToken, msg.sender, stakingTokens[stakedToken].cumulativeStaked);\n }\n\n /**************************************\n * VIEW FUNCTIONS *\n **************************************/\n\n /**\n * @notice Returns the total staked for a given stakedToken.\n * @param stakedToken The address of the staked token to query.\n * @return uint256 Total amount staked of the stakedToken.\n */\n function getCumulativeStaked(address stakedToken) external view returns (uint256) {\n return stakingTokens[stakedToken].cumulativeStaked;\n }\n\n /**\n * @notice Returns all the information associated with a user's stake.\n * @param stakedToken The address of the staked token to query.\n * @param account The address of user to query.\n * @return UserDeposit Struct with: {cumulativeBalance,averageDepositTime,rewardsAccumulatedPerToken,rewardsOutstanding}\n */\n function getUserStake(address stakedToken, address account) external view returns (UserDeposit memory) {\n return stakingTokens[stakedToken].stakingBalances[account];\n }\n\n /**\n * @notice Returns the base rewards per staked token for a given staking token. This factors in the last time\n * any internal logic was called on this contract to correctly attribute retroactive cumulative rewards.\n * @dev the value returned is represented by a uint256 with fixed precision of 18 decimals.\n * @param stakedToken The address of the staked token to query.\n * @return uint256 Total base reward per token that will be applied, pro-rata, to stakers.\n */\n function baseRewardPerToken(address stakedToken) public view returns (uint256) {\n StakingToken storage stakingToken = stakingTokens[stakedToken];\n if (stakingToken.cumulativeStaked == 0) return stakingToken.rewardPerTokenStored;\n\n return\n stakingToken.rewardPerTokenStored +\n ((getCurrentTime() - stakingToken.lastUpdateTime) * stakingToken.baseEmissionRate * 1e18) /\n stakingToken.cumulativeStaked;\n }\n\n /**\n * @notice Returns the multiplier applied to the base reward per staked token for a given staking token and account.\n * The longer a user stakes the higher their multiplier up to maxMultiplier for that given staking token.\n * any internal logic was called on this contract to correctly attribute retroactive cumulative rewards.\n * @dev the value returned is represented by a uint256 with fixed precision of 18 decimals.\n * @param stakedToken The address of the staked token to query.\n * @param account The address of the user to query.\n * @return uint256 User multiplier, applied to the baseRewardPerToken, when claiming rewards.\n */\n function getUserRewardMultiplier(address stakedToken, address account) public view returns (uint256) {\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[account];\n if (userDeposit.averageDepositTime == 0 || userDeposit.cumulativeBalance == 0) return 1e18;\n uint256 fractionOfMaxMultiplier = ((getTimeSinceAverageDeposit(stakedToken, account)) * 1e18) /\n stakingTokens[stakedToken].secondsToMaxMultiplier;\n\n // At maximum, the multiplier should be equal to the maxMultiplier.\n if (fractionOfMaxMultiplier > 1e18) fractionOfMaxMultiplier = 1e18;\n return 1e18 + (fractionOfMaxMultiplier * (stakingTokens[stakedToken].maxMultiplier - 1e18)) / (1e18);\n }\n\n /**\n * @notice Returns the total outstanding rewards entitled to a user for a given staking token. This factors in the\n * users staking duration (and therefore reward multiplier) and their pro-rata share of the total rewards.\n * @param stakedToken The address of the staked token to query.\n * @param account The address of the user to query.\n * @return uint256 Total outstanding rewards entitled to user.\n */\n function getOutstandingRewards(address stakedToken, address account) public view returns (uint256) {\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[account];\n\n uint256 userRewardMultiplier = getUserRewardMultiplier(stakedToken, account);\n\n uint256 newUserRewards = (userDeposit.cumulativeBalance *\n (baseRewardPerToken(stakedToken) - userDeposit.rewardsAccumulatedPerToken) *\n userRewardMultiplier) / (1e18 * 1e18);\n\n return newUserRewards + userDeposit.rewardsOutstanding;\n }\n\n /**\n * @notice Returns the time that has elapsed between the current time and the last users average deposit time.\n * @param stakedToken The address of the staked token to query.\n * @param account The address of the user to query.\n *@return uint256 Time, in seconds, between the users average deposit time and the current time.\n */\n function getTimeSinceAverageDeposit(address stakedToken, address account) public view returns (uint256) {\n return getCurrentTime() - stakingTokens[stakedToken].stakingBalances[account].averageDepositTime;\n }\n\n /**\n * @notice Returns a users new average deposit time, considering the addition of a new deposit. This factors in the\n * cumulative previous deposits, new deposit and time from the last deposit.\n * @param stakedToken The address of the staked token to query.\n * @param account The address of the user to query.\n * @return uint256 Average post deposit time, considering all deposits to date.\n */\n function getAverageDepositTimePostDeposit(\n address stakedToken,\n address account,\n uint256 amount\n ) public view returns (uint256) {\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[account];\n if (amount == 0) return userDeposit.averageDepositTime;\n uint256 amountWeightedTime = (((amount * 1e18) / (userDeposit.cumulativeBalance + amount)) *\n (getTimeSinceAverageDeposit(stakedToken, account))) / 1e18;\n return userDeposit.averageDepositTime + amountWeightedTime;\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n // Update the internal counters for a given stakedToken and user.\n function _updateReward(address stakedToken, address account) internal {\n StakingToken storage stakingToken = stakingTokens[stakedToken];\n stakingToken.rewardPerTokenStored = baseRewardPerToken(stakedToken);\n stakingToken.lastUpdateTime = getCurrentTime();\n if (account != address(0)) {\n UserDeposit storage userDeposit = stakingToken.stakingBalances[account];\n userDeposit.rewardsOutstanding = getOutstandingRewards(stakedToken, account);\n userDeposit.rewardsAccumulatedPerToken = stakingToken.rewardPerTokenStored;\n }\n }\n\n function _stake(\n address stakedToken,\n uint256 amount,\n address staker\n ) internal {\n _updateReward(stakedToken, staker);\n\n UserDeposit storage userDeposit = stakingTokens[stakedToken].stakingBalances[staker];\n\n uint256 averageDepositTime = getAverageDepositTimePostDeposit(stakedToken, staker, amount);\n\n userDeposit.averageDepositTime = averageDepositTime;\n userDeposit.cumulativeBalance += amount;\n stakingTokens[stakedToken].cumulativeStaked += amount;\n\n IERC20(stakedToken).safeTransferFrom(msg.sender, address(this), amount);\n emit Stake(\n stakedToken,\n staker,\n amount,\n averageDepositTime,\n userDeposit.cumulativeBalance,\n stakingTokens[stakedToken].cumulativeStaked\n );\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-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 function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) 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(\n IERC20 token,\n address spender,\n uint256 value\n ) 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 function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\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 if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\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" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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/utils/Multicall.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./Address.sol\";\n\n/**\n * @dev Provides a function to batch together multiple calls in a single external call.\n *\n * _Available since v4.1._\n */\nabstract contract Multicall {\n /**\n * @dev Receives and executes a batch of function calls on this contract.\n */\n function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n results[i] = Address.functionDelegateCall(address(this), data[i]);\n }\n return results;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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 */\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 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/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 *\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \"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(\n address target,\n bytes memory data,\n uint256 value\n ) 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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(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 require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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" + }, + "contracts/test/AcceleratingDistributor_Testable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../AcceleratingDistributor.sol\";\nimport \"./Testable.sol\";\n\n/**\n * @notice // Testable version of the AcceleratingDistributor that enables time to be overridden with a Testable contract.\n */\n\ncontract AcceleratingDistributor_Testable is AcceleratingDistributor, Testable {\n constructor(address _rewardToken, address _timer) AcceleratingDistributor(_rewardToken) Testable(_timer) {}\n\n function getCurrentTime() public view override(AcceleratingDistributor, Testable) returns (uint256) {\n return Testable.getCurrentTime();\n }\n}\n" + }, + "contracts/test/Testable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Timer.sol\";\n\n/**\n * @title Base class that provides time overrides, but only if being run in test mode.\n */\nabstract contract Testable {\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\n // Note: this variable should be set on construction and never modified.\n address public timerAddress;\n\n /**\n * @notice Constructs the Testable contract. Called by child contracts.\n * @param _timerAddress Contract that stores the current time in a testing environment.\n * Must be set to 0x0 for production environments that use live time.\n */\n constructor(address _timerAddress) {\n timerAddress = _timerAddress;\n }\n\n /**\n * @notice Reverts if not running in test mode.\n */\n modifier onlyIfTest() {\n require(timerAddress != address(0x0));\n _;\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set current Testable time to.\n */\n function setCurrentTime(uint256 time) external onlyIfTest {\n Timer(timerAddress).setCurrentTime(time);\n }\n\n /**\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\n * Otherwise, it will return the block timestamp.\n * @return uint for the current Testable timestamp.\n */\n function getCurrentTime() public view virtual returns (uint256) {\n if (timerAddress != address(0x0)) return Timer(timerAddress).getCurrentTime();\n else return block.timestamp; // solhint-disable-line not-rely-on-time\n }\n}\n" + }, + "contracts/test/Timer.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Universal store of current contract time for testing environments.\n */\ncontract Timer {\n uint256 private currentTime;\n\n constructor() {\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set `currentTime` to.\n */\n function setCurrentTime(uint256 time) external {\n currentTime = time;\n }\n\n /**\n * @notice Gets the currentTime variable set in the Timer.\n * @return uint256 for the current Testable timestamp.\n */\n function getCurrentTime() public view returns (uint256) {\n return currentTime;\n }\n}\n" + }, + "contracts/ClaimAndStake.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"@openzeppelin/contracts/utils/Multicall.sol\";\nimport \"@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol\";\nimport \"./AcceleratingDistributor.sol\";\n\n/**\n * @notice Allows claimer to claim tokens from AcrossMerkleDistributor and stake into AcceleratingDistributor\n * atomically in a single transaction. This intermediary contract also removes the need for claimer to approve\n * AcceleratingDistributor to spend its staking tokens.\n */\n\ncontract ClaimAndStake is ReentrancyGuard, Multicall {\n using SafeERC20 for IERC20;\n\n // Contract which rewards tokens to users that they can then stake.\n AcrossMerkleDistributor public immutable merkleDistributor;\n\n // Contract that user stakes claimed tokens into.\n AcceleratingDistributor public immutable acceleratingDistributor;\n\n constructor(AcrossMerkleDistributor _merkleDistributor, AcceleratingDistributor _acceleratingDistributor) {\n merkleDistributor = _merkleDistributor;\n acceleratingDistributor = _acceleratingDistributor;\n }\n\n /**************************************\n * ADMIN FUNCTIONS *\n **************************************/\n\n /**\n * @notice Claim tokens from a MerkleDistributor contract and stake them for rewards in AcceleratingDistributor.\n * @dev Will revert if `merkleDistributor` is not set to valid MerkleDistributor contract.\n * @dev Will revert if the claim recipient account is not equal to caller, or if the reward token\n * for claim is not a valid staking token.\n * @dev Will revert if this contract is not a \"whitelisted claimer\" on the MerkleDistributor contract.\n * @param _claim Claim leaf to retrieve from MerkleDistributor.\n */\n function claimAndStake(MerkleDistributorInterface.Claim memory _claim) external nonReentrant {\n require(_claim.account == msg.sender, \"claim account not caller\");\n address stakedToken = merkleDistributor.getRewardTokenForWindow(_claim.windowIndex);\n merkleDistributor.claimFor(_claim);\n IERC20(stakedToken).safeIncreaseAllowance(address(acceleratingDistributor), _claim.amount);\n acceleratingDistributor.stakeFor(stakedToken, _claim.amount, msg.sender);\n }\n}\n" + }, + "@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@uma/core/contracts/merkle-distributor/implementation/MerkleDistributor.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title Extended MerkleDistributor contract.\n * @notice Adds additional constraints governing who can claim leaves from merkle windows.\n */\ncontract AcrossMerkleDistributor is MerkleDistributor {\n using SafeERC20 for IERC20;\n\n // Addresses that can claim on user's behalf.\n mapping(address => bool) public whitelistedClaimers;\n\n /****************************************\n * EVENTS\n ****************************************/\n event WhitelistedClaimer(address indexed claimer, bool indexed whitelist);\n event ClaimFor(\n address indexed caller,\n uint256 windowIndex,\n address indexed account,\n uint256 accountIndex,\n uint256 amount,\n address indexed rewardToken\n );\n\n /****************************\n * ADMIN FUNCTIONS\n ****************************/\n\n /**\n * @notice Updates whitelisted claimer status.\n * @dev Callable only by owner.\n * @param newContract Reset claimer contract to this address.\n * @param whitelist True to whitelist claimer, False otherwise.\n */\n function whitelistClaimer(address newContract, bool whitelist) external onlyOwner {\n whitelistedClaimers[newContract] = whitelist;\n emit WhitelistedClaimer(newContract, whitelist);\n }\n\n /****************************\n * NON-ADMIN FUNCTIONS\n ****************************/\n\n /**\n * @notice Batch claims to reduce gas versus individual submitting all claims. Method will fail\n * if any individual claims within the batch would fail.\n * @dev All claim recipients must be equal to msg.sender.\n * @param claims array of claims to claim.\n */\n function claimMulti(Claim[] memory claims) public override {\n uint256 claimCount = claims.length;\n for (uint256 i = 0; i < claimCount; i++) {\n require(claims[i].account == msg.sender, \"invalid claimer\");\n }\n super.claimMulti(claims);\n }\n\n /**\n * @notice Claim amount of reward tokens for account, as described by Claim input object.\n * @dev Claim recipient must be equal to msg.sender.\n * @param _claim claim object describing amount, accountIndex, account, window index, and merkle proof.\n */\n function claim(Claim memory _claim) public override {\n require(_claim.account == msg.sender, \"invalid claimer\");\n super.claim(_claim);\n }\n\n /**\n * @notice Executes merkle leaf claim on behaf of user. This can only be called by a trusted\n * claimer address. This function is designed to be called atomically with other transactions\n * that ultimately return the claimed amount to the rightful recipient. For example,\n * AcceleratingDistributor could call this function and then stake atomically on behalf of the user.\n * @dev Caller must be in whitelistedClaimers struct set to \"true\".\n * @param _claim leaf to claim.\n */\n\n function claimFor(Claim memory _claim) public {\n require(whitelistedClaimers[msg.sender], \"unwhitelisted claimer\");\n _verifyAndMarkClaimed(_claim);\n merkleWindows[_claim.windowIndex].rewardToken.safeTransfer(msg.sender, _claim.amount);\n emit ClaimFor(\n msg.sender,\n _claim.windowIndex,\n _claim.account,\n _claim.accountIndex,\n _claim.amount,\n address(merkleWindows[_claim.windowIndex].rewardToken)\n );\n }\n}\n" + }, + "@uma/core/contracts/merkle-distributor/implementation/MerkleDistributor.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./MerkleDistributorInterface.sol\";\n\n/**\n * Inspired by:\n * - https://github.com/pie-dao/vested-token-migration-app\n * - https://github.com/Uniswap/merkle-distributor\n * - https://github.com/balancer-labs/erc20-redeemable\n *\n * @title MerkleDistributor contract.\n * @notice Allows an owner to distribute any reward ERC20 to claimants according to Merkle roots. The owner can specify\n * multiple Merkle roots distributions with customized reward currencies.\n * @dev The Merkle trees are not validated in any way, so the system assumes the contract owner behaves honestly.\n */\ncontract MerkleDistributor is MerkleDistributorInterface, Ownable {\n using SafeERC20 for IERC20;\n\n // Windows are mapped to arbitrary indices.\n mapping(uint256 => Window) public merkleWindows;\n\n // Index of next created Merkle root.\n uint256 public nextCreatedIndex;\n\n // Track which accounts have claimed for each window index.\n // Note: uses a packed array of bools for gas optimization on tracking certain claims. Copied from Uniswap's contract.\n mapping(uint256 => mapping(uint256 => uint256)) private claimedBitMap;\n\n /****************************************\n * EVENTS\n ****************************************/\n event Claimed(\n address indexed caller,\n uint256 windowIndex,\n address indexed account,\n uint256 accountIndex,\n uint256 amount,\n address indexed rewardToken\n );\n event CreatedWindow(\n uint256 indexed windowIndex,\n uint256 rewardsDeposited,\n address indexed rewardToken,\n address owner\n );\n event WithdrawRewards(address indexed owner, uint256 amount, address indexed currency);\n event DeleteWindow(uint256 indexed windowIndex, address owner);\n\n /****************************\n * ADMIN FUNCTIONS\n ****************************/\n\n /**\n * @notice Set merkle root for the next available window index and seed allocations.\n * @notice Callable only by owner of this contract. Caller must have approved this contract to transfer\n * `rewardsToDeposit` amount of `rewardToken` or this call will fail. Importantly, we assume that the\n * owner of this contract correctly chooses an amount `rewardsToDeposit` that is sufficient to cover all\n * claims within the `merkleRoot`.\n * @param rewardsToDeposit amount of rewards to deposit to seed this allocation.\n * @param rewardToken ERC20 reward token.\n * @param merkleRoot merkle root describing allocation.\n * @param ipfsHash hash of IPFS object, conveniently stored for clients\n */\n function setWindow(\n uint256 rewardsToDeposit,\n address rewardToken,\n bytes32 merkleRoot,\n string calldata ipfsHash\n ) external onlyOwner {\n uint256 indexToSet = nextCreatedIndex;\n nextCreatedIndex = indexToSet + 1;\n\n _setWindow(indexToSet, rewardsToDeposit, rewardToken, merkleRoot, ipfsHash);\n }\n\n /**\n * @notice Delete merkle root at window index.\n * @dev Callable only by owner. Likely to be followed by a withdrawRewards call to clear contract state.\n * @param windowIndex merkle root index to delete.\n */\n function deleteWindow(uint256 windowIndex) external onlyOwner {\n delete merkleWindows[windowIndex];\n emit DeleteWindow(windowIndex, msg.sender);\n }\n\n /**\n * @notice Emergency method that transfers rewards out of the contract if the contract was configured improperly.\n * @dev Callable only by owner.\n * @param rewardCurrency rewards to withdraw from contract.\n * @param amount amount of rewards to withdraw.\n */\n function withdrawRewards(IERC20 rewardCurrency, uint256 amount) external onlyOwner {\n rewardCurrency.safeTransfer(msg.sender, amount);\n emit WithdrawRewards(msg.sender, amount, address(rewardCurrency));\n }\n\n /****************************\n * NON-ADMIN FUNCTIONS\n ****************************/\n\n /**\n * @notice Batch claims to reduce gas versus individual submitting all claims. Method will fail\n * if any individual claims within the batch would fail.\n * @dev Optimistically tries to batch together consecutive claims for the same account and same\n * reward token to reduce gas. Therefore, the most gas-cost-optimal way to use this method\n * is to pass in an array of claims sorted by account and reward currency. It also reverts\n * when any of individual `_claim`'s `amount` exceeds `remainingAmount` for its window.\n * @param claims array of claims to claim.\n */\n function claimMulti(Claim[] memory claims) public virtual override {\n uint256 batchedAmount;\n uint256 claimCount = claims.length;\n for (uint256 i = 0; i < claimCount; i++) {\n Claim memory _claim = claims[i];\n _verifyAndMarkClaimed(_claim);\n batchedAmount += _claim.amount;\n\n // If the next claim is NOT the same account or the same token (or this claim is the last one),\n // then disburse the `batchedAmount` to the current claim's account for the current claim's reward token.\n uint256 nextI = i + 1;\n IERC20 currentRewardToken = merkleWindows[_claim.windowIndex].rewardToken;\n if (\n nextI == claimCount ||\n // This claim is last claim.\n claims[nextI].account != _claim.account ||\n // Next claim account is different than current one.\n merkleWindows[claims[nextI].windowIndex].rewardToken != currentRewardToken\n // Next claim reward token is different than current one.\n ) {\n currentRewardToken.safeTransfer(_claim.account, batchedAmount);\n batchedAmount = 0;\n }\n }\n }\n\n /**\n * @notice Claim amount of reward tokens for account, as described by Claim input object.\n * @dev If the `_claim`'s `amount`, `accountIndex`, and `account` do not exactly match the\n * values stored in the merkle root for the `_claim`'s `windowIndex` this method\n * will revert. It also reverts when `_claim`'s `amount` exceeds `remainingAmount` for the window.\n * @param _claim claim object describing amount, accountIndex, account, window index, and merkle proof.\n */\n function claim(Claim memory _claim) public virtual override {\n _verifyAndMarkClaimed(_claim);\n merkleWindows[_claim.windowIndex].rewardToken.safeTransfer(_claim.account, _claim.amount);\n }\n\n /**\n * @notice Returns True if the claim for `accountIndex` has already been completed for the Merkle root at\n * `windowIndex`.\n * @dev This method will only work as intended if all `accountIndex`'s are unique for a given `windowIndex`.\n * The onus is on the Owner of this contract to submit only valid Merkle roots.\n * @param windowIndex merkle root to check.\n * @param accountIndex account index to check within window index.\n * @return True if claim has been executed already, False otherwise.\n */\n function isClaimed(uint256 windowIndex, uint256 accountIndex) public view returns (bool) {\n uint256 claimedWordIndex = accountIndex / 256;\n uint256 claimedBitIndex = accountIndex % 256;\n uint256 claimedWord = claimedBitMap[windowIndex][claimedWordIndex];\n uint256 mask = (1 << claimedBitIndex);\n return claimedWord & mask == mask;\n }\n\n /**\n * @notice Returns rewardToken set by admin for windowIndex.\n * @param windowIndex merkle root to check.\n * @return address Reward token address\n */\n function getRewardTokenForWindow(uint256 windowIndex) public view override returns (address) {\n return address(merkleWindows[windowIndex].rewardToken);\n }\n\n /**\n * @notice Returns True if leaf described by {account, amount, accountIndex} is stored in Merkle root at given\n * window index.\n * @param _claim claim object describing amount, accountIndex, account, window index, and merkle proof.\n * @return valid True if leaf exists.\n */\n function verifyClaim(Claim memory _claim) public view returns (bool valid) {\n bytes32 leaf = keccak256(abi.encodePacked(_claim.account, _claim.amount, _claim.accountIndex));\n return MerkleProof.verify(_claim.merkleProof, merkleWindows[_claim.windowIndex].merkleRoot, leaf);\n }\n\n /****************************\n * PRIVATE FUNCTIONS\n ****************************/\n\n // Mark claim as completed for `accountIndex` for Merkle root at `windowIndex`.\n function _setClaimed(uint256 windowIndex, uint256 accountIndex) private {\n uint256 claimedWordIndex = accountIndex / 256;\n uint256 claimedBitIndex = accountIndex % 256;\n claimedBitMap[windowIndex][claimedWordIndex] =\n claimedBitMap[windowIndex][claimedWordIndex] |\n (1 << claimedBitIndex);\n }\n\n // Store new Merkle root at `windowindex`. Pull `rewardsDeposited` from caller to seed distribution for this root.\n function _setWindow(\n uint256 windowIndex,\n uint256 rewardsDeposited,\n address rewardToken,\n bytes32 merkleRoot,\n string memory ipfsHash\n ) private {\n Window storage window = merkleWindows[windowIndex];\n window.merkleRoot = merkleRoot;\n window.remainingAmount = rewardsDeposited;\n window.rewardToken = IERC20(rewardToken);\n window.ipfsHash = ipfsHash;\n\n emit CreatedWindow(windowIndex, rewardsDeposited, rewardToken, msg.sender);\n\n window.rewardToken.safeTransferFrom(msg.sender, address(this), rewardsDeposited);\n }\n\n // Verify claim is valid and mark it as completed in this contract.\n function _verifyAndMarkClaimed(Claim memory _claim) internal {\n // Check claimed proof against merkle window at given index.\n require(verifyClaim(_claim), \"Incorrect merkle proof\");\n // Check the account has not yet claimed for this window.\n require(!isClaimed(_claim.windowIndex, _claim.accountIndex), \"Account has already claimed for this window\");\n\n // Proof is correct and claim has not occurred yet, mark claimed complete.\n _setClaimed(_claim.windowIndex, _claim.accountIndex);\n merkleWindows[_claim.windowIndex].remainingAmount -= _claim.amount;\n emit Claimed(\n msg.sender,\n _claim.windowIndex,\n _claim.account,\n _claim.accountIndex,\n _claim.amount,\n address(merkleWindows[_claim.windowIndex].rewardToken)\n );\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Tree proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n *\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\n * hashing, or use a hash function other than keccak256 for hashing leaves.\n * This is because the concatenation of a sorted pair of internal nodes in\n * the merkle tree could be reinterpreted as a leaf value.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Calldata version of {verify}\n *\n * _Available since v4.7._\n */\n function verifyCalldata(\n bytes32[] calldata proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProofCalldata(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Calldata version of {processProof}\n *\n * _Available since v4.7._\n */\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\n *\n * _Available since v4.7._\n */\n function multiProofVerify(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProof(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Calldata version of {multiProofVerify}\n *\n * _Available since v4.7._\n */\n function multiProofVerifyCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`,\n * consuming from one or the other at each step according to the instructions given by\n * `proofFlags`.\n *\n * _Available since v4.7._\n */\n function processMultiProof(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proof.length - 1 == totalHashes, \"MerkleProof: invalid multiproof\");\n\n // The xxxPos values are \"pointers\" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \"pop\".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the \"main queue\". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value for the \"main queue\" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n return hashes[totalHashes - 1];\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n /**\n * @dev Calldata version of {processMultiProof}\n *\n * _Available since v4.7._\n */\n function processMultiProofCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proof.length - 1 == totalHashes, \"MerkleProof: invalid multiproof\");\n\n // The xxxPos values are \"pointers\" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \"pop\".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the \"main queue\". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value for the \"main queue\" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n return hashes[totalHashes - 1];\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n" + }, + "@uma/core/contracts/merkle-distributor/implementation/MerkleDistributorInterface.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Concise list of functions in MerkleDistributor implementation that would be called by\n * a consuming external contract (such as the Across Protocol's AcceleratingDistributor).\n */\ninterface MerkleDistributorInterface {\n // A Window maps a Merkle root to a reward token address.\n struct Window {\n // Merkle root describing the distribution.\n bytes32 merkleRoot;\n // Remaining amount of deposited rewards that have not yet been claimed.\n uint256 remainingAmount;\n // Currency in which reward is processed.\n IERC20 rewardToken;\n // IPFS hash of the merkle tree. Can be used to independently fetch recipient proofs and tree. Note that the canonical\n // data type for storing an IPFS hash is a multihash which is the concatenation of \n // . We opted to store this in a string type to make it easier\n // for users to query the ipfs data without needing to reconstruct the multihash. to view the IPFS data simply\n // go to https://cloudflare-ipfs.com/ipfs/.\n string ipfsHash;\n }\n\n // Represents an account's claim for `amount` within the Merkle root located at the `windowIndex`.\n struct Claim {\n uint256 windowIndex;\n uint256 amount;\n uint256 accountIndex; // Used only for bitmap. Assumed to be unique for each claim.\n address account;\n bytes32[] merkleProof;\n }\n\n function claim(Claim memory _claim) external;\n\n function claimMulti(Claim[] memory claims) external;\n\n function getRewardTokenForWindow(uint256 windowIndex) external view returns (address);\n}\n" + }, + "contracts/test/MerkleDistributorTest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\nimport \"@across-protocol/contracts-v2/contracts/merkle-distributor/AcrossMerkleDistributor.sol\";\n\npragma solidity ^0.8.0;\n\n/// @notice Pass through contract that allows tests to access MerkleDistributor from /artifacts via\n// utils.getContractFactory()\ncontract MerkleDistributorTest is AcrossMerkleDistributor {\n\n}\n" + }, + "contracts/test/TestToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract TestToken is ERC20, Ownable {\n constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) {}\n\n function mint(address _guy, uint256 _wad) public onlyOwner {\n _mint(_guy, _wad);\n }\n\n function burn(address _guy, uint256 _wad) public onlyOwner {\n _burn(_guy, _wad);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\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 * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\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 value {ERC20} uses, unless this function is\n * 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(\n address from,\n address to,\n uint256 amount\n ) 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(\n address from,\n address to,\n uint256 amount\n ) 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 }\n _balances[to] += amount;\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 _balances[account] += amount;\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 }\n _totalSupply -= amount;\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(\n address owner,\n address spender,\n uint256 amount\n ) 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(\n address owner,\n address spender,\n uint256 amount\n ) 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(\n address from,\n address to,\n uint256 amount\n ) 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(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\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" + }, + "contracts/AcrossToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract AcrossToken is ERC20, Ownable {\n constructor() ERC20(\"Across Protocol Token\", \"ACX\") {}\n\n function mint(address _guy, uint256 _wad) external onlyOwner {\n _mint(_guy, _wad);\n }\n\n function burn(address _guy, uint256 _wad) external onlyOwner {\n _burn(_guy, _wad);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": ["ast"] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} diff --git a/package.json b/package.json index 2077d2d..2157574 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@across-protocol/across-token", - "version": "0.0.2", + "version": "1.0.0", "description": "Across Protocol token and distribution contracts", "main": "dist/index.js", "types": "dist/index.d.ts",