From 72ff7b3fd2a4404db67cdd3d80c5ca55396c7f84 Mon Sep 17 00:00:00 2001 From: Nicholas Addison Date: Fri, 10 Oct 2025 19:50:38 +1100 Subject: [PATCH 1/7] Allow withdraws from the staking strategy by the Registrator for automation --- .../NativeStaking/CompoundingStakingSSVStrategy.sol | 8 ++++++-- .../NativeStaking/CompoundingValidatorManager.sol | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/contracts/contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol b/contracts/contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol index dee216cb34..cf4f3d6c2d 100644 --- a/contracts/contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol +++ b/contracts/contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol @@ -116,8 +116,12 @@ contract CompoundingStakingSSVStrategy is address _recipient, address _asset, uint256 _amount - ) external override onlyVault nonReentrant { + ) external override nonReentrant { require(_asset == WETH, "Unsupported asset"); + require( + msg.sender == vaultAddress || msg.sender == validatorRegistrator, + "Caller not Vault or Registrator" + ); _withdraw(_recipient, _amount, address(this).balance); } @@ -128,7 +132,7 @@ contract CompoundingStakingSSVStrategy is uint256 _ethBalance ) internal { require(_withdrawAmount > 0, "Must withdraw something"); - require(_recipient != address(0), "Must specify recipient"); + require(_recipient == vaultAddress, "Recipient not Vault"); // Convert any ETH from validator partial withdrawals, exits // or execution rewards to WETH and do the necessary accounting. diff --git a/contracts/contracts/strategies/NativeStaking/CompoundingValidatorManager.sol b/contracts/contracts/strategies/NativeStaking/CompoundingValidatorManager.sol index f0d030c4a6..09349db53e 100644 --- a/contracts/contracts/strategies/NativeStaking/CompoundingValidatorManager.sol +++ b/contracts/contracts/strategies/NativeStaking/CompoundingValidatorManager.sol @@ -55,7 +55,7 @@ abstract contract CompoundingValidatorManager is Governable, Pausable { /// @notice The address of the beacon chain deposit contract address internal immutable BEACON_CHAIN_DEPOSIT_CONTRACT; /// @notice The address of the SSV Network contract used to interface with - address public immutable SSV_NETWORK; + address internal immutable SSV_NETWORK; /// @notice Address of the OETH Vault proxy contract address internal immutable VAULT_ADDRESS; /// @notice Address of the Beacon Proofs contract that verifies beacon chain data From 4995c94cdc58f3033dae807021f45cc2a4124258 Mon Sep 17 00:00:00 2001 From: Nicholas Addison Date: Fri, 10 Oct 2025 19:51:13 +1100 Subject: [PATCH 2/7] Added signMessage HH task for Etherscan ownership verification --- contracts/tasks/crypto.js | 9 +++++++++ contracts/tasks/tasks.js | 15 +++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/contracts/tasks/crypto.js b/contracts/tasks/crypto.js index 26ee790973..897870e9ca 100644 --- a/contracts/tasks/crypto.js +++ b/contracts/tasks/crypto.js @@ -178,9 +178,18 @@ const concatKDF = (secret, s1, keyLen) => { return hashSum.slice(0, keyLen); }; +const signMessage = async ({ signer, message }) => { + console.log(`Message: ${message}`); + console.log(`Signer: ${await signer.getAddress()}`); + + const hash = await signer.signMessage(message); + console.log(`Hash: ${hash}`); +}; + module.exports = { genECDHKey, decryptValidatorKey, decryptValidatorKeyWithMasterKey, decryptValidatorKeyFromStorage, + signMessage, }; diff --git a/contracts/tasks/tasks.js b/contracts/tasks/tasks.js index 1ccec5c3ea..546a471a36 100644 --- a/contracts/tasks/tasks.js +++ b/contracts/tasks/tasks.js @@ -11,6 +11,7 @@ const { genECDHKey, decryptValidatorKey, decryptValidatorKeyWithMasterKey, + signMessage, } = require("./crypto"); const { advanceBlocks } = require("./block"); const { @@ -1651,6 +1652,20 @@ task("masterDecrypt").setAction(async (_, __, runSuper) => { return runSuper(); }); +subtask( + "signMessage", + "Sign a message using a Elliptic-curve Diffie–Hellman (ECDH) private key" +) + .addParam("message", "Message to be signed", undefined, types.string) + .setAction(async (taskArgs) => { + const signer = await getSigner(); + + await signMessage({ ...taskArgs, signer }); + }); +task("signMessage").setAction(async (_, __, runSuper) => { + return runSuper(); +}); + // Defender subtask( "setActionVars", From 88f618a5c282447f9e97af940c05bac3b07acda2 Mon Sep 17 00:00:00 2001 From: Nicholas Addison Date: Mon, 13 Oct 2025 15:37:55 +1100 Subject: [PATCH 3/7] Deployed latest strategy contract to Hoodi --- .../hoodi/031_upgrade_staking_contracts.js | 15 ++ contracts/deployments/hoodi/.migrations.json | 3 +- .../hoodi/CompoundingStakingSSVStrategy.json | 167 ++++++++---------- .../6009afe519e1f288a46249ae425a2ffb.json | 105 +++++++++++ 4 files changed, 191 insertions(+), 99 deletions(-) create mode 100644 contracts/deploy/hoodi/031_upgrade_staking_contracts.js create mode 100644 contracts/deployments/hoodi/solcInputs/6009afe519e1f288a46249ae425a2ffb.json diff --git a/contracts/deploy/hoodi/031_upgrade_staking_contracts.js b/contracts/deploy/hoodi/031_upgrade_staking_contracts.js new file mode 100644 index 0000000000..f65d23683b --- /dev/null +++ b/contracts/deploy/hoodi/031_upgrade_staking_contracts.js @@ -0,0 +1,15 @@ +const { upgradeCompoundingStakingSSVStrategy } = require("../deployActions"); + +const mainExport = async () => { + await upgradeCompoundingStakingSSVStrategy(); + + console.log("Running 031 deployment done"); + return true; +}; + +mainExport.id = "031_upgrade_staking_contract"; +mainExport.tags = []; +mainExport.dependencies = []; +mainExport.skip = () => false; + +module.exports = mainExport; diff --git a/contracts/deployments/hoodi/.migrations.json b/contracts/deployments/hoodi/.migrations.json index f9d0cad3cd..d4d840a27a 100644 --- a/contracts/deployments/hoodi/.migrations.json +++ b/contracts/deployments/hoodi/.migrations.json @@ -28,5 +28,6 @@ "027_upgrade_staking_contract": 1757382067, "028_deploy_new_staking_contracts": 1757935264, "029_upgrade_staking_contract": 1758151852, - "030_upgrade_staking_contract": 1758515961 + "030_upgrade_staking_contract": 1758515961, + "031_upgrade_staking_contract": 1760330143 } \ No newline at end of file diff --git a/contracts/deployments/hoodi/CompoundingStakingSSVStrategy.json b/contracts/deployments/hoodi/CompoundingStakingSSVStrategy.json index 240bf9b7ff..3de5255d64 100644 --- a/contracts/deployments/hoodi/CompoundingStakingSSVStrategy.json +++ b/contracts/deployments/hoodi/CompoundingStakingSSVStrategy.json @@ -1,5 +1,5 @@ { - "address": "0x3302C7ba6076D39E70336c799a1bcf7619faE5bf", + "address": "0x81237AF2050E7bE4fB1302E1Cc6Ddc92E982a292", "abi": [ { "inputs": [ @@ -388,19 +388,6 @@ "name": "SSVValidatorRemoved", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newAddress", - "type": "address" - } - ], - "name": "StakingMonitorChanged", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -503,19 +490,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "SSV_NETWORK", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "SSV_TOKEN", @@ -1491,34 +1465,34 @@ "type": "receive" } ], - "transactionHash": "0x6459f4fbf847ea6faead199e52aaed7dbd0c406c1648c9840688a597674fff82", + "transactionHash": "0x87b7119b3a4ab05695865d6d09bd2b12c0890eca6215c30ef814ad6b44d2e51c", "receipt": { "to": null, "from": "0xf7749B41db006860cEc0650D18b8013d69C44Eeb", - "contractAddress": "0x3302C7ba6076D39E70336c799a1bcf7619faE5bf", - "transactionIndex": 21, - "gasUsed": "5357056", - "logsBloom": "0x000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000100000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xa3063a1ebd9849c07f737010d37b6888c0ce6cf56150563d635cd979eb3f3d67", - "transactionHash": "0x6459f4fbf847ea6faead199e52aaed7dbd0c406c1648c9840688a597674fff82", + "contractAddress": "0x81237AF2050E7bE4fB1302E1Cc6Ddc92E982a292", + "transactionIndex": 55, + "gasUsed": "5371178", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000800000000000010000000000000080000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xbe6aea901f998632a1cbac81de0f948eb18e95b54ba0e54f4bf2d4334cf4c9ff", + "transactionHash": "0x87b7119b3a4ab05695865d6d09bd2b12c0890eca6215c30ef814ad6b44d2e51c", "logs": [ { - "transactionIndex": 21, - "blockNumber": 1263390, - "transactionHash": "0x6459f4fbf847ea6faead199e52aaed7dbd0c406c1648c9840688a597674fff82", - "address": "0x3302C7ba6076D39E70336c799a1bcf7619faE5bf", + "transactionIndex": 55, + "blockNumber": 1403773, + "transactionHash": "0x87b7119b3a4ab05695865d6d09bd2b12c0890eca6215c30ef814ad6b44d2e51c", + "address": "0x81237AF2050E7bE4fB1302E1Cc6Ddc92E982a292", "topics": [ "0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000" ], "data": "0x", - "logIndex": 248, - "blockHash": "0xa3063a1ebd9849c07f737010d37b6888c0ce6cf56150563d635cd979eb3f3d67" + "logIndex": 357, + "blockHash": "0xbe6aea901f998632a1cbac81de0f948eb18e95b54ba0e54f4bf2d4334cf4c9ff" } ], - "blockNumber": 1263390, - "cumulativeGasUsed": "19822017", + "blockNumber": 1403773, + "cumulativeGasUsed": "40123481", "status": 1, "byzantium": true }, @@ -1534,11 +1508,11 @@ "0x04b2D730106B9cA91aA011984eD2F7d62D00cF9f", 1742213400 ], - "numDeployments": 6, - "solcInputHash": "7de90067c6ddbeeea4788e7c02ed9ce8", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"platformAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"vaultAddress\",\"type\":\"address\"}],\"internalType\":\"struct InitializableAbstractStrategy.BaseStrategyConfig\",\"name\":\"_baseConfig\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"_wethAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ssvToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ssvNetwork\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_beaconChainDepositContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_beaconProofs\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"_beaconGenesisTimestamp\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"blockRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethBalance\",\"type\":\"uint256\"}],\"name\":\"BalancesSnapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalDepositsWei\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalValidatorBalance\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethBalance\",\"type\":\"uint256\"}],\"name\":\"BalancesVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pendingDepositRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountWei\",\"type\":\"uint256\"}],\"name\":\"DepositVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pendingDepositRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubKey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountWei\",\"type\":\"uint256\"}],\"name\":\"ETHStaked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"FirstDepositReset\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousGovernor\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newGovernor\",\"type\":\"address\"}],\"name\":\"GovernorshipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_oldHarvesterAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newHarvesterAddress\",\"type\":\"address\"}],\"name\":\"HarvesterAddressesUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pToken\",\"type\":\"address\"}],\"name\":\"PTokenAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pToken\",\"type\":\"address\"}],\"name\":\"PTokenRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousGovernor\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorshipTransfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"RegistratorChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"_oldAddresses\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"_newAddresses\",\"type\":\"address[]\"}],\"name\":\"RewardTokenAddressesUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardTokenCollected\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64[]\",\"name\":\"operatorIds\",\"type\":\"uint64[]\"}],\"name\":\"SSVValidatorRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64[]\",\"name\":\"operatorIds\",\"type\":\"uint64[]\"}],\"name\":\"SSVValidatorRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"StakingMonitorChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"}],\"name\":\"ValidatorInvalid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint40\",\"name\":\"validatorIndex\",\"type\":\"uint40\"}],\"name\":\"ValidatorVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountWei\",\"type\":\"uint256\"}],\"name\":\"ValidatorWithdraw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BEACON_PROOFS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SSV_NETWORK\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SSV_TOKEN\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"assetToPToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"}],\"name\":\"checkBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collectRewardTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"depositList\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositListLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositedWethAccountedFor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"deposits\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"amountGwei\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"slot\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositIndex\",\"type\":\"uint32\"},{\"internalType\":\"enum CompoundingValidatorManager.DepositStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"firstDeposit\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRewardTokenAddresses\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"harvesterAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_rewardTokenAddresses\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_assets\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_pTokens\",\"type\":\"address[]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isGovernor\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastVerifiedEthBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"platformAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"publicKey\",\"type\":\"bytes\"},{\"internalType\":\"uint64[]\",\"name\":\"operatorIds\",\"type\":\"uint64[]\"},{\"internalType\":\"bytes\",\"name\":\"sharesData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"ssvAmount\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint32\",\"name\":\"validatorCount\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"networkFeeIndex\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"index\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"internalType\":\"struct Cluster\",\"name\":\"cluster\",\"type\":\"tuple\"}],\"name\":\"registerSsvValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"removePToken\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"publicKey\",\"type\":\"bytes\"},{\"internalType\":\"uint64[]\",\"name\":\"operatorIds\",\"type\":\"uint64[]\"},{\"components\":[{\"internalType\":\"uint32\",\"name\":\"validatorCount\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"networkFeeIndex\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"index\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"internalType\":\"struct Cluster\",\"name\":\"cluster\",\"type\":\"tuple\"}],\"name\":\"removeSsvValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"resetFirstDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewardTokenAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"safeApproveAllTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_harvesterAddress\",\"type\":\"address\"}],\"name\":\"setHarvesterAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"setPTokenAddress\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"setRegistrator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_rewardTokenAddresses\",\"type\":\"address[]\"}],\"name\":\"setRewardTokenAddresses\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"snapBalances\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"snappedBalance\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"blockRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint128\",\"name\":\"ethBalance\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"depositDataRoot\",\"type\":\"bytes32\"}],\"internalType\":\"struct CompoundingValidatorManager.ValidatorStakeData\",\"name\":\"validatorStakeData\",\"type\":\"tuple\"},{\"internalType\":\"uint64\",\"name\":\"depositAmountGwei\",\"type\":\"uint64\"}],\"name\":\"stakeEth\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"}],\"name\":\"supportsAsset\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newGovernor\",\"type\":\"address\"}],\"name\":\"transferGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"transferToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unPause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"validator\",\"outputs\":[{\"internalType\":\"enum CompoundingValidatorManager.ValidatorState\",\"name\":\"state\",\"type\":\"uint8\"},{\"internalType\":\"uint40\",\"name\":\"index\",\"type\":\"uint40\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorRegistrator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"publicKey\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"amountGwei\",\"type\":\"uint64\"}],\"name\":\"validatorWithdrawal\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"vaultAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"verifiedValidators\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifiedValidatorsLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"balancesContainerRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"balancesContainerProof\",\"type\":\"bytes\"},{\"internalType\":\"bytes32[]\",\"name\":\"validatorBalanceLeaves\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes[]\",\"name\":\"validatorBalanceProofs\",\"type\":\"bytes[]\"}],\"internalType\":\"struct CompoundingValidatorManager.BalanceProofs\",\"name\":\"balanceProofs\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"pendingDepositContainerRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"pendingDepositContainerProof\",\"type\":\"bytes\"},{\"internalType\":\"uint32[]\",\"name\":\"pendingDepositIndexes\",\"type\":\"uint32[]\"},{\"internalType\":\"bytes[]\",\"name\":\"pendingDepositProofs\",\"type\":\"bytes[]\"}],\"internalType\":\"struct CompoundingValidatorManager.PendingDepositProofs\",\"name\":\"pendingDepositProofs\",\"type\":\"tuple\"}],\"name\":\"verifyBalances\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"pendingDepositRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"depositProcessedSlot\",\"type\":\"uint64\"},{\"components\":[{\"internalType\":\"uint64\",\"name\":\"slot\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"internalType\":\"struct CompoundingValidatorManager.FirstPendingDepositSlotProofData\",\"name\":\"firstPendingDeposit\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint64\",\"name\":\"withdrawableEpoch\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"withdrawableEpochProof\",\"type\":\"bytes\"}],\"internalType\":\"struct CompoundingValidatorManager.StrategyValidatorProofData\",\"name\":\"strategyValidatorData\",\"type\":\"tuple\"}],\"name\":\"verifyDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"nextBlockTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint40\",\"name\":\"validatorIndex\",\"type\":\"uint40\"},{\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"withdrawalCredentials\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"validatorPubKeyProof\",\"type\":\"bytes\"}],\"name\":\"verifyValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64[]\",\"name\":\"operatorIds\",\"type\":\"uint64[]\"},{\"internalType\":\"uint256\",\"name\":\"ssvAmount\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint32\",\"name\":\"validatorCount\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"networkFeeIndex\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"index\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"internalType\":\"struct Cluster\",\"name\":\"cluster\",\"type\":\"tuple\"}],\"name\":\"withdrawSSV\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Origin Protocol Inc\",\"events\":{\"Paused(address)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"Unpaused(address)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"}},\"kind\":\"dev\",\"methods\":{\"checkBalance(address)\":{\"params\":{\"_asset\":\"Address of WETH asset.\"},\"returns\":{\"balance\":\" Total value in ETH\"}},\"constructor\":{\"params\":{\"_baseConfig\":\"Base strategy config with `platformAddress` not used so empty address `vaultAddress` the address of the OETH Vault contract\",\"_beaconChainDepositContract\":\"Address of the beacon chain deposit contract\",\"_beaconGenesisTimestamp\":\"The timestamp of the Beacon chain's genesis.\",\"_beaconProofs\":\"Address of the Beacon Proofs contract that verifies beacon chain data\",\"_ssvNetwork\":\"Address of the SSV Network contract\",\"_ssvToken\":\"Address of the SSV Token contract\",\"_wethAddress\":\"Address of the WETH Token contract\"}},\"deposit(address,uint256)\":{\"params\":{\"_amount\":\"Amount of WETH that was transferred to the strategy by the vault.\",\"_asset\":\"Address of the WETH token.\"}},\"getRewardTokenAddresses()\":{\"returns\":{\"_0\":\"address[] the reward token addresses.\"}},\"initialize(address[],address[],address[])\":{\"params\":{\"_assets\":\"Not used so empty array\",\"_pTokens\":\"Not used so empty array\",\"_rewardTokenAddresses\":\"Not used so empty array\"}},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"registerSsvValidator(bytes,uint64[],bytes,uint256,(uint32,uint64,uint64,bool,uint256))\":{\"params\":{\"cluster\":\"The SSV cluster details including the validator count and SSV balance\",\"operatorIds\":\"The operator IDs of the SSV Cluster\",\"publicKey\":\"The public key of the validator\",\"sharesData\":\"The shares data for the validator\",\"ssvAmount\":\"The amount of SSV tokens to be deposited to the SSV cluster\"}},\"removeSsvValidator(bytes,uint64[],(uint32,uint64,uint64,bool,uint256))\":{\"params\":{\"cluster\":\"The SSV cluster details including the validator count and SSV balance\",\"operatorIds\":\"The operator IDs of the SSV Cluster\",\"publicKey\":\"The public key of the validator\"}},\"setHarvesterAddress(address)\":{\"params\":{\"_harvesterAddress\":\"Address of the harvester contract.\"}},\"setRewardTokenAddresses(address[])\":{\"params\":{\"_rewardTokenAddresses\":\"Array of reward token addresses\"}},\"stakeEth((bytes,bytes,bytes32),uint64)\":{\"params\":{\"depositAmountGwei\":\"The amount of WETH to stake to the validator in Gwei.\",\"validatorStakeData\":\"validator data needed to stake. The `ValidatorStakeData` struct contains the pubkey, signature and depositDataRoot. Only the registrator can call this function.\"}},\"supportsAsset(address)\":{\"params\":{\"_asset\":\"The address of the WETH token.\"}},\"transferGovernance(address)\":{\"params\":{\"_newGovernor\":\"Address of the new Governor\"}},\"transferToken(address,uint256)\":{\"params\":{\"_amount\":\"Amount of the asset to transfer\",\"_asset\":\"Address for the asset\"}},\"validatorWithdrawal(bytes,uint64)\":{\"params\":{\"amountGwei\":\"The amount of ETH to be withdrawn from the validator in Gwei. A zero amount will trigger a full withdrawal.\",\"publicKey\":\"The public key of the validator\"}},\"verifyBalances((bytes32,bytes,bytes32[],bytes[]),(bytes32,bytes,uint32[],bytes[]))\":{\"params\":{\"balanceProofs\":\"a `BalanceProofs` struct containing the following: - balancesContainerRoot: The merkle root of the balances container - balancesContainerProof: The merkle proof for the balances container to the beacon block root. This is 9 witness hashes of 32 bytes each concatenated together starting from the leaf node. - validatorBalanceLeaves: Array of leaf nodes containing the validator balance with three other balances. - validatorBalanceProofs: Array of merkle proofs for the validator balance to the Balances container root. This is 39 witness hashes of 32 bytes each concatenated together starting from the leaf node.\",\"pendingDepositProofs\":\"a `PendingDepositProofs` struct containing the following: - pendingDepositContainerRoot: The merkle root of the pending deposits list container - pendingDepositContainerProof: The merkle proof from the pending deposits list container to the beacon block root. This is 9 witness hashes of 32 bytes each concatenated together starting from the leaf node. - pendingDepositIndexes: Array of indexes in the pending deposits list container for each of the strategy's deposits. - pendingDepositProofs: Array of merkle proofs for each strategy deposit in the beacon chain's pending deposit list container to the pending deposits list container root. These are 28 witness hashes of 32 bytes each concatenated together starting from the leaf node.\"}},\"verifyDeposit(bytes32,uint64,(uint64,bytes),(uint64,bytes))\":{\"params\":{\"depositProcessedSlot\":\"Any slot on or after the strategy's deposit was processed on the beacon chain. Can not be a slot with pending deposits with the same slot as the deposit being verified. Can not be a slot before a missed slot as the Beacon Root contract will have the parent block root set for the next block timestamp in 12 seconds time.\",\"firstPendingDeposit\":\"a `FirstPendingDepositSlotProofData` struct containing: - slot: The beacon chain slot of the first deposit in the beacon chain's deposit queue. Can be any non-zero value if the deposit queue is empty. - proof: The merkle proof of the first pending deposit's slot to the beacon block root. Can be either: * 40 witness hashes for BeaconBlock.state.PendingDeposits[0].slot when the deposit queue is not empty. * 37 witness hashes for BeaconBlock.state.PendingDeposits[0] when the deposit queue is empty. The 32 byte witness hashes are concatenated together starting from the leaf node.\",\"pendingDepositRoot\":\"The unique identifier of the deposit emitted in `ETHStaked` from the `stakeEth` function.\",\"strategyValidatorData\":\"a `StrategyValidatorProofData` struct containing: - withdrawableEpoch: The withdrawable epoch of the validator the strategy is depositing to. - withdrawableEpochProof: The merkle proof for the withdrawable epoch of the validator the strategy is depositing to, to the beacon block root. This is 53 witness hashes of 32 bytes each concatenated together starting from the leaf node.\"}},\"verifyValidator(uint64,uint40,bytes32,bytes32,bytes)\":{\"params\":{\"nextBlockTimestamp\":\"The timestamp of the execution layer block after the beacon chain slot we are verifying. The next one is needed as the Beacon Oracle returns the parent beacon block root for a block timestamp, which is the beacon block root of the previous block.\",\"pubKeyHash\":\"The hash of the validator's public key using the Beacon Chain's format\",\"validatorIndex\":\"The index of the validator on the beacon chain.\",\"validatorPubKeyProof\":\"The merkle proof for the validator public key to the beacon block root. This is 53 witness hashes of 32 bytes each concatenated together starting from the leaf node. BeaconBlock.state.validators[validatorIndex].pubkey\",\"withdrawalCredentials\":\"contain the validator type and withdrawal address. These can be incorrect and/or malformed. In case of incorrect withdrawalCredentials the validator deposit has been front run\"}},\"withdraw(address,address,uint256)\":{\"params\":{\"_amount\":\"Amount of WETH to withdraw.\",\"_asset\":\"Address of the WETH token.\",\"_recipient\":\"Address to receive withdrawn assets.\"}},\"withdrawSSV(uint64[],uint256,(uint32,uint64,uint64,bool,uint256))\":{\"details\":\"A SSV cluster is defined by the SSVOwnerAddress and the set of operatorIds.\",\"params\":{\"cluster\":\"The SSV cluster details including the validator count and SSV balance\",\"operatorIds\":\"The operator IDs of the SSV Cluster\",\"ssvAmount\":\"The amount of SSV tokens to be withdrawn from the SSV cluster\"}}},\"title\":\"Compounding Staking SSV Strategy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"BEACON_PROOFS()\":{\"notice\":\"Address of the Beacon Proofs contract that verifies beacon chain data\"},\"SSV_NETWORK()\":{\"notice\":\"The address of the SSV Network contract used to interface with\"},\"SSV_TOKEN()\":{\"notice\":\"SSV ERC20 token that serves as a payment for operating SSV validators\"},\"assetToPToken(address)\":{\"notice\":\"asset => pToken (Platform Specific Token Address)\"},\"checkBalance(address)\":{\"notice\":\"Accounts for all the assets managed by this strategy which includes: 1. The current WETH in this strategy contract 2. The last verified ETH balance, total deposits and total validator balances\"},\"claimGovernance()\":{\"notice\":\"Claim Governance of the contract to a new account (`newGovernor`). Can only be called by the new Governor.\"},\"collectRewardTokens()\":{\"notice\":\"Collect accumulated reward token and send to Vault.\"},\"deposit(address,uint256)\":{\"notice\":\"Unlike other strategies, this does not deposit assets into the underlying platform. It just checks the asset is WETH and emits the Deposit event. To deposit WETH into validators, `registerSsvValidator` and `stakeEth` must be used.\"},\"depositAll()\":{\"notice\":\"Unlike other strategies, this does not deposit assets into the underlying platform. It just emits the Deposit event. To deposit WETH into validators `registerSsvValidator` and `stakeEth` must be used.\"},\"depositList(uint256)\":{\"notice\":\"List of strategy deposit IDs to a validator. The ID is the merkle root of the pending deposit data which is unique for each validator, amount and block. Duplicate pending deposit roots are prevented so can be used as an identifier to each strategy deposit. The list can be for deposits waiting to be verified as processed on the beacon chain, or deposits that have been verified to an exiting validator and is now waiting for the validator's balance to be swept. The list may not be ordered by time of deposit. Removed deposits will move the last deposit to the removed index.\"},\"depositListLength()\":{\"notice\":\"Returns the number of deposits waiting to be verified as processed on the beacon chain, or deposits that have been verified to an exiting validator and is now waiting for the validator's balance to be swept.\"},\"deposits(bytes32)\":{\"notice\":\"Mapping of the pending deposit roots to the deposit data\"},\"firstDeposit()\":{\"notice\":\"Restricts to only one deposit to an unverified validator at a time. This is to limit front-running attacks of deposits to the beacon chain contract.\"},\"getRewardTokenAddresses()\":{\"notice\":\"Get the reward token addresses.\"},\"governor()\":{\"notice\":\"Returns the address of the current Governor.\"},\"harvesterAddress()\":{\"notice\":\"Address of the Harvester contract allowed to collect reward tokens\"},\"initialize(address[],address[],address[])\":{\"notice\":\"Set up initial internal state including 1. approving the SSVNetwork to transfer SSV tokens from this strategy contract\"},\"isGovernor()\":{\"notice\":\"Returns true if the caller is the current Governor.\"},\"lastVerifiedEthBalance()\":{\"notice\":\"The last verified ETH balance of the strategy\"},\"platformAddress()\":{\"notice\":\"Address of the underlying platform\"},\"registerSsvValidator(bytes,uint64[],bytes,uint256,(uint32,uint64,uint64,bool,uint256))\":{\"notice\":\"Registers a single validator in a SSV Cluster. Only the Registrator can call this function.\"},\"removePToken(uint256)\":{\"notice\":\"is not supported for this strategy as there is no platform token.\"},\"removeSsvValidator(bytes,uint64[],(uint32,uint64,uint64,bool,uint256))\":{\"notice\":\"Remove the validator from the SSV Cluster after: - the validator has been exited from `validatorWithdrawal` or slashed - the validator has incorrectly registered and can not be staked to - the initial deposit was front-run and the withdrawal address is not this strategy's address. Make sure `validatorWithdrawal` is called with a zero amount and the validator has exited the Beacon chain. If removed before the validator has exited the beacon chain will result in the validator being slashed. Only the registrator can call this function.\"},\"resetFirstDeposit()\":{\"notice\":\"Reset the `firstDeposit` flag to false so deposits to unverified validators can be made again.\"},\"rewardTokenAddresses(uint256)\":{\"notice\":\"Address of the reward tokens. eg CRV, BAL, CVX, AURA\"},\"safeApproveAllTokens()\":{\"notice\":\"Approves the SSV Network contract to transfer SSV tokens for validator registration.\"},\"setHarvesterAddress(address)\":{\"notice\":\"Set the Harvester contract that can collect rewards.\"},\"setPTokenAddress(address,address)\":{\"notice\":\"is not supported for this strategy as there is no platform token.\"},\"setRegistrator(address)\":{\"notice\":\"Set the address of the registrator which can register, exit and remove validators\"},\"setRewardTokenAddresses(address[])\":{\"notice\":\"Set the reward token addresses. Any old addresses will be overwritten.\"},\"snapBalances()\":{\"notice\":\"Stores the current ETH balance at the current block and beacon block root of the slot that is associated with the previous block. When snapping / verifying balance it is of a high importance that there is no miss-match in respect to ETH that is held by the contract and balances that are verified on the validators. First some context on the beacon-chain block building behaviour. Relevant parts of constructing a block on the beacon chain consist of: - process_withdrawals: ETH is deducted from the validator's balance - process_execution_payload: immediately after the previous step executing all the transactions - apply the withdrawals: adding ETH to the recipient which is the withdrawal address contained in the withdrawal credentials of the exited validators That means that balance increases which are part of the post-block execution state are done within the block, but the transaction that are contained within that block can not see / interact with the balance from the exited validators. Only transactions in the next block can do that. When snap balances is performed the state of the chain is snapped across 2 separate chain states: - ETH balance of the contract is recorded on block X -> and corresponding slot Y - beacon chain block root is recorded of block X - 1 -> and corresponding slot Y - 1 given there were no missed slots. It could also be Y - 2, Y - 3 depending on how many slots have not managed to propose a block. For the sake of simplicity this slot will be referred to as Y - 1 as it makes no difference in the argument Given these 2 separate chain states it is paramount that verify balances can not experience miss-counting ETH or much more dangerous double counting of the ETH. When verifyBalances is called it is performed on the current block Z where Z > X. Verify balances adds up all the ETH (omitting WETH) controlled by this contract: - ETH balance in the contract on block X - ETH balance in Deposits on block Z that haven't been yet processed in slot Y - 1 - ETH balance in validators that are active in slot Y - 1 - skips the ETH balance in validators that have withdrawn in slot Y - 1 (or sooner) and have their balance visible to transactions in slot Y and corresponding block X (or sooner) Lets verify the correctness of ETH accounting given the above described behaviour. *ETH balance in the contract on block X* This is an ETH balance of the contract on a non current X block. Any ETH leaving the contract as a result of a withdrawal subtracts from the ETH accounted for on block X if `verifyBalances` has already been called. It also invalidates a `snapBalances` in case `verifyBalances` has not been called yet. Not performing this would result in not accounting for the withdrawn ETH that has happened anywhere in the block interval [X + 1, Z]. Similarly to withdrawals any `stakeEth` deposits to the deposit contract adds to the ETH accounted for since the last `verifyBalances` has been called. And it invalidates the `snapBalances` in case `verifyBalances` hasn't been yet called. Not performing this would result in double counting the `stakedEth` since it would be present once in the snapped contract balance and the second time in deposit storage variables. This behaviour is correct. *ETH balance in Deposits on block Z that haven't been yet processed in slot Y - 1* The contract sums up all the ETH that has been deposited to the Beacon chain deposit contract at block Z. The execution layer doesn't have direct access to the state of deposits on the beacon chain. And if it is to sum up all the ETH that is marked to be deposited it needs to be sure to not double count ETH that is in deposits (storage vars) and could also be part of the validator balances. It does that by verifying that at slot Y - 1 none of the deposits visible on block Z have been processed. Meaning since the last snap till now all are still in queue. Which ensures they can not be part of the validator balances in later steps. This behaviour is correct. *ETH balance in validators that are active in slot Y - 1* The contract is verifying none of the deposits on Y - 1 slot have been processed and for that reason it checks the validator balances in the same slot. Ensuring accounting correctness. This behaviour is correct. *The withdrawn validators* The withdrawn validators could have their balances deducted in any slot before slot Y - 1 and the execution layer sees the balance increase in the subsequent slot. Lets look at the \\\"worst case scenario\\\" where the validator withdrawal is processed in the slot Y - 1 (snapped slot) and see their balance increase (in execution layer) in slot Y -> block X. The ETH balance on the contract is snapped at block X meaning that even if the validator exits at the latest possible time it is paramount that the ETH balance on the execution layer is recorded in the next block. Correctly accounting for the withdrawn ETH. Worth mentioning if the validator exit is processed by the slot Y and balance increase seen on the execution layer on block X + 1 the withdrawal is ignored by both the validator balance verification as well as execution layer contract balance snap. This behaviour is correct. The validator balances on the beacon chain can then be proved with `verifyBalances`.\"},\"snappedBalance()\":{\"notice\":\"Mapping of the block root to the balances at that slot\"},\"stakeEth((bytes,bytes,bytes32),uint64)\":{\"notice\":\"Stakes WETH in this strategy to a compounding validator. The the first deposit to a new validator, the amount must be 1 ETH. Another deposit of at least 31 ETH is required for the validator to be activated. This second deposit has to be done after the validator has been verified. Does not convert any ETH sitting in this strategy to WETH. There can not be two deposits to the same validator in the same block for the same amount. Function is pausable so in case a run-away Registrator can be prevented from continuing to deposit funds to slashed or undesired validators.\"},\"supportsAsset(address)\":{\"notice\":\"Returns bool indicating whether asset is supported by the strategy.\"},\"transferGovernance(address)\":{\"notice\":\"Transfers Governance of the contract to a new account (`newGovernor`). Can only be called by the current Governor. Must be claimed for this to complete\"},\"transferToken(address,uint256)\":{\"notice\":\"Transfer token to governor. Intended for recovering tokens stuck in strategy contracts, i.e. mistaken sends.\"},\"validator(bytes32)\":{\"notice\":\"Mapping of the hash of the validator's public key to the validator state and index. Uses the Beacon chain hashing for BLSPubkey which is sha256(abi.encodePacked(validator.pubkey, bytes16(0)))\"},\"validatorRegistrator()\":{\"notice\":\"Address of the registrator - allowed to register, withdraw, exit and remove validators\"},\"validatorWithdrawal(bytes,uint64)\":{\"notice\":\"Request a full or partial withdrawal from a validator. A zero amount will trigger a full withdrawal. If the remaining balance is < 32 ETH then only the amount in excess of 32 ETH will be withdrawn. Only the Registrator can call this function. 1 wei of value should be sent with the tx to pay for the withdrawal request fee. If no value sent, 1 wei will be taken from the strategy's ETH balance if it has any. If no ETH balance, the tx will revert.\"},\"vaultAddress()\":{\"notice\":\"Address of the OToken vault\"},\"verifiedValidators(uint256)\":{\"notice\":\"List of validator public key hashes that have been verified to exist on the beacon chain. These have had a deposit processed and the validator's balance increased. Validators will be removed from this list when its verified they have a zero balance.\"},\"verifiedValidatorsLength()\":{\"notice\":\"Returns the number of verified validators.\"},\"verifyBalances((bytes32,bytes,bytes32[],bytes[]),(bytes32,bytes,uint32[],bytes[]))\":{\"notice\":\"Verifies the balances of all active validators on the beacon chain and checks each of the strategy's deposits are still to be processed by the beacon chain.\"},\"verifyDeposit(bytes32,uint64,(uint64,bytes),(uint64,bytes))\":{\"notice\":\"Verifies a deposit on the execution layer has been processed by the beacon chain. This means the accounting of the strategy's ETH moves from a pending deposit to a validator balance. Important: this function has a limitation where `depositProcessedSlot` that is passed by the off-chain verifier requires a slot immediately after it to propose a block otherwise the `BeaconRoots.parentBlockRoot` will fail. This shouldn't be a problem, since by the current behaviour of beacon chain only 1%-3% slots don't propose a block.\"},\"verifyValidator(uint64,uint40,bytes32,bytes32,bytes)\":{\"notice\":\"Verifies a validator's index to its public key. Adds to the list of verified validators if the validator's withdrawal address is this strategy's address. Marks the validator as invalid and removes the deposit if the withdrawal address is not this strategy's address.\"},\"withdraw(address,address,uint256)\":{\"notice\":\"Withdraw ETH and WETH from this strategy contract.\"},\"withdrawAll()\":{\"notice\":\"Transfer all WETH deposits, ETH from validator withdrawals and ETH from execution rewards in this strategy to the vault. This does not withdraw from the validators. That has to be done separately with the `validatorWithdrawal` operation.\"},\"withdrawSSV(uint64[],uint256,(uint32,uint64,uint64,bool,uint256))\":{\"notice\":\"Withdraws excess SSV Tokens from the SSV Network contract which was used to pay the SSV Operators.\"}},\"notice\":\"Strategy to deploy funds into DVT validators powered by the SSV Network\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol\":\"CompoundingStakingSSVStrategy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/security/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract Pausable is Context {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n constructor() {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n require(!paused(), \\\"Pausable: paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n require(paused(), \\\"Pausable: not paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n}\\n\",\"keccak256\":\"0xe68ed7fb8766ed1e888291f881e36b616037f852b37d96877045319ad298ba87\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, 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 `sender` to `recipient` 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 sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0x61437cb513a887a1bbad006e7b1c8b414478427d33de47c5600af3c748f108da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 /**\\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\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\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 function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 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\\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\":\"0x51b758a8815ecc9596c66c37d56b1d33883a444631a3f916b9fe65cb863ef7c4\",\"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/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a / b + (a % b == 0 ? 0 : 1);\\n }\\n}\\n\",\"keccak256\":\"0xfaad496c1c944b6259b7dc70b4865eb1775d6402bc0c81b38a0b24d9f525ae37\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Returns the downcasted uint224 from uint256, reverting on\\n * overflow (when the input is greater than largest uint224).\\n *\\n * Counterpart to Solidity's `uint224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n */\\n function toUint224(uint256 value) internal pure returns (uint224) {\\n require(value <= type(uint224).max, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n return uint224(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n require(value <= type(uint128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint96 from uint256, reverting on\\n * overflow (when the input is greater than largest uint96).\\n *\\n * Counterpart to Solidity's `uint96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n */\\n function toUint96(uint256 value) internal pure returns (uint96) {\\n require(value <= type(uint96).max, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n return uint96(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n require(value <= type(uint64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n require(value <= type(uint32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n require(value <= type(uint16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits.\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n require(value <= type(uint8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n require(value >= 0, \\\"SafeCast: value must be positive\\\");\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128) {\\n require(value >= type(int128).min && value <= type(int128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return int128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64) {\\n require(value >= type(int64).min && value <= type(int64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return int64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32) {\\n require(value >= type(int32).min && value <= type(int32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return int32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16) {\\n require(value >= type(int16).min && value <= type(int16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return int16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits.\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8) {\\n require(value >= type(int8).min && value <= type(int8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return int8(value);\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n require(value <= uint256(type(int256).max), \\\"SafeCast: value doesn't fit in an int256\\\");\\n return int256(value);\\n }\\n}\\n\",\"keccak256\":\"0x5c6caab697d302ad7eb59c234a4d2dbc965c1bae87709bd2850060b7695b28c7\",\"license\":\"MIT\"},\"contracts/beacon/BeaconRoots.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Library to retrieve beacon block roots.\\n * @author Origin Protocol Inc\\n */\\nlibrary BeaconRoots {\\n /// @notice The address of beacon block roots oracle\\n /// See https://eips.ethereum.org/EIPS/eip-4788\\n address internal constant BEACON_ROOTS_ADDRESS =\\n 0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02;\\n\\n /// @notice Returns the beacon block root for the previous block.\\n /// This comes from the Beacon Roots contract defined in EIP-4788.\\n /// This will revert if the block is more than 8,191 blocks old as\\n /// that is the size of the beacon root's ring buffer.\\n /// @param timestamp The timestamp of the block for which to get the parent root.\\n /// @return parentRoot The parent block root for the given timestamp.\\n function parentBlockRoot(uint64 timestamp)\\n internal\\n view\\n returns (bytes32 parentRoot)\\n {\\n // Call the Beacon Roots contract to get the parent block root.\\n // This does not have a function signature, so we use a staticcall.\\n (bool success, bytes memory result) = BEACON_ROOTS_ADDRESS.staticcall(\\n abi.encode(timestamp)\\n );\\n\\n require(success && result.length > 0, \\\"Invalid beacon timestamp\\\");\\n parentRoot = abi.decode(result, (bytes32));\\n }\\n}\\n\",\"keccak256\":\"0x4005989f852a68bbcdc1cdc3472ebd3911395e75b4e6366ffcaae4d1c128691e\",\"license\":\"BUSL-1.1\"},\"contracts/beacon/PartialWithdrawal.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Library to request full or partial withdrawals from validators on the beacon chain.\\n * @author Origin Protocol Inc\\n */\\nlibrary PartialWithdrawal {\\n /// @notice The address where the withdrawal request is sent to\\n /// See https://eips.ethereum.org/EIPS/eip-7002\\n address internal constant WITHDRAWAL_REQUEST_ADDRESS =\\n 0x00000961Ef480Eb55e80D19ad83579A64c007002;\\n\\n /// @notice Requests a partial withdrawal for a given validator public key and amount.\\n /// @param validatorPubKey The public key of the validator to withdraw from\\n /// @param amount The amount of ETH to withdraw\\n function request(bytes calldata validatorPubKey, uint64 amount)\\n internal\\n returns (uint256 fee_)\\n {\\n require(validatorPubKey.length == 48, \\\"Invalid validator byte length\\\");\\n fee_ = fee();\\n\\n // Call the Withdrawal Request contract with the validator public key\\n // and amount to be withdrawn packed together\\n\\n // This is a general purpose EL to CL request:\\n // https://eips.ethereum.org/EIPS/eip-7685\\n (bool success, ) = WITHDRAWAL_REQUEST_ADDRESS.call{ value: fee_ }(\\n abi.encodePacked(validatorPubKey, amount)\\n );\\n\\n require(success, \\\"Withdrawal request failed\\\");\\n }\\n\\n /// @notice Gets fee for withdrawal requests contract on Beacon chain\\n function fee() internal view returns (uint256) {\\n // Get fee from the withdrawal request contract\\n (bool success, bytes memory result) = WITHDRAWAL_REQUEST_ADDRESS\\n .staticcall(\\\"\\\");\\n\\n require(success && result.length > 0, \\\"Failed to get fee\\\");\\n return abi.decode(result, (uint256));\\n }\\n}\\n\",\"keccak256\":\"0x80d29153ff7eb5c6841692aca98eb0cc14ac43ad2d8e402890b6c6b6e4a9719d\",\"license\":\"BUSL-1.1\"},\"contracts/governance/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Base for contracts that are managed by the Origin Protocol's Governor.\\n * @dev Copy of the openzeppelin Ownable.sol contract with nomenclature change\\n * from owner to governor and renounce methods removed. Does not use\\n * Context.sol like Ownable.sol does for simplification.\\n * @author Origin Protocol Inc\\n */\\nabstract contract Governable {\\n // Storage position of the owner and pendingOwner of the contract\\n // keccak256(\\\"OUSD.governor\\\");\\n bytes32 private constant governorPosition =\\n 0x7bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4a;\\n\\n // keccak256(\\\"OUSD.pending.governor\\\");\\n bytes32 private constant pendingGovernorPosition =\\n 0x44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db;\\n\\n // keccak256(\\\"OUSD.reentry.status\\\");\\n bytes32 private constant reentryStatusPosition =\\n 0x53bf423e48ed90e97d02ab0ebab13b2a235a6bfbe9c321847d5c175333ac4535;\\n\\n // See OpenZeppelin ReentrancyGuard implementation\\n uint256 constant _NOT_ENTERED = 1;\\n uint256 constant _ENTERED = 2;\\n\\n event PendingGovernorshipTransfer(\\n address indexed previousGovernor,\\n address indexed newGovernor\\n );\\n\\n event GovernorshipTransferred(\\n address indexed previousGovernor,\\n address indexed newGovernor\\n );\\n\\n /**\\n * @notice Returns the address of the current Governor.\\n */\\n function governor() public view returns (address) {\\n return _governor();\\n }\\n\\n /**\\n * @dev Returns the address of the current Governor.\\n */\\n function _governor() internal view returns (address governorOut) {\\n bytes32 position = governorPosition;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n governorOut := sload(position)\\n }\\n }\\n\\n /**\\n * @dev Returns the address of the pending Governor.\\n */\\n function _pendingGovernor()\\n internal\\n view\\n returns (address pendingGovernor)\\n {\\n bytes32 position = pendingGovernorPosition;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n pendingGovernor := sload(position)\\n }\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the Governor.\\n */\\n modifier onlyGovernor() {\\n require(isGovernor(), \\\"Caller is not the Governor\\\");\\n _;\\n }\\n\\n /**\\n * @notice Returns true if the caller is the current Governor.\\n */\\n function isGovernor() public view returns (bool) {\\n return msg.sender == _governor();\\n }\\n\\n function _setGovernor(address newGovernor) internal {\\n emit GovernorshipTransferred(_governor(), newGovernor);\\n\\n bytes32 position = governorPosition;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(position, newGovernor)\\n }\\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 make it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n bytes32 position = reentryStatusPosition;\\n uint256 _reentry_status;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n _reentry_status := sload(position)\\n }\\n\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_reentry_status != _ENTERED, \\\"Reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(position, _ENTERED)\\n }\\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 // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(position, _NOT_ENTERED)\\n }\\n }\\n\\n function _setPendingGovernor(address newGovernor) internal {\\n bytes32 position = pendingGovernorPosition;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(position, newGovernor)\\n }\\n }\\n\\n /**\\n * @notice Transfers Governance of the contract to a new account (`newGovernor`).\\n * Can only be called by the current Governor. Must be claimed for this to complete\\n * @param _newGovernor Address of the new Governor\\n */\\n function transferGovernance(address _newGovernor) external onlyGovernor {\\n _setPendingGovernor(_newGovernor);\\n emit PendingGovernorshipTransfer(_governor(), _newGovernor);\\n }\\n\\n /**\\n * @notice Claim Governance of the contract to a new account (`newGovernor`).\\n * Can only be called by the new Governor.\\n */\\n function claimGovernance() external {\\n require(\\n msg.sender == _pendingGovernor(),\\n \\\"Only the pending Governor can complete the claim\\\"\\n );\\n _changeGovernor(msg.sender);\\n }\\n\\n /**\\n * @dev Change Governance of the contract to a new account (`newGovernor`).\\n * @param _newGovernor Address of the new Governor\\n */\\n function _changeGovernor(address _newGovernor) internal {\\n require(_newGovernor != address(0), \\\"New Governor is address(0)\\\");\\n _setGovernor(_newGovernor);\\n }\\n}\\n\",\"keccak256\":\"0xf32f873c8bfbacf2e5f01d0cf37bc7f54fbd5aa656e95c8a599114229946f107\",\"license\":\"BUSL-1.1\"},\"contracts/interfaces/IBasicToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IBasicToken {\\n function symbol() external view returns (string memory);\\n\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0xa562062698aa12572123b36dfd2072f1a39e44fed2031cc19c2c9fd522f96ec2\",\"license\":\"MIT\"},\"contracts/interfaces/IBeaconProofs.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\ninterface IBeaconProofs {\\n function verifyValidator(\\n bytes32 beaconBlockRoot,\\n bytes32 pubKeyHash,\\n bytes calldata validatorPubKeyProof,\\n uint40 validatorIndex,\\n bytes32 withdrawalCredentials\\n ) external view;\\n\\n function verifyValidatorWithdrawable(\\n bytes32 beaconBlockRoot,\\n uint40 validatorIndex,\\n uint64 withdrawableEpoch,\\n bytes calldata withdrawableEpochProof\\n ) external view;\\n\\n function verifyBalancesContainer(\\n bytes32 beaconBlockRoot,\\n bytes32 balancesContainerLeaf,\\n bytes calldata balancesContainerProof\\n ) external view;\\n\\n function verifyValidatorBalance(\\n bytes32 balancesContainerRoot,\\n bytes32 validatorBalanceLeaf,\\n bytes calldata balanceProof,\\n uint40 validatorIndex\\n ) external view returns (uint256 validatorBalance);\\n\\n function verifyPendingDepositsContainer(\\n bytes32 beaconBlockRoot,\\n bytes32 pendingDepositsContainerRoot,\\n bytes calldata proof\\n ) external view;\\n\\n function verifyPendingDeposit(\\n bytes32 pendingDepositsContainerRoot,\\n bytes32 pendingDepositRoot,\\n bytes calldata proof,\\n uint32 pendingDepositIndex\\n ) external view;\\n\\n function verifyFirstPendingDeposit(\\n bytes32 beaconBlockRoot,\\n uint64 slot,\\n bytes calldata firstPendingDepositSlotProof\\n ) external view returns (bool isEmptyDepositQueue);\\n\\n function merkleizePendingDeposit(\\n bytes32 pubKeyHash,\\n bytes calldata withdrawalCredentials,\\n uint64 amountGwei,\\n bytes calldata signature,\\n uint64 slot\\n ) external pure returns (bytes32 root);\\n\\n function merkleizeSignature(bytes calldata signature)\\n external\\n pure\\n returns (bytes32 root);\\n}\\n\",\"keccak256\":\"0xbc611f259b296451c358638a6e164227179bcee079656f5078800cc2f06c22fd\",\"license\":\"BUSL-1.1\"},\"contracts/interfaces/IDepositContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IDepositContract {\\n /// @notice A processed deposit event.\\n event DepositEvent(\\n bytes pubkey,\\n bytes withdrawal_credentials,\\n bytes amount,\\n bytes signature,\\n bytes index\\n );\\n\\n /// @notice Submit a Phase 0 DepositData object.\\n /// @param pubkey A BLS12-381 public key.\\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\\n /// @param signature A BLS12-381 signature.\\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\\n /// Used as a protection against malformed input.\\n function deposit(\\n bytes calldata pubkey,\\n bytes calldata withdrawal_credentials,\\n bytes calldata signature,\\n bytes32 deposit_data_root\\n ) external payable;\\n\\n /// @notice Query the current deposit root hash.\\n /// @return The deposit root hash.\\n function get_deposit_root() external view returns (bytes32);\\n\\n /// @notice Query the current deposit count.\\n /// @return The deposit count encoded as a little endian 64-bit number.\\n function get_deposit_count() external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x598f90bdbc854250bbd5991426bfb43367207e64e33109c41aa8b54323fd8d8e\",\"license\":\"MIT\"},\"contracts/interfaces/ISSVNetwork.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nstruct Cluster {\\n uint32 validatorCount;\\n uint64 networkFeeIndex;\\n uint64 index;\\n bool active;\\n uint256 balance;\\n}\\n\\ninterface ISSVNetwork {\\n /**********/\\n /* Errors */\\n /**********/\\n\\n error CallerNotOwner(); // 0x5cd83192\\n error CallerNotWhitelisted(); // 0x8c6e5d71\\n error FeeTooLow(); // 0x732f9413\\n error FeeExceedsIncreaseLimit(); // 0x958065d9\\n error NoFeeDeclared(); // 0x1d226c30\\n error ApprovalNotWithinTimeframe(); // 0x97e4b518\\n error OperatorDoesNotExist(); // 0x961e3e8c\\n error InsufficientBalance(); // 0xf4d678b8\\n error ValidatorDoesNotExist(); // 0xe51315d2\\n error ClusterNotLiquidatable(); // 0x60300a8d\\n error InvalidPublicKeyLength(); // 0x637297a4\\n error InvalidOperatorIdsLength(); // 0x38186224\\n error ClusterAlreadyEnabled(); // 0x3babafd2\\n error ClusterIsLiquidated(); // 0x95a0cf33\\n error ClusterDoesNotExists(); // 0x185e2b16\\n error IncorrectClusterState(); // 0x12e04c87\\n error UnsortedOperatorsList(); // 0xdd020e25\\n error NewBlockPeriodIsBelowMinimum(); // 0x6e6c9cac\\n error ExceedValidatorLimit(); // 0x6df5ab76\\n error TokenTransferFailed(); // 0x045c4b02\\n error SameFeeChangeNotAllowed(); // 0xc81272f8\\n error FeeIncreaseNotAllowed(); // 0x410a2b6c\\n error NotAuthorized(); // 0xea8e4eb5\\n error OperatorsListNotUnique(); // 0xa5a1ff5d\\n error OperatorAlreadyExists(); // 0x289c9494\\n error TargetModuleDoesNotExist(); // 0x8f9195fb\\n error MaxValueExceeded(); // 0x91aa3017\\n error FeeTooHigh(); // 0xcd4e6167\\n error PublicKeysSharesLengthMismatch(); // 0x9ad467b8\\n error IncorrectValidatorStateWithData(bytes publicKey); // 0x89307938\\n error ValidatorAlreadyExistsWithData(bytes publicKey); // 0x388e7999\\n error EmptyPublicKeysList(); // df83e679\\n\\n // legacy errors\\n error ValidatorAlreadyExists(); // 0x8d09a73e\\n error IncorrectValidatorState(); // 0x2feda3c1\\n\\n event AdminChanged(address previousAdmin, address newAdmin);\\n event BeaconUpgraded(address indexed beacon);\\n event ClusterDeposited(\\n address indexed owner,\\n uint64[] operatorIds,\\n uint256 value,\\n Cluster cluster\\n );\\n event ClusterLiquidated(\\n address indexed owner,\\n uint64[] operatorIds,\\n Cluster cluster\\n );\\n event ClusterReactivated(\\n address indexed owner,\\n uint64[] operatorIds,\\n Cluster cluster\\n );\\n event ClusterWithdrawn(\\n address indexed owner,\\n uint64[] operatorIds,\\n uint256 value,\\n Cluster cluster\\n );\\n event DeclareOperatorFeePeriodUpdated(uint64 value);\\n event ExecuteOperatorFeePeriodUpdated(uint64 value);\\n event FeeRecipientAddressUpdated(\\n address indexed owner,\\n address recipientAddress\\n );\\n event Initialized(uint8 version);\\n event LiquidationThresholdPeriodUpdated(uint64 value);\\n event MinimumLiquidationCollateralUpdated(uint256 value);\\n event NetworkEarningsWithdrawn(uint256 value, address recipient);\\n event NetworkFeeUpdated(uint256 oldFee, uint256 newFee);\\n event OperatorAdded(\\n uint64 indexed operatorId,\\n address indexed owner,\\n bytes publicKey,\\n uint256 fee\\n );\\n event OperatorFeeDeclarationCancelled(\\n address indexed owner,\\n uint64 indexed operatorId\\n );\\n event OperatorFeeDeclared(\\n address indexed owner,\\n uint64 indexed operatorId,\\n uint256 blockNumber,\\n uint256 fee\\n );\\n event OperatorFeeExecuted(\\n address indexed owner,\\n uint64 indexed operatorId,\\n uint256 blockNumber,\\n uint256 fee\\n );\\n event OperatorFeeIncreaseLimitUpdated(uint64 value);\\n event OperatorMaximumFeeUpdated(uint64 maxFee);\\n event OperatorRemoved(uint64 indexed operatorId);\\n event OperatorWhitelistUpdated(\\n uint64 indexed operatorId,\\n address whitelisted\\n );\\n event OperatorWithdrawn(\\n address indexed owner,\\n uint64 indexed operatorId,\\n uint256 value\\n );\\n event OwnershipTransferStarted(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n event Upgraded(address indexed implementation);\\n event ValidatorAdded(\\n address indexed owner,\\n uint64[] operatorIds,\\n bytes publicKey,\\n bytes shares,\\n Cluster cluster\\n );\\n event ValidatorExited(\\n address indexed owner,\\n uint64[] operatorIds,\\n bytes publicKey\\n );\\n event ValidatorRemoved(\\n address indexed owner,\\n uint64[] operatorIds,\\n bytes publicKey,\\n Cluster cluster\\n );\\n\\n fallback() external;\\n\\n function acceptOwnership() external;\\n\\n function cancelDeclaredOperatorFee(uint64 operatorId) external;\\n\\n function declareOperatorFee(uint64 operatorId, uint256 fee) external;\\n\\n function deposit(\\n address clusterOwner,\\n uint64[] memory operatorIds,\\n uint256 amount,\\n Cluster memory cluster\\n ) external;\\n\\n function executeOperatorFee(uint64 operatorId) external;\\n\\n function exitValidator(bytes memory publicKey, uint64[] memory operatorIds)\\n external;\\n\\n function bulkExitValidator(\\n bytes[] calldata publicKeys,\\n uint64[] calldata operatorIds\\n ) external;\\n\\n function getVersion() external pure returns (string memory version);\\n\\n function initialize(\\n address token_,\\n address ssvOperators_,\\n address ssvClusters_,\\n address ssvDAO_,\\n address ssvViews_,\\n uint64 minimumBlocksBeforeLiquidation_,\\n uint256 minimumLiquidationCollateral_,\\n uint32 validatorsPerOperatorLimit_,\\n uint64 declareOperatorFeePeriod_,\\n uint64 executeOperatorFeePeriod_,\\n uint64 operatorMaxFeeIncrease_\\n ) external;\\n\\n function liquidate(\\n address clusterOwner,\\n uint64[] memory operatorIds,\\n Cluster memory cluster\\n ) external;\\n\\n function owner() external view returns (address);\\n\\n function pendingOwner() external view returns (address);\\n\\n function proxiableUUID() external view returns (bytes32);\\n\\n function reactivate(\\n uint64[] memory operatorIds,\\n uint256 amount,\\n Cluster memory cluster\\n ) external;\\n\\n function reduceOperatorFee(uint64 operatorId, uint256 fee) external;\\n\\n function registerOperator(bytes memory publicKey, uint256 fee)\\n external\\n returns (uint64 id);\\n\\n function registerValidator(\\n bytes memory publicKey,\\n uint64[] memory operatorIds,\\n bytes memory sharesData,\\n uint256 amount,\\n Cluster memory cluster\\n ) external;\\n\\n function bulkRegisterValidator(\\n bytes[] calldata publicKeys,\\n uint64[] calldata operatorIds,\\n bytes[] calldata sharesData,\\n uint256 amount,\\n Cluster memory cluster\\n ) external;\\n\\n function removeOperator(uint64 operatorId) external;\\n\\n function removeValidator(\\n bytes memory publicKey,\\n uint64[] memory operatorIds,\\n Cluster memory cluster\\n ) external;\\n\\n function bulkRemoveValidator(\\n bytes[] calldata publicKeys,\\n uint64[] calldata operatorIds,\\n Cluster memory cluster\\n ) external;\\n\\n function renounceOwnership() external;\\n\\n function setFeeRecipientAddress(address recipientAddress) external;\\n\\n function setOperatorWhitelist(uint64 operatorId, address whitelisted)\\n external;\\n\\n function transferOwnership(address newOwner) external;\\n\\n function updateDeclareOperatorFeePeriod(uint64 timeInSeconds) external;\\n\\n function updateExecuteOperatorFeePeriod(uint64 timeInSeconds) external;\\n\\n function updateLiquidationThresholdPeriod(uint64 blocks) external;\\n\\n function updateMaximumOperatorFee(uint64 maxFee) external;\\n\\n function updateMinimumLiquidationCollateral(uint256 amount) external;\\n\\n function updateModule(uint8 moduleId, address moduleAddress) external;\\n\\n function updateNetworkFee(uint256 fee) external;\\n\\n function updateOperatorFeeIncreaseLimit(uint64 percentage) external;\\n\\n function upgradeTo(address newImplementation) external;\\n\\n function upgradeToAndCall(address newImplementation, bytes memory data)\\n external\\n payable;\\n\\n function withdraw(\\n uint64[] memory operatorIds,\\n uint256 amount,\\n Cluster memory cluster\\n ) external;\\n\\n function withdrawAllOperatorEarnings(uint64 operatorId) external;\\n\\n function withdrawNetworkEarnings(uint256 amount) external;\\n\\n function withdrawOperatorEarnings(uint64 operatorId, uint256 amount)\\n external;\\n}\\n\",\"keccak256\":\"0xbd86cb74702aebc5b53c8fc738a2e3ad1b410583460617be84b22ce922af12a7\",\"license\":\"MIT\"},\"contracts/interfaces/IStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Platform interface to integrate with lending platform like Compound, AAVE etc.\\n */\\ninterface IStrategy {\\n /**\\n * @dev Deposit the given asset to platform\\n * @param _asset asset address\\n * @param _amount Amount to deposit\\n */\\n function deposit(address _asset, uint256 _amount) external;\\n\\n /**\\n * @dev Deposit the entire balance of all supported assets in the Strategy\\n * to the platform\\n */\\n function depositAll() external;\\n\\n /**\\n * @dev Withdraw given asset from Lending platform\\n */\\n function withdraw(\\n address _recipient,\\n address _asset,\\n uint256 _amount\\n ) external;\\n\\n /**\\n * @dev Liquidate all assets in strategy and return them to Vault.\\n */\\n function withdrawAll() external;\\n\\n /**\\n * @dev Returns the current balance of the given asset.\\n */\\n function checkBalance(address _asset)\\n external\\n view\\n returns (uint256 balance);\\n\\n /**\\n * @dev Returns bool indicating whether strategy supports asset.\\n */\\n function supportsAsset(address _asset) external view returns (bool);\\n\\n /**\\n * @dev Collect reward tokens from the Strategy.\\n */\\n function collectRewardTokens() external;\\n\\n /**\\n * @dev The address array of the reward tokens for the Strategy.\\n */\\n function getRewardTokenAddresses() external view returns (address[] memory);\\n\\n function harvesterAddress() external view returns (address);\\n\\n function transferToken(address token, uint256 amount) external;\\n\\n function setRewardTokenAddresses(address[] calldata _rewardTokenAddresses)\\n external;\\n}\\n\",\"keccak256\":\"0x79ca47defb3b5a56bba13f14c440838152fd1c1aa640476154516a16da4da8ba\",\"license\":\"BUSL-1.1\"},\"contracts/interfaces/IVault.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\nimport { VaultStorage } from \\\"../vault/VaultStorage.sol\\\";\\n\\ninterface IVault {\\n // slither-disable-start constable-states\\n\\n event AssetSupported(address _asset);\\n event AssetDefaultStrategyUpdated(address _asset, address _strategy);\\n event AssetAllocated(address _asset, address _strategy, uint256 _amount);\\n event StrategyApproved(address _addr);\\n event StrategyRemoved(address _addr);\\n event Mint(address _addr, uint256 _value);\\n event Redeem(address _addr, uint256 _value);\\n event CapitalPaused();\\n event CapitalUnpaused();\\n event RebasePaused();\\n event RebaseUnpaused();\\n event VaultBufferUpdated(uint256 _vaultBuffer);\\n event RedeemFeeUpdated(uint256 _redeemFeeBps);\\n event PriceProviderUpdated(address _priceProvider);\\n event AllocateThresholdUpdated(uint256 _threshold);\\n event RebaseThresholdUpdated(uint256 _threshold);\\n event StrategistUpdated(address _address);\\n event MaxSupplyDiffChanged(uint256 maxSupplyDiff);\\n event YieldDistribution(address _to, uint256 _yield, uint256 _fee);\\n event TrusteeFeeBpsChanged(uint256 _basis);\\n event TrusteeAddressChanged(address _address);\\n event SwapperChanged(address _address);\\n event SwapAllowedUndervalueChanged(uint256 _basis);\\n event SwapSlippageChanged(address _asset, uint256 _basis);\\n event Swapped(\\n address indexed _fromAsset,\\n address indexed _toAsset,\\n uint256 _fromAssetAmount,\\n uint256 _toAssetAmount\\n );\\n event StrategyAddedToMintWhitelist(address indexed strategy);\\n event StrategyRemovedFromMintWhitelist(address indexed strategy);\\n event DripperChanged(address indexed _dripper);\\n event WithdrawalRequested(\\n address indexed _withdrawer,\\n uint256 indexed _requestId,\\n uint256 _amount,\\n uint256 _queued\\n );\\n event WithdrawalClaimed(\\n address indexed _withdrawer,\\n uint256 indexed _requestId,\\n uint256 _amount\\n );\\n event WithdrawalClaimable(uint256 _claimable, uint256 _newClaimable);\\n\\n // Governable.sol\\n function transferGovernance(address _newGovernor) external;\\n\\n function claimGovernance() external;\\n\\n function governor() external view returns (address);\\n\\n function ADMIN_IMPLEMENTATION() external view returns (address);\\n\\n // VaultAdmin.sol\\n function setPriceProvider(address _priceProvider) external;\\n\\n function priceProvider() external view returns (address);\\n\\n function setRedeemFeeBps(uint256 _redeemFeeBps) external;\\n\\n function redeemFeeBps() external view returns (uint256);\\n\\n function setVaultBuffer(uint256 _vaultBuffer) external;\\n\\n function vaultBuffer() external view returns (uint256);\\n\\n function setAutoAllocateThreshold(uint256 _threshold) external;\\n\\n function autoAllocateThreshold() external view returns (uint256);\\n\\n function setRebaseThreshold(uint256 _threshold) external;\\n\\n function rebaseThreshold() external view returns (uint256);\\n\\n function setStrategistAddr(address _address) external;\\n\\n function strategistAddr() external view returns (address);\\n\\n function setMaxSupplyDiff(uint256 _maxSupplyDiff) external;\\n\\n function maxSupplyDiff() external view returns (uint256);\\n\\n function setTrusteeAddress(address _address) external;\\n\\n function trusteeAddress() external view returns (address);\\n\\n function setTrusteeFeeBps(uint256 _basis) external;\\n\\n function trusteeFeeBps() external view returns (uint256);\\n\\n function ousdMetaStrategy() external view returns (address);\\n\\n function setSwapper(address _swapperAddr) external;\\n\\n function setSwapAllowedUndervalue(uint16 _percentageBps) external;\\n\\n function setOracleSlippage(address _asset, uint16 _allowedOracleSlippageBps)\\n external;\\n\\n function supportAsset(address _asset, uint8 _unitConversion) external;\\n\\n function approveStrategy(address _addr) external;\\n\\n function removeStrategy(address _addr) external;\\n\\n function setAssetDefaultStrategy(address _asset, address _strategy)\\n external;\\n\\n function assetDefaultStrategies(address _asset)\\n external\\n view\\n returns (address);\\n\\n function pauseRebase() external;\\n\\n function unpauseRebase() external;\\n\\n function rebasePaused() external view returns (bool);\\n\\n function pauseCapital() external;\\n\\n function unpauseCapital() external;\\n\\n function capitalPaused() external view returns (bool);\\n\\n function transferToken(address _asset, uint256 _amount) external;\\n\\n function priceUnitMint(address asset) external view returns (uint256);\\n\\n function priceUnitRedeem(address asset) external view returns (uint256);\\n\\n function withdrawAllFromStrategy(address _strategyAddr) external;\\n\\n function withdrawAllFromStrategies() external;\\n\\n function withdrawFromStrategy(\\n address _strategyFromAddress,\\n address[] calldata _assets,\\n uint256[] calldata _amounts\\n ) external;\\n\\n function depositToStrategy(\\n address _strategyToAddress,\\n address[] calldata _assets,\\n uint256[] calldata _amounts\\n ) external;\\n\\n // VaultCore.sol\\n function mint(\\n address _asset,\\n uint256 _amount,\\n uint256 _minimumOusdAmount\\n ) external;\\n\\n function mintForStrategy(uint256 _amount) external;\\n\\n function redeem(uint256 _amount, uint256 _minimumUnitAmount) external;\\n\\n function burnForStrategy(uint256 _amount) external;\\n\\n function allocate() external;\\n\\n function rebase() external;\\n\\n function swapCollateral(\\n address fromAsset,\\n address toAsset,\\n uint256 fromAssetAmount,\\n uint256 minToAssetAmount,\\n bytes calldata data\\n ) external returns (uint256 toAssetAmount);\\n\\n function totalValue() external view returns (uint256 value);\\n\\n function checkBalance(address _asset) external view returns (uint256);\\n\\n function calculateRedeemOutputs(uint256 _amount)\\n external\\n view\\n returns (uint256[] memory);\\n\\n function getAssetCount() external view returns (uint256);\\n\\n function getAssetConfig(address _asset)\\n external\\n view\\n returns (VaultStorage.Asset memory config);\\n\\n function getAllAssets() external view returns (address[] memory);\\n\\n function getStrategyCount() external view returns (uint256);\\n\\n function swapper() external view returns (address);\\n\\n function allowedSwapUndervalue() external view returns (uint256);\\n\\n function getAllStrategies() external view returns (address[] memory);\\n\\n function isSupportedAsset(address _asset) external view returns (bool);\\n\\n function netOusdMintForStrategyThreshold() external view returns (uint256);\\n\\n function setOusdMetaStrategy(address _ousdMetaStrategy) external;\\n\\n function setNetOusdMintForStrategyThreshold(uint256 _threshold) external;\\n\\n function netOusdMintedForStrategy() external view returns (int256);\\n\\n function setDripper(address _dripper) external;\\n\\n function dripper() external view returns (address);\\n\\n function weth() external view returns (address);\\n\\n function cacheWETHAssetIndex() external;\\n\\n function wethAssetIndex() external view returns (uint256);\\n\\n function initialize(address, address) external;\\n\\n function setAdminImpl(address) external;\\n\\n function removeAsset(address _asset) external;\\n\\n // These are OETH specific functions\\n function addWithdrawalQueueLiquidity() external;\\n\\n function requestWithdrawal(uint256 _amount)\\n external\\n returns (uint256 requestId, uint256 queued);\\n\\n function claimWithdrawal(uint256 requestId)\\n external\\n returns (uint256 amount);\\n\\n function claimWithdrawals(uint256[] memory requestIds)\\n external\\n returns (uint256[] memory amounts, uint256 totalAmount);\\n\\n function withdrawalQueueMetadata()\\n external\\n view\\n returns (VaultStorage.WithdrawalQueueMetadata memory);\\n\\n function withdrawalRequests(uint256 requestId)\\n external\\n view\\n returns (VaultStorage.WithdrawalRequest memory);\\n\\n // OETHb specific functions\\n function addStrategyToMintWhitelist(address strategyAddr) external;\\n\\n function removeStrategyFromMintWhitelist(address strategyAddr) external;\\n\\n function isMintWhitelistedStrategy(address strategyAddr)\\n external\\n view\\n returns (bool);\\n\\n function withdrawalClaimDelay() external view returns (uint256);\\n\\n function setWithdrawalClaimDelay(uint256 newDelay) external;\\n\\n function lastRebase() external view returns (uint64);\\n\\n function dripDuration() external view returns (uint64);\\n\\n function setDripDuration(uint256 _dripDuration) external;\\n\\n function rebasePerSecondMax() external view returns (uint64);\\n\\n function setRebaseRateMax(uint256 yearlyApr) external;\\n\\n function rebasePerSecondTarget() external view returns (uint64);\\n\\n function previewYield() external view returns (uint256 yield);\\n\\n // slither-disable-end constable-states\\n}\\n\",\"keccak256\":\"0x8d0a60f594d97578b0513b4da3d8fcafaa601950c6c4c016bf60b1344733269c\",\"license\":\"BUSL-1.1\"},\"contracts/interfaces/IWETH9.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IWETH9 {\\n event Approval(address indexed src, address indexed guy, uint256 wad);\\n event Deposit(address indexed dst, uint256 wad);\\n event Transfer(address indexed src, address indexed dst, uint256 wad);\\n event Withdrawal(address indexed src, uint256 wad);\\n\\n function allowance(address, address) external view returns (uint256);\\n\\n function approve(address guy, uint256 wad) external returns (bool);\\n\\n function balanceOf(address) external view returns (uint256);\\n\\n function decimals() external view returns (uint8);\\n\\n function deposit() external payable;\\n\\n function name() external view returns (string memory);\\n\\n function symbol() external view returns (string memory);\\n\\n function totalSupply() external view returns (uint256);\\n\\n function transfer(address dst, uint256 wad) external returns (bool);\\n\\n function transferFrom(\\n address src,\\n address dst,\\n uint256 wad\\n ) external returns (bool);\\n\\n function withdraw(uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x05b7dce6c24d3cd4e48b5c6346d86e5e40ecc3291bcdf3f3ef091c98fc826519\",\"license\":\"MIT\"},\"contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport { InitializableAbstractStrategy } from \\\"../../utils/InitializableAbstractStrategy.sol\\\";\\nimport { IWETH9 } from \\\"../../interfaces/IWETH9.sol\\\";\\nimport { CompoundingValidatorManager } from \\\"./CompoundingValidatorManager.sol\\\";\\n\\n/// @title Compounding Staking SSV Strategy\\n/// @notice Strategy to deploy funds into DVT validators powered by the SSV Network\\n/// @author Origin Protocol Inc\\ncontract CompoundingStakingSSVStrategy is\\n CompoundingValidatorManager,\\n InitializableAbstractStrategy\\n{\\n /// @notice SSV ERC20 token that serves as a payment for operating SSV validators\\n address public immutable SSV_TOKEN;\\n\\n // For future use\\n uint256[50] private __gap;\\n\\n /// @param _baseConfig Base strategy config with\\n /// `platformAddress` not used so empty address\\n /// `vaultAddress` the address of the OETH Vault contract\\n /// @param _wethAddress Address of the WETH Token contract\\n /// @param _ssvToken Address of the SSV Token contract\\n /// @param _ssvNetwork Address of the SSV Network contract\\n /// @param _beaconChainDepositContract Address of the beacon chain deposit contract\\n /// @param _beaconProofs Address of the Beacon Proofs contract that verifies beacon chain data\\n /// @param _beaconGenesisTimestamp The timestamp of the Beacon chain's genesis.\\n constructor(\\n BaseStrategyConfig memory _baseConfig,\\n address _wethAddress,\\n address _ssvToken,\\n address _ssvNetwork,\\n address _beaconChainDepositContract,\\n address _beaconProofs,\\n uint64 _beaconGenesisTimestamp\\n )\\n InitializableAbstractStrategy(_baseConfig)\\n CompoundingValidatorManager(\\n _wethAddress,\\n _baseConfig.vaultAddress,\\n _beaconChainDepositContract,\\n _ssvNetwork,\\n _beaconProofs,\\n _beaconGenesisTimestamp\\n )\\n {\\n SSV_TOKEN = _ssvToken;\\n\\n // Make sure nobody owns the implementation contract\\n _setGovernor(address(0));\\n }\\n\\n /// @notice Set up initial internal state including\\n /// 1. approving the SSVNetwork to transfer SSV tokens from this strategy contract\\n /// @param _rewardTokenAddresses Not used so empty array\\n /// @param _assets Not used so empty array\\n /// @param _pTokens Not used so empty array\\n function initialize(\\n address[] memory _rewardTokenAddresses,\\n address[] memory _assets,\\n address[] memory _pTokens\\n ) external onlyGovernor initializer {\\n InitializableAbstractStrategy._initialize(\\n _rewardTokenAddresses,\\n _assets,\\n _pTokens\\n );\\n\\n safeApproveAllTokens();\\n }\\n\\n /// @notice Unlike other strategies, this does not deposit assets into the underlying platform.\\n /// It just checks the asset is WETH and emits the Deposit event.\\n /// To deposit WETH into validators, `registerSsvValidator` and `stakeEth` must be used.\\n /// @param _asset Address of the WETH token.\\n /// @param _amount Amount of WETH that was transferred to the strategy by the vault.\\n function deposit(address _asset, uint256 _amount)\\n external\\n override\\n onlyVault\\n nonReentrant\\n {\\n require(_asset == WETH, \\\"Unsupported asset\\\");\\n require(_amount > 0, \\\"Must deposit something\\\");\\n\\n // Account for the new WETH\\n depositedWethAccountedFor += _amount;\\n\\n emit Deposit(_asset, address(0), _amount);\\n }\\n\\n /// @notice Unlike other strategies, this does not deposit assets into the underlying platform.\\n /// It just emits the Deposit event.\\n /// To deposit WETH into validators `registerSsvValidator` and `stakeEth` must be used.\\n function depositAll() external override onlyVault nonReentrant {\\n uint256 wethBalance = IERC20(WETH).balanceOf(address(this));\\n uint256 newWeth = wethBalance - depositedWethAccountedFor;\\n\\n if (newWeth > 0) {\\n // Account for the new WETH\\n depositedWethAccountedFor = wethBalance;\\n\\n emit Deposit(WETH, address(0), newWeth);\\n }\\n }\\n\\n /// @notice Withdraw ETH and WETH from this strategy contract.\\n /// @param _recipient Address to receive withdrawn assets.\\n /// @param _asset Address of the WETH token.\\n /// @param _amount Amount of WETH to withdraw.\\n function withdraw(\\n address _recipient,\\n address _asset,\\n uint256 _amount\\n ) external override onlyVault nonReentrant {\\n require(_asset == WETH, \\\"Unsupported asset\\\");\\n\\n _withdraw(_recipient, _amount, address(this).balance);\\n }\\n\\n function _withdraw(\\n address _recipient,\\n uint256 _withdrawAmount,\\n uint256 _ethBalance\\n ) internal {\\n require(_withdrawAmount > 0, \\\"Must withdraw something\\\");\\n require(_recipient != address(0), \\\"Must specify recipient\\\");\\n\\n // Convert any ETH from validator partial withdrawals, exits\\n // or execution rewards to WETH and do the necessary accounting.\\n if (_ethBalance > 0) _convertEthToWeth(_ethBalance);\\n\\n // Transfer WETH to the recipient and do the necessary accounting.\\n _transferWeth(_withdrawAmount, _recipient);\\n\\n emit Withdrawal(WETH, address(0), _withdrawAmount);\\n }\\n\\n /// @notice Transfer all WETH deposits, ETH from validator withdrawals and ETH from\\n /// execution rewards in this strategy to the vault.\\n /// This does not withdraw from the validators. That has to be done separately with the\\n /// `validatorWithdrawal` operation.\\n function withdrawAll() external override onlyVaultOrGovernor nonReentrant {\\n uint256 ethBalance = address(this).balance;\\n uint256 withdrawAmount = IERC20(WETH).balanceOf(address(this)) +\\n ethBalance;\\n\\n if (withdrawAmount > 0) {\\n _withdraw(vaultAddress, withdrawAmount, ethBalance);\\n }\\n }\\n\\n /// @notice Accounts for all the assets managed by this strategy which includes:\\n /// 1. The current WETH in this strategy contract\\n /// 2. The last verified ETH balance, total deposits and total validator balances\\n /// @param _asset Address of WETH asset.\\n /// @return balance Total value in ETH\\n function checkBalance(address _asset)\\n external\\n view\\n override\\n returns (uint256 balance)\\n {\\n require(_asset == WETH, \\\"Unsupported asset\\\");\\n\\n // Load the last verified balance from the storage\\n // and add to the latest WETH balance of this strategy.\\n balance =\\n lastVerifiedEthBalance +\\n IWETH9(WETH).balanceOf(address(this));\\n }\\n\\n /// @notice Returns bool indicating whether asset is supported by the strategy.\\n /// @param _asset The address of the WETH token.\\n function supportsAsset(address _asset) public view override returns (bool) {\\n return _asset == WETH;\\n }\\n\\n /// @notice Approves the SSV Network contract to transfer SSV tokens for validator registration.\\n function safeApproveAllTokens() public override {\\n // Approves the SSV Network contract to transfer SSV tokens when validators are registered\\n IERC20(SSV_TOKEN).approve(SSV_NETWORK, type(uint256).max);\\n }\\n\\n /**\\n * @notice We can accept ETH directly to this contract from anyone as it does not impact our accounting\\n * like it did in the legacy NativeStakingStrategy.\\n * The new ETH will be accounted for in `checkBalance` after the next snapBalances and verifyBalances txs.\\n */\\n receive() external payable {}\\n\\n /***************************************\\n Internal functions\\n ****************************************/\\n\\n /// @notice is not supported for this strategy as there is no platform token.\\n function setPTokenAddress(address, address) external pure override {\\n revert(\\\"Unsupported function\\\");\\n }\\n\\n /// @notice is not supported for this strategy as there is no platform token.\\n function removePToken(uint256) external pure override {\\n revert(\\\"Unsupported function\\\");\\n }\\n\\n /// @dev This strategy does not use a platform token like the old Aave and Compound strategies.\\n function _abstractSetPToken(address _asset, address) internal override {}\\n\\n /// @dev Consensus rewards are compounded to the validator's balance instead of being\\n /// swept to this strategy contract.\\n /// Execution rewards from MEV and tx priority accumulate as ETH in this strategy contract.\\n /// Withdrawals from validators also accumulate as ETH in this strategy contract.\\n /// It's too complex to separate the rewards from withdrawals so this function is not implemented.\\n /// Besides, ETH rewards are not sent to the Dripper any more. The Vault can now regulate\\n /// the increase in assets.\\n function _collectRewardTokens() internal pure override {\\n revert(\\\"Unsupported function\\\");\\n }\\n}\\n\",\"keccak256\":\"0x1c54018f3c60ed6c0a3a9c5c2c6e6ca4c29ffd4434e96fab0cb7f3d06e3bd649\",\"license\":\"BUSL-1.1\"},\"contracts/strategies/NativeStaking/CompoundingValidatorManager.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { SafeCast } from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport { Math } from \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { Pausable } from \\\"@openzeppelin/contracts/security/Pausable.sol\\\";\\nimport { Governable } from \\\"../../governance/Governable.sol\\\";\\nimport { IDepositContract } from \\\"../../interfaces/IDepositContract.sol\\\";\\nimport { IWETH9 } from \\\"../../interfaces/IWETH9.sol\\\";\\nimport { ISSVNetwork, Cluster } from \\\"../../interfaces/ISSVNetwork.sol\\\";\\nimport { BeaconRoots } from \\\"../../beacon/BeaconRoots.sol\\\";\\nimport { PartialWithdrawal } from \\\"../../beacon/PartialWithdrawal.sol\\\";\\nimport { IBeaconProofs } from \\\"../../interfaces/IBeaconProofs.sol\\\";\\n\\n/**\\n * @title Validator lifecycle management contract\\n * @notice This contract implements all the required functionality to\\n * register, deposit, withdraw, exit and remove validators.\\n * @author Origin Protocol Inc\\n */\\nabstract contract CompoundingValidatorManager is Governable, Pausable {\\n using SafeERC20 for IERC20;\\n\\n /// @dev The amount of ETH in wei that is required for a deposit to a new validator.\\n uint256 internal constant DEPOSIT_AMOUNT_WEI = 1 ether;\\n /// @dev Validator balances over this amount will eventually become active on the beacon chain.\\n /// Due to hysteresis, if the effective balance is 31 ETH, the actual balance\\n /// must rise to 32.25 ETH to trigger an effective balance update to 32 ETH.\\n /// https://eth2book.info/capella/part2/incentives/balances/#hysteresis\\n uint256 internal constant MIN_ACTIVATION_BALANCE_GWEI = 32.25 ether / 1e9;\\n /// @dev The maximum number of deposits that are waiting to be verified as processed on the beacon chain.\\n uint256 internal constant MAX_DEPOSITS = 12;\\n /// @dev The maximum number of validators that can be verified.\\n uint256 internal constant MAX_VERIFIED_VALIDATORS = 48;\\n /// @dev The default withdrawable epoch value on the Beacon chain.\\n /// A value in the far future means the validator is not exiting.\\n uint64 internal constant FAR_FUTURE_EPOCH = type(uint64).max;\\n /// @dev The number of seconds between each beacon chain slot.\\n uint64 internal constant SLOT_DURATION = 12;\\n /// @dev The number of slots in each beacon chain epoch.\\n uint64 internal constant SLOTS_PER_EPOCH = 32;\\n /// @dev Minimum time in seconds to allow snapped balances to be verified.\\n /// Set to 35 slots which is 3 slots more than 1 epoch (32 slots). Deposits get processed\\n /// once per epoch. This larger than 1 epoch delay should achieve that `snapBalances` sometimes\\n /// get called in the middle (or towards the end) of the epoch. Giving the off-chain script\\n /// sufficient time after the end of the epoch to prepare the proofs and call `verifyBalances`.\\n /// This is considering a malicious actor would keep calling `snapBalances` as frequent as possible\\n /// to disturb our operations.\\n uint64 internal constant SNAP_BALANCES_DELAY = 35 * SLOT_DURATION;\\n\\n /// @notice The address of the Wrapped ETH (WETH) token contract\\n address internal immutable WETH;\\n /// @notice The address of the beacon chain deposit contract\\n address internal immutable BEACON_CHAIN_DEPOSIT_CONTRACT;\\n /// @notice The address of the SSV Network contract used to interface with\\n address public immutable SSV_NETWORK;\\n /// @notice Address of the OETH Vault proxy contract\\n address internal immutable VAULT_ADDRESS;\\n /// @notice Address of the Beacon Proofs contract that verifies beacon chain data\\n address public immutable BEACON_PROOFS;\\n /// @notice The timestamp of the Beacon chain genesis.\\n /// @dev this is different on Testnets like Hoodi so is set at deployment time.\\n uint64 internal immutable BEACON_GENESIS_TIMESTAMP;\\n\\n /// @notice Address of the registrator - allowed to register, withdraw, exit and remove validators\\n address public validatorRegistrator;\\n\\n /// @notice Deposit data for new compounding validators.\\n /// @dev A `VERIFIED` deposit can mean 3 separate things:\\n /// - a deposit has been processed by the beacon chain and shall be included in the\\n /// balance of the next verifyBalances call\\n /// - a deposit has been done to a slashed validator and has probably been recovered\\n /// back to this strategy. Probably because we can not know for certain. This contract\\n /// only detects when the validator has passed its withdrawal epoch. It is close to impossible\\n /// to prove with Merkle Proofs that the postponed deposit this contract is responsible for\\n /// creating is not present anymore in BeaconChain.state.pending_deposits. This in effect\\n /// means that there might be a period where this contract thinks the deposit has been already\\n /// returned as ETH balance before it happens. This will result in some days (or weeks)\\n /// -> depending on the size of deposit queue of showing a deficit when calling `checkBalance`.\\n /// As this only offsets the yield and doesn't cause a critical double-counting we are not addressing\\n /// this issue.\\n /// - A deposit has been done to the validator, but our deposit has been front run by a malicious\\n /// actor. Funds in the deposit this contract makes are not recoverable.\\n enum DepositStatus {\\n UNKNOWN, // default value\\n PENDING, // deposit is pending and waiting to be verified\\n VERIFIED // deposit has been verified\\n }\\n\\n /// @param pubKeyHash Hash of validator's public key using the Beacon Chain's format\\n /// @param amountGwei Amount of ETH in gwei that has been deposited to the beacon chain deposit contract\\n /// @param slot The beacon chain slot number when the deposit has been made\\n /// @param depositIndex The index of the deposit in the list of active deposits\\n /// @param status The status of the deposit, either UNKNOWN, PENDING or VERIFIED\\n struct DepositData {\\n bytes32 pubKeyHash;\\n uint64 amountGwei;\\n uint64 slot;\\n uint32 depositIndex;\\n DepositStatus status;\\n }\\n /// @notice Restricts to only one deposit to an unverified validator at a time.\\n /// This is to limit front-running attacks of deposits to the beacon chain contract.\\n ///\\n /// @dev The value is set to true when a deposit to a new validator has been done that has\\n /// not yet be verified.\\n bool public firstDeposit;\\n /// @notice Mapping of the pending deposit roots to the deposit data\\n mapping(bytes32 => DepositData) public deposits;\\n /// @notice List of strategy deposit IDs to a validator.\\n /// The ID is the merkle root of the pending deposit data which is unique for each validator, amount and block.\\n /// Duplicate pending deposit roots are prevented so can be used as an identifier to each strategy deposit.\\n /// The list can be for deposits waiting to be verified as processed on the beacon chain,\\n /// or deposits that have been verified to an exiting validator and is now waiting for the\\n /// validator's balance to be swept.\\n /// The list may not be ordered by time of deposit.\\n /// Removed deposits will move the last deposit to the removed index.\\n bytes32[] public depositList;\\n\\n enum ValidatorState {\\n NON_REGISTERED, // validator is not registered on the SSV network\\n REGISTERED, // validator is registered on the SSV network\\n STAKED, // validator has funds staked\\n VERIFIED, // validator has been verified to exist on the beacon chain\\n ACTIVE, // The validator balance is at least 32 ETH. The validator may not yet be active on the beacon chain.\\n EXITING, // The validator has been requested to exit or has been verified as forced exit\\n EXITED, // The validator has been verified to have a zero balance\\n REMOVED, // validator has funds withdrawn to this strategy contract and is removed from the SSV\\n INVALID // The validator has been front-run and the withdrawal address is not this strategy\\n }\\n\\n // Validator data\\n struct ValidatorData {\\n ValidatorState state; // The state of the validator known to this contract\\n uint40 index; // The index of the validator on the beacon chain\\n }\\n /// @notice List of validator public key hashes that have been verified to exist on the beacon chain.\\n /// These have had a deposit processed and the validator's balance increased.\\n /// Validators will be removed from this list when its verified they have a zero balance.\\n bytes32[] public verifiedValidators;\\n /// @notice Mapping of the hash of the validator's public key to the validator state and index.\\n /// Uses the Beacon chain hashing for BLSPubkey which is sha256(abi.encodePacked(validator.pubkey, bytes16(0)))\\n mapping(bytes32 => ValidatorData) public validator;\\n\\n /// @param blockRoot Beacon chain block root of the snapshot\\n /// @param timestamp Timestamp of the snapshot\\n /// @param ethBalance The balance of ETH in the strategy contract at the snapshot\\n struct Balances {\\n bytes32 blockRoot;\\n uint64 timestamp;\\n uint128 ethBalance;\\n }\\n /// @notice Mapping of the block root to the balances at that slot\\n Balances public snappedBalance;\\n /// @notice The last verified ETH balance of the strategy\\n uint256 public lastVerifiedEthBalance;\\n\\n /// @dev This contract receives WETH as the deposit asset, but unlike other strategies doesn't immediately\\n /// deposit it to an underlying platform. Rather a special privilege account stakes it to the validators.\\n /// For that reason calling WETH.balanceOf(this) in a deposit function can contain WETH that has just been\\n /// deposited and also WETH that has previously been deposited. To keep a correct count we need to keep track\\n /// of WETH that has already been accounted for.\\n /// This value represents the amount of WETH balance of this contract that has already been accounted for by the\\n /// deposit events.\\n /// It is important to note that this variable is not concerned with WETH that is a result of full/partial\\n /// withdrawal of the validators. It is strictly concerned with WETH that has been deposited and is waiting to\\n /// be staked.\\n uint256 public depositedWethAccountedFor;\\n\\n // For future use\\n uint256[41] private __gap;\\n\\n event RegistratorChanged(address indexed newAddress);\\n event StakingMonitorChanged(address indexed newAddress);\\n event FirstDepositReset();\\n event SSVValidatorRegistered(\\n bytes32 indexed pubKeyHash,\\n uint64[] operatorIds\\n );\\n event SSVValidatorRemoved(bytes32 indexed pubKeyHash, uint64[] operatorIds);\\n event ETHStaked(\\n bytes32 indexed pubKeyHash,\\n bytes32 indexed pendingDepositRoot,\\n bytes pubKey,\\n uint256 amountWei\\n );\\n event ValidatorVerified(\\n bytes32 indexed pubKeyHash,\\n uint40 indexed validatorIndex\\n );\\n event ValidatorInvalid(bytes32 indexed pubKeyHash);\\n event DepositVerified(\\n bytes32 indexed pendingDepositRoot,\\n uint256 amountWei\\n );\\n event ValidatorWithdraw(bytes32 indexed pubKeyHash, uint256 amountWei);\\n event BalancesSnapped(bytes32 indexed blockRoot, uint256 ethBalance);\\n event BalancesVerified(\\n uint64 indexed timestamp,\\n uint256 totalDepositsWei,\\n uint256 totalValidatorBalance,\\n uint256 ethBalance\\n );\\n\\n /// @dev Throws if called by any account other than the Registrator\\n modifier onlyRegistrator() {\\n require(msg.sender == validatorRegistrator, \\\"Not Registrator\\\");\\n _;\\n }\\n\\n /// @dev Throws if called by any account other than the Registrator or Governor\\n modifier onlyRegistratorOrGovernor() {\\n require(\\n msg.sender == validatorRegistrator || isGovernor(),\\n \\\"Not Registrator or Governor\\\"\\n );\\n _;\\n }\\n\\n /// @param _wethAddress Address of the Erc20 WETH Token contract\\n /// @param _vaultAddress Address of the Vault\\n /// @param _beaconChainDepositContract Address of the beacon chain deposit contract\\n /// @param _ssvNetwork Address of the SSV Network contract\\n /// @param _beaconProofs Address of the Beacon Proofs contract that verifies beacon chain data\\n /// @param _beaconGenesisTimestamp The timestamp of the Beacon chain's genesis.\\n constructor(\\n address _wethAddress,\\n address _vaultAddress,\\n address _beaconChainDepositContract,\\n address _ssvNetwork,\\n address _beaconProofs,\\n uint64 _beaconGenesisTimestamp\\n ) {\\n WETH = _wethAddress;\\n BEACON_CHAIN_DEPOSIT_CONTRACT = _beaconChainDepositContract;\\n SSV_NETWORK = _ssvNetwork;\\n VAULT_ADDRESS = _vaultAddress;\\n BEACON_PROOFS = _beaconProofs;\\n BEACON_GENESIS_TIMESTAMP = _beaconGenesisTimestamp;\\n\\n require(\\n block.timestamp > _beaconGenesisTimestamp,\\n \\\"Invalid genesis timestamp\\\"\\n );\\n }\\n\\n /**\\n *\\n * Admin Functions\\n *\\n */\\n\\n /// @notice Set the address of the registrator which can register, exit and remove validators\\n function setRegistrator(address _address) external onlyGovernor {\\n validatorRegistrator = _address;\\n emit RegistratorChanged(_address);\\n }\\n\\n /// @notice Reset the `firstDeposit` flag to false so deposits to unverified validators can be made again.\\n function resetFirstDeposit() external onlyGovernor {\\n require(firstDeposit, \\\"No first deposit\\\");\\n\\n firstDeposit = false;\\n\\n emit FirstDepositReset();\\n }\\n\\n function pause() external onlyRegistratorOrGovernor {\\n _pause();\\n }\\n\\n function unPause() external onlyGovernor {\\n _unpause();\\n }\\n\\n /**\\n *\\n * Validator Management\\n *\\n */\\n\\n /// @notice Registers a single validator in a SSV Cluster.\\n /// Only the Registrator can call this function.\\n /// @param publicKey The public key of the validator\\n /// @param operatorIds The operator IDs of the SSV Cluster\\n /// @param sharesData The shares data for the validator\\n /// @param ssvAmount The amount of SSV tokens to be deposited to the SSV cluster\\n /// @param cluster The SSV cluster details including the validator count and SSV balance\\n // slither-disable-start reentrancy-no-eth\\n function registerSsvValidator(\\n bytes calldata publicKey,\\n uint64[] calldata operatorIds,\\n bytes calldata sharesData,\\n uint256 ssvAmount,\\n Cluster calldata cluster\\n ) external onlyRegistrator whenNotPaused {\\n // Hash the public key using the Beacon Chain's format\\n bytes32 pubKeyHash = _hashPubKey(publicKey);\\n // Check each public key has not already been used\\n require(\\n validator[pubKeyHash].state == ValidatorState.NON_REGISTERED,\\n \\\"Validator already registered\\\"\\n );\\n\\n // Store the validator state as registered\\n validator[pubKeyHash].state = ValidatorState.REGISTERED;\\n\\n ISSVNetwork(SSV_NETWORK).registerValidator(\\n publicKey,\\n operatorIds,\\n sharesData,\\n ssvAmount,\\n cluster\\n );\\n\\n emit SSVValidatorRegistered(pubKeyHash, operatorIds);\\n }\\n\\n // slither-disable-end reentrancy-no-eth\\n\\n struct ValidatorStakeData {\\n bytes pubkey;\\n bytes signature;\\n bytes32 depositDataRoot;\\n }\\n\\n /// @notice Stakes WETH in this strategy to a compounding validator.\\n /// The the first deposit to a new validator, the amount must be 1 ETH.\\n /// Another deposit of at least 31 ETH is required for the validator to be activated.\\n /// This second deposit has to be done after the validator has been verified.\\n /// Does not convert any ETH sitting in this strategy to WETH.\\n /// There can not be two deposits to the same validator in the same block for the same amount.\\n /// Function is pausable so in case a run-away Registrator can be prevented from continuing\\n /// to deposit funds to slashed or undesired validators.\\n /// @param validatorStakeData validator data needed to stake.\\n /// The `ValidatorStakeData` struct contains the pubkey, signature and depositDataRoot.\\n /// Only the registrator can call this function.\\n /// @param depositAmountGwei The amount of WETH to stake to the validator in Gwei.\\n // slither-disable-start reentrancy-eth,reentrancy-no-eth\\n function stakeEth(\\n ValidatorStakeData calldata validatorStakeData,\\n uint64 depositAmountGwei\\n ) external onlyRegistrator whenNotPaused {\\n uint256 depositAmountWei = uint256(depositAmountGwei) * 1 gwei;\\n // Check there is enough WETH from the deposits sitting in this strategy contract\\n // There could be ETH from withdrawals but we'll ignore that. If it's really needed\\n // the ETH can be withdrawn and then deposited back to the strategy.\\n require(\\n depositAmountWei <= IWETH9(WETH).balanceOf(address(this)),\\n \\\"Insufficient WETH\\\"\\n );\\n require(depositList.length < MAX_DEPOSITS, \\\"Max deposits\\\");\\n\\n // Convert required ETH from WETH and do the necessary accounting\\n _convertWethToEth(depositAmountWei);\\n\\n // Hash the public key using the Beacon Chain's hashing for BLSPubkey\\n bytes32 pubKeyHash = _hashPubKey(validatorStakeData.pubkey);\\n ValidatorState currentState = validator[pubKeyHash].state;\\n // Can only stake to a validator has have been registered, verified or active.\\n // Can not stake to a validator that has been staked but not yet verified.\\n require(\\n (currentState == ValidatorState.REGISTERED ||\\n currentState == ValidatorState.VERIFIED ||\\n currentState == ValidatorState.ACTIVE),\\n \\\"Not registered or verified\\\"\\n );\\n require(depositAmountWei >= 1 ether, \\\"Deposit too small\\\");\\n if (currentState == ValidatorState.REGISTERED) {\\n // Can only have one pending deposit to an unverified validator at a time.\\n // This is to limit front-running deposit attacks to a single deposit.\\n // The exiting deposit needs to be verified before another deposit can be made.\\n // If there was a front-running attack, the validator needs to be verified as invalid\\n // and the Governor calls `resetFirstDeposit` to set `firstDeposit` to false.\\n require(!firstDeposit, \\\"Existing first deposit\\\");\\n // Limits the amount of ETH that can be at risk from a front-running deposit attack.\\n require(\\n depositAmountWei == DEPOSIT_AMOUNT_WEI,\\n \\\"Invalid first deposit amount\\\"\\n );\\n // Limits the number of validator balance proofs to verifyBalances\\n require(\\n verifiedValidators.length + 1 < MAX_VERIFIED_VALIDATORS,\\n \\\"Max validators\\\"\\n );\\n\\n // Flag a deposit to an unverified validator so only no other deposits can be made\\n // to an unverified validator.\\n firstDeposit = true;\\n validator[pubKeyHash].state = ValidatorState.STAKED;\\n }\\n\\n /* 0x02 to indicate that withdrawal credentials are for a compounding validator\\n * that was introduced with the Pectra upgrade.\\n * bytes11(0) to fill up the required zeros\\n * remaining bytes20 are for the address\\n */\\n bytes memory withdrawalCredentials = abi.encodePacked(\\n bytes1(0x02),\\n bytes11(0),\\n address(this)\\n );\\n\\n /// After the Pectra upgrade the validators have a new restriction when proposing\\n /// blocks. The timestamps are at strict intervals of 12 seconds from the genesis block\\n /// forward. Each slot is created at strict 12 second intervals and those slots can\\n /// either have blocks attached to them or not. This way using the block.timestamp\\n /// the slot number can easily be calculated.\\n uint64 depositSlot = (SafeCast.toUint64(block.timestamp) -\\n BEACON_GENESIS_TIMESTAMP) / SLOT_DURATION;\\n\\n // Calculate the merkle root of the beacon chain pending deposit data.\\n // This is used as the unique ID of the deposit.\\n bytes32 pendingDepositRoot = IBeaconProofs(BEACON_PROOFS)\\n .merkleizePendingDeposit(\\n pubKeyHash,\\n withdrawalCredentials,\\n depositAmountGwei,\\n validatorStakeData.signature,\\n depositSlot\\n );\\n require(\\n deposits[pendingDepositRoot].status == DepositStatus.UNKNOWN,\\n \\\"Duplicate deposit\\\"\\n );\\n\\n // Store the deposit data for verifyDeposit and verifyBalances\\n deposits[pendingDepositRoot] = DepositData({\\n pubKeyHash: pubKeyHash,\\n amountGwei: depositAmountGwei,\\n slot: depositSlot,\\n depositIndex: SafeCast.toUint32(depositList.length),\\n status: DepositStatus.PENDING\\n });\\n depositList.push(pendingDepositRoot);\\n\\n // Deposit to the Beacon Chain deposit contract.\\n // This will create a deposit in the beacon chain's pending deposit queue.\\n IDepositContract(BEACON_CHAIN_DEPOSIT_CONTRACT).deposit{\\n value: depositAmountWei\\n }(\\n validatorStakeData.pubkey,\\n withdrawalCredentials,\\n validatorStakeData.signature,\\n validatorStakeData.depositDataRoot\\n );\\n\\n emit ETHStaked(\\n pubKeyHash,\\n pendingDepositRoot,\\n validatorStakeData.pubkey,\\n depositAmountWei\\n );\\n }\\n\\n // slither-disable-end reentrancy-eth,reentrancy-no-eth\\n\\n /// @notice Request a full or partial withdrawal from a validator.\\n /// A zero amount will trigger a full withdrawal.\\n /// If the remaining balance is < 32 ETH then only the amount in excess of 32 ETH will be withdrawn.\\n /// Only the Registrator can call this function.\\n /// 1 wei of value should be sent with the tx to pay for the withdrawal request fee.\\n /// If no value sent, 1 wei will be taken from the strategy's ETH balance if it has any.\\n /// If no ETH balance, the tx will revert.\\n /// @param publicKey The public key of the validator\\n /// @param amountGwei The amount of ETH to be withdrawn from the validator in Gwei.\\n /// A zero amount will trigger a full withdrawal.\\n // slither-disable-start reentrancy-no-eth\\n function validatorWithdrawal(bytes calldata publicKey, uint64 amountGwei)\\n external\\n payable\\n onlyRegistrator\\n {\\n // Hash the public key using the Beacon Chain's format\\n bytes32 pubKeyHash = _hashPubKey(publicKey);\\n ValidatorData memory validatorDataMem = validator[pubKeyHash];\\n // Validator full withdrawal could be denied due to multiple reasons:\\n // - the validator has not been activated or active long enough\\n // (current_epoch < activation_epoch + SHARD_COMMITTEE_PERIOD)\\n // - the validator has pending balance to withdraw from a previous partial withdrawal request\\n //\\n // Meaning that the on-chain to beacon chain full withdrawal request could fail. Instead\\n // of adding complexity of verifying if a validator is eligible for a full exit, we allow\\n // multiple full withdrawal requests per validator.\\n require(\\n validatorDataMem.state == ValidatorState.ACTIVE ||\\n validatorDataMem.state == ValidatorState.EXITING,\\n \\\"Validator not active/exiting\\\"\\n );\\n\\n // If a full withdrawal (validator exit)\\n if (amountGwei == 0) {\\n // For each staking strategy's deposits\\n uint256 depositsCount = depositList.length;\\n for (uint256 i = 0; i < depositsCount; ++i) {\\n bytes32 pendingDepositRoot = depositList[i];\\n // Check there is no pending deposits to the exiting validator\\n require(\\n pubKeyHash != deposits[pendingDepositRoot].pubKeyHash,\\n \\\"Pending deposit\\\"\\n );\\n }\\n\\n // Store the validator state as exiting so no more deposits can be made to it.\\n // This may already be EXITING if the previous exit request failed. eg the validator\\n // was not active long enough.\\n validator[pubKeyHash].state = ValidatorState.EXITING;\\n }\\n\\n // Do not remove from the list of verified validators.\\n // This is done in the verifyBalances function once the validator's balance has been verified to be zero.\\n // The validator state will be set to EXITED in the verifyBalances function.\\n\\n PartialWithdrawal.request(publicKey, amountGwei);\\n\\n emit ValidatorWithdraw(pubKeyHash, uint256(amountGwei) * 1 gwei);\\n }\\n\\n // slither-disable-end reentrancy-no-eth\\n\\n /// @notice Remove the validator from the SSV Cluster after:\\n /// - the validator has been exited from `validatorWithdrawal` or slashed\\n /// - the validator has incorrectly registered and can not be staked to\\n /// - the initial deposit was front-run and the withdrawal address is not this strategy's address.\\n /// Make sure `validatorWithdrawal` is called with a zero amount and the validator has exited the Beacon chain.\\n /// If removed before the validator has exited the beacon chain will result in the validator being slashed.\\n /// Only the registrator can call this function.\\n /// @param publicKey The public key of the validator\\n /// @param operatorIds The operator IDs of the SSV Cluster\\n /// @param cluster The SSV cluster details including the validator count and SSV balance\\n // slither-disable-start reentrancy-no-eth\\n function removeSsvValidator(\\n bytes calldata publicKey,\\n uint64[] calldata operatorIds,\\n Cluster calldata cluster\\n ) external onlyRegistrator {\\n // Hash the public key using the Beacon Chain's format\\n bytes32 pubKeyHash = _hashPubKey(publicKey);\\n ValidatorState currentState = validator[pubKeyHash].state;\\n // Can remove SSV validators that were incorrectly registered and can not be deposited to.\\n require(\\n currentState == ValidatorState.REGISTERED ||\\n currentState == ValidatorState.EXITED ||\\n currentState == ValidatorState.INVALID,\\n \\\"Validator not regd or exited\\\"\\n );\\n\\n validator[pubKeyHash].state = ValidatorState.REMOVED;\\n\\n ISSVNetwork(SSV_NETWORK).removeValidator(\\n publicKey,\\n operatorIds,\\n cluster\\n );\\n\\n emit SSVValidatorRemoved(pubKeyHash, operatorIds);\\n }\\n\\n /**\\n *\\n * SSV Management\\n *\\n */\\n\\n // slither-disable-end reentrancy-no-eth\\n\\n /// `depositSSV` has been removed as `deposit` on the SSVNetwork contract can be called directly\\n /// by the Strategist which is already holding SSV tokens.\\n\\n /// @notice Withdraws excess SSV Tokens from the SSV Network contract which was used to pay the SSV Operators.\\n /// @dev A SSV cluster is defined by the SSVOwnerAddress and the set of operatorIds.\\n /// @param operatorIds The operator IDs of the SSV Cluster\\n /// @param ssvAmount The amount of SSV tokens to be withdrawn from the SSV cluster\\n /// @param cluster The SSV cluster details including the validator count and SSV balance\\n function withdrawSSV(\\n uint64[] memory operatorIds,\\n uint256 ssvAmount,\\n Cluster memory cluster\\n ) external onlyGovernor {\\n ISSVNetwork(SSV_NETWORK).withdraw(operatorIds, ssvAmount, cluster);\\n }\\n\\n /**\\n *\\n * Beacon Chain Proofs\\n *\\n */\\n\\n /// @notice Verifies a validator's index to its public key.\\n /// Adds to the list of verified validators if the validator's withdrawal address is this strategy's address.\\n /// Marks the validator as invalid and removes the deposit if the withdrawal address is not this strategy's address.\\n /// @param nextBlockTimestamp The timestamp of the execution layer block after the beacon chain slot\\n /// we are verifying.\\n /// The next one is needed as the Beacon Oracle returns the parent beacon block root for a block timestamp,\\n /// which is the beacon block root of the previous block.\\n /// @param validatorIndex The index of the validator on the beacon chain.\\n /// @param pubKeyHash The hash of the validator's public key using the Beacon Chain's format\\n /// @param withdrawalCredentials contain the validator type and withdrawal address. These can be incorrect and/or\\n /// malformed. In case of incorrect withdrawalCredentials the validator deposit has been front run\\n /// @param validatorPubKeyProof The merkle proof for the validator public key to the beacon block root.\\n /// This is 53 witness hashes of 32 bytes each concatenated together starting from the leaf node.\\n /// BeaconBlock.state.validators[validatorIndex].pubkey\\n function verifyValidator(\\n uint64 nextBlockTimestamp,\\n uint40 validatorIndex,\\n bytes32 pubKeyHash,\\n bytes32 withdrawalCredentials,\\n bytes calldata validatorPubKeyProof\\n ) external {\\n require(\\n validator[pubKeyHash].state == ValidatorState.STAKED,\\n \\\"Validator not staked\\\"\\n );\\n\\n // Get the beacon block root of the slot we are verifying the validator in.\\n // The parent beacon block root of the next block is the beacon block root of the slot we are verifying.\\n bytes32 blockRoot = BeaconRoots.parentBlockRoot(nextBlockTimestamp);\\n\\n // Verify the validator index is for the validator with the given public key.\\n // Also verify the validator's withdrawal credentials\\n IBeaconProofs(BEACON_PROOFS).verifyValidator(\\n blockRoot,\\n pubKeyHash,\\n validatorPubKeyProof,\\n validatorIndex,\\n withdrawalCredentials\\n );\\n\\n // Store the validator state as verified\\n validator[pubKeyHash] = ValidatorData({\\n state: ValidatorState.VERIFIED,\\n index: validatorIndex\\n });\\n\\n bytes32 expectedWithdrawalCredentials = bytes32(\\n abi.encodePacked(bytes1(0x02), bytes11(0), address(this))\\n );\\n\\n // If the initial deposit was front-run and the withdrawal address is not this strategy\\n // or the validator type is not a compounding validator (0x02)\\n if (expectedWithdrawalCredentials != withdrawalCredentials) {\\n // override the validator state\\n validator[pubKeyHash].state = ValidatorState.INVALID;\\n\\n // Find and remove the deposit as the funds can not be recovered\\n uint256 depositCount = depositList.length;\\n for (uint256 i = 0; i < depositCount; i++) {\\n DepositData memory deposit = deposits[depositList[i]];\\n if (deposit.pubKeyHash == pubKeyHash) {\\n // next verifyBalances will correctly account for the loss of a front-run\\n // deposit. Doing it here accounts for the loss as soon as possible\\n lastVerifiedEthBalance -= Math.min(\\n lastVerifiedEthBalance,\\n uint256(deposit.amountGwei) * 1 gwei\\n );\\n _removeDeposit(depositList[i], deposit);\\n break;\\n }\\n }\\n\\n // Leave the `firstDeposit` flag as true so no more deposits to unverified validators can be made.\\n // The Governor has to reset the `firstDeposit` to false before another deposit to\\n // an unverified validator can be made.\\n // The Governor can set a new `validatorRegistrator` if they suspect it has been compromised.\\n\\n emit ValidatorInvalid(pubKeyHash);\\n return;\\n }\\n\\n // Add the new validator to the list of verified validators\\n verifiedValidators.push(pubKeyHash);\\n\\n // Reset the firstDeposit flag as the first deposit to an unverified validator has been verified.\\n firstDeposit = false;\\n\\n emit ValidatorVerified(pubKeyHash, validatorIndex);\\n }\\n\\n struct FirstPendingDepositSlotProofData {\\n uint64 slot;\\n bytes proof;\\n }\\n\\n struct StrategyValidatorProofData {\\n uint64 withdrawableEpoch;\\n bytes withdrawableEpochProof;\\n }\\n\\n /// @notice Verifies a deposit on the execution layer has been processed by the beacon chain.\\n /// This means the accounting of the strategy's ETH moves from a pending deposit to a validator balance.\\n ///\\n /// Important: this function has a limitation where `depositProcessedSlot` that is passed by the off-chain\\n /// verifier requires a slot immediately after it to propose a block otherwise the `BeaconRoots.parentBlockRoot`\\n /// will fail. This shouldn't be a problem, since by the current behaviour of beacon chain only 1%-3% slots\\n /// don't propose a block.\\n /// @param pendingDepositRoot The unique identifier of the deposit emitted in `ETHStaked` from\\n /// the `stakeEth` function.\\n /// @param depositProcessedSlot Any slot on or after the strategy's deposit was processed on the beacon chain.\\n /// Can not be a slot with pending deposits with the same slot as the deposit being verified.\\n /// Can not be a slot before a missed slot as the Beacon Root contract will have the parent block root\\n /// set for the next block timestamp in 12 seconds time.\\n /// @param firstPendingDeposit a `FirstPendingDepositSlotProofData` struct containing:\\n /// - slot: The beacon chain slot of the first deposit in the beacon chain's deposit queue.\\n /// Can be any non-zero value if the deposit queue is empty.\\n /// - proof: The merkle proof of the first pending deposit's slot to the beacon block root.\\n /// Can be either:\\n /// * 40 witness hashes for BeaconBlock.state.PendingDeposits[0].slot when the deposit queue is not empty.\\n /// * 37 witness hashes for BeaconBlock.state.PendingDeposits[0] when the deposit queue is empty.\\n /// The 32 byte witness hashes are concatenated together starting from the leaf node.\\n /// @param strategyValidatorData a `StrategyValidatorProofData` struct containing:\\n /// - withdrawableEpoch: The withdrawable epoch of the validator the strategy is depositing to.\\n /// - withdrawableEpochProof: The merkle proof for the withdrawable epoch of the validator the strategy\\n /// is depositing to, to the beacon block root.\\n /// This is 53 witness hashes of 32 bytes each concatenated together starting from the leaf node.\\n // slither-disable-start reentrancy-no-eth\\n function verifyDeposit(\\n bytes32 pendingDepositRoot,\\n uint64 depositProcessedSlot,\\n FirstPendingDepositSlotProofData calldata firstPendingDeposit,\\n StrategyValidatorProofData calldata strategyValidatorData\\n ) external {\\n // Load into memory the previously saved deposit data\\n DepositData memory deposit = deposits[pendingDepositRoot];\\n ValidatorData memory strategyValidator = validator[deposit.pubKeyHash];\\n require(deposit.status == DepositStatus.PENDING, \\\"Deposit not pending\\\");\\n require(firstPendingDeposit.slot != 0, \\\"Zero 1st pending deposit slot\\\");\\n\\n // We should allow the verification of deposits for validators that have been marked as exiting\\n // to cover this situation:\\n // - there are 2 pending deposits\\n // - beacon chain has slashed the validator\\n // - when verifyDeposit is called for the first deposit it sets the Validator state to EXITING\\n // - verifyDeposit should allow a secondary call for the other deposit to a slashed validator\\n require(\\n strategyValidator.state == ValidatorState.VERIFIED ||\\n strategyValidator.state == ValidatorState.ACTIVE ||\\n strategyValidator.state == ValidatorState.EXITING,\\n \\\"Not verified/active/exiting\\\"\\n );\\n // The verification slot must be after the deposit's slot.\\n // This is needed for when the deposit queue is empty.\\n require(deposit.slot < depositProcessedSlot, \\\"Slot not after deposit\\\");\\n\\n uint64 snapTimestamp = snappedBalance.timestamp;\\n\\n // This check prevents an accounting error that can happen if:\\n // - snapBalances are snapped at the time of T\\n // - deposit is processed on the beacon chain after time T and before verifyBalances()\\n // - verifyDeposit is called before verifyBalances which removes a deposit from depositList\\n // and deposit balance from totalDepositsWei\\n // - verifyBalances is called under-reporting the strategy's balance\\n require(\\n (_calcNextBlockTimestamp(depositProcessedSlot) <= snapTimestamp) ||\\n snapTimestamp == 0,\\n \\\"Deposit after balance snapshot\\\"\\n );\\n\\n // Get the parent beacon block root of the next block which is the block root of the deposit verification slot.\\n // This will revert if the slot after the verification slot was missed.\\n bytes32 depositBlockRoot = BeaconRoots.parentBlockRoot(\\n _calcNextBlockTimestamp(depositProcessedSlot)\\n );\\n\\n // Verify the slot of the first pending deposit matches the beacon chain\\n bool isDepositQueueEmpty = IBeaconProofs(BEACON_PROOFS)\\n .verifyFirstPendingDeposit(\\n depositBlockRoot,\\n firstPendingDeposit.slot,\\n firstPendingDeposit.proof\\n );\\n\\n // Verify the withdrawableEpoch on the validator of the strategy's deposit\\n IBeaconProofs(BEACON_PROOFS).verifyValidatorWithdrawable(\\n depositBlockRoot,\\n strategyValidator.index,\\n strategyValidatorData.withdrawableEpoch,\\n strategyValidatorData.withdrawableEpochProof\\n );\\n\\n uint64 firstPendingDepositEpoch = firstPendingDeposit.slot /\\n SLOTS_PER_EPOCH;\\n\\n // If deposit queue is empty all deposits have certainly been processed. If not\\n // a validator can either be not exiting and no further checks are required.\\n // Or a validator is exiting then this function needs to make sure that the\\n // pending deposit to an exited validator has certainly been processed. The\\n // slot/epoch of first pending deposit is the one that contains the transaction\\n // where the deposit to the ETH Deposit Contract has been made.\\n //\\n // Once the firstPendingDepositEpoch becomes greater than the withdrawableEpoch of\\n // the slashed validator then the deposit has certainly been processed. When the beacon\\n // chain reaches the withdrawableEpoch of the validator the deposit will no longer be\\n // postponed. And any new deposits created (and present in the deposit queue)\\n // will have an equal or larger withdrawableEpoch.\\n require(\\n strategyValidatorData.withdrawableEpoch == FAR_FUTURE_EPOCH ||\\n strategyValidatorData.withdrawableEpoch <=\\n firstPendingDepositEpoch ||\\n isDepositQueueEmpty,\\n \\\"Exit Deposit likely not proc.\\\"\\n );\\n\\n // solhint-disable max-line-length\\n // Check the deposit slot is before the first pending deposit's slot on the beacon chain.\\n // If this is not true then we can't guarantee the deposit has been processed by the beacon chain.\\n // The deposit's slot can not be the same slot as the first pending deposit as there could be\\n // many deposits in the same block, hence have the same pending deposit slot.\\n // If the deposit queue is empty then our deposit must have been processed on the beacon chain.\\n // The deposit slot can be zero for validators consolidating to a compounding validator or 0x01 validator\\n // being promoted to a compounding one. Reference:\\n // - [switch_to_compounding_validator](https://ethereum.github.io/consensus-specs/specs/electra/beacon-chain/#new-switch_to_compounding_validator\\n // - [queue_excess_active_balance](https://ethereum.github.io/consensus-specs/specs/electra/beacon-chain/#new-queue_excess_active_balance)\\n // - [process_consolidation_request](https://ethereum.github.io/consensus-specs/specs/electra/beacon-chain/#new-process_consolidation_request)\\n // We can not guarantee that the deposit has been processed in that case.\\n // solhint-enable max-line-length\\n require(\\n deposit.slot < firstPendingDeposit.slot || isDepositQueueEmpty,\\n \\\"Deposit likely not processed\\\"\\n );\\n\\n // Remove the deposit now it has been verified as processed on the beacon chain.\\n _removeDeposit(pendingDepositRoot, deposit);\\n\\n emit DepositVerified(\\n pendingDepositRoot,\\n uint256(deposit.amountGwei) * 1 gwei\\n );\\n }\\n\\n function _removeDeposit(\\n bytes32 pendingDepositRoot,\\n DepositData memory deposit\\n ) internal {\\n // After verifying the proof, update the contract storage\\n deposits[pendingDepositRoot].status = DepositStatus.VERIFIED;\\n // Move the last deposit to the index of the verified deposit\\n bytes32 lastDeposit = depositList[depositList.length - 1];\\n depositList[deposit.depositIndex] = lastDeposit;\\n deposits[lastDeposit].depositIndex = deposit.depositIndex;\\n // Delete the last deposit from the list\\n depositList.pop();\\n }\\n\\n /// @dev Calculates the timestamp of the next execution block from the given slot.\\n /// @param slot The beacon chain slot number used for merkle proof verification.\\n function _calcNextBlockTimestamp(uint64 slot)\\n internal\\n view\\n returns (uint64)\\n {\\n // Calculate the next block timestamp from the slot.\\n return SLOT_DURATION * slot + BEACON_GENESIS_TIMESTAMP + SLOT_DURATION;\\n }\\n\\n // slither-disable-end reentrancy-no-eth\\n\\n /// @notice Stores the current ETH balance at the current block and beacon block root\\n /// of the slot that is associated with the previous block.\\n ///\\n /// When snapping / verifying balance it is of a high importance that there is no\\n /// miss-match in respect to ETH that is held by the contract and balances that are\\n /// verified on the validators.\\n ///\\n /// First some context on the beacon-chain block building behaviour. Relevant parts of\\n /// constructing a block on the beacon chain consist of:\\n /// - process_withdrawals: ETH is deducted from the validator's balance\\n /// - process_execution_payload: immediately after the previous step executing all the\\n /// transactions\\n /// - apply the withdrawals: adding ETH to the recipient which is the withdrawal address\\n /// contained in the withdrawal credentials of the exited validators\\n ///\\n /// That means that balance increases which are part of the post-block execution state are\\n /// done within the block, but the transaction that are contained within that block can not\\n /// see / interact with the balance from the exited validators. Only transactions in the\\n /// next block can do that.\\n ///\\n /// When snap balances is performed the state of the chain is snapped across 2 separate\\n /// chain states:\\n /// - ETH balance of the contract is recorded on block X -> and corresponding slot Y\\n /// - beacon chain block root is recorded of block X - 1 -> and corresponding slot Y - 1\\n /// given there were no missed slots. It could also be Y - 2, Y - 3 depending on how\\n /// many slots have not managed to propose a block. For the sake of simplicity this slot\\n /// will be referred to as Y - 1 as it makes no difference in the argument\\n ///\\n /// Given these 2 separate chain states it is paramount that verify balances can not experience\\n /// miss-counting ETH or much more dangerous double counting of the ETH.\\n ///\\n /// When verifyBalances is called it is performed on the current block Z where Z > X. Verify\\n /// balances adds up all the ETH (omitting WETH) controlled by this contract:\\n /// - ETH balance in the contract on block X\\n /// - ETH balance in Deposits on block Z that haven't been yet processed in slot Y - 1\\n /// - ETH balance in validators that are active in slot Y - 1\\n /// - skips the ETH balance in validators that have withdrawn in slot Y - 1 (or sooner)\\n /// and have their balance visible to transactions in slot Y and corresponding block X\\n /// (or sooner)\\n ///\\n /// Lets verify the correctness of ETH accounting given the above described behaviour.\\n ///\\n /// *ETH balance in the contract on block X*\\n ///\\n /// This is an ETH balance of the contract on a non current X block. Any ETH leaving the\\n /// contract as a result of a withdrawal subtracts from the ETH accounted for on block X\\n /// if `verifyBalances` has already been called. It also invalidates a `snapBalances` in\\n /// case `verifyBalances` has not been called yet. Not performing this would result in not\\n /// accounting for the withdrawn ETH that has happened anywhere in the block interval [X + 1, Z].\\n ///\\n /// Similarly to withdrawals any `stakeEth` deposits to the deposit contract adds to the ETH\\n /// accounted for since the last `verifyBalances` has been called. And it invalidates the\\n /// `snapBalances` in case `verifyBalances` hasn't been yet called. Not performing this\\n /// would result in double counting the `stakedEth` since it would be present once in the\\n /// snapped contract balance and the second time in deposit storage variables.\\n ///\\n /// This behaviour is correct.\\n ///\\n /// *ETH balance in Deposits on block Z that haven't been yet processed in slot Y - 1*\\n ///\\n /// The contract sums up all the ETH that has been deposited to the Beacon chain deposit\\n /// contract at block Z. The execution layer doesn't have direct access to the state of\\n /// deposits on the beacon chain. And if it is to sum up all the ETH that is marked to be\\n /// deposited it needs to be sure to not double count ETH that is in deposits (storage vars)\\n /// and could also be part of the validator balances. It does that by verifying that at\\n /// slot Y - 1 none of the deposits visible on block Z have been processed. Meaning since\\n /// the last snap till now all are still in queue. Which ensures they can not be part of\\n /// the validator balances in later steps.\\n ///\\n /// This behaviour is correct.\\n ///\\n /// *ETH balance in validators that are active in slot Y - 1*\\n ///\\n /// The contract is verifying none of the deposits on Y - 1 slot have been processed and\\n /// for that reason it checks the validator balances in the same slot. Ensuring accounting\\n /// correctness.\\n ///\\n /// This behaviour is correct.\\n ///\\n /// *The withdrawn validators*\\n ///\\n /// The withdrawn validators could have their balances deducted in any slot before slot\\n /// Y - 1 and the execution layer sees the balance increase in the subsequent slot. Lets\\n /// look at the \\\"worst case scenario\\\" where the validator withdrawal is processed in the\\n /// slot Y - 1 (snapped slot) and see their balance increase (in execution layer) in slot\\n /// Y -> block X. The ETH balance on the contract is snapped at block X meaning that\\n /// even if the validator exits at the latest possible time it is paramount that the ETH\\n /// balance on the execution layer is recorded in the next block. Correctly accounting\\n /// for the withdrawn ETH.\\n ///\\n /// Worth mentioning if the validator exit is processed by the slot Y and balance increase\\n /// seen on the execution layer on block X + 1 the withdrawal is ignored by both the\\n /// validator balance verification as well as execution layer contract balance snap.\\n ///\\n /// This behaviour is correct.\\n ///\\n /// The validator balances on the beacon chain can then be proved with `verifyBalances`.\\n function snapBalances() external {\\n uint64 currentTimestamp = SafeCast.toUint64(block.timestamp);\\n require(\\n snappedBalance.timestamp + SNAP_BALANCES_DELAY < currentTimestamp,\\n \\\"Snap too soon\\\"\\n );\\n\\n bytes32 blockRoot = BeaconRoots.parentBlockRoot(currentTimestamp);\\n // Get the current ETH balance\\n uint256 ethBalance = address(this).balance;\\n\\n // Store the snapped balance\\n snappedBalance = Balances({\\n blockRoot: blockRoot,\\n timestamp: currentTimestamp,\\n ethBalance: SafeCast.toUint128(ethBalance)\\n });\\n\\n emit BalancesSnapped(blockRoot, ethBalance);\\n }\\n\\n // A struct is used to avoid stack too deep errors\\n struct BalanceProofs {\\n // BeaconBlock.state.balances\\n bytes32 balancesContainerRoot;\\n bytes balancesContainerProof;\\n // BeaconBlock.state.balances[validatorIndex]\\n bytes32[] validatorBalanceLeaves;\\n bytes[] validatorBalanceProofs;\\n }\\n\\n struct PendingDepositProofs {\\n bytes32 pendingDepositContainerRoot;\\n bytes pendingDepositContainerProof;\\n uint32[] pendingDepositIndexes;\\n bytes[] pendingDepositProofs;\\n }\\n\\n /// @notice Verifies the balances of all active validators on the beacon chain\\n /// and checks each of the strategy's deposits are still to be processed by the beacon chain.\\n /// @param balanceProofs a `BalanceProofs` struct containing the following:\\n /// - balancesContainerRoot: The merkle root of the balances container\\n /// - balancesContainerProof: The merkle proof for the balances container to the beacon block root.\\n /// This is 9 witness hashes of 32 bytes each concatenated together starting from the leaf node.\\n /// - validatorBalanceLeaves: Array of leaf nodes containing the validator balance with three other balances.\\n /// - validatorBalanceProofs: Array of merkle proofs for the validator balance to the Balances container root.\\n /// This is 39 witness hashes of 32 bytes each concatenated together starting from the leaf node.\\n /// @param pendingDepositProofs a `PendingDepositProofs` struct containing the following:\\n /// - pendingDepositContainerRoot: The merkle root of the pending deposits list container\\n /// - pendingDepositContainerProof: The merkle proof from the pending deposits list container\\n /// to the beacon block root.\\n /// This is 9 witness hashes of 32 bytes each concatenated together starting from the leaf node.\\n /// - pendingDepositIndexes: Array of indexes in the pending deposits list container for each\\n /// of the strategy's deposits.\\n /// - pendingDepositProofs: Array of merkle proofs for each strategy deposit in the\\n /// beacon chain's pending deposit list container to the pending deposits list container root.\\n /// These are 28 witness hashes of 32 bytes each concatenated together starting from the leaf node.\\n // slither-disable-start reentrancy-no-eth\\n function verifyBalances(\\n BalanceProofs calldata balanceProofs,\\n PendingDepositProofs calldata pendingDepositProofs\\n ) external {\\n // Load previously snapped balances for the given block root\\n Balances memory balancesMem = snappedBalance;\\n // Check the balances are the latest\\n require(balancesMem.timestamp > 0, \\\"No snapped balances\\\");\\n\\n uint256 verifiedValidatorsCount = verifiedValidators.length;\\n uint256 totalValidatorBalance = 0;\\n uint256 depositsCount = depositList.length;\\n\\n // If there are no verified validators then we can skip the balance verification\\n if (verifiedValidatorsCount > 0) {\\n require(\\n balanceProofs.validatorBalanceProofs.length ==\\n verifiedValidatorsCount,\\n \\\"Invalid balance proofs\\\"\\n );\\n require(\\n balanceProofs.validatorBalanceLeaves.length ==\\n verifiedValidatorsCount,\\n \\\"Invalid balance leaves\\\"\\n );\\n // verify beaconBlock.state.balances root to beacon block root\\n IBeaconProofs(BEACON_PROOFS).verifyBalancesContainer(\\n balancesMem.blockRoot,\\n balanceProofs.balancesContainerRoot,\\n balanceProofs.balancesContainerProof\\n );\\n\\n bytes32[]\\n memory validatorHashesMem = _getPendingDepositValidatorHashes(\\n depositsCount\\n );\\n\\n // for each validator in reverse order so we can pop off exited validators at the end\\n for (uint256 i = verifiedValidatorsCount; i > 0; ) {\\n --i;\\n ValidatorData memory validatorDataMem = validator[\\n verifiedValidators[i]\\n ];\\n // verify validator's balance in beaconBlock.state.balances to the\\n // beaconBlock.state.balances container root\\n uint256 validatorBalanceGwei = IBeaconProofs(BEACON_PROOFS)\\n .verifyValidatorBalance(\\n balanceProofs.balancesContainerRoot,\\n balanceProofs.validatorBalanceLeaves[i],\\n balanceProofs.validatorBalanceProofs[i],\\n validatorDataMem.index\\n );\\n\\n // If the validator has exited and the balance is now zero\\n if (validatorBalanceGwei == 0) {\\n // Check if there are any pending deposits to this validator\\n bool depositPending = false;\\n for (uint256 j = 0; j < validatorHashesMem.length; j++) {\\n if (validatorHashesMem[j] == verifiedValidators[i]) {\\n depositPending = true;\\n break;\\n }\\n }\\n\\n // If validator has a pending deposit we can not remove due to\\n // the following situation:\\n // - validator has a pending deposit\\n // - validator has been slashed\\n // - sweep cycle has withdrawn all ETH from the validator. Balance is 0\\n // - beacon chain has processed the deposit and set the validator balance\\n // to deposit amount\\n // - if validator is no longer in the list of verifiedValidators its\\n // balance will not be considered and be under-counted.\\n if (!depositPending) {\\n // Store the validator state as exited\\n // This could have been in VERIFIED, ACTIVE or EXITING state\\n validator[verifiedValidators[i]].state = ValidatorState\\n .EXITED;\\n\\n // Remove the validator with a zero balance from the list of verified validators\\n\\n // Reduce the count of verified validators which is the last index before the pop removes it.\\n verifiedValidatorsCount -= 1;\\n\\n // Move the last validator that has already been verified to the current index.\\n // There's an extra SSTORE if i is the last active validator but that's fine,\\n // It's not a common case and the code is simpler this way.\\n verifiedValidators[i] = verifiedValidators[\\n verifiedValidatorsCount\\n ];\\n // Delete the last validator from the list\\n verifiedValidators.pop();\\n }\\n\\n // The validator balance is zero so not need to add to totalValidatorBalance\\n continue;\\n } else if (\\n validatorDataMem.state == ValidatorState.VERIFIED &&\\n validatorBalanceGwei > MIN_ACTIVATION_BALANCE_GWEI\\n ) {\\n // Store the validator state as active. This does not necessarily mean the\\n // validator is active on the beacon chain yet. It just means the validator has\\n // enough balance that it can become active.\\n validator[verifiedValidators[i]].state = ValidatorState\\n .ACTIVE;\\n }\\n\\n // convert Gwei balance to Wei and add to the total validator balance\\n totalValidatorBalance += validatorBalanceGwei * 1 gwei;\\n }\\n }\\n\\n uint256 totalDepositsWei = 0;\\n\\n // If there are no deposits then we can skip the deposit verification.\\n // This section is after the validator balance verifications so an exited validator will be marked\\n // as EXITED before the deposits are verified. If there was a deposit to an exited validator\\n // then the deposit can only be removed once the validator is fully exited.\\n // It is possible that validator fully exits and a postponed deposit to an exited validator increases\\n // its balance again. In such case the contract will erroneously consider a deposit applied before it\\n // has been applied on the beacon chain showing a smaller than real `totalValidatorBalance`.\\n if (depositsCount > 0) {\\n require(\\n pendingDepositProofs.pendingDepositProofs.length ==\\n depositsCount,\\n \\\"Invalid deposit proofs\\\"\\n );\\n require(\\n pendingDepositProofs.pendingDepositIndexes.length ==\\n depositsCount,\\n \\\"Invalid deposit indexes\\\"\\n );\\n\\n // Verify from the root of the pending deposit list container to the beacon block root\\n IBeaconProofs(BEACON_PROOFS).verifyPendingDepositsContainer(\\n balancesMem.blockRoot,\\n pendingDepositProofs.pendingDepositContainerRoot,\\n pendingDepositProofs.pendingDepositContainerProof\\n );\\n\\n // For each staking strategy's deposit.\\n for (uint256 i = 0; i < depositsCount; ++i) {\\n bytes32 pendingDepositRoot = depositList[i];\\n\\n // Verify the strategy's deposit is still pending on the beacon chain.\\n IBeaconProofs(BEACON_PROOFS).verifyPendingDeposit(\\n pendingDepositProofs.pendingDepositContainerRoot,\\n pendingDepositRoot,\\n pendingDepositProofs.pendingDepositProofs[i],\\n pendingDepositProofs.pendingDepositIndexes[i]\\n );\\n\\n // Convert the deposit amount from Gwei to Wei and add to the total\\n totalDepositsWei +=\\n uint256(deposits[pendingDepositRoot].amountGwei) *\\n 1 gwei;\\n }\\n }\\n\\n // Store the verified balance in storage\\n lastVerifiedEthBalance =\\n totalDepositsWei +\\n totalValidatorBalance +\\n balancesMem.ethBalance;\\n // Reset the last snap timestamp so a new snapBalances has to be made\\n snappedBalance.timestamp = 0;\\n\\n emit BalancesVerified(\\n balancesMem.timestamp,\\n totalDepositsWei,\\n totalValidatorBalance,\\n balancesMem.ethBalance\\n );\\n }\\n\\n // slither-disable-end reentrancy-no-eth\\n\\n /// @notice get a list of all validator hashes present in the pending deposits\\n /// list can have duplicate entries\\n function _getPendingDepositValidatorHashes(uint256 depositsCount)\\n internal\\n view\\n returns (bytes32[] memory validatorHashes)\\n {\\n validatorHashes = new bytes32[](depositsCount);\\n for (uint256 i = 0; i < depositsCount; i++) {\\n validatorHashes[i] = deposits[depositList[i]].pubKeyHash;\\n }\\n }\\n\\n /// @notice Hash a validator public key using the Beacon Chain's format\\n function _hashPubKey(bytes memory pubKey) internal pure returns (bytes32) {\\n require(pubKey.length == 48, \\\"Invalid public key\\\");\\n return sha256(abi.encodePacked(pubKey, bytes16(0)));\\n }\\n\\n /**\\n *\\n * WETH and ETH Accounting\\n *\\n */\\n\\n /// @dev Called when WETH is transferred out of the strategy so\\n /// the strategy knows how much WETH it has on deposit.\\n /// This is so it can emit the correct amount in the Deposit event in depositAll().\\n function _transferWeth(uint256 _amount, address _recipient) internal {\\n IERC20(WETH).safeTransfer(_recipient, _amount);\\n\\n // The min is required as more WETH can be withdrawn than deposited\\n // as the strategy earns consensus and execution rewards.\\n uint256 deductAmount = Math.min(_amount, depositedWethAccountedFor);\\n depositedWethAccountedFor -= deductAmount;\\n\\n // No change in ETH balance so no need to snapshot the balances\\n }\\n\\n /// @dev Converts ETH to WETH and updates the accounting.\\n /// @param _ethAmount The amount of ETH in wei.\\n function _convertEthToWeth(uint256 _ethAmount) internal {\\n // slither-disable-next-line arbitrary-send-eth\\n IWETH9(WETH).deposit{ value: _ethAmount }();\\n\\n depositedWethAccountedFor += _ethAmount;\\n\\n // Store the reduced ETH balance.\\n // The ETH balance in this strategy contract can be more than the last verified ETH balance\\n // due to partial withdrawals or full exits being processed by the beacon chain since the last snapBalances.\\n // It can also happen from execution rewards (MEV) or ETH donations.\\n lastVerifiedEthBalance -= Math.min(lastVerifiedEthBalance, _ethAmount);\\n\\n // The ETH balance was decreased to WETH so we need to invalidate the last balances snap.\\n snappedBalance.timestamp = 0;\\n }\\n\\n /// @dev Converts WETH to ETH and updates the accounting.\\n /// @param _wethAmount The amount of WETH in wei.\\n function _convertWethToEth(uint256 _wethAmount) internal {\\n IWETH9(WETH).withdraw(_wethAmount);\\n\\n uint256 deductAmount = Math.min(_wethAmount, depositedWethAccountedFor);\\n depositedWethAccountedFor -= deductAmount;\\n\\n // Store the increased ETH balance\\n lastVerifiedEthBalance += _wethAmount;\\n\\n // The ETH balance was increased from WETH so we need to invalidate the last balances snap.\\n snappedBalance.timestamp = 0;\\n }\\n\\n /**\\n *\\n * View Functions\\n *\\n */\\n\\n /// @notice Returns the number of deposits waiting to be verified as processed on the beacon chain,\\n /// or deposits that have been verified to an exiting validator and is now waiting for the\\n /// validator's balance to be swept.\\n function depositListLength() external view returns (uint256) {\\n return depositList.length;\\n }\\n\\n /// @notice Returns the number of verified validators.\\n function verifiedValidatorsLength() external view returns (uint256) {\\n return verifiedValidators.length;\\n }\\n}\\n\",\"keccak256\":\"0x43e67349bb86dc110c4c923d5cced012aff0d80a6fe61fe27dc7228f66bcba28\",\"license\":\"BUSL-1.1\"},\"contracts/token/OUSD.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title OUSD Token Contract\\n * @dev ERC20 compatible contract for OUSD\\n * @dev Implements an elastic supply\\n * @author Origin Protocol Inc\\n */\\nimport { IVault } from \\\"../interfaces/IVault.sol\\\";\\nimport { Governable } from \\\"../governance/Governable.sol\\\";\\nimport { SafeCast } from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\n\\ncontract OUSD is Governable {\\n using SafeCast for int256;\\n using SafeCast for uint256;\\n\\n /// @dev Event triggered when the supply changes\\n /// @param totalSupply Updated token total supply\\n /// @param rebasingCredits Updated token rebasing credits\\n /// @param rebasingCreditsPerToken Updated token rebasing credits per token\\n event TotalSupplyUpdatedHighres(\\n uint256 totalSupply,\\n uint256 rebasingCredits,\\n uint256 rebasingCreditsPerToken\\n );\\n /// @dev Event triggered when an account opts in for rebasing\\n /// @param account Address of the account\\n event AccountRebasingEnabled(address account);\\n /// @dev Event triggered when an account opts out of rebasing\\n /// @param account Address of the account\\n event AccountRebasingDisabled(address account);\\n /// @dev Emitted when `value` tokens are moved from one account `from` to\\n /// another `to`.\\n /// @param from Address of the account tokens are moved from\\n /// @param to Address of the account tokens are moved to\\n /// @param value Amount of tokens transferred\\n event Transfer(address indexed from, address indexed to, uint256 value);\\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 /// @param owner Address of the owner approving allowance\\n /// @param spender Address of the spender allowance is granted to\\n /// @param value Amount of tokens spender can transfer\\n event Approval(\\n address indexed owner,\\n address indexed spender,\\n uint256 value\\n );\\n /// @dev Yield resulting from {changeSupply} that a `source` account would\\n /// receive is directed to `target` account.\\n /// @param source Address of the source forwarding the yield\\n /// @param target Address of the target receiving the yield\\n event YieldDelegated(address source, address target);\\n /// @dev Yield delegation from `source` account to the `target` account is\\n /// suspended.\\n /// @param source Address of the source suspending yield forwarding\\n /// @param target Address of the target no longer receiving yield from `source`\\n /// account\\n event YieldUndelegated(address source, address target);\\n\\n enum RebaseOptions {\\n NotSet,\\n StdNonRebasing,\\n StdRebasing,\\n YieldDelegationSource,\\n YieldDelegationTarget\\n }\\n\\n uint256[154] private _gap; // Slots to align with deployed contract\\n uint256 private constant MAX_SUPPLY = type(uint128).max;\\n /// @dev The amount of tokens in existence\\n uint256 public totalSupply;\\n mapping(address => mapping(address => uint256)) private allowances;\\n /// @dev The vault with privileges to execute {mint}, {burn}\\n /// and {changeSupply}\\n address public vaultAddress;\\n mapping(address => uint256) internal creditBalances;\\n // the 2 storage variables below need trailing underscores to not name collide with public functions\\n uint256 private rebasingCredits_; // Sum of all rebasing credits (creditBalances for rebasing accounts)\\n uint256 private rebasingCreditsPerToken_;\\n /// @dev The amount of tokens that are not rebasing - receiving yield\\n uint256 public nonRebasingSupply;\\n mapping(address => uint256) internal alternativeCreditsPerToken;\\n /// @dev A map of all addresses and their respective RebaseOptions\\n mapping(address => RebaseOptions) public rebaseState;\\n mapping(address => uint256) private __deprecated_isUpgraded;\\n /// @dev A map of addresses that have yields forwarded to. This is an\\n /// inverse mapping of {yieldFrom}\\n /// Key Account forwarding yield\\n /// Value Account receiving yield\\n mapping(address => address) public yieldTo;\\n /// @dev A map of addresses that are receiving the yield. This is an\\n /// inverse mapping of {yieldTo}\\n /// Key Account receiving yield\\n /// Value Account forwarding yield\\n mapping(address => address) public yieldFrom;\\n\\n uint256 private constant RESOLUTION_INCREASE = 1e9;\\n uint256[34] private __gap; // including below gap totals up to 200\\n\\n /// @dev Verifies that the caller is the Governor or Strategist.\\n modifier onlyGovernorOrStrategist() {\\n require(\\n isGovernor() || msg.sender == IVault(vaultAddress).strategistAddr(),\\n \\\"Caller is not the Strategist or Governor\\\"\\n );\\n _;\\n }\\n\\n /// @dev Initializes the contract and sets necessary variables.\\n /// @param _vaultAddress Address of the vault contract\\n /// @param _initialCreditsPerToken The starting rebasing credits per token.\\n function initialize(address _vaultAddress, uint256 _initialCreditsPerToken)\\n external\\n onlyGovernor\\n {\\n require(_vaultAddress != address(0), \\\"Zero vault address\\\");\\n require(vaultAddress == address(0), \\\"Already initialized\\\");\\n\\n rebasingCreditsPerToken_ = _initialCreditsPerToken;\\n vaultAddress = _vaultAddress;\\n }\\n\\n /// @dev Returns the symbol of the token, a shorter version\\n /// of the name.\\n function symbol() external pure virtual returns (string memory) {\\n return \\\"OUSD\\\";\\n }\\n\\n /// @dev Returns the name of the token.\\n function name() external pure virtual returns (string memory) {\\n return \\\"Origin Dollar\\\";\\n }\\n\\n /// @dev Returns the number of decimals used to get its user representation.\\n function decimals() external pure virtual returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev Verifies that the caller is the Vault contract\\n */\\n modifier onlyVault() {\\n require(vaultAddress == msg.sender, \\\"Caller is not the Vault\\\");\\n _;\\n }\\n\\n /**\\n * @return High resolution rebasingCreditsPerToken\\n */\\n function rebasingCreditsPerTokenHighres() external view returns (uint256) {\\n return rebasingCreditsPerToken_;\\n }\\n\\n /**\\n * @return Low resolution rebasingCreditsPerToken\\n */\\n function rebasingCreditsPerToken() external view returns (uint256) {\\n return rebasingCreditsPerToken_ / RESOLUTION_INCREASE;\\n }\\n\\n /**\\n * @return High resolution total number of rebasing credits\\n */\\n function rebasingCreditsHighres() external view returns (uint256) {\\n return rebasingCredits_;\\n }\\n\\n /**\\n * @return Low resolution total number of rebasing credits\\n */\\n function rebasingCredits() external view returns (uint256) {\\n return rebasingCredits_ / RESOLUTION_INCREASE;\\n }\\n\\n /**\\n * @notice Gets the balance of the specified address.\\n * @param _account Address to query the balance of.\\n * @return A uint256 representing the amount of base units owned by the\\n * specified address.\\n */\\n function balanceOf(address _account) public view returns (uint256) {\\n RebaseOptions state = rebaseState[_account];\\n if (state == RebaseOptions.YieldDelegationSource) {\\n // Saves a slot read when transferring to or from a yield delegating source\\n // since we know creditBalances equals the balance.\\n return creditBalances[_account];\\n }\\n uint256 baseBalance = (creditBalances[_account] * 1e18) /\\n _creditsPerToken(_account);\\n if (state == RebaseOptions.YieldDelegationTarget) {\\n // creditBalances of yieldFrom accounts equals token balances\\n return baseBalance - creditBalances[yieldFrom[_account]];\\n }\\n return baseBalance;\\n }\\n\\n /**\\n * @notice Gets the credits balance of the specified address.\\n * @dev Backwards compatible with old low res credits per token.\\n * @param _account The address to query the balance of.\\n * @return (uint256, uint256) Credit balance and credits per token of the\\n * address\\n */\\n function creditsBalanceOf(address _account)\\n external\\n view\\n returns (uint256, uint256)\\n {\\n uint256 cpt = _creditsPerToken(_account);\\n if (cpt == 1e27) {\\n // For a period before the resolution upgrade, we created all new\\n // contract accounts at high resolution. Since they are not changing\\n // as a result of this upgrade, we will return their true values\\n return (creditBalances[_account], cpt);\\n } else {\\n return (\\n creditBalances[_account] / RESOLUTION_INCREASE,\\n cpt / RESOLUTION_INCREASE\\n );\\n }\\n }\\n\\n /**\\n * @notice Gets the credits balance of the specified address.\\n * @param _account The address to query the balance of.\\n * @return (uint256, uint256, bool) Credit balance, credits per token of the\\n * address, and isUpgraded\\n */\\n function creditsBalanceOfHighres(address _account)\\n external\\n view\\n returns (\\n uint256,\\n uint256,\\n bool\\n )\\n {\\n return (\\n creditBalances[_account],\\n _creditsPerToken(_account),\\n true // all accounts have their resolution \\\"upgraded\\\"\\n );\\n }\\n\\n // Backwards compatible view\\n function nonRebasingCreditsPerToken(address _account)\\n external\\n view\\n returns (uint256)\\n {\\n return alternativeCreditsPerToken[_account];\\n }\\n\\n /**\\n * @notice Transfer tokens to a specified address.\\n * @param _to the address to transfer to.\\n * @param _value the amount to be transferred.\\n * @return true on success.\\n */\\n function transfer(address _to, uint256 _value) external returns (bool) {\\n require(_to != address(0), \\\"Transfer to zero address\\\");\\n\\n _executeTransfer(msg.sender, _to, _value);\\n\\n emit Transfer(msg.sender, _to, _value);\\n return true;\\n }\\n\\n /**\\n * @notice Transfer tokens from one address to another.\\n * @param _from The address you want to send tokens from.\\n * @param _to The address you want to transfer to.\\n * @param _value The amount of tokens to be transferred.\\n * @return true on success.\\n */\\n function transferFrom(\\n address _from,\\n address _to,\\n uint256 _value\\n ) external returns (bool) {\\n require(_to != address(0), \\\"Transfer to zero address\\\");\\n uint256 userAllowance = allowances[_from][msg.sender];\\n require(_value <= userAllowance, \\\"Allowance exceeded\\\");\\n\\n unchecked {\\n allowances[_from][msg.sender] = userAllowance - _value;\\n }\\n\\n _executeTransfer(_from, _to, _value);\\n\\n emit Transfer(_from, _to, _value);\\n return true;\\n }\\n\\n function _executeTransfer(\\n address _from,\\n address _to,\\n uint256 _value\\n ) internal {\\n (\\n int256 fromRebasingCreditsDiff,\\n int256 fromNonRebasingSupplyDiff\\n ) = _adjustAccount(_from, -_value.toInt256());\\n (\\n int256 toRebasingCreditsDiff,\\n int256 toNonRebasingSupplyDiff\\n ) = _adjustAccount(_to, _value.toInt256());\\n\\n _adjustGlobals(\\n fromRebasingCreditsDiff + toRebasingCreditsDiff,\\n fromNonRebasingSupplyDiff + toNonRebasingSupplyDiff\\n );\\n }\\n\\n function _adjustAccount(address _account, int256 _balanceChange)\\n internal\\n returns (int256 rebasingCreditsDiff, int256 nonRebasingSupplyDiff)\\n {\\n RebaseOptions state = rebaseState[_account];\\n int256 currentBalance = balanceOf(_account).toInt256();\\n if (currentBalance + _balanceChange < 0) {\\n revert(\\\"Transfer amount exceeds balance\\\");\\n }\\n uint256 newBalance = (currentBalance + _balanceChange).toUint256();\\n\\n if (state == RebaseOptions.YieldDelegationSource) {\\n address target = yieldTo[_account];\\n uint256 targetOldBalance = balanceOf(target);\\n uint256 targetNewCredits = _balanceToRebasingCredits(\\n targetOldBalance + newBalance\\n );\\n rebasingCreditsDiff =\\n targetNewCredits.toInt256() -\\n creditBalances[target].toInt256();\\n\\n creditBalances[_account] = newBalance;\\n creditBalances[target] = targetNewCredits;\\n } else if (state == RebaseOptions.YieldDelegationTarget) {\\n uint256 newCredits = _balanceToRebasingCredits(\\n newBalance + creditBalances[yieldFrom[_account]]\\n );\\n rebasingCreditsDiff =\\n newCredits.toInt256() -\\n creditBalances[_account].toInt256();\\n creditBalances[_account] = newCredits;\\n } else {\\n _autoMigrate(_account);\\n uint256 alternativeCreditsPerTokenMem = alternativeCreditsPerToken[\\n _account\\n ];\\n if (alternativeCreditsPerTokenMem > 0) {\\n nonRebasingSupplyDiff = _balanceChange;\\n if (alternativeCreditsPerTokenMem != 1e18) {\\n alternativeCreditsPerToken[_account] = 1e18;\\n }\\n creditBalances[_account] = newBalance;\\n } else {\\n uint256 newCredits = _balanceToRebasingCredits(newBalance);\\n rebasingCreditsDiff =\\n newCredits.toInt256() -\\n creditBalances[_account].toInt256();\\n creditBalances[_account] = newCredits;\\n }\\n }\\n }\\n\\n function _adjustGlobals(\\n int256 _rebasingCreditsDiff,\\n int256 _nonRebasingSupplyDiff\\n ) internal {\\n if (_rebasingCreditsDiff != 0) {\\n rebasingCredits_ = (rebasingCredits_.toInt256() +\\n _rebasingCreditsDiff).toUint256();\\n }\\n if (_nonRebasingSupplyDiff != 0) {\\n nonRebasingSupply = (nonRebasingSupply.toInt256() +\\n _nonRebasingSupplyDiff).toUint256();\\n }\\n }\\n\\n /**\\n * @notice Function to check the amount of tokens that _owner has allowed\\n * to `_spender`.\\n * @param _owner The address which owns the funds.\\n * @param _spender The address which will spend the funds.\\n * @return The number of tokens still available for the _spender.\\n */\\n function allowance(address _owner, address _spender)\\n external\\n view\\n returns (uint256)\\n {\\n return allowances[_owner][_spender];\\n }\\n\\n /**\\n * @notice Approve the passed address to spend the specified amount of\\n * tokens on behalf of msg.sender.\\n * @param _spender The address which will spend the funds.\\n * @param _value The amount of tokens to be spent.\\n * @return true on success.\\n */\\n function approve(address _spender, uint256 _value) external returns (bool) {\\n allowances[msg.sender][_spender] = _value;\\n emit Approval(msg.sender, _spender, _value);\\n return true;\\n }\\n\\n /**\\n * @notice Creates `_amount` tokens and assigns them to `_account`,\\n * increasing the total supply.\\n */\\n function mint(address _account, uint256 _amount) external onlyVault {\\n require(_account != address(0), \\\"Mint to the zero address\\\");\\n\\n // Account\\n (\\n int256 toRebasingCreditsDiff,\\n int256 toNonRebasingSupplyDiff\\n ) = _adjustAccount(_account, _amount.toInt256());\\n // Globals\\n _adjustGlobals(toRebasingCreditsDiff, toNonRebasingSupplyDiff);\\n totalSupply = totalSupply + _amount;\\n\\n require(totalSupply < MAX_SUPPLY, \\\"Max supply\\\");\\n emit Transfer(address(0), _account, _amount);\\n }\\n\\n /**\\n * @notice Destroys `_amount` tokens from `_account`,\\n * reducing the total supply.\\n */\\n function burn(address _account, uint256 _amount) external onlyVault {\\n require(_account != address(0), \\\"Burn from the zero address\\\");\\n if (_amount == 0) {\\n return;\\n }\\n\\n // Account\\n (\\n int256 toRebasingCreditsDiff,\\n int256 toNonRebasingSupplyDiff\\n ) = _adjustAccount(_account, -_amount.toInt256());\\n // Globals\\n _adjustGlobals(toRebasingCreditsDiff, toNonRebasingSupplyDiff);\\n totalSupply = totalSupply - _amount;\\n\\n emit Transfer(_account, address(0), _amount);\\n }\\n\\n /**\\n * @dev Get the credits per token for an account. Returns a fixed amount\\n * if the account is non-rebasing.\\n * @param _account Address of the account.\\n */\\n function _creditsPerToken(address _account)\\n internal\\n view\\n returns (uint256)\\n {\\n uint256 alternativeCreditsPerTokenMem = alternativeCreditsPerToken[\\n _account\\n ];\\n if (alternativeCreditsPerTokenMem != 0) {\\n return alternativeCreditsPerTokenMem;\\n } else {\\n return rebasingCreditsPerToken_;\\n }\\n }\\n\\n /**\\n * @dev Auto migrate contracts to be non rebasing,\\n * unless they have opted into yield.\\n * @param _account Address of the account.\\n */\\n function _autoMigrate(address _account) internal {\\n uint256 codeLen = _account.code.length;\\n bool isEOA = (codeLen == 0) ||\\n (codeLen == 23 && bytes3(_account.code) == 0xef0100);\\n // In previous code versions, contracts would not have had their\\n // rebaseState[_account] set to RebaseOptions.NonRebasing when migrated\\n // therefore we check the actual accounting used on the account as well.\\n if (\\n (!isEOA) &&\\n rebaseState[_account] == RebaseOptions.NotSet &&\\n alternativeCreditsPerToken[_account] == 0\\n ) {\\n _rebaseOptOut(_account);\\n }\\n }\\n\\n /**\\n * @dev Calculates credits from contract's global rebasingCreditsPerToken_, and\\n * also balance that corresponds to those credits. The latter is important\\n * when adjusting the contract's global nonRebasingSupply to circumvent any\\n * possible rounding errors.\\n *\\n * @param _balance Balance of the account.\\n */\\n function _balanceToRebasingCredits(uint256 _balance)\\n internal\\n view\\n returns (uint256 rebasingCredits)\\n {\\n // Rounds up, because we need to ensure that accounts always have\\n // at least the balance that they should have.\\n // Note this should always be used on an absolute account value,\\n // not on a possibly negative diff, because then the rounding would be wrong.\\n return ((_balance) * rebasingCreditsPerToken_ + 1e18 - 1) / 1e18;\\n }\\n\\n /**\\n * @notice The calling account will start receiving yield after a successful call.\\n * @param _account Address of the account.\\n */\\n function governanceRebaseOptIn(address _account) external onlyGovernor {\\n require(_account != address(0), \\\"Zero address not allowed\\\");\\n _rebaseOptIn(_account);\\n }\\n\\n /**\\n * @notice The calling account will start receiving yield after a successful call.\\n */\\n function rebaseOptIn() external {\\n _rebaseOptIn(msg.sender);\\n }\\n\\n function _rebaseOptIn(address _account) internal {\\n uint256 balance = balanceOf(_account);\\n\\n // prettier-ignore\\n require(\\n alternativeCreditsPerToken[_account] > 0 ||\\n // Accounts may explicitly `rebaseOptIn` regardless of\\n // accounting if they have a 0 balance.\\n creditBalances[_account] == 0\\n ,\\n \\\"Account must be non-rebasing\\\"\\n );\\n RebaseOptions state = rebaseState[_account];\\n // prettier-ignore\\n require(\\n state == RebaseOptions.StdNonRebasing ||\\n state == RebaseOptions.NotSet,\\n \\\"Only standard non-rebasing accounts can opt in\\\"\\n );\\n\\n uint256 newCredits = _balanceToRebasingCredits(balance);\\n\\n // Account\\n rebaseState[_account] = RebaseOptions.StdRebasing;\\n alternativeCreditsPerToken[_account] = 0;\\n creditBalances[_account] = newCredits;\\n // Globals\\n _adjustGlobals(newCredits.toInt256(), -balance.toInt256());\\n\\n emit AccountRebasingEnabled(_account);\\n }\\n\\n /**\\n * @notice The calling account will no longer receive yield\\n */\\n function rebaseOptOut() external {\\n _rebaseOptOut(msg.sender);\\n }\\n\\n function _rebaseOptOut(address _account) internal {\\n require(\\n alternativeCreditsPerToken[_account] == 0,\\n \\\"Account must be rebasing\\\"\\n );\\n RebaseOptions state = rebaseState[_account];\\n require(\\n state == RebaseOptions.StdRebasing || state == RebaseOptions.NotSet,\\n \\\"Only standard rebasing accounts can opt out\\\"\\n );\\n\\n uint256 oldCredits = creditBalances[_account];\\n uint256 balance = balanceOf(_account);\\n\\n // Account\\n rebaseState[_account] = RebaseOptions.StdNonRebasing;\\n alternativeCreditsPerToken[_account] = 1e18;\\n creditBalances[_account] = balance;\\n // Globals\\n _adjustGlobals(-oldCredits.toInt256(), balance.toInt256());\\n\\n emit AccountRebasingDisabled(_account);\\n }\\n\\n /**\\n * @notice Distribute yield to users. This changes the exchange rate\\n * between \\\"credits\\\" and OUSD tokens to change rebasing user's balances.\\n * @param _newTotalSupply New total supply of OUSD.\\n */\\n function changeSupply(uint256 _newTotalSupply) external onlyVault {\\n require(totalSupply > 0, \\\"Cannot increase 0 supply\\\");\\n\\n if (totalSupply == _newTotalSupply) {\\n emit TotalSupplyUpdatedHighres(\\n totalSupply,\\n rebasingCredits_,\\n rebasingCreditsPerToken_\\n );\\n return;\\n }\\n\\n totalSupply = _newTotalSupply > MAX_SUPPLY\\n ? MAX_SUPPLY\\n : _newTotalSupply;\\n\\n uint256 rebasingSupply = totalSupply - nonRebasingSupply;\\n // round up in the favour of the protocol\\n rebasingCreditsPerToken_ =\\n (rebasingCredits_ * 1e18 + rebasingSupply - 1) /\\n rebasingSupply;\\n\\n require(rebasingCreditsPerToken_ > 0, \\\"Invalid change in supply\\\");\\n\\n emit TotalSupplyUpdatedHighres(\\n totalSupply,\\n rebasingCredits_,\\n rebasingCreditsPerToken_\\n );\\n }\\n\\n /*\\n * @notice Send the yield from one account to another account.\\n * Each account keeps its own balances.\\n */\\n function delegateYield(address _from, address _to)\\n external\\n onlyGovernorOrStrategist\\n {\\n require(_from != address(0), \\\"Zero from address not allowed\\\");\\n require(_to != address(0), \\\"Zero to address not allowed\\\");\\n\\n require(_from != _to, \\\"Cannot delegate to self\\\");\\n require(\\n yieldFrom[_to] == address(0) &&\\n yieldTo[_to] == address(0) &&\\n yieldFrom[_from] == address(0) &&\\n yieldTo[_from] == address(0),\\n \\\"Blocked by existing yield delegation\\\"\\n );\\n RebaseOptions stateFrom = rebaseState[_from];\\n RebaseOptions stateTo = rebaseState[_to];\\n\\n require(\\n stateFrom == RebaseOptions.NotSet ||\\n stateFrom == RebaseOptions.StdNonRebasing ||\\n stateFrom == RebaseOptions.StdRebasing,\\n \\\"Invalid rebaseState from\\\"\\n );\\n\\n require(\\n stateTo == RebaseOptions.NotSet ||\\n stateTo == RebaseOptions.StdNonRebasing ||\\n stateTo == RebaseOptions.StdRebasing,\\n \\\"Invalid rebaseState to\\\"\\n );\\n\\n if (alternativeCreditsPerToken[_from] == 0) {\\n _rebaseOptOut(_from);\\n }\\n if (alternativeCreditsPerToken[_to] > 0) {\\n _rebaseOptIn(_to);\\n }\\n\\n uint256 fromBalance = balanceOf(_from);\\n uint256 toBalance = balanceOf(_to);\\n uint256 oldToCredits = creditBalances[_to];\\n uint256 newToCredits = _balanceToRebasingCredits(\\n fromBalance + toBalance\\n );\\n\\n // Set up the bidirectional links\\n yieldTo[_from] = _to;\\n yieldFrom[_to] = _from;\\n\\n // Local\\n rebaseState[_from] = RebaseOptions.YieldDelegationSource;\\n alternativeCreditsPerToken[_from] = 1e18;\\n creditBalances[_from] = fromBalance;\\n rebaseState[_to] = RebaseOptions.YieldDelegationTarget;\\n creditBalances[_to] = newToCredits;\\n\\n // Global\\n int256 creditsChange = newToCredits.toInt256() -\\n oldToCredits.toInt256();\\n _adjustGlobals(creditsChange, -(fromBalance).toInt256());\\n emit YieldDelegated(_from, _to);\\n }\\n\\n /*\\n * @notice Stop sending the yield from one account to another account.\\n */\\n function undelegateYield(address _from) external onlyGovernorOrStrategist {\\n // Require a delegation, which will also ensure a valid delegation\\n require(yieldTo[_from] != address(0), \\\"Zero address not allowed\\\");\\n\\n address to = yieldTo[_from];\\n uint256 fromBalance = balanceOf(_from);\\n uint256 toBalance = balanceOf(to);\\n uint256 oldToCredits = creditBalances[to];\\n uint256 newToCredits = _balanceToRebasingCredits(toBalance);\\n\\n // Remove the bidirectional links\\n yieldFrom[to] = address(0);\\n yieldTo[_from] = address(0);\\n\\n // Local\\n rebaseState[_from] = RebaseOptions.StdNonRebasing;\\n // alternativeCreditsPerToken[from] already 1e18 from `delegateYield()`\\n creditBalances[_from] = fromBalance;\\n rebaseState[to] = RebaseOptions.StdRebasing;\\n // alternativeCreditsPerToken[to] already 0 from `delegateYield()`\\n creditBalances[to] = newToCredits;\\n\\n // Global\\n int256 creditsChange = newToCredits.toInt256() -\\n oldToCredits.toInt256();\\n _adjustGlobals(creditsChange, fromBalance.toInt256());\\n emit YieldUndelegated(_from, to);\\n }\\n}\\n\",\"keccak256\":\"0x73439bef6569f5adf6f5ce2cb54a5f0d3109d4819457532236e172a7091980a9\",\"license\":\"BUSL-1.1\"},\"contracts/utils/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\nimport { IBasicToken } from \\\"../interfaces/IBasicToken.sol\\\";\\n\\nlibrary Helpers {\\n /**\\n * @notice Fetch the `symbol()` from an ERC20 token\\n * @dev Grabs the `symbol()` from a contract\\n * @param _token Address of the ERC20 token\\n * @return string Symbol of the ERC20 token\\n */\\n function getSymbol(address _token) internal view returns (string memory) {\\n string memory symbol = IBasicToken(_token).symbol();\\n return symbol;\\n }\\n\\n /**\\n * @notice Fetch the `decimals()` from an ERC20 token\\n * @dev Grabs the `decimals()` from a contract and fails if\\n * the decimal value does not live within a certain range\\n * @param _token Address of the ERC20 token\\n * @return uint256 Decimals of the ERC20 token\\n */\\n function getDecimals(address _token) internal view returns (uint256) {\\n uint256 decimals = IBasicToken(_token).decimals();\\n require(\\n decimals >= 4 && decimals <= 18,\\n \\\"Token must have sufficient decimal places\\\"\\n );\\n\\n return decimals;\\n }\\n}\\n\",\"keccak256\":\"0x4366f8d90b34c1eef8bbaaf369b1e5cd59f04027bb3c111f208eaee65bbc0346\",\"license\":\"BUSL-1.1\"},\"contracts/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Base contract any contracts that need to initialize state after deployment.\\n * @author Origin Protocol Inc\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n require(\\n initializing || !initialized,\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n\\n bool isTopLevelCall = !initializing;\\n if (isTopLevelCall) {\\n initializing = true;\\n initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n initializing = false;\\n }\\n }\\n\\n uint256[50] private ______gap;\\n}\\n\",\"keccak256\":\"0x50d39ebf38a3d3111f2b77a6c75ece1d4ae731552fec4697ab16fcf6c0d4d5e8\",\"license\":\"BUSL-1.1\"},\"contracts/utils/InitializableAbstractStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Base contract for vault strategies.\\n * @author Origin Protocol Inc\\n */\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\nimport { Initializable } from \\\"../utils/Initializable.sol\\\";\\nimport { Governable } from \\\"../governance/Governable.sol\\\";\\nimport { IVault } from \\\"../interfaces/IVault.sol\\\";\\n\\nabstract contract InitializableAbstractStrategy is Initializable, Governable {\\n using SafeERC20 for IERC20;\\n\\n event PTokenAdded(address indexed _asset, address _pToken);\\n event PTokenRemoved(address indexed _asset, address _pToken);\\n event Deposit(address indexed _asset, address _pToken, uint256 _amount);\\n event Withdrawal(address indexed _asset, address _pToken, uint256 _amount);\\n event RewardTokenCollected(\\n address recipient,\\n address rewardToken,\\n uint256 amount\\n );\\n event RewardTokenAddressesUpdated(\\n address[] _oldAddresses,\\n address[] _newAddresses\\n );\\n event HarvesterAddressesUpdated(\\n address _oldHarvesterAddress,\\n address _newHarvesterAddress\\n );\\n\\n /// @notice Address of the underlying platform\\n address public immutable platformAddress;\\n /// @notice Address of the OToken vault\\n address public immutable vaultAddress;\\n\\n /// @dev Replaced with an immutable variable\\n // slither-disable-next-line constable-states\\n address private _deprecated_platformAddress;\\n\\n /// @dev Replaced with an immutable\\n // slither-disable-next-line constable-states\\n address private _deprecated_vaultAddress;\\n\\n /// @notice asset => pToken (Platform Specific Token Address)\\n mapping(address => address) public assetToPToken;\\n\\n /// @notice Full list of all assets supported by the strategy\\n address[] internal assetsMapped;\\n\\n // Deprecated: Reward token address\\n // slither-disable-next-line constable-states\\n address private _deprecated_rewardTokenAddress;\\n\\n // Deprecated: now resides in Harvester's rewardTokenConfigs\\n // slither-disable-next-line constable-states\\n uint256 private _deprecated_rewardLiquidationThreshold;\\n\\n /// @notice Address of the Harvester contract allowed to collect reward tokens\\n address public harvesterAddress;\\n\\n /// @notice Address of the reward tokens. eg CRV, BAL, CVX, AURA\\n address[] public rewardTokenAddresses;\\n\\n /* Reserved for future expansion. Used to be 100 storage slots\\n * and has decreased to accommodate:\\n * - harvesterAddress\\n * - rewardTokenAddresses\\n */\\n int256[98] private _reserved;\\n\\n struct BaseStrategyConfig {\\n address platformAddress; // Address of the underlying platform\\n address vaultAddress; // Address of the OToken's Vault\\n }\\n\\n /**\\n * @dev Verifies that the caller is the Governor or Strategist.\\n */\\n modifier onlyGovernorOrStrategist() {\\n require(\\n isGovernor() || msg.sender == IVault(vaultAddress).strategistAddr(),\\n \\\"Caller is not the Strategist or Governor\\\"\\n );\\n _;\\n }\\n\\n /**\\n * @param _config The platform and OToken vault addresses\\n */\\n constructor(BaseStrategyConfig memory _config) {\\n platformAddress = _config.platformAddress;\\n vaultAddress = _config.vaultAddress;\\n }\\n\\n /**\\n * @dev Internal initialize function, to set up initial internal state\\n * @param _rewardTokenAddresses Address of reward token for platform\\n * @param _assets Addresses of initial supported assets\\n * @param _pTokens Platform Token corresponding addresses\\n */\\n function _initialize(\\n address[] memory _rewardTokenAddresses,\\n address[] memory _assets,\\n address[] memory _pTokens\\n ) internal {\\n rewardTokenAddresses = _rewardTokenAddresses;\\n\\n uint256 assetCount = _assets.length;\\n require(assetCount == _pTokens.length, \\\"Invalid input arrays\\\");\\n for (uint256 i = 0; i < assetCount; ++i) {\\n _setPTokenAddress(_assets[i], _pTokens[i]);\\n }\\n }\\n\\n /**\\n * @notice Collect accumulated reward token and send to Vault.\\n */\\n function collectRewardTokens() external virtual onlyHarvester nonReentrant {\\n _collectRewardTokens();\\n }\\n\\n /**\\n * @dev Default implementation that transfers reward tokens to the Harvester\\n * Implementing strategies need to add custom logic to collect the rewards.\\n */\\n function _collectRewardTokens() internal virtual {\\n uint256 rewardTokenCount = rewardTokenAddresses.length;\\n for (uint256 i = 0; i < rewardTokenCount; ++i) {\\n IERC20 rewardToken = IERC20(rewardTokenAddresses[i]);\\n uint256 balance = rewardToken.balanceOf(address(this));\\n if (balance > 0) {\\n emit RewardTokenCollected(\\n harvesterAddress,\\n address(rewardToken),\\n balance\\n );\\n rewardToken.safeTransfer(harvesterAddress, balance);\\n }\\n }\\n }\\n\\n /**\\n * @dev Verifies that the caller is the Vault.\\n */\\n modifier onlyVault() {\\n require(msg.sender == vaultAddress, \\\"Caller is not the Vault\\\");\\n _;\\n }\\n\\n /**\\n * @dev Verifies that the caller is the Harvester.\\n */\\n modifier onlyHarvester() {\\n require(msg.sender == harvesterAddress, \\\"Caller is not the Harvester\\\");\\n _;\\n }\\n\\n /**\\n * @dev Verifies that the caller is the Vault or Governor.\\n */\\n modifier onlyVaultOrGovernor() {\\n require(\\n msg.sender == vaultAddress || msg.sender == governor(),\\n \\\"Caller is not the Vault or Governor\\\"\\n );\\n _;\\n }\\n\\n /**\\n * @dev Verifies that the caller is the Vault, Governor, or Strategist.\\n */\\n modifier onlyVaultOrGovernorOrStrategist() {\\n require(\\n msg.sender == vaultAddress ||\\n msg.sender == governor() ||\\n msg.sender == IVault(vaultAddress).strategistAddr(),\\n \\\"Caller is not the Vault, Governor, or Strategist\\\"\\n );\\n _;\\n }\\n\\n /**\\n * @notice Set the reward token addresses. Any old addresses will be overwritten.\\n * @param _rewardTokenAddresses Array of reward token addresses\\n */\\n function setRewardTokenAddresses(address[] calldata _rewardTokenAddresses)\\n external\\n onlyGovernor\\n {\\n uint256 rewardTokenCount = _rewardTokenAddresses.length;\\n for (uint256 i = 0; i < rewardTokenCount; ++i) {\\n require(\\n _rewardTokenAddresses[i] != address(0),\\n \\\"Can not set an empty address as a reward token\\\"\\n );\\n }\\n\\n emit RewardTokenAddressesUpdated(\\n rewardTokenAddresses,\\n _rewardTokenAddresses\\n );\\n rewardTokenAddresses = _rewardTokenAddresses;\\n }\\n\\n /**\\n * @notice Get the reward token addresses.\\n * @return address[] the reward token addresses.\\n */\\n function getRewardTokenAddresses()\\n external\\n view\\n returns (address[] memory)\\n {\\n return rewardTokenAddresses;\\n }\\n\\n /**\\n * @notice Provide support for asset by passing its pToken address.\\n * This method can only be called by the system Governor\\n * @param _asset Address for the asset\\n * @param _pToken Address for the corresponding platform token\\n */\\n function setPTokenAddress(address _asset, address _pToken)\\n external\\n virtual\\n onlyGovernor\\n {\\n _setPTokenAddress(_asset, _pToken);\\n }\\n\\n /**\\n * @notice Remove a supported asset by passing its index.\\n * This method can only be called by the system Governor\\n * @param _assetIndex Index of the asset to be removed\\n */\\n function removePToken(uint256 _assetIndex) external virtual onlyGovernor {\\n require(_assetIndex < assetsMapped.length, \\\"Invalid index\\\");\\n address asset = assetsMapped[_assetIndex];\\n address pToken = assetToPToken[asset];\\n\\n if (_assetIndex < assetsMapped.length - 1) {\\n assetsMapped[_assetIndex] = assetsMapped[assetsMapped.length - 1];\\n }\\n assetsMapped.pop();\\n assetToPToken[asset] = address(0);\\n\\n emit PTokenRemoved(asset, pToken);\\n }\\n\\n /**\\n * @notice Provide support for asset by passing its pToken address.\\n * Add to internal mappings and execute the platform specific,\\n * abstract method `_abstractSetPToken`\\n * @param _asset Address for the asset\\n * @param _pToken Address for the corresponding platform token\\n */\\n function _setPTokenAddress(address _asset, address _pToken) internal {\\n require(assetToPToken[_asset] == address(0), \\\"pToken already set\\\");\\n require(\\n _asset != address(0) && _pToken != address(0),\\n \\\"Invalid addresses\\\"\\n );\\n\\n assetToPToken[_asset] = _pToken;\\n assetsMapped.push(_asset);\\n\\n emit PTokenAdded(_asset, _pToken);\\n\\n _abstractSetPToken(_asset, _pToken);\\n }\\n\\n /**\\n * @notice Transfer token to governor. Intended for recovering tokens stuck in\\n * strategy contracts, i.e. mistaken sends.\\n * @param _asset Address for the asset\\n * @param _amount Amount of the asset to transfer\\n */\\n function transferToken(address _asset, uint256 _amount)\\n public\\n virtual\\n onlyGovernor\\n {\\n require(!supportsAsset(_asset), \\\"Cannot transfer supported asset\\\");\\n IERC20(_asset).safeTransfer(governor(), _amount);\\n }\\n\\n /**\\n * @notice Set the Harvester contract that can collect rewards.\\n * @param _harvesterAddress Address of the harvester contract.\\n */\\n function setHarvesterAddress(address _harvesterAddress)\\n external\\n onlyGovernor\\n {\\n emit HarvesterAddressesUpdated(harvesterAddress, _harvesterAddress);\\n harvesterAddress = _harvesterAddress;\\n }\\n\\n /***************************************\\n Abstract\\n ****************************************/\\n\\n function _abstractSetPToken(address _asset, address _pToken)\\n internal\\n virtual;\\n\\n function safeApproveAllTokens() external virtual;\\n\\n /**\\n * @notice Deposit an amount of assets into the platform\\n * @param _asset Address for the asset\\n * @param _amount Units of asset to deposit\\n */\\n function deposit(address _asset, uint256 _amount) external virtual;\\n\\n /**\\n * @notice Deposit all supported assets in this strategy contract to the platform\\n */\\n function depositAll() external virtual;\\n\\n /**\\n * @notice Withdraw an `amount` of assets from the platform and\\n * send to the `_recipient`.\\n * @param _recipient Address to which the asset should be sent\\n * @param _asset Address of the asset\\n * @param _amount Units of asset to withdraw\\n */\\n function withdraw(\\n address _recipient,\\n address _asset,\\n uint256 _amount\\n ) external virtual;\\n\\n /**\\n * @notice Withdraw all supported assets from platform and\\n * sends to the OToken's Vault.\\n */\\n function withdrawAll() external virtual;\\n\\n /**\\n * @notice Get the total asset value held in the platform.\\n * This includes any interest that was generated since depositing.\\n * @param _asset Address of the asset\\n * @return balance Total value of the asset in the platform\\n */\\n function checkBalance(address _asset)\\n external\\n view\\n virtual\\n returns (uint256 balance);\\n\\n /**\\n * @notice Check if an asset is supported.\\n * @param _asset Address of the asset\\n * @return bool Whether asset is supported\\n */\\n function supportsAsset(address _asset) public view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x0160d435384d75e8764f4a916764ba47c87fda46872ca5900d46e5e80e956ff9\",\"license\":\"BUSL-1.1\"},\"contracts/vault/VaultStorage.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title OToken VaultStorage contract\\n * @notice The VaultStorage contract defines the storage for the Vault contracts\\n * @author Origin Protocol Inc\\n */\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { Address } from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport { IStrategy } from \\\"../interfaces/IStrategy.sol\\\";\\nimport { Governable } from \\\"../governance/Governable.sol\\\";\\nimport { OUSD } from \\\"../token/OUSD.sol\\\";\\nimport { Initializable } from \\\"../utils/Initializable.sol\\\";\\nimport \\\"../utils/Helpers.sol\\\";\\n\\ncontract VaultStorage is Initializable, Governable {\\n using SafeERC20 for IERC20;\\n\\n event AssetSupported(address _asset);\\n event AssetRemoved(address _asset);\\n event AssetDefaultStrategyUpdated(address _asset, address _strategy);\\n event AssetAllocated(address _asset, address _strategy, uint256 _amount);\\n event StrategyApproved(address _addr);\\n event StrategyRemoved(address _addr);\\n event Mint(address _addr, uint256 _value);\\n event Redeem(address _addr, uint256 _value);\\n event CapitalPaused();\\n event CapitalUnpaused();\\n event RebasePaused();\\n event RebaseUnpaused();\\n event VaultBufferUpdated(uint256 _vaultBuffer);\\n event OusdMetaStrategyUpdated(address _ousdMetaStrategy);\\n event RedeemFeeUpdated(uint256 _redeemFeeBps);\\n event PriceProviderUpdated(address _priceProvider);\\n event AllocateThresholdUpdated(uint256 _threshold);\\n event RebaseThresholdUpdated(uint256 _threshold);\\n event StrategistUpdated(address _address);\\n event MaxSupplyDiffChanged(uint256 maxSupplyDiff);\\n event YieldDistribution(address _to, uint256 _yield, uint256 _fee);\\n event TrusteeFeeBpsChanged(uint256 _basis);\\n event TrusteeAddressChanged(address _address);\\n event NetOusdMintForStrategyThresholdChanged(uint256 _threshold);\\n event SwapperChanged(address _address);\\n event SwapAllowedUndervalueChanged(uint256 _basis);\\n event SwapSlippageChanged(address _asset, uint256 _basis);\\n event Swapped(\\n address indexed _fromAsset,\\n address indexed _toAsset,\\n uint256 _fromAssetAmount,\\n uint256 _toAssetAmount\\n );\\n event StrategyAddedToMintWhitelist(address indexed strategy);\\n event StrategyRemovedFromMintWhitelist(address indexed strategy);\\n event RebasePerSecondMaxChanged(uint256 rebaseRatePerSecond);\\n event DripDurationChanged(uint256 dripDuration);\\n event WithdrawalRequested(\\n address indexed _withdrawer,\\n uint256 indexed _requestId,\\n uint256 _amount,\\n uint256 _queued\\n );\\n event WithdrawalClaimed(\\n address indexed _withdrawer,\\n uint256 indexed _requestId,\\n uint256 _amount\\n );\\n event WithdrawalClaimable(uint256 _claimable, uint256 _newClaimable);\\n event WithdrawalClaimDelayUpdated(uint256 _newDelay);\\n\\n // Since we are proxy, all state should be uninitalized.\\n // Since this storage contract does not have logic directly on it\\n // we should not be checking for to see if these variables can be constant.\\n // slither-disable-start uninitialized-state\\n // slither-disable-start constable-states\\n\\n // Assets supported by the Vault, i.e. Stablecoins\\n enum UnitConversion {\\n DECIMALS,\\n GETEXCHANGERATE\\n }\\n // Changed to fit into a single storage slot so the decimals needs to be recached\\n struct Asset {\\n // Note: OETHVaultCore doesn't use `isSupported` when minting,\\n // redeeming or checking balance of assets.\\n bool isSupported;\\n UnitConversion unitConversion;\\n uint8 decimals;\\n // Max allowed slippage from the Oracle price when swapping collateral assets in basis points.\\n // For example 40 == 0.4% slippage\\n uint16 allowedOracleSlippageBps;\\n }\\n\\n /// @dev mapping of supported vault assets to their configuration\\n mapping(address => Asset) internal assets;\\n /// @dev list of all assets supported by the vault.\\n address[] internal allAssets;\\n\\n // Strategies approved for use by the Vault\\n struct Strategy {\\n bool isSupported;\\n uint256 _deprecated; // Deprecated storage slot\\n }\\n /// @dev mapping of strategy contracts to their configuration\\n mapping(address => Strategy) public strategies;\\n /// @dev list of all vault strategies\\n address[] internal allStrategies;\\n\\n /// @notice Address of the Oracle price provider contract\\n address public priceProvider;\\n /// @notice pause rebasing if true\\n bool public rebasePaused;\\n /// @notice pause operations that change the OToken supply.\\n /// eg mint, redeem, allocate, mint/burn for strategy\\n bool public capitalPaused;\\n /// @notice Redemption fee in basis points. eg 50 = 0.5%\\n uint256 public redeemFeeBps;\\n /// @notice Percentage of assets to keep in Vault to handle (most) withdrawals. 100% = 1e18.\\n uint256 public vaultBuffer;\\n /// @notice OToken mints over this amount automatically allocate funds. 18 decimals.\\n uint256 public autoAllocateThreshold;\\n /// @notice OToken mints over this amount automatically rebase. 18 decimals.\\n uint256 public rebaseThreshold;\\n\\n /// @dev Address of the OToken token. eg OUSD or OETH.\\n OUSD public oUSD;\\n\\n /// @dev Storage slot for the address of the VaultAdmin contract that is delegated to\\n // keccak256(\\\"OUSD.vault.governor.admin.impl\\\");\\n bytes32 public constant adminImplPosition =\\n 0xa2bd3d3cf188a41358c8b401076eb59066b09dec5775650c0de4c55187d17bd9;\\n\\n /// @dev Address of the contract responsible for post rebase syncs with AMMs\\n address private _deprecated_rebaseHooksAddr = address(0);\\n\\n /// @dev Deprecated: Address of Uniswap\\n address private _deprecated_uniswapAddr = address(0);\\n\\n /// @notice Address of the Strategist\\n address public strategistAddr = address(0);\\n\\n /// @notice Mapping of asset address to the Strategy that they should automatically\\n // be allocated to\\n mapping(address => address) public assetDefaultStrategies;\\n\\n /// @notice Max difference between total supply and total value of assets. 18 decimals.\\n uint256 public maxSupplyDiff;\\n\\n /// @notice Trustee contract that can collect a percentage of yield\\n address public trusteeAddress;\\n\\n /// @notice Amount of yield collected in basis points. eg 2000 = 20%\\n uint256 public trusteeFeeBps;\\n\\n /// @dev Deprecated: Tokens that should be swapped for stablecoins\\n address[] private _deprecated_swapTokens;\\n\\n uint256 constant MINT_MINIMUM_UNIT_PRICE = 0.998e18;\\n\\n /// @notice Metapool strategy that is allowed to mint/burn OTokens without changing collateral\\n\\n address public ousdMetaStrategy;\\n\\n /// @notice How much OTokens are currently minted by the strategy\\n int256 public netOusdMintedForStrategy;\\n\\n /// @notice How much net total OTokens are allowed to be minted by all strategies\\n uint256 public netOusdMintForStrategyThreshold;\\n\\n uint256 constant MIN_UNIT_PRICE_DRIFT = 0.7e18;\\n uint256 constant MAX_UNIT_PRICE_DRIFT = 1.3e18;\\n\\n /// @notice Collateral swap configuration.\\n /// @dev is packed into a single storage slot to save gas.\\n struct SwapConfig {\\n // Contract that swaps the vault's collateral assets\\n address swapper;\\n // Max allowed percentage the total value can drop below the total supply in basis points.\\n // For example 100 == 1%\\n uint16 allowedUndervalueBps;\\n }\\n SwapConfig internal swapConfig = SwapConfig(address(0), 0);\\n\\n // List of strategies that can mint oTokens directly\\n // Used in OETHBaseVaultCore\\n mapping(address => bool) public isMintWhitelistedStrategy;\\n\\n /// @notice Address of the Dripper contract that streams harvested rewards to the Vault\\n /// @dev The vault is proxied so needs to be set with setDripper against the proxy contract.\\n address private _deprecated_dripper;\\n\\n /// Withdrawal Queue Storage /////\\n\\n struct WithdrawalQueueMetadata {\\n // cumulative total of all withdrawal requests included the ones that have already been claimed\\n uint128 queued;\\n // cumulative total of all the requests that can be claimed including the ones that have already been claimed\\n uint128 claimable;\\n // total of all the requests that have been claimed\\n uint128 claimed;\\n // index of the next withdrawal request starting at 0\\n uint128 nextWithdrawalIndex;\\n }\\n\\n /// @notice Global metadata for the withdrawal queue including:\\n /// queued - cumulative total of all withdrawal requests included the ones that have already been claimed\\n /// claimable - cumulative total of all the requests that can be claimed including the ones already claimed\\n /// claimed - total of all the requests that have been claimed\\n /// nextWithdrawalIndex - index of the next withdrawal request starting at 0\\n WithdrawalQueueMetadata public withdrawalQueueMetadata;\\n\\n struct WithdrawalRequest {\\n address withdrawer;\\n bool claimed;\\n uint40 timestamp; // timestamp of the withdrawal request\\n // Amount of oTokens to redeem. eg OETH\\n uint128 amount;\\n // cumulative total of all withdrawal requests including this one.\\n // this request can be claimed when this queued amount is less than or equal to the queue's claimable amount.\\n uint128 queued;\\n }\\n\\n /// @notice Mapping of withdrawal request indices to the user withdrawal request data\\n mapping(uint256 => WithdrawalRequest) public withdrawalRequests;\\n\\n /// @notice Sets a minimum delay that is required to elapse between\\n /// requesting async withdrawals and claiming the request.\\n /// When set to 0 async withdrawals are disabled.\\n uint256 public withdrawalClaimDelay;\\n\\n /// @notice Time in seconds that the vault last rebased yield.\\n uint64 public lastRebase;\\n\\n /// @notice Automatic rebase yield calculations. In seconds. Set to 0 or 1 to disable.\\n uint64 public dripDuration;\\n\\n /// @notice max rebase percentage per second\\n /// Can be used to set maximum yield of the protocol,\\n /// spreading out yield over time\\n uint64 public rebasePerSecondMax;\\n\\n /// @notice target rebase rate limit, based on past rates and funds available.\\n uint64 public rebasePerSecondTarget;\\n\\n uint256 internal constant MAX_REBASE = 0.02 ether;\\n uint256 internal constant MAX_REBASE_PER_SECOND =\\n uint256(0.05 ether) / 1 days;\\n\\n // For future use\\n uint256[43] private __gap;\\n\\n // slither-disable-end constable-states\\n // slither-disable-end uninitialized-state\\n\\n /**\\n * @notice set the implementation for the admin, this needs to be in a base class else we cannot set it\\n * @param newImpl address of the implementation\\n */\\n function setAdminImpl(address newImpl) external onlyGovernor {\\n require(\\n Address.isContract(newImpl),\\n \\\"new implementation is not a contract\\\"\\n );\\n bytes32 position = adminImplPosition;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(position, newImpl)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe8c1056879e4d67e0085a30a525a4cb23b954ade0f22fce502278f35b9c69d3b\",\"license\":\"BUSL-1.1\"}},\"version\":1}", - "bytecode": "0x6101a060405234801561001157600080fd5b506040516163af3803806163af833981016040819052610030916101ac565b60208701516033805460ff191690556001600160a01b0380881660805280851660a05280861660c05280821660e0528316610100526001600160401b03821661012081905288918891869088908790879042116100d35760405162461bcd60e51b815260206004820152601960248201527f496e76616c69642067656e657369732074696d657374616d7000000000000000604482015260640160405180910390fd5b505084516001600160a01b0390811661014052602090950151851661016052505050508516610180526101066000610112565b50505050505050610289565b6001600160a01b03811661013260008051602061638f8339815191525490565b6001600160a01b03167fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a60405160405180910390a360008051602061638f83398151915255565b80516001600160a01b038116811461019057600080fd5b919050565b80516001600160401b038116811461019057600080fd5b60008060008060008060008789036101008112156101c957600080fd5b60408112156101d757600080fd5b50604080519081016001600160401b038111828210171561020857634e487b7160e01b600052604160045260246000fd5b60405261021489610179565b815261022260208a01610179565b6020820152965061023560408901610179565b955061024360608901610179565b945061025160808901610179565b935061025f60a08901610179565b925061026d60c08901610179565b915061027b60e08901610195565b905092959891949750929550565b60805160a05160c05160e0516101005161012051610140516101605161018051615fb96103d66000396000818161037501526134da01526000818161054301528181612302015281816131d40152818161334c015281816139620152613a4601526000610a0e015260008181611f840152613c6601526000818161074d01528181610de701528181610e8b0152818161132c0152818161145f015281816117ec015281816118a901528181611fce0152612b8b015260005050600081816107eb01528181613081015281816134aa0152818161358501526137330152600061220e0152600081816108b70152818161115601528181611bcd01528181612377015281816128ce01528181612932015281816132c2015281816139d701528181613ad101528181613b7c015281816140590152818161460701528181614a2b0152614af80152615fb96000f3fe6080604052600436106103035760003560e01c806371a735f311610190578063b6e2b520116100dc578063d38bfff411610095578063dbe55e561161006f578063dbe55e56146109fc578063de5f626814610a30578063f6ca71b014610a45578063f7b188a514610a6757600080fd5b8063d38bfff4146109a7578063d79e4032146109c7578063d9caed12146109dc57600080fd5b8063b6e2b520146108fc578063b8ec66781461091c578063bb1b918d1461093c578063c2e1e3f41461095c578063c7af33521461097c578063d059f6ef1461099157600080fd5b80639136616a1161014957806398245f1b1161012357806398245f1b1461082d578063a5f5be5414610879578063aa388af61461089a578063ad1728cb146108e757600080fd5b80639136616a146107be57806391649751146107d957806396d538bb1461080d57600080fd5b806371a735f3146106fb5780637b2d9b2c1461071b5780637da9982a1461073b5780638456cb591461076f578063853828b61461078457806387bae8671461079957600080fd5b806347e7ef241161024f5780635c975abb1161020857806367c7066c116101e257806367c7066c146106865780636874469d146106a65780636c341d1a146106bb5780636e811d38146106db57600080fd5b80635c975abb1461062d5780635d36b190146106515780635f5152261461066657600080fd5b806347e7ef24146105a55780634896b31a146105c55780634c84e6f8146105da578063522e4245146105ef57806359ff4158146106025780635a063f631461061857600080fd5b80631072cbea116102bc5780633d4dff7b116102965780633d4dff7b146104bd578063430bf08a14610531578063435356d1146105655780634583ef101461058557600080fd5b80631072cbea1461041b5780631a1a15711461043b57806325e2e9f31461045b57600080fd5b80630c340a241461030f5780630d304174146103415780630df1ecfd146103635780630ed57b3a146103975780630ef99855146103b75780630fc3b4c4146103e557600080fd5b3661030a57005b600080fd5b34801561031b57600080fd5b50610324610a7c565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561034d57600080fd5b5061036161035c366004614d4d565b610a99565b005b34801561036f57600080fd5b506103247f000000000000000000000000000000000000000000000000000000000000000081565b3480156103a357600080fd5b506103616103b2366004614de5565b6110c8565b3480156103c357600080fd5b506103d76103d2366004614e18565b611107565b604051908152602001610338565b3480156103f157600080fd5b50610324610400366004614e31565b6067602052600090815260409020546001600160a01b031681565b34801561042757600080fd5b50610361610436366004614e4c565b611128565b34801561044757600080fd5b50610361610456366004614e88565b6111e7565b34801561046757600080fd5b5060385460395461049191906001600160401b03811690600160401b90046001600160801b031683565b604080519384526001600160401b0390921660208401526001600160801b031690820152606001610338565b3480156104c957600080fd5b506105206104d8366004614e18565b603460205260009081526040902080546001909101546001600160401b0380821691600160401b810490911690600160801b810463ffffffff1690600160a01b900460ff1685565b604051610338959493929190614f05565b34801561053d57600080fd5b506103247f000000000000000000000000000000000000000000000000000000000000000081565b34801561057157600080fd5b5061036161058036600461502c565b611a5d565b34801561059157600080fd5b506103616105a03660046150bd565b611b4a565b3480156105b157600080fd5b506103616105c0366004614e4c565b6122f7565b3480156105d157600080fd5b506035546103d7565b3480156105e657600080fd5b50610361612474565b6103616105fd36600461514e565b61251c565b34801561060e57600080fd5b506103d7603a5481565b34801561062457600080fd5b50610361612785565b34801561063957600080fd5b5060335460ff165b6040519015158152602001610338565b34801561065d57600080fd5b50610361612824565b34801561067257600080fd5b506103d7610681366004614e31565b6128ca565b34801561069257600080fd5b50606b54610324906001600160a01b031681565b3480156106b257600080fd5b506103616129b8565b3480156106c757600080fd5b506103616106d63660046151a1565b612afd565b3480156106e757600080fd5b506103616106f6366004614e31565b612ec5565b34801561070757600080fd5b5061036161071636600461527a565b612f3b565b34801561072757600080fd5b50610324610736366004614e18565b61312a565b34801561074757600080fd5b506103247f000000000000000000000000000000000000000000000000000000000000000081565b34801561077b57600080fd5b50610361613154565b34801561079057600080fd5b506103616131c9565b3480156107a557600080fd5b506033546103249061010090046001600160a01b031681565b3480156107ca57600080fd5b506103616103b2366004614e18565b3480156107e557600080fd5b506103247f000000000000000000000000000000000000000000000000000000000000000081565b34801561081957600080fd5b506103616108283660046152ff565b61337c565b34801561083957600080fd5b5061086b610848366004614e18565b60376020526000908152604090205460ff811690610100900464ffffffffff1682565b604051610338929190615340565b34801561088557600080fd5b5060335461064190600160a81b900460ff1681565b3480156108a657600080fd5b506106416108b5366004614e31565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b3480156108f357600080fd5b50610361613493565b34801561090857600080fd5b50610361610917366004615417565b61354a565b34801561092857600080fd5b506103d7610937366004614e18565b6135f5565b34801561094857600080fd5b506103616109573660046154c5565b613605565b34801561096857600080fd5b50610361610977366004614e31565b6137f5565b34801561098857600080fd5b50610641613882565b34801561099d57600080fd5b506103d7603b5481565b3480156109b357600080fd5b506103616109c2366004614e31565b6138b3565b3480156109d357600080fd5b506036546103d7565b3480156109e857600080fd5b506103616109f7366004615583565b613957565b348015610a0857600080fd5b506103247f000000000000000000000000000000000000000000000000000000000000000081565b348015610a3c57600080fd5b50610361613a3b565b348015610a5157600080fd5b50610a5a613bd2565b60405161033891906155c0565b348015610a7357600080fd5b50610361613c34565b6000610a94600080516020615f648339815191525490565b905090565b6000848152603460209081526040808320815160a0810183528154815260018201546001600160401b0380821695830195909552600160401b810490941692810192909252600160801b830463ffffffff16606083015290916080830190600160a01b900460ff166002811115610b1257610b12614eef565b6002811115610b2357610b23614eef565b9052508051600090815260376020526040808220815180830190925280549394509192909190829060ff166008811115610b5f57610b5f614eef565b6008811115610b7057610b70614eef565b81529054610100900464ffffffffff166020909101529050600182608001516002811115610ba057610ba0614eef565b14610be85760405162461bcd60e51b81526020600482015260136024820152724465706f736974206e6f742070656e64696e6760681b60448201526064015b60405180910390fd5b610bf5602085018561560c565b6001600160401b0316600003610c4d5760405162461bcd60e51b815260206004820152601d60248201527f5a65726f203173742070656e64696e67206465706f73697420736c6f740000006044820152606401610bdf565b600381516008811115610c6257610c62614eef565b1480610c805750600481516008811115610c7e57610c7e614eef565b145b80610c9d5750600581516008811115610c9b57610c9b614eef565b145b610ce95760405162461bcd60e51b815260206004820152601b60248201527f4e6f742076657269666965642f6163746976652f65786974696e6700000000006044820152606401610bdf565b846001600160401b031682604001516001600160401b031610610d475760405162461bcd60e51b815260206004820152601660248201527514db1bdd081b9bdd0818599d195c8819195c1bdcda5d60521b6044820152606401610bdf565b6039546001600160401b031680610d5d87613c60565b6001600160401b0316111580610d7a57506001600160401b038116155b610dc65760405162461bcd60e51b815260206004820152601e60248201527f4465706f7369742061667465722062616c616e636520736e617073686f7400006044820152606401610bdf565b6000610dd9610dd488613c60565b613ca3565b905060006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663d98a556483610e1a60208b018b61560c565b610e2760208c018c615627565b6040518563ffffffff1660e01b8152600401610e469493929190615696565b602060405180830381865afa158015610e63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8791906156c9565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663334a88fb838660200151896000016020810190610ed1919061560c565b610ede60208c018c615627565b6040518663ffffffff1660e01b8152600401610efe9594939291906156e6565b60006040518083038186803b158015610f1657600080fd5b505afa158015610f2a573d6000803e3d6000fd5b506000925060209150610f4190508982018a61560c565b610f4b9190615732565b90506001600160401b03610f62602089018961560c565b6001600160401b03161480610f9557506001600160401b038116610f89602089018961560c565b6001600160401b031611155b80610f9d5750815b610fe95760405162461bcd60e51b815260206004820152601d60248201527f45786974204465706f736974206c696b656c79206e6f742070726f632e0000006044820152606401610bdf565b610ff6602089018961560c565b6001600160401b031686604001516001600160401b031610806110165750815b6110625760405162461bcd60e51b815260206004820152601c60248201527f4465706f736974206c696b656c79206e6f742070726f636573736564000000006044820152606401610bdf565b61106c8a87613da8565b897fae0e4f727389efd70d748d667436e0264f370ae498b339b713797dbab57b12ff87602001516001600160401b0316633b9aca006110ab919061576e565b60405190815260200160405180910390a250505050505050505050565b60405162461bcd60e51b81526020600482015260146024820152732ab739bab83837b93a32b210333ab731ba34b7b760611b6044820152606401610bdf565b6036818154811061111757600080fd5b600091825260209091200154905081565b611130613882565b61114c5760405162461bcd60e51b8152600401610bdf90615785565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116908316036111c75760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74207472616e7366657220737570706f72746564206173736574006044820152606401610bdf565b6111e36111d2610a7c565b6001600160a01b0384169083613e89565b5050565b6040805160608101825260385481526039546001600160401b03811660208301819052600160401b9091046001600160801b031692820192909252906112655760405162461bcd60e51b81526020600482015260136024820152724e6f20736e61707065642062616c616e63657360681b6044820152606401610bdf565b6036546035546000908215611725578261128260608801886157bc565b9050146112ca5760405162461bcd60e51b8152602060048201526016602482015275496e76616c69642062616c616e63652070726f6f667360501b6044820152606401610bdf565b826112d860408801886157bc565b9050146113205760405162461bcd60e51b8152602060048201526016602482015275496e76616c69642062616c616e6365206c656176657360501b6044820152606401610bdf565b83516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906391ad640d90883561136260208b018b615627565b6040518563ffffffff1660e01b81526004016113819493929190615805565b60006040518083038186803b15801561139957600080fd5b505afa1580156113ad573d6000803e3d6000fd5b5050505060006113bc82613ee0565b9050835b8015611722576113cf81615825565b9050600060376000603684815481106113ea576113ea61583c565b906000526020600020015481526020019081526020016000206040518060400160405290816000820160009054906101000a900460ff16600881111561143257611432614eef565b600881111561144357611443614eef565b81529054610100900464ffffffffff16602090910152905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663f34ad34c8b3561149b60408e018e6157bc565b878181106114ab576114ab61583c565b905060200201358d80606001906114c291906157bc565b888181106114d2576114d261583c565b90506020028101906114e49190615627565b87602001516040518663ffffffff1660e01b8152600401611509959493929190615852565b602060405180830381865afa158015611526573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061154a919061588b565b905080600003611682576000805b85518110156115af57603685815481106115745761157461583c565b90600052602060002001548682815181106115915761159161583c565b6020026020010151036115a757600191506115af565b600101611558565b508061167a57600660376000603687815481106115ce576115ce61583c565b600091825260208083209091015483528201929092526040019020805460ff1916600183600881111561160357611603614eef565b02179055506116136001896158a4565b9750603688815481106116285761162861583c565b9060005260206000200154603685815481106116465761164661583c565b6000918252602090912001556036805480611663576116636158b7565b600190038181906000526020600020016000905590555b5050506113c0565b60038251600881111561169757611697614eef565b1480156116a857506407823ff28081115b1561170157600460376000603686815481106116c6576116c661583c565b600091825260208083209091015483528201929092526040019020805460ff191660018360088111156116fb576116fb614eef565b02179055505b61170f81633b9aca0061576e565b61171990876158cd565b955050506113c0565b50505b600081156119c2578161173b60608801886157bc565b9050146117835760405162461bcd60e51b8152602060048201526016602482015275496e76616c6964206465706f7369742070726f6f667360501b6044820152606401610bdf565b8161179160408801886157bc565b9050146117e05760405162461bcd60e51b815260206004820152601760248201527f496e76616c6964206465706f73697420696e64657865730000000000000000006044820152606401610bdf565b84516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690632b00e79690883561182260208b018b615627565b6040518563ffffffff1660e01b81526004016118419493929190615805565b60006040518083038186803b15801561185957600080fd5b505afa15801561186d573d6000803e3d6000fd5b5050505060005b828110156119c0576000603582815481106118915761189161583c565b60009182526020909120015490506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016638a050dd48935836118de60608d018d6157bc565b878181106118ee576118ee61583c565b90506020028101906119009190615627565b61190d60408f018f6157bc565b8981811061191d5761191d61583c565b905060200201602081019061193291906158e0565b6040518663ffffffff1660e01b81526004016119529594939291906158fb565b60006040518083038186803b15801561196a57600080fd5b505afa15801561197e573d6000803e3d6000fd5b5050506000828152603460205260409020600101546119ab91506001600160401b0316633b9aca0061576e565b6119b590846158cd565b925050600101611874565b505b60408501516001600160801b03166119da84836158cd565b6119e491906158cd565b603a556039805467ffffffffffffffff1916905560208581015160408088015181518581529384018790526001600160801b0316908301526001600160401b0316907fed2528338eefb63fd1860078b91e35106bc25e3fd528634d180f662582fe5ec1906060015b60405180910390a250505050505050565b611a65613882565b611a815760405162461bcd60e51b8152600401610bdf90615785565b600054610100900460ff1680611a9a575060005460ff16155b611afd5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610bdf565b600054610100900460ff16158015611b1f576000805461ffff19166101011790555b611b2a848484613f90565b611b32613493565b8015611b44576000805461ff00191690555b50505050565b60335461010090046001600160a01b03163314611b795760405162461bcd60e51b8152600401610bdf90615933565b60335460ff1615611b9c5760405162461bcd60e51b8152600401610bdf9061595c565b6000611bb56001600160401b038316633b9aca0061576e565b6040516370a0823160e01b81523060048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611c1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c40919061588b565b811115611c835760405162461bcd60e51b8152602060048201526011602482015270092dce6eaccccd2c6d2cadce840ae8aa89607b1b6044820152606401610bdf565b603554600c11611cc45760405162461bcd60e51b815260206004820152600c60248201526b4d6178206465706f7369747360a01b6044820152606401610bdf565b611ccd81614043565b6000611d16611cdc8580615627565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061411292505050565b60008181526037602052604090205490915060ff166001816008811115611d3f57611d3f614eef565b1480611d5c57506003816008811115611d5a57611d5a614eef565b145b80611d7857506004816008811115611d7657611d76614eef565b145b611dc45760405162461bcd60e51b815260206004820152601a60248201527f4e6f742072656769737465726564206f722076657269666965640000000000006044820152606401610bdf565b670de0b6b3a7640000831015611e105760405162461bcd60e51b815260206004820152601160248201527011195c1bdcda5d081d1bdbc81cdb585b1b607a1b6044820152606401610bdf565b6001816008811115611e2457611e24614eef565b03611f5157603354600160a81b900460ff1615611e7c5760405162461bcd60e51b8152602060048201526016602482015275115e1a5cdd1a5b99c8199a5c9cdd0819195c1bdcda5d60521b6044820152606401610bdf565b670de0b6b3a76400008314611ed35760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206669727374206465706f73697420616d6f756e74000000006044820152606401610bdf565b603654603090611ee49060016158cd565b10611f225760405162461bcd60e51b815260206004820152600e60248201526d4d61782076616c696461746f727360901b6044820152606401610bdf565b60338054600160a81b60ff60a81b199091161790556000828152603760205260409020805460ff191660021790555b604051600090611f6d90600160f91b9083903090602001615986565b60405160208183030381529060405290506000600c7f0000000000000000000000000000000000000000000000000000000000000000611fac426141cb565b611fb691906159c4565b611fc09190615732565b905060006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663afe7688786858a61200360208e018e615627565b886040518763ffffffff1660e01b815260040161202596959493929190615a33565b602060405180830381865afa158015612042573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612066919061588b565b905060008082815260346020526040902060010154600160a01b900460ff16600281111561209657612096614eef565b146120d75760405162461bcd60e51b8152602060048201526011602482015270111d5c1b1a58d85d194819195c1bdcda5d607a1b6044820152606401610bdf565b6040518060a00160405280868152602001886001600160401b03168152602001836001600160401b03168152602001612114603580549050614237565b63ffffffff16815260200160019052600082815260346020908152604091829020835181559083015160018201805493850151606086015163ffffffff16600160801b0263ffffffff60801b196001600160401b03928316600160401b026001600160801b03199097169290941691909117949094179182168417815560808501519293909160ff60a01b1990911664ffffffffff60801b1990911617600160a01b8360028111156121c8576121c8614eef565b021790555050603580546001810182556000919091527fcfa4bec1d3298408bb5afcfcd9c430549c5b31f8aa5c5848151c0a55f473c34d01829055506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663228951188761223e8b80615627565b8761224c60208f018f615627565b8f604001356040518863ffffffff1660e01b815260040161227296959493929190615a8b565b6000604051808303818588803b15801561228b57600080fd5b505af115801561229f573d6000803e3d6000fd5b508493508892507faca97428a1d7f2b7c4cee2fbe4feda457e132b404b0c9c3ff73bf7a988d889a891506122d590508b80615627565b8a6040516122e593929190615ada565b60405180910390a35050505050505050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461233f5760405162461bcd60e51b8152600401610bdf90615afe565b600080516020615f44833981519152805460011981016123715760405162461bcd60e51b8152600401610bdf90615b35565b600282557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146123c65760405162461bcd60e51b8152600401610bdf90615b5d565b6000831161240f5760405162461bcd60e51b81526020600482015260166024820152754d757374206465706f73697420736f6d657468696e6760501b6044820152606401610bdf565b82603b600082825461242191906158cd565b90915550506040805160008152602081018590526001600160a01b038616917f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62910160405180910390a250600190555050565b61247c613882565b6124985760405162461bcd60e51b8152600401610bdf90615785565b603354600160a81b900460ff166124e45760405162461bcd60e51b815260206004820152601060248201526f139bc8199a5c9cdd0819195c1bdcda5d60821b6044820152606401610bdf565b6033805460ff60a81b191690556040517fce77f85e30b0e6df0d12527ddf038f900fdeda0eeda4284c52be47b05de31a9790600090a1565b60335461010090046001600160a01b0316331461254b5760405162461bcd60e51b8152600401610bdf90615933565b600061258c84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061411292505050565b600081815260376020526040808220815180830190925280549394509192909190829060ff1660088111156125c3576125c3614eef565b60088111156125d4576125d4614eef565b81529054610100900464ffffffffff16602090910152905060048151600881111561260157612601614eef565b148061261f575060058151600881111561261d5761261d614eef565b145b61266b5760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f72206e6f74206163746976652f65786974696e67000000006044820152606401610bdf565b826001600160401b03166000036127285760355460005b8181101561270c5760006035828154811061269f5761269f61583c565b90600052602060002001549050603460008281526020019081526020016000206000015485036127035760405162461bcd60e51b815260206004820152600f60248201526e14195b991a5b99c819195c1bdcda5d608a1b6044820152606401610bdf565b50600101612682565b50506000828152603760205260409020805460ff191660051790555b61273385858561429c565b50817f8dd83105dbd4263d41c76e5d414905babdd3f035bd2031f6ce8895715595979c61276d6001600160401b038616633b9aca0061576e565b60405190815260200160405180910390a25050505050565b606b546001600160a01b031633146127df5760405162461bcd60e51b815260206004820152601b60248201527f43616c6c6572206973206e6f74207468652048617276657374657200000000006044820152606401610bdf565b600080516020615f44833981519152805460011981016128115760405162461bcd60e51b8152600401610bdf90615b35565b6002825561281d6110c8565b5060019055565b7f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db546001600160a01b0316336001600160a01b0316146128bf5760405162461bcd60e51b815260206004820152603060248201527f4f6e6c79207468652070656e64696e6720476f7665726e6f722063616e20636f60448201526f6d706c6574652074686520636c61696d60801b6064820152608401610bdf565b6128c8336143e1565b565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161461291d5760405162461bcd60e51b8152600401610bdf90615b5d565b6040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015612981573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129a5919061588b565b603a546129b291906158cd565b92915050565b60006129c3426141cb565b90506001600160401b0381166129db600c6023615b88565b6039546129f191906001600160401b0316615bb1565b6001600160401b031610612a375760405162461bcd60e51b815260206004820152600d60248201526c29b730b8103a37b79039b7b7b760991b6044820152606401610bdf565b6000612a4282613ca3565b905060004790506040518060600160405280838152602001846001600160401b03168152602001612a7283614440565b6001600160801b039081169091528151603855602082015160398054604094850151909316600160401b026001600160c01b03199093166001600160401b03909216919091179190911790555182907fb7523e03ed4a74718427c422a01fee1138835adb5bd592240f30bd8b5e1b929a90612af09084815260200190565b60405180910390a2505050565b600260008581526037602052604090205460ff166008811115612b2257612b22614eef565b14612b665760405162461bcd60e51b815260206004820152601460248201527315985b1a59185d1bdc881b9bdd081cdd185ad95960621b6044820152606401610bdf565b6000612b7187613ca3565b604051632a5d4ad960e11b81529091506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906354ba95b290612bca9084908990889088908d908c90600401615bd0565b60006040518083038186803b158015612be257600080fd5b505afa158015612bf6573d6000803e3d6000fd5b50505050604051806040016040528060036008811115612c1857612c18614eef565b815264ffffffffff8816602091820152600087815260379091526040902081518154829060ff19166001836008811115612c5457612c54614eef565b0217905550602091820151815464ffffffffff9091166101000265ffffffffff0019909116179055604051600091612c9691600160f91b918491309101615986565b604051602081830303815290604052612cae90615c0c565b9050848114612e47576000868152603760205260408120805460ff19166008179055603554905b81811015612e135760006034600060358481548110612cf657612cf661583c565b600091825260208083209091015483528281019390935260409182019020815160a0810183528154815260018201546001600160401b0380821695830195909552600160401b81049094169281019290925263ffffffff600160801b84041660608301529091608083019060ff600160a01b909104166002811115612d7d57612d7d614eef565b6002811115612d8e57612d8e614eef565b9052508051909150899003612e0a57612dc5603a5482602001516001600160401b0316633b9aca00612dc0919061576e565b6144a9565b603a6000828254612dd691906158a4565b92505081905550612e0460358381548110612df357612df361583c565b906000526020600020015482613da8565b50612e13565b50600101612cd5565b5060405187907fb8318df57b70f6381fb18aaf762e33efa2cc92627aae83d417f6710e1415d8d890600090a2505050612ebd565b6036805460018101825560009182527f4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b8018790556033805460ff60a81b1916905560405164ffffffffff89169188917f8142f1367675d1a37dc1aa31258c38b05f5348de55b799764472d94ccb4a71f49190a350505b505050505050565b612ecd613882565b612ee95760405162461bcd60e51b8152600401610bdf90615785565b60338054610100600160a81b0319166101006001600160a01b038416908102919091179091556040517f83f29c79feb71f8fba9d0fbc4ba5f0982a28b6b1e868b3fc50e6400d100bca0f90600090a250565b60335461010090046001600160a01b03163314612f6a5760405162461bcd60e51b8152600401610bdf90615933565b6000612fab86868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061411292505050565b60008181526037602052604090205490915060ff166001816008811115612fd457612fd4614eef565b1480612ff157506006816008811115612fef57612fef614eef565b145b8061300d5750600881600881111561300b5761300b614eef565b145b6130595760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f72206e6f742072656764206f7220657869746564000000006044820152606401610bdf565b60008281526037602052604090819020805460ff19166007179055516312b3fc1960e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906312b3fc19906130c6908a908a908a908a908a90600401615cdd565b600060405180830381600087803b1580156130e057600080fd5b505af11580156130f4573d6000803e3d6000fd5b50505050817f63d54ea43f163d6e28fc23abec67eb7c3294e7e6f0620955a73cd8d17c7367f48686604051611a4c929190615d14565b606c818154811061313a57600080fd5b6000918252602090912001546001600160a01b0316905081565b60335461010090046001600160a01b03163314806131755750613175613882565b6131c15760405162461bcd60e51b815260206004820152601b60248201527f4e6f74205265676973747261746f72206f7220476f7665726e6f7200000000006044820152606401610bdf565b6128c86144c1565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806132185750613203610a7c565b6001600160a01b0316336001600160a01b0316145b6132705760405162461bcd60e51b815260206004820152602360248201527f43616c6c6572206973206e6f7420746865205661756c74206f7220476f7665726044820152623737b960e91b6064820152608401610bdf565b600080516020615f44833981519152805460011981016132a25760405162461bcd60e51b8152600401610bdf90615b35565b600282556040516370a0823160e01b8152306004820152479060009082907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015613311573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613335919061588b565b61333f91906158cd565b90508015613372576133727f00000000000000000000000000000000000000000000000000000000000000008284614536565b5050600182555050565b613384613882565b6133a05760405162461bcd60e51b8152600401610bdf90615785565b8060005b8181101561344a5760008484838181106133c0576133c061583c565b90506020020160208101906133d59190614e31565b6001600160a01b0316036134425760405162461bcd60e51b815260206004820152602e60248201527f43616e206e6f742073657420616e20656d70747920616464726573732061732060448201526d30903932bbb0b932103a37b5b2b760911b6064820152608401610bdf565b6001016133a4565b507f04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc606c848460405161347f93929190615d28565b60405180910390a1611b44606c8484614c56565b60405163095ea7b360e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015260001960248301527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b3906044016020604051808303816000875af1158015613523573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061354791906156c9565b50565b613552613882565b61356e5760405162461bcd60e51b8152600401610bdf90615785565b604051631a1b9a0b60e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063686e682c906135be90869086908690600401615dc1565b600060405180830381600087803b1580156135d857600080fd5b505af11580156135ec573d6000803e3d6000fd5b50505050505050565b6035818154811061111757600080fd5b60335461010090046001600160a01b031633146136345760405162461bcd60e51b8152600401610bdf90615933565b60335460ff16156136575760405162461bcd60e51b8152600401610bdf9061595c565b600061369889898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061411292505050565b90506000808281526037602052604090205460ff1660088111156136be576136be614eef565b1461370b5760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f7220616c72656164792072656769737465726564000000006044820152606401610bdf565b60008181526037602052604090819020805460ff19166001179055516301ba3ee760e21b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306e8fb9c9061377e908c908c908c908c908c908c908c908c90600401615e63565b600060405180830381600087803b15801561379857600080fd5b505af11580156137ac573d6000803e3d6000fd5b50505050807f50837f89f5e75ae0a7bcc858f53ea15fa398dc007fd52cbfe4683ae9a6c2d72288886040516137e2929190615d14565b60405180910390a2505050505050505050565b6137fd613882565b6138195760405162461bcd60e51b8152600401610bdf90615785565b606b54604080516001600160a01b03928316815291831660208301527fe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796910160405180910390a1606b80546001600160a01b0319166001600160a01b0392909216919091179055565b600061389a600080516020615f648339815191525490565b6001600160a01b0316336001600160a01b031614905090565b6138bb613882565b6138d75760405162461bcd60e51b8152600401610bdf90615785565b6138ff817f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db55565b806001600160a01b031661391f600080516020615f648339815191525490565b6001600160a01b03167fa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d60405160405180910390a350565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461399f5760405162461bcd60e51b8152600401610bdf90615afe565b600080516020615f44833981519152805460011981016139d15760405162461bcd60e51b8152600401610bdf90615b35565b600282557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b031614613a265760405162461bcd60e51b8152600401610bdf90615b5d565b613a31858447614536565b5060019055505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614613a835760405162461bcd60e51b8152600401610bdf90615afe565b600080516020615f4483398151915280546001198101613ab55760405162461bcd60e51b8152600401610bdf90615b35565b600282556040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015613b20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b44919061588b565b90506000603b5482613b5691906158a4565b9050801561337257603b8290556040805160008152602081018390526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62910160405180910390a25050600182555050565b6060606c805480602002602001604051908101604052809291908181526020018280548015613c2a57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613c0c575b5050505050905090565b613c3c613882565b613c585760405162461bcd60e51b8152600401610bdf90615785565b6128c8614650565b6000600c7f0000000000000000000000000000000000000000000000000000000000000000613c8f8483615b88565b613c999190615bb1565b6129b29190615bb1565b604080516001600160401b038316602082015260009182918291720f3df6d732807ef1319fb7b8bb8522d0beac02910160408051601f1981840301815290829052613ced91615ec4565b600060405180830381855afa9150503d8060008114613d28576040519150601f19603f3d011682016040523d82523d6000602084013e613d2d565b606091505b5091509150818015613d40575060008151115b613d8c5760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420626561636f6e2074696d657374616d7000000000000000006044820152606401610bdf565b80806020019051810190613da0919061588b565b949350505050565b60008281526034602052604081206001908101805460ff60a01b1916600160a11b179055603580549091613ddb916158a4565b81548110613deb57613deb61583c565b90600052602060002001549050806035836060015163ffffffff1681548110613e1657613e1661583c565b60009182526020808320909101929092556060840151838252603490925260409020600101805463ffffffff909216600160801b0263ffffffff60801b199092169190911790556035805480613e6e57613e6e6158b7565b60019003818190600052602060002001600090559055505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052613edb9084906146ca565b505050565b6060816001600160401b03811115613efa57613efa614f4f565b604051908082528060200260200182016040528015613f23578160200160208202803683370190505b50905060005b82811015613f8a576034600060358381548110613f4857613f4861583c565b9060005260206000200154815260200190815260200160002060000154828281518110613f7757613f7761583c565b6020908102919091010152600101613f29565b50919050565b8251613fa390606c906020860190614cb5565b50815181518114613fed5760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420696e7075742061727261797360601b6044820152606401610bdf565b60005b8181101561403c5761403484828151811061400d5761400d61583c565b60200260200101518483815181106140275761402761583c565b602002602001015161479c565b600101613ff0565b5050505050565b604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156140a557600080fd5b505af11580156140b9573d6000803e3d6000fd5b5050505060006140cb82603b546144a9565b905080603b60008282546140df91906158a4565b9250508190555081603a60008282546140f891906158cd565b90915550506039805467ffffffffffffffff191690555050565b6000815160301461415a5760405162461bcd60e51b8152602060048201526012602482015271496e76616c6964207075626c6963206b657960701b6044820152606401610bdf565b604051600290614171908490600090602001615ee0565b60408051601f198184030181529082905261418b91615ec4565b602060405180830381855afa1580156141a8573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906129b2919061588b565b60006001600160401b038211156142335760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b6064820152608401610bdf565b5090565b600063ffffffff8211156142335760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b6064820152608401610bdf565b6000603083146142ee5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642076616c696461746f722062797465206c656e6774680000006044820152606401610bdf565b6142f66148fb565b90506000710961ef480eb55e80d19ad83579a64c0070026001600160a01b03168286868660405160200161432c93929190615f0f565b60408051601f198184030181529082905261434691615ec4565b60006040518083038185875af1925050503d8060008114614383576040519150601f19603f3d011682016040523d82523d6000602084013e614388565b606091505b50509050806143d95760405162461bcd60e51b815260206004820152601960248201527f5769746864726177616c2072657175657374206661696c6564000000000000006044820152606401610bdf565b509392505050565b6001600160a01b0381166144375760405162461bcd60e51b815260206004820152601a60248201527f4e657720476f7665726e6f7220697320616464726573732830290000000000006044820152606401610bdf565b613547816149c2565b60006001600160801b038211156142335760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b6064820152608401610bdf565b60008183106144b857816144ba565b825b9392505050565b60335460ff16156144e45760405162461bcd60e51b8152600401610bdf9061595c565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586145193390565b6040516001600160a01b03909116815260200160405180910390a1565b600082116145865760405162461bcd60e51b815260206004820152601760248201527f4d75737420776974686472617720736f6d657468696e670000000000000000006044820152606401610bdf565b6001600160a01b0383166145d55760405162461bcd60e51b8152602060048201526016602482015275135d5cdd081cdc1958da599e481c9958da5c1a595b9d60521b6044820152606401610bdf565b80156145e4576145e481614a29565b6145ee8284614aeb565b6040805160008152602081018490526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63989101612af0565b60335460ff166146995760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610bdf565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33614519565b600061471f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614b4b9092919063ffffffff16565b805190915015613edb578080602001905181019061473d91906156c9565b613edb5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610bdf565b6001600160a01b0382811660009081526067602052604090205416156147f95760405162461bcd60e51b81526020600482015260126024820152711c151bdad95b88185b1c9958591e481cd95d60721b6044820152606401610bdf565b6001600160a01b0382161580159061481957506001600160a01b03811615155b6148595760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642061646472657373657360781b6044820152606401610bdf565b6001600160a01b03828116600081815260676020908152604080832080549587166001600160a01b031996871681179091556068805460018101825594527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c2209775390930180549095168417909455925190815290917fef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765910160405180910390a25050565b60405160009081908190710961ef480eb55e80d19ad83579a64c0070029082818181855afa9150503d806000811461494f576040519150601f19603f3d011682016040523d82523d6000602084013e614954565b606091505b5091509150818015614967575060008151115b6149a75760405162461bcd60e51b81526020600482015260116024820152704661696c656420746f206765742066656560781b6044820152606401610bdf565b808060200190518101906149bb919061588b565b9250505090565b806001600160a01b03166149e2600080516020615f648339815191525490565b6001600160a01b03167fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a60405160405180910390a3600080516020615f6483398151915255565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015614a8457600080fd5b505af1158015614a98573d6000803e3d6000fd5b505050505080603b6000828254614aaf91906158cd565b9091555050603a54614ac190826144a9565b603a6000828254614ad291906158a4565b90915550506039805467ffffffffffffffff1916905550565b614b1f6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168284613e89565b6000614b2d83603b546144a9565b905080603b6000828254614b4191906158a4565b9091555050505050565b6060613da0848460008585843b614ba45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610bdf565b600080866001600160a01b03168587604051614bc09190615ec4565b60006040518083038185875af1925050503d8060008114614bfd576040519150601f19603f3d011682016040523d82523d6000602084013e614c02565b606091505b5091509150614c12828286614c1d565b979650505050505050565b60608315614c2c5750816144ba565b825115614c3c5782518084602001fd5b8160405162461bcd60e51b8152600401610bdf9190615f30565b828054828255906000526020600020908101928215614ca9579160200282015b82811115614ca95781546001600160a01b0319166001600160a01b03843516178255602090920191600190910190614c76565b50614233929150614d0a565b828054828255906000526020600020908101928215614ca9579160200282015b82811115614ca957825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614cd5565b5b808211156142335760008155600101614d0b565b80356001600160401b0381168114614d3657600080fd5b919050565b600060408284031215613f8a57600080fd5b60008060008060808587031215614d6357600080fd5b84359350614d7360208601614d1f565b925060408501356001600160401b03811115614d8e57600080fd5b614d9a87828801614d3b565b92505060608501356001600160401b03811115614db657600080fd5b614dc287828801614d3b565b91505092959194509250565b80356001600160a01b0381168114614d3657600080fd5b60008060408385031215614df857600080fd5b614e0183614dce565b9150614e0f60208401614dce565b90509250929050565b600060208284031215614e2a57600080fd5b5035919050565b600060208284031215614e4357600080fd5b6144ba82614dce565b60008060408385031215614e5f57600080fd5b614e6883614dce565b946020939093013593505050565b600060808284031215613f8a57600080fd5b60008060408385031215614e9b57600080fd5b82356001600160401b03811115614eb157600080fd5b614ebd85828601614e76565b92505060208301356001600160401b03811115614ed957600080fd5b614ee585828601614e76565b9150509250929050565b634e487b7160e01b600052602160045260246000fd5b8581526001600160401b0385811660208301528416604082015263ffffffff8316606082015260a0810160038310614f3f57614f3f614eef565b8260808301529695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614f8d57614f8d614f4f565b604052919050565b60006001600160401b03821115614fae57614fae614f4f565b5060051b60200190565b600082601f830112614fc957600080fd5b8135614fdc614fd782614f95565b614f65565b8082825260208201915060208360051b860101925085831115614ffe57600080fd5b602085015b838110156150225761501481614dce565b835260209283019201615003565b5095945050505050565b60008060006060848603121561504157600080fd5b83356001600160401b0381111561505757600080fd5b61506386828701614fb8565b93505060208401356001600160401b0381111561507f57600080fd5b61508b86828701614fb8565b92505060408401356001600160401b038111156150a757600080fd5b6150b386828701614fb8565b9150509250925092565b600080604083850312156150d057600080fd5b82356001600160401b038111156150e657600080fd5b8301606081860312156150f857600080fd5b9150614e0f60208401614d1f565b60008083601f84011261511857600080fd5b5081356001600160401b0381111561512f57600080fd5b60208301915083602082850101111561514757600080fd5b9250929050565b60008060006040848603121561516357600080fd5b83356001600160401b0381111561517957600080fd5b61518586828701615106565b9094509250615198905060208501614d1f565b90509250925092565b60008060008060008060a087890312156151ba57600080fd5b6151c387614d1f565b9550602087013564ffffffffff811681146151dd57600080fd5b9450604087013593506060870135925060808701356001600160401b0381111561520657600080fd5b61521289828a01615106565b979a9699509497509295939492505050565b60008083601f84011261523657600080fd5b5081356001600160401b0381111561524d57600080fd5b6020830191508360208260051b850101111561514757600080fd5b600060a08284031215613f8a57600080fd5b600080600080600060e0868803121561529257600080fd5b85356001600160401b038111156152a857600080fd5b6152b488828901615106565b90965094505060208601356001600160401b038111156152d357600080fd5b6152df88828901615224565b90945092506152f390508760408801615268565b90509295509295909350565b6000806020838503121561531257600080fd5b82356001600160401b0381111561532857600080fd5b61533485828601615224565b90969095509350505050565b604081016009841061535457615354614eef565b92815264ffffffffff9190911660209091015290565b803563ffffffff81168114614d3657600080fd5b801515811461354757600080fd5b600060a0828403121561539e57600080fd5b60405160a081016001600160401b03811182821017156153c0576153c0614f4f565b6040529050806153cf8361536a565b81526153dd60208401614d1f565b60208201526153ee60408401614d1f565b604082015260608301356154018161537e565b6060820152608092830135920191909152919050565b600080600060e0848603121561542c57600080fd5b83356001600160401b0381111561544257600080fd5b8401601f8101861361545357600080fd5b8035615461614fd782614f95565b8082825260208201915060208360051b85010192508883111561548357600080fd5b6020840193505b828410156154ac5761549b84614d1f565b82526020938401939091019061548a565b955050505060208401359150615198856040860161538c565b600080600080600080600080610120898b0312156154e257600080fd5b88356001600160401b038111156154f857600080fd5b6155048b828c01615106565b90995097505060208901356001600160401b0381111561552357600080fd5b61552f8b828c01615224565b90975095505060408901356001600160401b0381111561554e57600080fd5b61555a8b828c01615106565b909550935050606089013591506155748a60808b01615268565b90509295985092959890939650565b60008060006060848603121561559857600080fd5b6155a184614dce565b92506155af60208501614dce565b929592945050506040919091013590565b602080825282518282018190526000918401906040840190835b818110156156015783516001600160a01b03168352602093840193909201916001016155da565b509095945050505050565b60006020828403121561561e57600080fd5b6144ba82614d1f565b6000808335601e1984360301811261563e57600080fd5b8301803591506001600160401b0382111561565857600080fd5b60200191503681900382131561514757600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8481526001600160401b03841660208201526060604082015260006156bf60608301848661566d565b9695505050505050565b6000602082840312156156db57600080fd5b81516144ba8161537e565b85815264ffffffffff851660208201526001600160401b0384166040820152608060608201526000614c1260808301848661566d565b634e487b7160e01b600052601160045260246000fd5b60006001600160401b0383168061575957634e487b7160e01b600052601260045260246000fd5b806001600160401b0384160491505092915050565b80820281158282048414176129b2576129b261571c565b6020808252601a908201527f43616c6c6572206973206e6f742074686520476f7665726e6f72000000000000604082015260600190565b6000808335601e198436030181126157d357600080fd5b8301803591506001600160401b038211156157ed57600080fd5b6020019150600581901b360382131561514757600080fd5b8481528360208201526060604082015260006156bf60608301848661566d565b6000816158345761583461571c565b506000190190565b634e487b7160e01b600052603260045260246000fd5b85815284602082015260806040820152600061587260808301858761566d565b905064ffffffffff831660608301529695505050505050565b60006020828403121561589d57600080fd5b5051919050565b818103818111156129b2576129b261571c565b634e487b7160e01b600052603160045260246000fd5b808201808211156129b2576129b261571c565b6000602082840312156158f257600080fd5b6144ba8261536a565b85815284602082015260806040820152600061591b60808301858761566d565b905063ffffffff831660608301529695505050505050565b6020808252600f908201526e2737ba102932b3b4b9ba3930ba37b960891b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6001600160f81b03199390931683526001600160a81b031991909116600183015260601b6bffffffffffffffffffffffff1916600c82015260200190565b6001600160401b0382811682821603908111156129b2576129b261571c565b60005b838110156159fe5781810151838201526020016159e6565b50506000910152565b60008151808452615a1f8160208601602086016159e3565b601f01601f19169290920160200192915050565b86815260a060208201526000615a4c60a0830188615a07565b6001600160401b03871660408401528281036060840152615a6e81868861566d565b9150506001600160401b0383166080830152979650505050505050565b608081526000615a9f60808301888a61566d565b8281036020840152615ab18188615a07565b90508281036040840152615ac681868861566d565b915050826060830152979650505050505050565b604081526000615aee60408301858761566d565b9050826020830152949350505050565b60208082526017908201527f43616c6c6572206973206e6f7420746865205661756c74000000000000000000604082015260600190565b6020808252600e908201526d1499595b9d1c985b9d0818d85b1b60921b604082015260600190565b602080825260119082015270155b9cdd5c1c1bdc9d195908185cdcd95d607a1b604082015260600190565b6001600160401b038181168382160290811690818114615baa57615baa61571c565b5092915050565b6001600160401b0381811683821601908111156129b2576129b261571c565b86815285602082015260a060408201526000615bf060a08301868861566d565b64ffffffffff9490941660608301525060800152949350505050565b80516020808301519190811015613f8a5760001960209190910360031b1b16919050565b81835260208301925060008160005b84811015615c6e576001600160401b03615c5883614d1f565b1686526020958601959190910190600101615c3f565b5093949350505050565b63ffffffff615c868261536a565b1682526001600160401b03615c9d60208301614d1f565b1660208301526001600160401b03615cb760408301614d1f565b1660408301526060810135615ccb8161537e565b15156060830152608090810135910152565b60e081526000615cf160e08301878961566d565b8281036020840152615d04818688615c30565b9150506156bf6040830184615c78565b602081526000613da0602083018486615c30565b6040808252845490820181905260008581526020812090916060840190835b81811015615d6e5783546001600160a01b0316835260019384019360209093019201615d47565b50508381036020808601919091528582520190508460005b85811015615db5576001600160a01b03615d9f83614dce565b1683526020928301929190910190600101615d86565b50909695505050505050565b60e080825284519082018190526000906020860190610100840190835b81811015615e055783516001600160401b0316835260209384019390920191600101615dde565b5050809250505083602083015263ffffffff83511660408301526001600160401b0360208401511660608301526001600160401b0360408401511660808301526060830151151560a0830152608083015160c0830152949350505050565b61012081526000615e7961012083018a8c61566d565b8281036020840152615e8c81898b615c30565b90508281036040840152615ea181878961566d565b915050836060830152615eb76080830184615c78565b9998505050505050505050565b60008251615ed68184602087016159e3565b9190910192915050565b60008351615ef28184602088016159e3565b6001600160801b0319939093169190920190815260100192915050565b8284823760c09190911b6001600160c01b0319169101908152600801919050565b6020815260006144ba6020830184615a0756fe53bf423e48ed90e97d02ab0ebab13b2a235a6bfbe9c321847d5c175333ac45357bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4aa2646970667358221220cee775df8d65f3ce633ccb3adad18cf76e2c539a2711bd2695a6e1e771d4f3bb64736f6c634300081c00337bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4a", - "deployedBytecode": "0x6080604052600436106103035760003560e01c806371a735f311610190578063b6e2b520116100dc578063d38bfff411610095578063dbe55e561161006f578063dbe55e56146109fc578063de5f626814610a30578063f6ca71b014610a45578063f7b188a514610a6757600080fd5b8063d38bfff4146109a7578063d79e4032146109c7578063d9caed12146109dc57600080fd5b8063b6e2b520146108fc578063b8ec66781461091c578063bb1b918d1461093c578063c2e1e3f41461095c578063c7af33521461097c578063d059f6ef1461099157600080fd5b80639136616a1161014957806398245f1b1161012357806398245f1b1461082d578063a5f5be5414610879578063aa388af61461089a578063ad1728cb146108e757600080fd5b80639136616a146107be57806391649751146107d957806396d538bb1461080d57600080fd5b806371a735f3146106fb5780637b2d9b2c1461071b5780637da9982a1461073b5780638456cb591461076f578063853828b61461078457806387bae8671461079957600080fd5b806347e7ef241161024f5780635c975abb1161020857806367c7066c116101e257806367c7066c146106865780636874469d146106a65780636c341d1a146106bb5780636e811d38146106db57600080fd5b80635c975abb1461062d5780635d36b190146106515780635f5152261461066657600080fd5b806347e7ef24146105a55780634896b31a146105c55780634c84e6f8146105da578063522e4245146105ef57806359ff4158146106025780635a063f631461061857600080fd5b80631072cbea116102bc5780633d4dff7b116102965780633d4dff7b146104bd578063430bf08a14610531578063435356d1146105655780634583ef101461058557600080fd5b80631072cbea1461041b5780631a1a15711461043b57806325e2e9f31461045b57600080fd5b80630c340a241461030f5780630d304174146103415780630df1ecfd146103635780630ed57b3a146103975780630ef99855146103b75780630fc3b4c4146103e557600080fd5b3661030a57005b600080fd5b34801561031b57600080fd5b50610324610a7c565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561034d57600080fd5b5061036161035c366004614d4d565b610a99565b005b34801561036f57600080fd5b506103247f000000000000000000000000000000000000000000000000000000000000000081565b3480156103a357600080fd5b506103616103b2366004614de5565b6110c8565b3480156103c357600080fd5b506103d76103d2366004614e18565b611107565b604051908152602001610338565b3480156103f157600080fd5b50610324610400366004614e31565b6067602052600090815260409020546001600160a01b031681565b34801561042757600080fd5b50610361610436366004614e4c565b611128565b34801561044757600080fd5b50610361610456366004614e88565b6111e7565b34801561046757600080fd5b5060385460395461049191906001600160401b03811690600160401b90046001600160801b031683565b604080519384526001600160401b0390921660208401526001600160801b031690820152606001610338565b3480156104c957600080fd5b506105206104d8366004614e18565b603460205260009081526040902080546001909101546001600160401b0380821691600160401b810490911690600160801b810463ffffffff1690600160a01b900460ff1685565b604051610338959493929190614f05565b34801561053d57600080fd5b506103247f000000000000000000000000000000000000000000000000000000000000000081565b34801561057157600080fd5b5061036161058036600461502c565b611a5d565b34801561059157600080fd5b506103616105a03660046150bd565b611b4a565b3480156105b157600080fd5b506103616105c0366004614e4c565b6122f7565b3480156105d157600080fd5b506035546103d7565b3480156105e657600080fd5b50610361612474565b6103616105fd36600461514e565b61251c565b34801561060e57600080fd5b506103d7603a5481565b34801561062457600080fd5b50610361612785565b34801561063957600080fd5b5060335460ff165b6040519015158152602001610338565b34801561065d57600080fd5b50610361612824565b34801561067257600080fd5b506103d7610681366004614e31565b6128ca565b34801561069257600080fd5b50606b54610324906001600160a01b031681565b3480156106b257600080fd5b506103616129b8565b3480156106c757600080fd5b506103616106d63660046151a1565b612afd565b3480156106e757600080fd5b506103616106f6366004614e31565b612ec5565b34801561070757600080fd5b5061036161071636600461527a565b612f3b565b34801561072757600080fd5b50610324610736366004614e18565b61312a565b34801561074757600080fd5b506103247f000000000000000000000000000000000000000000000000000000000000000081565b34801561077b57600080fd5b50610361613154565b34801561079057600080fd5b506103616131c9565b3480156107a557600080fd5b506033546103249061010090046001600160a01b031681565b3480156107ca57600080fd5b506103616103b2366004614e18565b3480156107e557600080fd5b506103247f000000000000000000000000000000000000000000000000000000000000000081565b34801561081957600080fd5b506103616108283660046152ff565b61337c565b34801561083957600080fd5b5061086b610848366004614e18565b60376020526000908152604090205460ff811690610100900464ffffffffff1682565b604051610338929190615340565b34801561088557600080fd5b5060335461064190600160a81b900460ff1681565b3480156108a657600080fd5b506106416108b5366004614e31565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b3480156108f357600080fd5b50610361613493565b34801561090857600080fd5b50610361610917366004615417565b61354a565b34801561092857600080fd5b506103d7610937366004614e18565b6135f5565b34801561094857600080fd5b506103616109573660046154c5565b613605565b34801561096857600080fd5b50610361610977366004614e31565b6137f5565b34801561098857600080fd5b50610641613882565b34801561099d57600080fd5b506103d7603b5481565b3480156109b357600080fd5b506103616109c2366004614e31565b6138b3565b3480156109d357600080fd5b506036546103d7565b3480156109e857600080fd5b506103616109f7366004615583565b613957565b348015610a0857600080fd5b506103247f000000000000000000000000000000000000000000000000000000000000000081565b348015610a3c57600080fd5b50610361613a3b565b348015610a5157600080fd5b50610a5a613bd2565b60405161033891906155c0565b348015610a7357600080fd5b50610361613c34565b6000610a94600080516020615f648339815191525490565b905090565b6000848152603460209081526040808320815160a0810183528154815260018201546001600160401b0380821695830195909552600160401b810490941692810192909252600160801b830463ffffffff16606083015290916080830190600160a01b900460ff166002811115610b1257610b12614eef565b6002811115610b2357610b23614eef565b9052508051600090815260376020526040808220815180830190925280549394509192909190829060ff166008811115610b5f57610b5f614eef565b6008811115610b7057610b70614eef565b81529054610100900464ffffffffff166020909101529050600182608001516002811115610ba057610ba0614eef565b14610be85760405162461bcd60e51b81526020600482015260136024820152724465706f736974206e6f742070656e64696e6760681b60448201526064015b60405180910390fd5b610bf5602085018561560c565b6001600160401b0316600003610c4d5760405162461bcd60e51b815260206004820152601d60248201527f5a65726f203173742070656e64696e67206465706f73697420736c6f740000006044820152606401610bdf565b600381516008811115610c6257610c62614eef565b1480610c805750600481516008811115610c7e57610c7e614eef565b145b80610c9d5750600581516008811115610c9b57610c9b614eef565b145b610ce95760405162461bcd60e51b815260206004820152601b60248201527f4e6f742076657269666965642f6163746976652f65786974696e6700000000006044820152606401610bdf565b846001600160401b031682604001516001600160401b031610610d475760405162461bcd60e51b815260206004820152601660248201527514db1bdd081b9bdd0818599d195c8819195c1bdcda5d60521b6044820152606401610bdf565b6039546001600160401b031680610d5d87613c60565b6001600160401b0316111580610d7a57506001600160401b038116155b610dc65760405162461bcd60e51b815260206004820152601e60248201527f4465706f7369742061667465722062616c616e636520736e617073686f7400006044820152606401610bdf565b6000610dd9610dd488613c60565b613ca3565b905060006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663d98a556483610e1a60208b018b61560c565b610e2760208c018c615627565b6040518563ffffffff1660e01b8152600401610e469493929190615696565b602060405180830381865afa158015610e63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8791906156c9565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663334a88fb838660200151896000016020810190610ed1919061560c565b610ede60208c018c615627565b6040518663ffffffff1660e01b8152600401610efe9594939291906156e6565b60006040518083038186803b158015610f1657600080fd5b505afa158015610f2a573d6000803e3d6000fd5b506000925060209150610f4190508982018a61560c565b610f4b9190615732565b90506001600160401b03610f62602089018961560c565b6001600160401b03161480610f9557506001600160401b038116610f89602089018961560c565b6001600160401b031611155b80610f9d5750815b610fe95760405162461bcd60e51b815260206004820152601d60248201527f45786974204465706f736974206c696b656c79206e6f742070726f632e0000006044820152606401610bdf565b610ff6602089018961560c565b6001600160401b031686604001516001600160401b031610806110165750815b6110625760405162461bcd60e51b815260206004820152601c60248201527f4465706f736974206c696b656c79206e6f742070726f636573736564000000006044820152606401610bdf565b61106c8a87613da8565b897fae0e4f727389efd70d748d667436e0264f370ae498b339b713797dbab57b12ff87602001516001600160401b0316633b9aca006110ab919061576e565b60405190815260200160405180910390a250505050505050505050565b60405162461bcd60e51b81526020600482015260146024820152732ab739bab83837b93a32b210333ab731ba34b7b760611b6044820152606401610bdf565b6036818154811061111757600080fd5b600091825260209091200154905081565b611130613882565b61114c5760405162461bcd60e51b8152600401610bdf90615785565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116908316036111c75760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74207472616e7366657220737570706f72746564206173736574006044820152606401610bdf565b6111e36111d2610a7c565b6001600160a01b0384169083613e89565b5050565b6040805160608101825260385481526039546001600160401b03811660208301819052600160401b9091046001600160801b031692820192909252906112655760405162461bcd60e51b81526020600482015260136024820152724e6f20736e61707065642062616c616e63657360681b6044820152606401610bdf565b6036546035546000908215611725578261128260608801886157bc565b9050146112ca5760405162461bcd60e51b8152602060048201526016602482015275496e76616c69642062616c616e63652070726f6f667360501b6044820152606401610bdf565b826112d860408801886157bc565b9050146113205760405162461bcd60e51b8152602060048201526016602482015275496e76616c69642062616c616e6365206c656176657360501b6044820152606401610bdf565b83516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906391ad640d90883561136260208b018b615627565b6040518563ffffffff1660e01b81526004016113819493929190615805565b60006040518083038186803b15801561139957600080fd5b505afa1580156113ad573d6000803e3d6000fd5b5050505060006113bc82613ee0565b9050835b8015611722576113cf81615825565b9050600060376000603684815481106113ea576113ea61583c565b906000526020600020015481526020019081526020016000206040518060400160405290816000820160009054906101000a900460ff16600881111561143257611432614eef565b600881111561144357611443614eef565b81529054610100900464ffffffffff16602090910152905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663f34ad34c8b3561149b60408e018e6157bc565b878181106114ab576114ab61583c565b905060200201358d80606001906114c291906157bc565b888181106114d2576114d261583c565b90506020028101906114e49190615627565b87602001516040518663ffffffff1660e01b8152600401611509959493929190615852565b602060405180830381865afa158015611526573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061154a919061588b565b905080600003611682576000805b85518110156115af57603685815481106115745761157461583c565b90600052602060002001548682815181106115915761159161583c565b6020026020010151036115a757600191506115af565b600101611558565b508061167a57600660376000603687815481106115ce576115ce61583c565b600091825260208083209091015483528201929092526040019020805460ff1916600183600881111561160357611603614eef565b02179055506116136001896158a4565b9750603688815481106116285761162861583c565b9060005260206000200154603685815481106116465761164661583c565b6000918252602090912001556036805480611663576116636158b7565b600190038181906000526020600020016000905590555b5050506113c0565b60038251600881111561169757611697614eef565b1480156116a857506407823ff28081115b1561170157600460376000603686815481106116c6576116c661583c565b600091825260208083209091015483528201929092526040019020805460ff191660018360088111156116fb576116fb614eef565b02179055505b61170f81633b9aca0061576e565b61171990876158cd565b955050506113c0565b50505b600081156119c2578161173b60608801886157bc565b9050146117835760405162461bcd60e51b8152602060048201526016602482015275496e76616c6964206465706f7369742070726f6f667360501b6044820152606401610bdf565b8161179160408801886157bc565b9050146117e05760405162461bcd60e51b815260206004820152601760248201527f496e76616c6964206465706f73697420696e64657865730000000000000000006044820152606401610bdf565b84516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690632b00e79690883561182260208b018b615627565b6040518563ffffffff1660e01b81526004016118419493929190615805565b60006040518083038186803b15801561185957600080fd5b505afa15801561186d573d6000803e3d6000fd5b5050505060005b828110156119c0576000603582815481106118915761189161583c565b60009182526020909120015490506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016638a050dd48935836118de60608d018d6157bc565b878181106118ee576118ee61583c565b90506020028101906119009190615627565b61190d60408f018f6157bc565b8981811061191d5761191d61583c565b905060200201602081019061193291906158e0565b6040518663ffffffff1660e01b81526004016119529594939291906158fb565b60006040518083038186803b15801561196a57600080fd5b505afa15801561197e573d6000803e3d6000fd5b5050506000828152603460205260409020600101546119ab91506001600160401b0316633b9aca0061576e565b6119b590846158cd565b925050600101611874565b505b60408501516001600160801b03166119da84836158cd565b6119e491906158cd565b603a556039805467ffffffffffffffff1916905560208581015160408088015181518581529384018790526001600160801b0316908301526001600160401b0316907fed2528338eefb63fd1860078b91e35106bc25e3fd528634d180f662582fe5ec1906060015b60405180910390a250505050505050565b611a65613882565b611a815760405162461bcd60e51b8152600401610bdf90615785565b600054610100900460ff1680611a9a575060005460ff16155b611afd5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610bdf565b600054610100900460ff16158015611b1f576000805461ffff19166101011790555b611b2a848484613f90565b611b32613493565b8015611b44576000805461ff00191690555b50505050565b60335461010090046001600160a01b03163314611b795760405162461bcd60e51b8152600401610bdf90615933565b60335460ff1615611b9c5760405162461bcd60e51b8152600401610bdf9061595c565b6000611bb56001600160401b038316633b9aca0061576e565b6040516370a0823160e01b81523060048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611c1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c40919061588b565b811115611c835760405162461bcd60e51b8152602060048201526011602482015270092dce6eaccccd2c6d2cadce840ae8aa89607b1b6044820152606401610bdf565b603554600c11611cc45760405162461bcd60e51b815260206004820152600c60248201526b4d6178206465706f7369747360a01b6044820152606401610bdf565b611ccd81614043565b6000611d16611cdc8580615627565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061411292505050565b60008181526037602052604090205490915060ff166001816008811115611d3f57611d3f614eef565b1480611d5c57506003816008811115611d5a57611d5a614eef565b145b80611d7857506004816008811115611d7657611d76614eef565b145b611dc45760405162461bcd60e51b815260206004820152601a60248201527f4e6f742072656769737465726564206f722076657269666965640000000000006044820152606401610bdf565b670de0b6b3a7640000831015611e105760405162461bcd60e51b815260206004820152601160248201527011195c1bdcda5d081d1bdbc81cdb585b1b607a1b6044820152606401610bdf565b6001816008811115611e2457611e24614eef565b03611f5157603354600160a81b900460ff1615611e7c5760405162461bcd60e51b8152602060048201526016602482015275115e1a5cdd1a5b99c8199a5c9cdd0819195c1bdcda5d60521b6044820152606401610bdf565b670de0b6b3a76400008314611ed35760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206669727374206465706f73697420616d6f756e74000000006044820152606401610bdf565b603654603090611ee49060016158cd565b10611f225760405162461bcd60e51b815260206004820152600e60248201526d4d61782076616c696461746f727360901b6044820152606401610bdf565b60338054600160a81b60ff60a81b199091161790556000828152603760205260409020805460ff191660021790555b604051600090611f6d90600160f91b9083903090602001615986565b60405160208183030381529060405290506000600c7f0000000000000000000000000000000000000000000000000000000000000000611fac426141cb565b611fb691906159c4565b611fc09190615732565b905060006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663afe7688786858a61200360208e018e615627565b886040518763ffffffff1660e01b815260040161202596959493929190615a33565b602060405180830381865afa158015612042573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612066919061588b565b905060008082815260346020526040902060010154600160a01b900460ff16600281111561209657612096614eef565b146120d75760405162461bcd60e51b8152602060048201526011602482015270111d5c1b1a58d85d194819195c1bdcda5d607a1b6044820152606401610bdf565b6040518060a00160405280868152602001886001600160401b03168152602001836001600160401b03168152602001612114603580549050614237565b63ffffffff16815260200160019052600082815260346020908152604091829020835181559083015160018201805493850151606086015163ffffffff16600160801b0263ffffffff60801b196001600160401b03928316600160401b026001600160801b03199097169290941691909117949094179182168417815560808501519293909160ff60a01b1990911664ffffffffff60801b1990911617600160a01b8360028111156121c8576121c8614eef565b021790555050603580546001810182556000919091527fcfa4bec1d3298408bb5afcfcd9c430549c5b31f8aa5c5848151c0a55f473c34d01829055506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663228951188761223e8b80615627565b8761224c60208f018f615627565b8f604001356040518863ffffffff1660e01b815260040161227296959493929190615a8b565b6000604051808303818588803b15801561228b57600080fd5b505af115801561229f573d6000803e3d6000fd5b508493508892507faca97428a1d7f2b7c4cee2fbe4feda457e132b404b0c9c3ff73bf7a988d889a891506122d590508b80615627565b8a6040516122e593929190615ada565b60405180910390a35050505050505050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461233f5760405162461bcd60e51b8152600401610bdf90615afe565b600080516020615f44833981519152805460011981016123715760405162461bcd60e51b8152600401610bdf90615b35565b600282557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146123c65760405162461bcd60e51b8152600401610bdf90615b5d565b6000831161240f5760405162461bcd60e51b81526020600482015260166024820152754d757374206465706f73697420736f6d657468696e6760501b6044820152606401610bdf565b82603b600082825461242191906158cd565b90915550506040805160008152602081018590526001600160a01b038616917f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62910160405180910390a250600190555050565b61247c613882565b6124985760405162461bcd60e51b8152600401610bdf90615785565b603354600160a81b900460ff166124e45760405162461bcd60e51b815260206004820152601060248201526f139bc8199a5c9cdd0819195c1bdcda5d60821b6044820152606401610bdf565b6033805460ff60a81b191690556040517fce77f85e30b0e6df0d12527ddf038f900fdeda0eeda4284c52be47b05de31a9790600090a1565b60335461010090046001600160a01b0316331461254b5760405162461bcd60e51b8152600401610bdf90615933565b600061258c84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061411292505050565b600081815260376020526040808220815180830190925280549394509192909190829060ff1660088111156125c3576125c3614eef565b60088111156125d4576125d4614eef565b81529054610100900464ffffffffff16602090910152905060048151600881111561260157612601614eef565b148061261f575060058151600881111561261d5761261d614eef565b145b61266b5760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f72206e6f74206163746976652f65786974696e67000000006044820152606401610bdf565b826001600160401b03166000036127285760355460005b8181101561270c5760006035828154811061269f5761269f61583c565b90600052602060002001549050603460008281526020019081526020016000206000015485036127035760405162461bcd60e51b815260206004820152600f60248201526e14195b991a5b99c819195c1bdcda5d608a1b6044820152606401610bdf565b50600101612682565b50506000828152603760205260409020805460ff191660051790555b61273385858561429c565b50817f8dd83105dbd4263d41c76e5d414905babdd3f035bd2031f6ce8895715595979c61276d6001600160401b038616633b9aca0061576e565b60405190815260200160405180910390a25050505050565b606b546001600160a01b031633146127df5760405162461bcd60e51b815260206004820152601b60248201527f43616c6c6572206973206e6f74207468652048617276657374657200000000006044820152606401610bdf565b600080516020615f44833981519152805460011981016128115760405162461bcd60e51b8152600401610bdf90615b35565b6002825561281d6110c8565b5060019055565b7f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db546001600160a01b0316336001600160a01b0316146128bf5760405162461bcd60e51b815260206004820152603060248201527f4f6e6c79207468652070656e64696e6720476f7665726e6f722063616e20636f60448201526f6d706c6574652074686520636c61696d60801b6064820152608401610bdf565b6128c8336143e1565b565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161461291d5760405162461bcd60e51b8152600401610bdf90615b5d565b6040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015612981573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129a5919061588b565b603a546129b291906158cd565b92915050565b60006129c3426141cb565b90506001600160401b0381166129db600c6023615b88565b6039546129f191906001600160401b0316615bb1565b6001600160401b031610612a375760405162461bcd60e51b815260206004820152600d60248201526c29b730b8103a37b79039b7b7b760991b6044820152606401610bdf565b6000612a4282613ca3565b905060004790506040518060600160405280838152602001846001600160401b03168152602001612a7283614440565b6001600160801b039081169091528151603855602082015160398054604094850151909316600160401b026001600160c01b03199093166001600160401b03909216919091179190911790555182907fb7523e03ed4a74718427c422a01fee1138835adb5bd592240f30bd8b5e1b929a90612af09084815260200190565b60405180910390a2505050565b600260008581526037602052604090205460ff166008811115612b2257612b22614eef565b14612b665760405162461bcd60e51b815260206004820152601460248201527315985b1a59185d1bdc881b9bdd081cdd185ad95960621b6044820152606401610bdf565b6000612b7187613ca3565b604051632a5d4ad960e11b81529091506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906354ba95b290612bca9084908990889088908d908c90600401615bd0565b60006040518083038186803b158015612be257600080fd5b505afa158015612bf6573d6000803e3d6000fd5b50505050604051806040016040528060036008811115612c1857612c18614eef565b815264ffffffffff8816602091820152600087815260379091526040902081518154829060ff19166001836008811115612c5457612c54614eef565b0217905550602091820151815464ffffffffff9091166101000265ffffffffff0019909116179055604051600091612c9691600160f91b918491309101615986565b604051602081830303815290604052612cae90615c0c565b9050848114612e47576000868152603760205260408120805460ff19166008179055603554905b81811015612e135760006034600060358481548110612cf657612cf661583c565b600091825260208083209091015483528281019390935260409182019020815160a0810183528154815260018201546001600160401b0380821695830195909552600160401b81049094169281019290925263ffffffff600160801b84041660608301529091608083019060ff600160a01b909104166002811115612d7d57612d7d614eef565b6002811115612d8e57612d8e614eef565b9052508051909150899003612e0a57612dc5603a5482602001516001600160401b0316633b9aca00612dc0919061576e565b6144a9565b603a6000828254612dd691906158a4565b92505081905550612e0460358381548110612df357612df361583c565b906000526020600020015482613da8565b50612e13565b50600101612cd5565b5060405187907fb8318df57b70f6381fb18aaf762e33efa2cc92627aae83d417f6710e1415d8d890600090a2505050612ebd565b6036805460018101825560009182527f4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b8018790556033805460ff60a81b1916905560405164ffffffffff89169188917f8142f1367675d1a37dc1aa31258c38b05f5348de55b799764472d94ccb4a71f49190a350505b505050505050565b612ecd613882565b612ee95760405162461bcd60e51b8152600401610bdf90615785565b60338054610100600160a81b0319166101006001600160a01b038416908102919091179091556040517f83f29c79feb71f8fba9d0fbc4ba5f0982a28b6b1e868b3fc50e6400d100bca0f90600090a250565b60335461010090046001600160a01b03163314612f6a5760405162461bcd60e51b8152600401610bdf90615933565b6000612fab86868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061411292505050565b60008181526037602052604090205490915060ff166001816008811115612fd457612fd4614eef565b1480612ff157506006816008811115612fef57612fef614eef565b145b8061300d5750600881600881111561300b5761300b614eef565b145b6130595760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f72206e6f742072656764206f7220657869746564000000006044820152606401610bdf565b60008281526037602052604090819020805460ff19166007179055516312b3fc1960e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906312b3fc19906130c6908a908a908a908a908a90600401615cdd565b600060405180830381600087803b1580156130e057600080fd5b505af11580156130f4573d6000803e3d6000fd5b50505050817f63d54ea43f163d6e28fc23abec67eb7c3294e7e6f0620955a73cd8d17c7367f48686604051611a4c929190615d14565b606c818154811061313a57600080fd5b6000918252602090912001546001600160a01b0316905081565b60335461010090046001600160a01b03163314806131755750613175613882565b6131c15760405162461bcd60e51b815260206004820152601b60248201527f4e6f74205265676973747261746f72206f7220476f7665726e6f7200000000006044820152606401610bdf565b6128c86144c1565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806132185750613203610a7c565b6001600160a01b0316336001600160a01b0316145b6132705760405162461bcd60e51b815260206004820152602360248201527f43616c6c6572206973206e6f7420746865205661756c74206f7220476f7665726044820152623737b960e91b6064820152608401610bdf565b600080516020615f44833981519152805460011981016132a25760405162461bcd60e51b8152600401610bdf90615b35565b600282556040516370a0823160e01b8152306004820152479060009082907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015613311573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613335919061588b565b61333f91906158cd565b90508015613372576133727f00000000000000000000000000000000000000000000000000000000000000008284614536565b5050600182555050565b613384613882565b6133a05760405162461bcd60e51b8152600401610bdf90615785565b8060005b8181101561344a5760008484838181106133c0576133c061583c565b90506020020160208101906133d59190614e31565b6001600160a01b0316036134425760405162461bcd60e51b815260206004820152602e60248201527f43616e206e6f742073657420616e20656d70747920616464726573732061732060448201526d30903932bbb0b932103a37b5b2b760911b6064820152608401610bdf565b6001016133a4565b507f04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc606c848460405161347f93929190615d28565b60405180910390a1611b44606c8484614c56565b60405163095ea7b360e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015260001960248301527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b3906044016020604051808303816000875af1158015613523573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061354791906156c9565b50565b613552613882565b61356e5760405162461bcd60e51b8152600401610bdf90615785565b604051631a1b9a0b60e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063686e682c906135be90869086908690600401615dc1565b600060405180830381600087803b1580156135d857600080fd5b505af11580156135ec573d6000803e3d6000fd5b50505050505050565b6035818154811061111757600080fd5b60335461010090046001600160a01b031633146136345760405162461bcd60e51b8152600401610bdf90615933565b60335460ff16156136575760405162461bcd60e51b8152600401610bdf9061595c565b600061369889898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061411292505050565b90506000808281526037602052604090205460ff1660088111156136be576136be614eef565b1461370b5760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f7220616c72656164792072656769737465726564000000006044820152606401610bdf565b60008181526037602052604090819020805460ff19166001179055516301ba3ee760e21b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306e8fb9c9061377e908c908c908c908c908c908c908c908c90600401615e63565b600060405180830381600087803b15801561379857600080fd5b505af11580156137ac573d6000803e3d6000fd5b50505050807f50837f89f5e75ae0a7bcc858f53ea15fa398dc007fd52cbfe4683ae9a6c2d72288886040516137e2929190615d14565b60405180910390a2505050505050505050565b6137fd613882565b6138195760405162461bcd60e51b8152600401610bdf90615785565b606b54604080516001600160a01b03928316815291831660208301527fe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796910160405180910390a1606b80546001600160a01b0319166001600160a01b0392909216919091179055565b600061389a600080516020615f648339815191525490565b6001600160a01b0316336001600160a01b031614905090565b6138bb613882565b6138d75760405162461bcd60e51b8152600401610bdf90615785565b6138ff817f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db55565b806001600160a01b031661391f600080516020615f648339815191525490565b6001600160a01b03167fa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d60405160405180910390a350565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461399f5760405162461bcd60e51b8152600401610bdf90615afe565b600080516020615f44833981519152805460011981016139d15760405162461bcd60e51b8152600401610bdf90615b35565b600282557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b031614613a265760405162461bcd60e51b8152600401610bdf90615b5d565b613a31858447614536565b5060019055505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614613a835760405162461bcd60e51b8152600401610bdf90615afe565b600080516020615f4483398151915280546001198101613ab55760405162461bcd60e51b8152600401610bdf90615b35565b600282556040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015613b20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b44919061588b565b90506000603b5482613b5691906158a4565b9050801561337257603b8290556040805160008152602081018390526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62910160405180910390a25050600182555050565b6060606c805480602002602001604051908101604052809291908181526020018280548015613c2a57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613c0c575b5050505050905090565b613c3c613882565b613c585760405162461bcd60e51b8152600401610bdf90615785565b6128c8614650565b6000600c7f0000000000000000000000000000000000000000000000000000000000000000613c8f8483615b88565b613c999190615bb1565b6129b29190615bb1565b604080516001600160401b038316602082015260009182918291720f3df6d732807ef1319fb7b8bb8522d0beac02910160408051601f1981840301815290829052613ced91615ec4565b600060405180830381855afa9150503d8060008114613d28576040519150601f19603f3d011682016040523d82523d6000602084013e613d2d565b606091505b5091509150818015613d40575060008151115b613d8c5760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420626561636f6e2074696d657374616d7000000000000000006044820152606401610bdf565b80806020019051810190613da0919061588b565b949350505050565b60008281526034602052604081206001908101805460ff60a01b1916600160a11b179055603580549091613ddb916158a4565b81548110613deb57613deb61583c565b90600052602060002001549050806035836060015163ffffffff1681548110613e1657613e1661583c565b60009182526020808320909101929092556060840151838252603490925260409020600101805463ffffffff909216600160801b0263ffffffff60801b199092169190911790556035805480613e6e57613e6e6158b7565b60019003818190600052602060002001600090559055505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052613edb9084906146ca565b505050565b6060816001600160401b03811115613efa57613efa614f4f565b604051908082528060200260200182016040528015613f23578160200160208202803683370190505b50905060005b82811015613f8a576034600060358381548110613f4857613f4861583c565b9060005260206000200154815260200190815260200160002060000154828281518110613f7757613f7761583c565b6020908102919091010152600101613f29565b50919050565b8251613fa390606c906020860190614cb5565b50815181518114613fed5760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420696e7075742061727261797360601b6044820152606401610bdf565b60005b8181101561403c5761403484828151811061400d5761400d61583c565b60200260200101518483815181106140275761402761583c565b602002602001015161479c565b600101613ff0565b5050505050565b604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156140a557600080fd5b505af11580156140b9573d6000803e3d6000fd5b5050505060006140cb82603b546144a9565b905080603b60008282546140df91906158a4565b9250508190555081603a60008282546140f891906158cd565b90915550506039805467ffffffffffffffff191690555050565b6000815160301461415a5760405162461bcd60e51b8152602060048201526012602482015271496e76616c6964207075626c6963206b657960701b6044820152606401610bdf565b604051600290614171908490600090602001615ee0565b60408051601f198184030181529082905261418b91615ec4565b602060405180830381855afa1580156141a8573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906129b2919061588b565b60006001600160401b038211156142335760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b6064820152608401610bdf565b5090565b600063ffffffff8211156142335760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b6064820152608401610bdf565b6000603083146142ee5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642076616c696461746f722062797465206c656e6774680000006044820152606401610bdf565b6142f66148fb565b90506000710961ef480eb55e80d19ad83579a64c0070026001600160a01b03168286868660405160200161432c93929190615f0f565b60408051601f198184030181529082905261434691615ec4565b60006040518083038185875af1925050503d8060008114614383576040519150601f19603f3d011682016040523d82523d6000602084013e614388565b606091505b50509050806143d95760405162461bcd60e51b815260206004820152601960248201527f5769746864726177616c2072657175657374206661696c6564000000000000006044820152606401610bdf565b509392505050565b6001600160a01b0381166144375760405162461bcd60e51b815260206004820152601a60248201527f4e657720476f7665726e6f7220697320616464726573732830290000000000006044820152606401610bdf565b613547816149c2565b60006001600160801b038211156142335760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b6064820152608401610bdf565b60008183106144b857816144ba565b825b9392505050565b60335460ff16156144e45760405162461bcd60e51b8152600401610bdf9061595c565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586145193390565b6040516001600160a01b03909116815260200160405180910390a1565b600082116145865760405162461bcd60e51b815260206004820152601760248201527f4d75737420776974686472617720736f6d657468696e670000000000000000006044820152606401610bdf565b6001600160a01b0383166145d55760405162461bcd60e51b8152602060048201526016602482015275135d5cdd081cdc1958da599e481c9958da5c1a595b9d60521b6044820152606401610bdf565b80156145e4576145e481614a29565b6145ee8284614aeb565b6040805160008152602081018490526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63989101612af0565b60335460ff166146995760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610bdf565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33614519565b600061471f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614b4b9092919063ffffffff16565b805190915015613edb578080602001905181019061473d91906156c9565b613edb5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610bdf565b6001600160a01b0382811660009081526067602052604090205416156147f95760405162461bcd60e51b81526020600482015260126024820152711c151bdad95b88185b1c9958591e481cd95d60721b6044820152606401610bdf565b6001600160a01b0382161580159061481957506001600160a01b03811615155b6148595760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642061646472657373657360781b6044820152606401610bdf565b6001600160a01b03828116600081815260676020908152604080832080549587166001600160a01b031996871681179091556068805460018101825594527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c2209775390930180549095168417909455925190815290917fef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765910160405180910390a25050565b60405160009081908190710961ef480eb55e80d19ad83579a64c0070029082818181855afa9150503d806000811461494f576040519150601f19603f3d011682016040523d82523d6000602084013e614954565b606091505b5091509150818015614967575060008151115b6149a75760405162461bcd60e51b81526020600482015260116024820152704661696c656420746f206765742066656560781b6044820152606401610bdf565b808060200190518101906149bb919061588b565b9250505090565b806001600160a01b03166149e2600080516020615f648339815191525490565b6001600160a01b03167fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a60405160405180910390a3600080516020615f6483398151915255565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015614a8457600080fd5b505af1158015614a98573d6000803e3d6000fd5b505050505080603b6000828254614aaf91906158cd565b9091555050603a54614ac190826144a9565b603a6000828254614ad291906158a4565b90915550506039805467ffffffffffffffff1916905550565b614b1f6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168284613e89565b6000614b2d83603b546144a9565b905080603b6000828254614b4191906158a4565b9091555050505050565b6060613da0848460008585843b614ba45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610bdf565b600080866001600160a01b03168587604051614bc09190615ec4565b60006040518083038185875af1925050503d8060008114614bfd576040519150601f19603f3d011682016040523d82523d6000602084013e614c02565b606091505b5091509150614c12828286614c1d565b979650505050505050565b60608315614c2c5750816144ba565b825115614c3c5782518084602001fd5b8160405162461bcd60e51b8152600401610bdf9190615f30565b828054828255906000526020600020908101928215614ca9579160200282015b82811115614ca95781546001600160a01b0319166001600160a01b03843516178255602090920191600190910190614c76565b50614233929150614d0a565b828054828255906000526020600020908101928215614ca9579160200282015b82811115614ca957825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614cd5565b5b808211156142335760008155600101614d0b565b80356001600160401b0381168114614d3657600080fd5b919050565b600060408284031215613f8a57600080fd5b60008060008060808587031215614d6357600080fd5b84359350614d7360208601614d1f565b925060408501356001600160401b03811115614d8e57600080fd5b614d9a87828801614d3b565b92505060608501356001600160401b03811115614db657600080fd5b614dc287828801614d3b565b91505092959194509250565b80356001600160a01b0381168114614d3657600080fd5b60008060408385031215614df857600080fd5b614e0183614dce565b9150614e0f60208401614dce565b90509250929050565b600060208284031215614e2a57600080fd5b5035919050565b600060208284031215614e4357600080fd5b6144ba82614dce565b60008060408385031215614e5f57600080fd5b614e6883614dce565b946020939093013593505050565b600060808284031215613f8a57600080fd5b60008060408385031215614e9b57600080fd5b82356001600160401b03811115614eb157600080fd5b614ebd85828601614e76565b92505060208301356001600160401b03811115614ed957600080fd5b614ee585828601614e76565b9150509250929050565b634e487b7160e01b600052602160045260246000fd5b8581526001600160401b0385811660208301528416604082015263ffffffff8316606082015260a0810160038310614f3f57614f3f614eef565b8260808301529695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614f8d57614f8d614f4f565b604052919050565b60006001600160401b03821115614fae57614fae614f4f565b5060051b60200190565b600082601f830112614fc957600080fd5b8135614fdc614fd782614f95565b614f65565b8082825260208201915060208360051b860101925085831115614ffe57600080fd5b602085015b838110156150225761501481614dce565b835260209283019201615003565b5095945050505050565b60008060006060848603121561504157600080fd5b83356001600160401b0381111561505757600080fd5b61506386828701614fb8565b93505060208401356001600160401b0381111561507f57600080fd5b61508b86828701614fb8565b92505060408401356001600160401b038111156150a757600080fd5b6150b386828701614fb8565b9150509250925092565b600080604083850312156150d057600080fd5b82356001600160401b038111156150e657600080fd5b8301606081860312156150f857600080fd5b9150614e0f60208401614d1f565b60008083601f84011261511857600080fd5b5081356001600160401b0381111561512f57600080fd5b60208301915083602082850101111561514757600080fd5b9250929050565b60008060006040848603121561516357600080fd5b83356001600160401b0381111561517957600080fd5b61518586828701615106565b9094509250615198905060208501614d1f565b90509250925092565b60008060008060008060a087890312156151ba57600080fd5b6151c387614d1f565b9550602087013564ffffffffff811681146151dd57600080fd5b9450604087013593506060870135925060808701356001600160401b0381111561520657600080fd5b61521289828a01615106565b979a9699509497509295939492505050565b60008083601f84011261523657600080fd5b5081356001600160401b0381111561524d57600080fd5b6020830191508360208260051b850101111561514757600080fd5b600060a08284031215613f8a57600080fd5b600080600080600060e0868803121561529257600080fd5b85356001600160401b038111156152a857600080fd5b6152b488828901615106565b90965094505060208601356001600160401b038111156152d357600080fd5b6152df88828901615224565b90945092506152f390508760408801615268565b90509295509295909350565b6000806020838503121561531257600080fd5b82356001600160401b0381111561532857600080fd5b61533485828601615224565b90969095509350505050565b604081016009841061535457615354614eef565b92815264ffffffffff9190911660209091015290565b803563ffffffff81168114614d3657600080fd5b801515811461354757600080fd5b600060a0828403121561539e57600080fd5b60405160a081016001600160401b03811182821017156153c0576153c0614f4f565b6040529050806153cf8361536a565b81526153dd60208401614d1f565b60208201526153ee60408401614d1f565b604082015260608301356154018161537e565b6060820152608092830135920191909152919050565b600080600060e0848603121561542c57600080fd5b83356001600160401b0381111561544257600080fd5b8401601f8101861361545357600080fd5b8035615461614fd782614f95565b8082825260208201915060208360051b85010192508883111561548357600080fd5b6020840193505b828410156154ac5761549b84614d1f565b82526020938401939091019061548a565b955050505060208401359150615198856040860161538c565b600080600080600080600080610120898b0312156154e257600080fd5b88356001600160401b038111156154f857600080fd5b6155048b828c01615106565b90995097505060208901356001600160401b0381111561552357600080fd5b61552f8b828c01615224565b90975095505060408901356001600160401b0381111561554e57600080fd5b61555a8b828c01615106565b909550935050606089013591506155748a60808b01615268565b90509295985092959890939650565b60008060006060848603121561559857600080fd5b6155a184614dce565b92506155af60208501614dce565b929592945050506040919091013590565b602080825282518282018190526000918401906040840190835b818110156156015783516001600160a01b03168352602093840193909201916001016155da565b509095945050505050565b60006020828403121561561e57600080fd5b6144ba82614d1f565b6000808335601e1984360301811261563e57600080fd5b8301803591506001600160401b0382111561565857600080fd5b60200191503681900382131561514757600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8481526001600160401b03841660208201526060604082015260006156bf60608301848661566d565b9695505050505050565b6000602082840312156156db57600080fd5b81516144ba8161537e565b85815264ffffffffff851660208201526001600160401b0384166040820152608060608201526000614c1260808301848661566d565b634e487b7160e01b600052601160045260246000fd5b60006001600160401b0383168061575957634e487b7160e01b600052601260045260246000fd5b806001600160401b0384160491505092915050565b80820281158282048414176129b2576129b261571c565b6020808252601a908201527f43616c6c6572206973206e6f742074686520476f7665726e6f72000000000000604082015260600190565b6000808335601e198436030181126157d357600080fd5b8301803591506001600160401b038211156157ed57600080fd5b6020019150600581901b360382131561514757600080fd5b8481528360208201526060604082015260006156bf60608301848661566d565b6000816158345761583461571c565b506000190190565b634e487b7160e01b600052603260045260246000fd5b85815284602082015260806040820152600061587260808301858761566d565b905064ffffffffff831660608301529695505050505050565b60006020828403121561589d57600080fd5b5051919050565b818103818111156129b2576129b261571c565b634e487b7160e01b600052603160045260246000fd5b808201808211156129b2576129b261571c565b6000602082840312156158f257600080fd5b6144ba8261536a565b85815284602082015260806040820152600061591b60808301858761566d565b905063ffffffff831660608301529695505050505050565b6020808252600f908201526e2737ba102932b3b4b9ba3930ba37b960891b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6001600160f81b03199390931683526001600160a81b031991909116600183015260601b6bffffffffffffffffffffffff1916600c82015260200190565b6001600160401b0382811682821603908111156129b2576129b261571c565b60005b838110156159fe5781810151838201526020016159e6565b50506000910152565b60008151808452615a1f8160208601602086016159e3565b601f01601f19169290920160200192915050565b86815260a060208201526000615a4c60a0830188615a07565b6001600160401b03871660408401528281036060840152615a6e81868861566d565b9150506001600160401b0383166080830152979650505050505050565b608081526000615a9f60808301888a61566d565b8281036020840152615ab18188615a07565b90508281036040840152615ac681868861566d565b915050826060830152979650505050505050565b604081526000615aee60408301858761566d565b9050826020830152949350505050565b60208082526017908201527f43616c6c6572206973206e6f7420746865205661756c74000000000000000000604082015260600190565b6020808252600e908201526d1499595b9d1c985b9d0818d85b1b60921b604082015260600190565b602080825260119082015270155b9cdd5c1c1bdc9d195908185cdcd95d607a1b604082015260600190565b6001600160401b038181168382160290811690818114615baa57615baa61571c565b5092915050565b6001600160401b0381811683821601908111156129b2576129b261571c565b86815285602082015260a060408201526000615bf060a08301868861566d565b64ffffffffff9490941660608301525060800152949350505050565b80516020808301519190811015613f8a5760001960209190910360031b1b16919050565b81835260208301925060008160005b84811015615c6e576001600160401b03615c5883614d1f565b1686526020958601959190910190600101615c3f565b5093949350505050565b63ffffffff615c868261536a565b1682526001600160401b03615c9d60208301614d1f565b1660208301526001600160401b03615cb760408301614d1f565b1660408301526060810135615ccb8161537e565b15156060830152608090810135910152565b60e081526000615cf160e08301878961566d565b8281036020840152615d04818688615c30565b9150506156bf6040830184615c78565b602081526000613da0602083018486615c30565b6040808252845490820181905260008581526020812090916060840190835b81811015615d6e5783546001600160a01b0316835260019384019360209093019201615d47565b50508381036020808601919091528582520190508460005b85811015615db5576001600160a01b03615d9f83614dce565b1683526020928301929190910190600101615d86565b50909695505050505050565b60e080825284519082018190526000906020860190610100840190835b81811015615e055783516001600160401b0316835260209384019390920191600101615dde565b5050809250505083602083015263ffffffff83511660408301526001600160401b0360208401511660608301526001600160401b0360408401511660808301526060830151151560a0830152608083015160c0830152949350505050565b61012081526000615e7961012083018a8c61566d565b8281036020840152615e8c81898b615c30565b90508281036040840152615ea181878961566d565b915050836060830152615eb76080830184615c78565b9998505050505050505050565b60008251615ed68184602087016159e3565b9190910192915050565b60008351615ef28184602088016159e3565b6001600160801b0319939093169190920190815260100192915050565b8284823760c09190911b6001600160c01b0319169101908152600801919050565b6020815260006144ba6020830184615a0756fe53bf423e48ed90e97d02ab0ebab13b2a235a6bfbe9c321847d5c175333ac45357bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4aa2646970667358221220cee775df8d65f3ce633ccb3adad18cf76e2c539a2711bd2695a6e1e771d4f3bb64736f6c634300081c0033", + "numDeployments": 7, + "solcInputHash": "6009afe519e1f288a46249ae425a2ffb", + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"platformAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"vaultAddress\",\"type\":\"address\"}],\"internalType\":\"struct InitializableAbstractStrategy.BaseStrategyConfig\",\"name\":\"_baseConfig\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"_wethAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ssvToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ssvNetwork\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_beaconChainDepositContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_beaconProofs\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"_beaconGenesisTimestamp\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"blockRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethBalance\",\"type\":\"uint256\"}],\"name\":\"BalancesSnapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalDepositsWei\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalValidatorBalance\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethBalance\",\"type\":\"uint256\"}],\"name\":\"BalancesVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pendingDepositRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountWei\",\"type\":\"uint256\"}],\"name\":\"DepositVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pendingDepositRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubKey\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountWei\",\"type\":\"uint256\"}],\"name\":\"ETHStaked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"FirstDepositReset\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousGovernor\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newGovernor\",\"type\":\"address\"}],\"name\":\"GovernorshipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_oldHarvesterAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newHarvesterAddress\",\"type\":\"address\"}],\"name\":\"HarvesterAddressesUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pToken\",\"type\":\"address\"}],\"name\":\"PTokenAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pToken\",\"type\":\"address\"}],\"name\":\"PTokenRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousGovernor\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorshipTransfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"RegistratorChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"_oldAddresses\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"_newAddresses\",\"type\":\"address[]\"}],\"name\":\"RewardTokenAddressesUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardTokenCollected\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64[]\",\"name\":\"operatorIds\",\"type\":\"uint64[]\"}],\"name\":\"SSVValidatorRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64[]\",\"name\":\"operatorIds\",\"type\":\"uint64[]\"}],\"name\":\"SSVValidatorRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"}],\"name\":\"ValidatorInvalid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint40\",\"name\":\"validatorIndex\",\"type\":\"uint40\"}],\"name\":\"ValidatorVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountWei\",\"type\":\"uint256\"}],\"name\":\"ValidatorWithdraw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BEACON_PROOFS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SSV_TOKEN\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"assetToPToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"}],\"name\":\"checkBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collectRewardTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"depositList\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositListLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositedWethAccountedFor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"deposits\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"amountGwei\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"slot\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositIndex\",\"type\":\"uint32\"},{\"internalType\":\"enum CompoundingValidatorManager.DepositStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"firstDeposit\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRewardTokenAddresses\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"harvesterAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_rewardTokenAddresses\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_assets\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_pTokens\",\"type\":\"address[]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isGovernor\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastVerifiedEthBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"platformAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"publicKey\",\"type\":\"bytes\"},{\"internalType\":\"uint64[]\",\"name\":\"operatorIds\",\"type\":\"uint64[]\"},{\"internalType\":\"bytes\",\"name\":\"sharesData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"ssvAmount\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint32\",\"name\":\"validatorCount\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"networkFeeIndex\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"index\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"internalType\":\"struct Cluster\",\"name\":\"cluster\",\"type\":\"tuple\"}],\"name\":\"registerSsvValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"removePToken\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"publicKey\",\"type\":\"bytes\"},{\"internalType\":\"uint64[]\",\"name\":\"operatorIds\",\"type\":\"uint64[]\"},{\"components\":[{\"internalType\":\"uint32\",\"name\":\"validatorCount\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"networkFeeIndex\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"index\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"internalType\":\"struct Cluster\",\"name\":\"cluster\",\"type\":\"tuple\"}],\"name\":\"removeSsvValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"resetFirstDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewardTokenAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"safeApproveAllTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_harvesterAddress\",\"type\":\"address\"}],\"name\":\"setHarvesterAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"setPTokenAddress\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"setRegistrator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_rewardTokenAddresses\",\"type\":\"address[]\"}],\"name\":\"setRewardTokenAddresses\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"snapBalances\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"snappedBalance\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"blockRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint128\",\"name\":\"ethBalance\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"depositDataRoot\",\"type\":\"bytes32\"}],\"internalType\":\"struct CompoundingValidatorManager.ValidatorStakeData\",\"name\":\"validatorStakeData\",\"type\":\"tuple\"},{\"internalType\":\"uint64\",\"name\":\"depositAmountGwei\",\"type\":\"uint64\"}],\"name\":\"stakeEth\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"}],\"name\":\"supportsAsset\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newGovernor\",\"type\":\"address\"}],\"name\":\"transferGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"transferToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unPause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"validator\",\"outputs\":[{\"internalType\":\"enum CompoundingValidatorManager.ValidatorState\",\"name\":\"state\",\"type\":\"uint8\"},{\"internalType\":\"uint40\",\"name\":\"index\",\"type\":\"uint40\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorRegistrator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"publicKey\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"amountGwei\",\"type\":\"uint64\"}],\"name\":\"validatorWithdrawal\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"vaultAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"verifiedValidators\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifiedValidatorsLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"balancesContainerRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"balancesContainerProof\",\"type\":\"bytes\"},{\"internalType\":\"bytes32[]\",\"name\":\"validatorBalanceLeaves\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes[]\",\"name\":\"validatorBalanceProofs\",\"type\":\"bytes[]\"}],\"internalType\":\"struct CompoundingValidatorManager.BalanceProofs\",\"name\":\"balanceProofs\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"pendingDepositContainerRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"pendingDepositContainerProof\",\"type\":\"bytes\"},{\"internalType\":\"uint32[]\",\"name\":\"pendingDepositIndexes\",\"type\":\"uint32[]\"},{\"internalType\":\"bytes[]\",\"name\":\"pendingDepositProofs\",\"type\":\"bytes[]\"}],\"internalType\":\"struct CompoundingValidatorManager.PendingDepositProofs\",\"name\":\"pendingDepositProofs\",\"type\":\"tuple\"}],\"name\":\"verifyBalances\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"pendingDepositRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"depositProcessedSlot\",\"type\":\"uint64\"},{\"components\":[{\"internalType\":\"uint64\",\"name\":\"slot\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"internalType\":\"struct CompoundingValidatorManager.FirstPendingDepositSlotProofData\",\"name\":\"firstPendingDeposit\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint64\",\"name\":\"withdrawableEpoch\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"withdrawableEpochProof\",\"type\":\"bytes\"}],\"internalType\":\"struct CompoundingValidatorManager.StrategyValidatorProofData\",\"name\":\"strategyValidatorData\",\"type\":\"tuple\"}],\"name\":\"verifyDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"nextBlockTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint40\",\"name\":\"validatorIndex\",\"type\":\"uint40\"},{\"internalType\":\"bytes32\",\"name\":\"pubKeyHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"withdrawalCredentials\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"validatorPubKeyProof\",\"type\":\"bytes\"}],\"name\":\"verifyValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64[]\",\"name\":\"operatorIds\",\"type\":\"uint64[]\"},{\"internalType\":\"uint256\",\"name\":\"ssvAmount\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint32\",\"name\":\"validatorCount\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"networkFeeIndex\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"index\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"internalType\":\"struct Cluster\",\"name\":\"cluster\",\"type\":\"tuple\"}],\"name\":\"withdrawSSV\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Origin Protocol Inc\",\"events\":{\"Paused(address)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"Unpaused(address)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"}},\"kind\":\"dev\",\"methods\":{\"checkBalance(address)\":{\"params\":{\"_asset\":\"Address of WETH asset.\"},\"returns\":{\"balance\":\" Total value in ETH\"}},\"constructor\":{\"params\":{\"_baseConfig\":\"Base strategy config with `platformAddress` not used so empty address `vaultAddress` the address of the OETH Vault contract\",\"_beaconChainDepositContract\":\"Address of the beacon chain deposit contract\",\"_beaconGenesisTimestamp\":\"The timestamp of the Beacon chain's genesis.\",\"_beaconProofs\":\"Address of the Beacon Proofs contract that verifies beacon chain data\",\"_ssvNetwork\":\"Address of the SSV Network contract\",\"_ssvToken\":\"Address of the SSV Token contract\",\"_wethAddress\":\"Address of the WETH Token contract\"}},\"deposit(address,uint256)\":{\"params\":{\"_amount\":\"Amount of WETH that was transferred to the strategy by the vault.\",\"_asset\":\"Address of the WETH token.\"}},\"getRewardTokenAddresses()\":{\"returns\":{\"_0\":\"address[] the reward token addresses.\"}},\"initialize(address[],address[],address[])\":{\"params\":{\"_assets\":\"Not used so empty array\",\"_pTokens\":\"Not used so empty array\",\"_rewardTokenAddresses\":\"Not used so empty array\"}},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"registerSsvValidator(bytes,uint64[],bytes,uint256,(uint32,uint64,uint64,bool,uint256))\":{\"params\":{\"cluster\":\"The SSV cluster details including the validator count and SSV balance\",\"operatorIds\":\"The operator IDs of the SSV Cluster\",\"publicKey\":\"The public key of the validator\",\"sharesData\":\"The shares data for the validator\",\"ssvAmount\":\"The amount of SSV tokens to be deposited to the SSV cluster\"}},\"removeSsvValidator(bytes,uint64[],(uint32,uint64,uint64,bool,uint256))\":{\"params\":{\"cluster\":\"The SSV cluster details including the validator count and SSV balance\",\"operatorIds\":\"The operator IDs of the SSV Cluster\",\"publicKey\":\"The public key of the validator\"}},\"setHarvesterAddress(address)\":{\"params\":{\"_harvesterAddress\":\"Address of the harvester contract.\"}},\"setRewardTokenAddresses(address[])\":{\"params\":{\"_rewardTokenAddresses\":\"Array of reward token addresses\"}},\"stakeEth((bytes,bytes,bytes32),uint64)\":{\"params\":{\"depositAmountGwei\":\"The amount of WETH to stake to the validator in Gwei.\",\"validatorStakeData\":\"validator data needed to stake. The `ValidatorStakeData` struct contains the pubkey, signature and depositDataRoot. Only the registrator can call this function.\"}},\"supportsAsset(address)\":{\"params\":{\"_asset\":\"The address of the WETH token.\"}},\"transferGovernance(address)\":{\"params\":{\"_newGovernor\":\"Address of the new Governor\"}},\"transferToken(address,uint256)\":{\"params\":{\"_amount\":\"Amount of the asset to transfer\",\"_asset\":\"Address for the asset\"}},\"validatorWithdrawal(bytes,uint64)\":{\"params\":{\"amountGwei\":\"The amount of ETH to be withdrawn from the validator in Gwei. A zero amount will trigger a full withdrawal.\",\"publicKey\":\"The public key of the validator\"}},\"verifyBalances((bytes32,bytes,bytes32[],bytes[]),(bytes32,bytes,uint32[],bytes[]))\":{\"params\":{\"balanceProofs\":\"a `BalanceProofs` struct containing the following: - balancesContainerRoot: The merkle root of the balances container - balancesContainerProof: The merkle proof for the balances container to the beacon block root. This is 9 witness hashes of 32 bytes each concatenated together starting from the leaf node. - validatorBalanceLeaves: Array of leaf nodes containing the validator balance with three other balances. - validatorBalanceProofs: Array of merkle proofs for the validator balance to the Balances container root. This is 39 witness hashes of 32 bytes each concatenated together starting from the leaf node.\",\"pendingDepositProofs\":\"a `PendingDepositProofs` struct containing the following: - pendingDepositContainerRoot: The merkle root of the pending deposits list container - pendingDepositContainerProof: The merkle proof from the pending deposits list container to the beacon block root. This is 9 witness hashes of 32 bytes each concatenated together starting from the leaf node. - pendingDepositIndexes: Array of indexes in the pending deposits list container for each of the strategy's deposits. - pendingDepositProofs: Array of merkle proofs for each strategy deposit in the beacon chain's pending deposit list container to the pending deposits list container root. These are 28 witness hashes of 32 bytes each concatenated together starting from the leaf node.\"}},\"verifyDeposit(bytes32,uint64,(uint64,bytes),(uint64,bytes))\":{\"params\":{\"depositProcessedSlot\":\"Any slot on or after the strategy's deposit was processed on the beacon chain. Can not be a slot with pending deposits with the same slot as the deposit being verified. Can not be a slot before a missed slot as the Beacon Root contract will have the parent block root set for the next block timestamp in 12 seconds time.\",\"firstPendingDeposit\":\"a `FirstPendingDepositSlotProofData` struct containing: - slot: The beacon chain slot of the first deposit in the beacon chain's deposit queue. Can be any non-zero value if the deposit queue is empty. - proof: The merkle proof of the first pending deposit's slot to the beacon block root. Can be either: * 40 witness hashes for BeaconBlock.state.PendingDeposits[0].slot when the deposit queue is not empty. * 37 witness hashes for BeaconBlock.state.PendingDeposits[0] when the deposit queue is empty. The 32 byte witness hashes are concatenated together starting from the leaf node.\",\"pendingDepositRoot\":\"The unique identifier of the deposit emitted in `ETHStaked` from the `stakeEth` function.\",\"strategyValidatorData\":\"a `StrategyValidatorProofData` struct containing: - withdrawableEpoch: The withdrawable epoch of the validator the strategy is depositing to. - withdrawableEpochProof: The merkle proof for the withdrawable epoch of the validator the strategy is depositing to, to the beacon block root. This is 53 witness hashes of 32 bytes each concatenated together starting from the leaf node.\"}},\"verifyValidator(uint64,uint40,bytes32,bytes32,bytes)\":{\"params\":{\"nextBlockTimestamp\":\"The timestamp of the execution layer block after the beacon chain slot we are verifying. The next one is needed as the Beacon Oracle returns the parent beacon block root for a block timestamp, which is the beacon block root of the previous block.\",\"pubKeyHash\":\"The hash of the validator's public key using the Beacon Chain's format\",\"validatorIndex\":\"The index of the validator on the beacon chain.\",\"validatorPubKeyProof\":\"The merkle proof for the validator public key to the beacon block root. This is 53 witness hashes of 32 bytes each concatenated together starting from the leaf node. BeaconBlock.state.validators[validatorIndex].pubkey\",\"withdrawalCredentials\":\"contain the validator type and withdrawal address. These can be incorrect and/or malformed. In case of incorrect withdrawalCredentials the validator deposit has been front run\"}},\"withdraw(address,address,uint256)\":{\"params\":{\"_amount\":\"Amount of WETH to withdraw.\",\"_asset\":\"Address of the WETH token.\",\"_recipient\":\"Address to receive withdrawn assets.\"}},\"withdrawSSV(uint64[],uint256,(uint32,uint64,uint64,bool,uint256))\":{\"details\":\"A SSV cluster is defined by the SSVOwnerAddress and the set of operatorIds.\",\"params\":{\"cluster\":\"The SSV cluster details including the validator count and SSV balance\",\"operatorIds\":\"The operator IDs of the SSV Cluster\",\"ssvAmount\":\"The amount of SSV tokens to be withdrawn from the SSV cluster\"}}},\"title\":\"Compounding Staking SSV Strategy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"BEACON_PROOFS()\":{\"notice\":\"Address of the Beacon Proofs contract that verifies beacon chain data\"},\"SSV_TOKEN()\":{\"notice\":\"SSV ERC20 token that serves as a payment for operating SSV validators\"},\"assetToPToken(address)\":{\"notice\":\"asset => pToken (Platform Specific Token Address)\"},\"checkBalance(address)\":{\"notice\":\"Accounts for all the assets managed by this strategy which includes: 1. The current WETH in this strategy contract 2. The last verified ETH balance, total deposits and total validator balances\"},\"claimGovernance()\":{\"notice\":\"Claim Governance of the contract to a new account (`newGovernor`). Can only be called by the new Governor.\"},\"collectRewardTokens()\":{\"notice\":\"Collect accumulated reward token and send to Vault.\"},\"deposit(address,uint256)\":{\"notice\":\"Unlike other strategies, this does not deposit assets into the underlying platform. It just checks the asset is WETH and emits the Deposit event. To deposit WETH into validators, `registerSsvValidator` and `stakeEth` must be used.\"},\"depositAll()\":{\"notice\":\"Unlike other strategies, this does not deposit assets into the underlying platform. It just emits the Deposit event. To deposit WETH into validators `registerSsvValidator` and `stakeEth` must be used.\"},\"depositList(uint256)\":{\"notice\":\"List of strategy deposit IDs to a validator. The ID is the merkle root of the pending deposit data which is unique for each validator, amount and block. Duplicate pending deposit roots are prevented so can be used as an identifier to each strategy deposit. The list can be for deposits waiting to be verified as processed on the beacon chain, or deposits that have been verified to an exiting validator and is now waiting for the validator's balance to be swept. The list may not be ordered by time of deposit. Removed deposits will move the last deposit to the removed index.\"},\"depositListLength()\":{\"notice\":\"Returns the number of deposits waiting to be verified as processed on the beacon chain, or deposits that have been verified to an exiting validator and is now waiting for the validator's balance to be swept.\"},\"deposits(bytes32)\":{\"notice\":\"Mapping of the pending deposit roots to the deposit data\"},\"firstDeposit()\":{\"notice\":\"Restricts to only one deposit to an unverified validator at a time. This is to limit front-running attacks of deposits to the beacon chain contract.\"},\"getRewardTokenAddresses()\":{\"notice\":\"Get the reward token addresses.\"},\"governor()\":{\"notice\":\"Returns the address of the current Governor.\"},\"harvesterAddress()\":{\"notice\":\"Address of the Harvester contract allowed to collect reward tokens\"},\"initialize(address[],address[],address[])\":{\"notice\":\"Set up initial internal state including 1. approving the SSVNetwork to transfer SSV tokens from this strategy contract\"},\"isGovernor()\":{\"notice\":\"Returns true if the caller is the current Governor.\"},\"lastVerifiedEthBalance()\":{\"notice\":\"The last verified ETH balance of the strategy\"},\"platformAddress()\":{\"notice\":\"Address of the underlying platform\"},\"registerSsvValidator(bytes,uint64[],bytes,uint256,(uint32,uint64,uint64,bool,uint256))\":{\"notice\":\"Registers a single validator in a SSV Cluster. Only the Registrator can call this function.\"},\"removePToken(uint256)\":{\"notice\":\"is not supported for this strategy as there is no platform token.\"},\"removeSsvValidator(bytes,uint64[],(uint32,uint64,uint64,bool,uint256))\":{\"notice\":\"Remove the validator from the SSV Cluster after: - the validator has been exited from `validatorWithdrawal` or slashed - the validator has incorrectly registered and can not be staked to - the initial deposit was front-run and the withdrawal address is not this strategy's address. Make sure `validatorWithdrawal` is called with a zero amount and the validator has exited the Beacon chain. If removed before the validator has exited the beacon chain will result in the validator being slashed. Only the registrator can call this function.\"},\"resetFirstDeposit()\":{\"notice\":\"Reset the `firstDeposit` flag to false so deposits to unverified validators can be made again.\"},\"rewardTokenAddresses(uint256)\":{\"notice\":\"Address of the reward tokens. eg CRV, BAL, CVX, AURA\"},\"safeApproveAllTokens()\":{\"notice\":\"Approves the SSV Network contract to transfer SSV tokens for validator registration.\"},\"setHarvesterAddress(address)\":{\"notice\":\"Set the Harvester contract that can collect rewards.\"},\"setPTokenAddress(address,address)\":{\"notice\":\"is not supported for this strategy as there is no platform token.\"},\"setRegistrator(address)\":{\"notice\":\"Set the address of the registrator which can register, exit and remove validators\"},\"setRewardTokenAddresses(address[])\":{\"notice\":\"Set the reward token addresses. Any old addresses will be overwritten.\"},\"snapBalances()\":{\"notice\":\"Stores the current ETH balance at the current block and beacon block root of the slot that is associated with the previous block. When snapping / verifying balance it is of a high importance that there is no miss-match in respect to ETH that is held by the contract and balances that are verified on the validators. First some context on the beacon-chain block building behaviour. Relevant parts of constructing a block on the beacon chain consist of: - process_withdrawals: ETH is deducted from the validator's balance - process_execution_payload: immediately after the previous step executing all the transactions - apply the withdrawals: adding ETH to the recipient which is the withdrawal address contained in the withdrawal credentials of the exited validators That means that balance increases which are part of the post-block execution state are done within the block, but the transaction that are contained within that block can not see / interact with the balance from the exited validators. Only transactions in the next block can do that. When snap balances is performed the state of the chain is snapped across 2 separate chain states: - ETH balance of the contract is recorded on block X -> and corresponding slot Y - beacon chain block root is recorded of block X - 1 -> and corresponding slot Y - 1 given there were no missed slots. It could also be Y - 2, Y - 3 depending on how many slots have not managed to propose a block. For the sake of simplicity this slot will be referred to as Y - 1 as it makes no difference in the argument Given these 2 separate chain states it is paramount that verify balances can not experience miss-counting ETH or much more dangerous double counting of the ETH. When verifyBalances is called it is performed on the current block Z where Z > X. Verify balances adds up all the ETH (omitting WETH) controlled by this contract: - ETH balance in the contract on block X - ETH balance in Deposits on block Z that haven't been yet processed in slot Y - 1 - ETH balance in validators that are active in slot Y - 1 - skips the ETH balance in validators that have withdrawn in slot Y - 1 (or sooner) and have their balance visible to transactions in slot Y and corresponding block X (or sooner) Lets verify the correctness of ETH accounting given the above described behaviour. *ETH balance in the contract on block X* This is an ETH balance of the contract on a non current X block. Any ETH leaving the contract as a result of a withdrawal subtracts from the ETH accounted for on block X if `verifyBalances` has already been called. It also invalidates a `snapBalances` in case `verifyBalances` has not been called yet. Not performing this would result in not accounting for the withdrawn ETH that has happened anywhere in the block interval [X + 1, Z]. Similarly to withdrawals any `stakeEth` deposits to the deposit contract adds to the ETH accounted for since the last `verifyBalances` has been called. And it invalidates the `snapBalances` in case `verifyBalances` hasn't been yet called. Not performing this would result in double counting the `stakedEth` since it would be present once in the snapped contract balance and the second time in deposit storage variables. This behaviour is correct. *ETH balance in Deposits on block Z that haven't been yet processed in slot Y - 1* The contract sums up all the ETH that has been deposited to the Beacon chain deposit contract at block Z. The execution layer doesn't have direct access to the state of deposits on the beacon chain. And if it is to sum up all the ETH that is marked to be deposited it needs to be sure to not double count ETH that is in deposits (storage vars) and could also be part of the validator balances. It does that by verifying that at slot Y - 1 none of the deposits visible on block Z have been processed. Meaning since the last snap till now all are still in queue. Which ensures they can not be part of the validator balances in later steps. This behaviour is correct. *ETH balance in validators that are active in slot Y - 1* The contract is verifying none of the deposits on Y - 1 slot have been processed and for that reason it checks the validator balances in the same slot. Ensuring accounting correctness. This behaviour is correct. *The withdrawn validators* The withdrawn validators could have their balances deducted in any slot before slot Y - 1 and the execution layer sees the balance increase in the subsequent slot. Lets look at the \\\"worst case scenario\\\" where the validator withdrawal is processed in the slot Y - 1 (snapped slot) and see their balance increase (in execution layer) in slot Y -> block X. The ETH balance on the contract is snapped at block X meaning that even if the validator exits at the latest possible time it is paramount that the ETH balance on the execution layer is recorded in the next block. Correctly accounting for the withdrawn ETH. Worth mentioning if the validator exit is processed by the slot Y and balance increase seen on the execution layer on block X + 1 the withdrawal is ignored by both the validator balance verification as well as execution layer contract balance snap. This behaviour is correct. The validator balances on the beacon chain can then be proved with `verifyBalances`.\"},\"snappedBalance()\":{\"notice\":\"Mapping of the block root to the balances at that slot\"},\"stakeEth((bytes,bytes,bytes32),uint64)\":{\"notice\":\"Stakes WETH in this strategy to a compounding validator. The first deposit to a new validator, the amount must be 1 ETH. Another deposit of at least 31 ETH is required for the validator to be activated. This second deposit has to be done after the validator has been verified. Does not convert any ETH sitting in this strategy to WETH. There can not be two deposits to the same validator in the same block for the same amount. Function is pausable so in case a run-away Registrator can be prevented from continuing to deposit funds to slashed or undesired validators.\"},\"supportsAsset(address)\":{\"notice\":\"Returns bool indicating whether asset is supported by the strategy.\"},\"transferGovernance(address)\":{\"notice\":\"Transfers Governance of the contract to a new account (`newGovernor`). Can only be called by the current Governor. Must be claimed for this to complete\"},\"transferToken(address,uint256)\":{\"notice\":\"Transfer token to governor. Intended for recovering tokens stuck in strategy contracts, i.e. mistaken sends.\"},\"validator(bytes32)\":{\"notice\":\"Mapping of the hash of the validator's public key to the validator state and index. Uses the Beacon chain hashing for BLSPubkey which is sha256(abi.encodePacked(validator.pubkey, bytes16(0)))\"},\"validatorRegistrator()\":{\"notice\":\"Address of the registrator - allowed to register, withdraw, exit and remove validators\"},\"validatorWithdrawal(bytes,uint64)\":{\"notice\":\"Request a full or partial withdrawal from a validator. A zero amount will trigger a full withdrawal. If the remaining balance is < 32 ETH then only the amount in excess of 32 ETH will be withdrawn. Only the Registrator can call this function. 1 wei of value should be sent with the tx to pay for the withdrawal request fee. If no value sent, 1 wei will be taken from the strategy's ETH balance if it has any. If no ETH balance, the tx will revert.\"},\"vaultAddress()\":{\"notice\":\"Address of the OToken vault\"},\"verifiedValidators(uint256)\":{\"notice\":\"List of validator public key hashes that have been verified to exist on the beacon chain. These have had a deposit processed and the validator's balance increased. Validators will be removed from this list when its verified they have a zero balance.\"},\"verifiedValidatorsLength()\":{\"notice\":\"Returns the number of verified validators.\"},\"verifyBalances((bytes32,bytes,bytes32[],bytes[]),(bytes32,bytes,uint32[],bytes[]))\":{\"notice\":\"Verifies the balances of all active validators on the beacon chain and checks each of the strategy's deposits are still to be processed by the beacon chain.\"},\"verifyDeposit(bytes32,uint64,(uint64,bytes),(uint64,bytes))\":{\"notice\":\"Verifies a deposit on the execution layer has been processed by the beacon chain. This means the accounting of the strategy's ETH moves from a pending deposit to a validator balance. Important: this function has a limitation where `depositProcessedSlot` that is passed by the off-chain verifier requires a slot immediately after it to propose a block otherwise the `BeaconRoots.parentBlockRoot` will fail. This shouldn't be a problem, since by the current behaviour of beacon chain only 1%-3% slots don't propose a block.\"},\"verifyValidator(uint64,uint40,bytes32,bytes32,bytes)\":{\"notice\":\"Verifies a validator's index to its public key. Adds to the list of verified validators if the validator's withdrawal address is this strategy's address. Marks the validator as invalid and removes the deposit if the withdrawal address is not this strategy's address.\"},\"withdraw(address,address,uint256)\":{\"notice\":\"Withdraw ETH and WETH from this strategy contract.\"},\"withdrawAll()\":{\"notice\":\"Transfer all WETH deposits, ETH from validator withdrawals and ETH from execution rewards in this strategy to the vault. This does not withdraw from the validators. That has to be done separately with the `validatorWithdrawal` operation.\"},\"withdrawSSV(uint64[],uint256,(uint32,uint64,uint64,bool,uint256))\":{\"notice\":\"Withdraws excess SSV Tokens from the SSV Network contract which was used to pay the SSV Operators.\"}},\"notice\":\"Strategy to deploy funds into DVT validators powered by the SSV Network\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol\":\"CompoundingStakingSSVStrategy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/security/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract Pausable is Context {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n constructor() {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n require(!paused(), \\\"Pausable: paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n require(paused(), \\\"Pausable: not paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n}\\n\",\"keccak256\":\"0xe68ed7fb8766ed1e888291f881e36b616037f852b37d96877045319ad298ba87\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, 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 `sender` to `recipient` 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 sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0x61437cb513a887a1bbad006e7b1c8b414478427d33de47c5600af3c748f108da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 /**\\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\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\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 function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 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\\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\":\"0x51b758a8815ecc9596c66c37d56b1d33883a444631a3f916b9fe65cb863ef7c4\",\"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/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a / b + (a % b == 0 ? 0 : 1);\\n }\\n}\\n\",\"keccak256\":\"0xfaad496c1c944b6259b7dc70b4865eb1775d6402bc0c81b38a0b24d9f525ae37\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Returns the downcasted uint224 from uint256, reverting on\\n * overflow (when the input is greater than largest uint224).\\n *\\n * Counterpart to Solidity's `uint224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n */\\n function toUint224(uint256 value) internal pure returns (uint224) {\\n require(value <= type(uint224).max, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n return uint224(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n require(value <= type(uint128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint96 from uint256, reverting on\\n * overflow (when the input is greater than largest uint96).\\n *\\n * Counterpart to Solidity's `uint96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n */\\n function toUint96(uint256 value) internal pure returns (uint96) {\\n require(value <= type(uint96).max, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n return uint96(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n require(value <= type(uint64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n require(value <= type(uint32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n require(value <= type(uint16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits.\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n require(value <= type(uint8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n require(value >= 0, \\\"SafeCast: value must be positive\\\");\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128) {\\n require(value >= type(int128).min && value <= type(int128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return int128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64) {\\n require(value >= type(int64).min && value <= type(int64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return int64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32) {\\n require(value >= type(int32).min && value <= type(int32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return int32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16) {\\n require(value >= type(int16).min && value <= type(int16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return int16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits.\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8) {\\n require(value >= type(int8).min && value <= type(int8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return int8(value);\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n require(value <= uint256(type(int256).max), \\\"SafeCast: value doesn't fit in an int256\\\");\\n return int256(value);\\n }\\n}\\n\",\"keccak256\":\"0x5c6caab697d302ad7eb59c234a4d2dbc965c1bae87709bd2850060b7695b28c7\",\"license\":\"MIT\"},\"contracts/beacon/BeaconRoots.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Library to retrieve beacon block roots.\\n * @author Origin Protocol Inc\\n */\\nlibrary BeaconRoots {\\n /// @notice The address of beacon block roots oracle\\n /// See https://eips.ethereum.org/EIPS/eip-4788\\n address internal constant BEACON_ROOTS_ADDRESS =\\n 0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02;\\n\\n /// @notice Returns the beacon block root for the previous block.\\n /// This comes from the Beacon Roots contract defined in EIP-4788.\\n /// This will revert if the block is more than 8,191 blocks old as\\n /// that is the size of the beacon root's ring buffer.\\n /// @param timestamp The timestamp of the block for which to get the parent root.\\n /// @return parentRoot The parent block root for the given timestamp.\\n function parentBlockRoot(uint64 timestamp)\\n internal\\n view\\n returns (bytes32 parentRoot)\\n {\\n // Call the Beacon Roots contract to get the parent block root.\\n // This does not have a function signature, so we use a staticcall.\\n (bool success, bytes memory result) = BEACON_ROOTS_ADDRESS.staticcall(\\n abi.encode(timestamp)\\n );\\n\\n require(success && result.length > 0, \\\"Invalid beacon timestamp\\\");\\n parentRoot = abi.decode(result, (bytes32));\\n }\\n}\\n\",\"keccak256\":\"0x4005989f852a68bbcdc1cdc3472ebd3911395e75b4e6366ffcaae4d1c128691e\",\"license\":\"BUSL-1.1\"},\"contracts/beacon/PartialWithdrawal.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Library to request full or partial withdrawals from validators on the beacon chain.\\n * @author Origin Protocol Inc\\n */\\nlibrary PartialWithdrawal {\\n /// @notice The address where the withdrawal request is sent to\\n /// See https://eips.ethereum.org/EIPS/eip-7002\\n address internal constant WITHDRAWAL_REQUEST_ADDRESS =\\n 0x00000961Ef480Eb55e80D19ad83579A64c007002;\\n\\n /// @notice Requests a partial withdrawal for a given validator public key and amount.\\n /// @param validatorPubKey The public key of the validator to withdraw from\\n /// @param amount The amount of ETH to withdraw\\n function request(bytes calldata validatorPubKey, uint64 amount)\\n internal\\n returns (uint256 fee_)\\n {\\n require(validatorPubKey.length == 48, \\\"Invalid validator byte length\\\");\\n fee_ = fee();\\n\\n // Call the Withdrawal Request contract with the validator public key\\n // and amount to be withdrawn packed together\\n\\n // This is a general purpose EL to CL request:\\n // https://eips.ethereum.org/EIPS/eip-7685\\n (bool success, ) = WITHDRAWAL_REQUEST_ADDRESS.call{ value: fee_ }(\\n abi.encodePacked(validatorPubKey, amount)\\n );\\n\\n require(success, \\\"Withdrawal request failed\\\");\\n }\\n\\n /// @notice Gets fee for withdrawal requests contract on Beacon chain\\n function fee() internal view returns (uint256) {\\n // Get fee from the withdrawal request contract\\n (bool success, bytes memory result) = WITHDRAWAL_REQUEST_ADDRESS\\n .staticcall(\\\"\\\");\\n\\n require(success && result.length > 0, \\\"Failed to get fee\\\");\\n return abi.decode(result, (uint256));\\n }\\n}\\n\",\"keccak256\":\"0x80d29153ff7eb5c6841692aca98eb0cc14ac43ad2d8e402890b6c6b6e4a9719d\",\"license\":\"BUSL-1.1\"},\"contracts/governance/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Base for contracts that are managed by the Origin Protocol's Governor.\\n * @dev Copy of the openzeppelin Ownable.sol contract with nomenclature change\\n * from owner to governor and renounce methods removed. Does not use\\n * Context.sol like Ownable.sol does for simplification.\\n * @author Origin Protocol Inc\\n */\\nabstract contract Governable {\\n // Storage position of the owner and pendingOwner of the contract\\n // keccak256(\\\"OUSD.governor\\\");\\n bytes32 private constant governorPosition =\\n 0x7bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4a;\\n\\n // keccak256(\\\"OUSD.pending.governor\\\");\\n bytes32 private constant pendingGovernorPosition =\\n 0x44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db;\\n\\n // keccak256(\\\"OUSD.reentry.status\\\");\\n bytes32 private constant reentryStatusPosition =\\n 0x53bf423e48ed90e97d02ab0ebab13b2a235a6bfbe9c321847d5c175333ac4535;\\n\\n // See OpenZeppelin ReentrancyGuard implementation\\n uint256 constant _NOT_ENTERED = 1;\\n uint256 constant _ENTERED = 2;\\n\\n event PendingGovernorshipTransfer(\\n address indexed previousGovernor,\\n address indexed newGovernor\\n );\\n\\n event GovernorshipTransferred(\\n address indexed previousGovernor,\\n address indexed newGovernor\\n );\\n\\n /**\\n * @notice Returns the address of the current Governor.\\n */\\n function governor() public view returns (address) {\\n return _governor();\\n }\\n\\n /**\\n * @dev Returns the address of the current Governor.\\n */\\n function _governor() internal view returns (address governorOut) {\\n bytes32 position = governorPosition;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n governorOut := sload(position)\\n }\\n }\\n\\n /**\\n * @dev Returns the address of the pending Governor.\\n */\\n function _pendingGovernor()\\n internal\\n view\\n returns (address pendingGovernor)\\n {\\n bytes32 position = pendingGovernorPosition;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n pendingGovernor := sload(position)\\n }\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the Governor.\\n */\\n modifier onlyGovernor() {\\n require(isGovernor(), \\\"Caller is not the Governor\\\");\\n _;\\n }\\n\\n /**\\n * @notice Returns true if the caller is the current Governor.\\n */\\n function isGovernor() public view returns (bool) {\\n return msg.sender == _governor();\\n }\\n\\n function _setGovernor(address newGovernor) internal {\\n emit GovernorshipTransferred(_governor(), newGovernor);\\n\\n bytes32 position = governorPosition;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(position, newGovernor)\\n }\\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 make it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n bytes32 position = reentryStatusPosition;\\n uint256 _reentry_status;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n _reentry_status := sload(position)\\n }\\n\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_reentry_status != _ENTERED, \\\"Reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(position, _ENTERED)\\n }\\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 // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(position, _NOT_ENTERED)\\n }\\n }\\n\\n function _setPendingGovernor(address newGovernor) internal {\\n bytes32 position = pendingGovernorPosition;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(position, newGovernor)\\n }\\n }\\n\\n /**\\n * @notice Transfers Governance of the contract to a new account (`newGovernor`).\\n * Can only be called by the current Governor. Must be claimed for this to complete\\n * @param _newGovernor Address of the new Governor\\n */\\n function transferGovernance(address _newGovernor) external onlyGovernor {\\n _setPendingGovernor(_newGovernor);\\n emit PendingGovernorshipTransfer(_governor(), _newGovernor);\\n }\\n\\n /**\\n * @notice Claim Governance of the contract to a new account (`newGovernor`).\\n * Can only be called by the new Governor.\\n */\\n function claimGovernance() external {\\n require(\\n msg.sender == _pendingGovernor(),\\n \\\"Only the pending Governor can complete the claim\\\"\\n );\\n _changeGovernor(msg.sender);\\n }\\n\\n /**\\n * @dev Change Governance of the contract to a new account (`newGovernor`).\\n * @param _newGovernor Address of the new Governor\\n */\\n function _changeGovernor(address _newGovernor) internal {\\n require(_newGovernor != address(0), \\\"New Governor is address(0)\\\");\\n _setGovernor(_newGovernor);\\n }\\n}\\n\",\"keccak256\":\"0xf32f873c8bfbacf2e5f01d0cf37bc7f54fbd5aa656e95c8a599114229946f107\",\"license\":\"BUSL-1.1\"},\"contracts/interfaces/IBasicToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IBasicToken {\\n function symbol() external view returns (string memory);\\n\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0xa562062698aa12572123b36dfd2072f1a39e44fed2031cc19c2c9fd522f96ec2\",\"license\":\"MIT\"},\"contracts/interfaces/IBeaconProofs.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\ninterface IBeaconProofs {\\n function verifyValidator(\\n bytes32 beaconBlockRoot,\\n bytes32 pubKeyHash,\\n bytes calldata validatorPubKeyProof,\\n uint40 validatorIndex,\\n bytes32 withdrawalCredentials\\n ) external view;\\n\\n function verifyValidatorWithdrawable(\\n bytes32 beaconBlockRoot,\\n uint40 validatorIndex,\\n uint64 withdrawableEpoch,\\n bytes calldata withdrawableEpochProof\\n ) external view;\\n\\n function verifyBalancesContainer(\\n bytes32 beaconBlockRoot,\\n bytes32 balancesContainerLeaf,\\n bytes calldata balancesContainerProof\\n ) external view;\\n\\n function verifyValidatorBalance(\\n bytes32 balancesContainerRoot,\\n bytes32 validatorBalanceLeaf,\\n bytes calldata balanceProof,\\n uint40 validatorIndex\\n ) external view returns (uint256 validatorBalance);\\n\\n function verifyPendingDepositsContainer(\\n bytes32 beaconBlockRoot,\\n bytes32 pendingDepositsContainerRoot,\\n bytes calldata proof\\n ) external view;\\n\\n function verifyPendingDeposit(\\n bytes32 pendingDepositsContainerRoot,\\n bytes32 pendingDepositRoot,\\n bytes calldata proof,\\n uint32 pendingDepositIndex\\n ) external view;\\n\\n function verifyFirstPendingDeposit(\\n bytes32 beaconBlockRoot,\\n uint64 slot,\\n bytes calldata firstPendingDepositSlotProof\\n ) external view returns (bool isEmptyDepositQueue);\\n\\n function merkleizePendingDeposit(\\n bytes32 pubKeyHash,\\n bytes calldata withdrawalCredentials,\\n uint64 amountGwei,\\n bytes calldata signature,\\n uint64 slot\\n ) external pure returns (bytes32 root);\\n\\n function merkleizeSignature(bytes calldata signature)\\n external\\n pure\\n returns (bytes32 root);\\n}\\n\",\"keccak256\":\"0xbc611f259b296451c358638a6e164227179bcee079656f5078800cc2f06c22fd\",\"license\":\"BUSL-1.1\"},\"contracts/interfaces/IDepositContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IDepositContract {\\n /// @notice A processed deposit event.\\n event DepositEvent(\\n bytes pubkey,\\n bytes withdrawal_credentials,\\n bytes amount,\\n bytes signature,\\n bytes index\\n );\\n\\n /// @notice Submit a Phase 0 DepositData object.\\n /// @param pubkey A BLS12-381 public key.\\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\\n /// @param signature A BLS12-381 signature.\\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\\n /// Used as a protection against malformed input.\\n function deposit(\\n bytes calldata pubkey,\\n bytes calldata withdrawal_credentials,\\n bytes calldata signature,\\n bytes32 deposit_data_root\\n ) external payable;\\n\\n /// @notice Query the current deposit root hash.\\n /// @return The deposit root hash.\\n function get_deposit_root() external view returns (bytes32);\\n\\n /// @notice Query the current deposit count.\\n /// @return The deposit count encoded as a little endian 64-bit number.\\n function get_deposit_count() external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x598f90bdbc854250bbd5991426bfb43367207e64e33109c41aa8b54323fd8d8e\",\"license\":\"MIT\"},\"contracts/interfaces/ISSVNetwork.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nstruct Cluster {\\n uint32 validatorCount;\\n uint64 networkFeeIndex;\\n uint64 index;\\n bool active;\\n uint256 balance;\\n}\\n\\ninterface ISSVNetwork {\\n /**********/\\n /* Errors */\\n /**********/\\n\\n error CallerNotOwner(); // 0x5cd83192\\n error CallerNotWhitelisted(); // 0x8c6e5d71\\n error FeeTooLow(); // 0x732f9413\\n error FeeExceedsIncreaseLimit(); // 0x958065d9\\n error NoFeeDeclared(); // 0x1d226c30\\n error ApprovalNotWithinTimeframe(); // 0x97e4b518\\n error OperatorDoesNotExist(); // 0x961e3e8c\\n error InsufficientBalance(); // 0xf4d678b8\\n error ValidatorDoesNotExist(); // 0xe51315d2\\n error ClusterNotLiquidatable(); // 0x60300a8d\\n error InvalidPublicKeyLength(); // 0x637297a4\\n error InvalidOperatorIdsLength(); // 0x38186224\\n error ClusterAlreadyEnabled(); // 0x3babafd2\\n error ClusterIsLiquidated(); // 0x95a0cf33\\n error ClusterDoesNotExists(); // 0x185e2b16\\n error IncorrectClusterState(); // 0x12e04c87\\n error UnsortedOperatorsList(); // 0xdd020e25\\n error NewBlockPeriodIsBelowMinimum(); // 0x6e6c9cac\\n error ExceedValidatorLimit(); // 0x6df5ab76\\n error TokenTransferFailed(); // 0x045c4b02\\n error SameFeeChangeNotAllowed(); // 0xc81272f8\\n error FeeIncreaseNotAllowed(); // 0x410a2b6c\\n error NotAuthorized(); // 0xea8e4eb5\\n error OperatorsListNotUnique(); // 0xa5a1ff5d\\n error OperatorAlreadyExists(); // 0x289c9494\\n error TargetModuleDoesNotExist(); // 0x8f9195fb\\n error MaxValueExceeded(); // 0x91aa3017\\n error FeeTooHigh(); // 0xcd4e6167\\n error PublicKeysSharesLengthMismatch(); // 0x9ad467b8\\n error IncorrectValidatorStateWithData(bytes publicKey); // 0x89307938\\n error ValidatorAlreadyExistsWithData(bytes publicKey); // 0x388e7999\\n error EmptyPublicKeysList(); // df83e679\\n\\n // legacy errors\\n error ValidatorAlreadyExists(); // 0x8d09a73e\\n error IncorrectValidatorState(); // 0x2feda3c1\\n\\n event AdminChanged(address previousAdmin, address newAdmin);\\n event BeaconUpgraded(address indexed beacon);\\n event ClusterDeposited(\\n address indexed owner,\\n uint64[] operatorIds,\\n uint256 value,\\n Cluster cluster\\n );\\n event ClusterLiquidated(\\n address indexed owner,\\n uint64[] operatorIds,\\n Cluster cluster\\n );\\n event ClusterReactivated(\\n address indexed owner,\\n uint64[] operatorIds,\\n Cluster cluster\\n );\\n event ClusterWithdrawn(\\n address indexed owner,\\n uint64[] operatorIds,\\n uint256 value,\\n Cluster cluster\\n );\\n event DeclareOperatorFeePeriodUpdated(uint64 value);\\n event ExecuteOperatorFeePeriodUpdated(uint64 value);\\n event FeeRecipientAddressUpdated(\\n address indexed owner,\\n address recipientAddress\\n );\\n event Initialized(uint8 version);\\n event LiquidationThresholdPeriodUpdated(uint64 value);\\n event MinimumLiquidationCollateralUpdated(uint256 value);\\n event NetworkEarningsWithdrawn(uint256 value, address recipient);\\n event NetworkFeeUpdated(uint256 oldFee, uint256 newFee);\\n event OperatorAdded(\\n uint64 indexed operatorId,\\n address indexed owner,\\n bytes publicKey,\\n uint256 fee\\n );\\n event OperatorFeeDeclarationCancelled(\\n address indexed owner,\\n uint64 indexed operatorId\\n );\\n event OperatorFeeDeclared(\\n address indexed owner,\\n uint64 indexed operatorId,\\n uint256 blockNumber,\\n uint256 fee\\n );\\n event OperatorFeeExecuted(\\n address indexed owner,\\n uint64 indexed operatorId,\\n uint256 blockNumber,\\n uint256 fee\\n );\\n event OperatorFeeIncreaseLimitUpdated(uint64 value);\\n event OperatorMaximumFeeUpdated(uint64 maxFee);\\n event OperatorRemoved(uint64 indexed operatorId);\\n event OperatorWhitelistUpdated(\\n uint64 indexed operatorId,\\n address whitelisted\\n );\\n event OperatorWithdrawn(\\n address indexed owner,\\n uint64 indexed operatorId,\\n uint256 value\\n );\\n event OwnershipTransferStarted(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n event Upgraded(address indexed implementation);\\n event ValidatorAdded(\\n address indexed owner,\\n uint64[] operatorIds,\\n bytes publicKey,\\n bytes shares,\\n Cluster cluster\\n );\\n event ValidatorExited(\\n address indexed owner,\\n uint64[] operatorIds,\\n bytes publicKey\\n );\\n event ValidatorRemoved(\\n address indexed owner,\\n uint64[] operatorIds,\\n bytes publicKey,\\n Cluster cluster\\n );\\n\\n fallback() external;\\n\\n function acceptOwnership() external;\\n\\n function cancelDeclaredOperatorFee(uint64 operatorId) external;\\n\\n function declareOperatorFee(uint64 operatorId, uint256 fee) external;\\n\\n function deposit(\\n address clusterOwner,\\n uint64[] memory operatorIds,\\n uint256 amount,\\n Cluster memory cluster\\n ) external;\\n\\n function executeOperatorFee(uint64 operatorId) external;\\n\\n function exitValidator(bytes memory publicKey, uint64[] memory operatorIds)\\n external;\\n\\n function bulkExitValidator(\\n bytes[] calldata publicKeys,\\n uint64[] calldata operatorIds\\n ) external;\\n\\n function getVersion() external pure returns (string memory version);\\n\\n function initialize(\\n address token_,\\n address ssvOperators_,\\n address ssvClusters_,\\n address ssvDAO_,\\n address ssvViews_,\\n uint64 minimumBlocksBeforeLiquidation_,\\n uint256 minimumLiquidationCollateral_,\\n uint32 validatorsPerOperatorLimit_,\\n uint64 declareOperatorFeePeriod_,\\n uint64 executeOperatorFeePeriod_,\\n uint64 operatorMaxFeeIncrease_\\n ) external;\\n\\n function liquidate(\\n address clusterOwner,\\n uint64[] memory operatorIds,\\n Cluster memory cluster\\n ) external;\\n\\n function owner() external view returns (address);\\n\\n function pendingOwner() external view returns (address);\\n\\n function proxiableUUID() external view returns (bytes32);\\n\\n function reactivate(\\n uint64[] memory operatorIds,\\n uint256 amount,\\n Cluster memory cluster\\n ) external;\\n\\n function reduceOperatorFee(uint64 operatorId, uint256 fee) external;\\n\\n function registerOperator(bytes memory publicKey, uint256 fee)\\n external\\n returns (uint64 id);\\n\\n function registerValidator(\\n bytes memory publicKey,\\n uint64[] memory operatorIds,\\n bytes memory sharesData,\\n uint256 amount,\\n Cluster memory cluster\\n ) external;\\n\\n function bulkRegisterValidator(\\n bytes[] calldata publicKeys,\\n uint64[] calldata operatorIds,\\n bytes[] calldata sharesData,\\n uint256 amount,\\n Cluster memory cluster\\n ) external;\\n\\n function removeOperator(uint64 operatorId) external;\\n\\n function removeValidator(\\n bytes memory publicKey,\\n uint64[] memory operatorIds,\\n Cluster memory cluster\\n ) external;\\n\\n function bulkRemoveValidator(\\n bytes[] calldata publicKeys,\\n uint64[] calldata operatorIds,\\n Cluster memory cluster\\n ) external;\\n\\n function renounceOwnership() external;\\n\\n function setFeeRecipientAddress(address recipientAddress) external;\\n\\n function setOperatorWhitelist(uint64 operatorId, address whitelisted)\\n external;\\n\\n function transferOwnership(address newOwner) external;\\n\\n function updateDeclareOperatorFeePeriod(uint64 timeInSeconds) external;\\n\\n function updateExecuteOperatorFeePeriod(uint64 timeInSeconds) external;\\n\\n function updateLiquidationThresholdPeriod(uint64 blocks) external;\\n\\n function updateMaximumOperatorFee(uint64 maxFee) external;\\n\\n function updateMinimumLiquidationCollateral(uint256 amount) external;\\n\\n function updateModule(uint8 moduleId, address moduleAddress) external;\\n\\n function updateNetworkFee(uint256 fee) external;\\n\\n function updateOperatorFeeIncreaseLimit(uint64 percentage) external;\\n\\n function upgradeTo(address newImplementation) external;\\n\\n function upgradeToAndCall(address newImplementation, bytes memory data)\\n external\\n payable;\\n\\n function withdraw(\\n uint64[] memory operatorIds,\\n uint256 amount,\\n Cluster memory cluster\\n ) external;\\n\\n function withdrawAllOperatorEarnings(uint64 operatorId) external;\\n\\n function withdrawNetworkEarnings(uint256 amount) external;\\n\\n function withdrawOperatorEarnings(uint64 operatorId, uint256 amount)\\n external;\\n}\\n\",\"keccak256\":\"0xbd86cb74702aebc5b53c8fc738a2e3ad1b410583460617be84b22ce922af12a7\",\"license\":\"MIT\"},\"contracts/interfaces/IStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Platform interface to integrate with lending platform like Compound, AAVE etc.\\n */\\ninterface IStrategy {\\n /**\\n * @dev Deposit the given asset to platform\\n * @param _asset asset address\\n * @param _amount Amount to deposit\\n */\\n function deposit(address _asset, uint256 _amount) external;\\n\\n /**\\n * @dev Deposit the entire balance of all supported assets in the Strategy\\n * to the platform\\n */\\n function depositAll() external;\\n\\n /**\\n * @dev Withdraw given asset from Lending platform\\n */\\n function withdraw(\\n address _recipient,\\n address _asset,\\n uint256 _amount\\n ) external;\\n\\n /**\\n * @dev Liquidate all assets in strategy and return them to Vault.\\n */\\n function withdrawAll() external;\\n\\n /**\\n * @dev Returns the current balance of the given asset.\\n */\\n function checkBalance(address _asset)\\n external\\n view\\n returns (uint256 balance);\\n\\n /**\\n * @dev Returns bool indicating whether strategy supports asset.\\n */\\n function supportsAsset(address _asset) external view returns (bool);\\n\\n /**\\n * @dev Collect reward tokens from the Strategy.\\n */\\n function collectRewardTokens() external;\\n\\n /**\\n * @dev The address array of the reward tokens for the Strategy.\\n */\\n function getRewardTokenAddresses() external view returns (address[] memory);\\n\\n function harvesterAddress() external view returns (address);\\n\\n function transferToken(address token, uint256 amount) external;\\n\\n function setRewardTokenAddresses(address[] calldata _rewardTokenAddresses)\\n external;\\n}\\n\",\"keccak256\":\"0x79ca47defb3b5a56bba13f14c440838152fd1c1aa640476154516a16da4da8ba\",\"license\":\"BUSL-1.1\"},\"contracts/interfaces/IVault.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\nimport { VaultStorage } from \\\"../vault/VaultStorage.sol\\\";\\n\\ninterface IVault {\\n // slither-disable-start constable-states\\n\\n event AssetSupported(address _asset);\\n event AssetDefaultStrategyUpdated(address _asset, address _strategy);\\n event AssetAllocated(address _asset, address _strategy, uint256 _amount);\\n event StrategyApproved(address _addr);\\n event StrategyRemoved(address _addr);\\n event Mint(address _addr, uint256 _value);\\n event Redeem(address _addr, uint256 _value);\\n event CapitalPaused();\\n event CapitalUnpaused();\\n event RebasePaused();\\n event RebaseUnpaused();\\n event VaultBufferUpdated(uint256 _vaultBuffer);\\n event RedeemFeeUpdated(uint256 _redeemFeeBps);\\n event PriceProviderUpdated(address _priceProvider);\\n event AllocateThresholdUpdated(uint256 _threshold);\\n event RebaseThresholdUpdated(uint256 _threshold);\\n event StrategistUpdated(address _address);\\n event MaxSupplyDiffChanged(uint256 maxSupplyDiff);\\n event YieldDistribution(address _to, uint256 _yield, uint256 _fee);\\n event TrusteeFeeBpsChanged(uint256 _basis);\\n event TrusteeAddressChanged(address _address);\\n event SwapperChanged(address _address);\\n event SwapAllowedUndervalueChanged(uint256 _basis);\\n event SwapSlippageChanged(address _asset, uint256 _basis);\\n event Swapped(\\n address indexed _fromAsset,\\n address indexed _toAsset,\\n uint256 _fromAssetAmount,\\n uint256 _toAssetAmount\\n );\\n event StrategyAddedToMintWhitelist(address indexed strategy);\\n event StrategyRemovedFromMintWhitelist(address indexed strategy);\\n event DripperChanged(address indexed _dripper);\\n event WithdrawalRequested(\\n address indexed _withdrawer,\\n uint256 indexed _requestId,\\n uint256 _amount,\\n uint256 _queued\\n );\\n event WithdrawalClaimed(\\n address indexed _withdrawer,\\n uint256 indexed _requestId,\\n uint256 _amount\\n );\\n event WithdrawalClaimable(uint256 _claimable, uint256 _newClaimable);\\n\\n // Governable.sol\\n function transferGovernance(address _newGovernor) external;\\n\\n function claimGovernance() external;\\n\\n function governor() external view returns (address);\\n\\n function ADMIN_IMPLEMENTATION() external view returns (address);\\n\\n // VaultAdmin.sol\\n function setPriceProvider(address _priceProvider) external;\\n\\n function priceProvider() external view returns (address);\\n\\n function setRedeemFeeBps(uint256 _redeemFeeBps) external;\\n\\n function redeemFeeBps() external view returns (uint256);\\n\\n function setVaultBuffer(uint256 _vaultBuffer) external;\\n\\n function vaultBuffer() external view returns (uint256);\\n\\n function setAutoAllocateThreshold(uint256 _threshold) external;\\n\\n function autoAllocateThreshold() external view returns (uint256);\\n\\n function setRebaseThreshold(uint256 _threshold) external;\\n\\n function rebaseThreshold() external view returns (uint256);\\n\\n function setStrategistAddr(address _address) external;\\n\\n function strategistAddr() external view returns (address);\\n\\n function setMaxSupplyDiff(uint256 _maxSupplyDiff) external;\\n\\n function maxSupplyDiff() external view returns (uint256);\\n\\n function setTrusteeAddress(address _address) external;\\n\\n function trusteeAddress() external view returns (address);\\n\\n function setTrusteeFeeBps(uint256 _basis) external;\\n\\n function trusteeFeeBps() external view returns (uint256);\\n\\n function ousdMetaStrategy() external view returns (address);\\n\\n function setSwapper(address _swapperAddr) external;\\n\\n function setSwapAllowedUndervalue(uint16 _percentageBps) external;\\n\\n function setOracleSlippage(address _asset, uint16 _allowedOracleSlippageBps)\\n external;\\n\\n function supportAsset(address _asset, uint8 _unitConversion) external;\\n\\n function approveStrategy(address _addr) external;\\n\\n function removeStrategy(address _addr) external;\\n\\n function setAssetDefaultStrategy(address _asset, address _strategy)\\n external;\\n\\n function assetDefaultStrategies(address _asset)\\n external\\n view\\n returns (address);\\n\\n function pauseRebase() external;\\n\\n function unpauseRebase() external;\\n\\n function rebasePaused() external view returns (bool);\\n\\n function pauseCapital() external;\\n\\n function unpauseCapital() external;\\n\\n function capitalPaused() external view returns (bool);\\n\\n function transferToken(address _asset, uint256 _amount) external;\\n\\n function priceUnitMint(address asset) external view returns (uint256);\\n\\n function priceUnitRedeem(address asset) external view returns (uint256);\\n\\n function withdrawAllFromStrategy(address _strategyAddr) external;\\n\\n function withdrawAllFromStrategies() external;\\n\\n function withdrawFromStrategy(\\n address _strategyFromAddress,\\n address[] calldata _assets,\\n uint256[] calldata _amounts\\n ) external;\\n\\n function depositToStrategy(\\n address _strategyToAddress,\\n address[] calldata _assets,\\n uint256[] calldata _amounts\\n ) external;\\n\\n // VaultCore.sol\\n function mint(\\n address _asset,\\n uint256 _amount,\\n uint256 _minimumOusdAmount\\n ) external;\\n\\n function mintForStrategy(uint256 _amount) external;\\n\\n function redeem(uint256 _amount, uint256 _minimumUnitAmount) external;\\n\\n function burnForStrategy(uint256 _amount) external;\\n\\n function allocate() external;\\n\\n function rebase() external;\\n\\n function swapCollateral(\\n address fromAsset,\\n address toAsset,\\n uint256 fromAssetAmount,\\n uint256 minToAssetAmount,\\n bytes calldata data\\n ) external returns (uint256 toAssetAmount);\\n\\n function totalValue() external view returns (uint256 value);\\n\\n function checkBalance(address _asset) external view returns (uint256);\\n\\n function calculateRedeemOutputs(uint256 _amount)\\n external\\n view\\n returns (uint256[] memory);\\n\\n function getAssetCount() external view returns (uint256);\\n\\n function getAssetConfig(address _asset)\\n external\\n view\\n returns (VaultStorage.Asset memory config);\\n\\n function getAllAssets() external view returns (address[] memory);\\n\\n function getStrategyCount() external view returns (uint256);\\n\\n function swapper() external view returns (address);\\n\\n function allowedSwapUndervalue() external view returns (uint256);\\n\\n function getAllStrategies() external view returns (address[] memory);\\n\\n function isSupportedAsset(address _asset) external view returns (bool);\\n\\n function netOusdMintForStrategyThreshold() external view returns (uint256);\\n\\n function setOusdMetaStrategy(address _ousdMetaStrategy) external;\\n\\n function setNetOusdMintForStrategyThreshold(uint256 _threshold) external;\\n\\n function netOusdMintedForStrategy() external view returns (int256);\\n\\n function setDripper(address _dripper) external;\\n\\n function dripper() external view returns (address);\\n\\n function weth() external view returns (address);\\n\\n function cacheWETHAssetIndex() external;\\n\\n function wethAssetIndex() external view returns (uint256);\\n\\n function initialize(address, address) external;\\n\\n function setAdminImpl(address) external;\\n\\n function removeAsset(address _asset) external;\\n\\n // These are OETH specific functions\\n function addWithdrawalQueueLiquidity() external;\\n\\n function requestWithdrawal(uint256 _amount)\\n external\\n returns (uint256 requestId, uint256 queued);\\n\\n function claimWithdrawal(uint256 requestId)\\n external\\n returns (uint256 amount);\\n\\n function claimWithdrawals(uint256[] memory requestIds)\\n external\\n returns (uint256[] memory amounts, uint256 totalAmount);\\n\\n function withdrawalQueueMetadata()\\n external\\n view\\n returns (VaultStorage.WithdrawalQueueMetadata memory);\\n\\n function withdrawalRequests(uint256 requestId)\\n external\\n view\\n returns (VaultStorage.WithdrawalRequest memory);\\n\\n // OETHb specific functions\\n function addStrategyToMintWhitelist(address strategyAddr) external;\\n\\n function removeStrategyFromMintWhitelist(address strategyAddr) external;\\n\\n function isMintWhitelistedStrategy(address strategyAddr)\\n external\\n view\\n returns (bool);\\n\\n function withdrawalClaimDelay() external view returns (uint256);\\n\\n function setWithdrawalClaimDelay(uint256 newDelay) external;\\n\\n function lastRebase() external view returns (uint64);\\n\\n function dripDuration() external view returns (uint64);\\n\\n function setDripDuration(uint256 _dripDuration) external;\\n\\n function rebasePerSecondMax() external view returns (uint64);\\n\\n function setRebaseRateMax(uint256 yearlyApr) external;\\n\\n function rebasePerSecondTarget() external view returns (uint64);\\n\\n function previewYield() external view returns (uint256 yield);\\n\\n // slither-disable-end constable-states\\n}\\n\",\"keccak256\":\"0x8d0a60f594d97578b0513b4da3d8fcafaa601950c6c4c016bf60b1344733269c\",\"license\":\"BUSL-1.1\"},\"contracts/interfaces/IWETH9.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IWETH9 {\\n event Approval(address indexed src, address indexed guy, uint256 wad);\\n event Deposit(address indexed dst, uint256 wad);\\n event Transfer(address indexed src, address indexed dst, uint256 wad);\\n event Withdrawal(address indexed src, uint256 wad);\\n\\n function allowance(address, address) external view returns (uint256);\\n\\n function approve(address guy, uint256 wad) external returns (bool);\\n\\n function balanceOf(address) external view returns (uint256);\\n\\n function decimals() external view returns (uint8);\\n\\n function deposit() external payable;\\n\\n function name() external view returns (string memory);\\n\\n function symbol() external view returns (string memory);\\n\\n function totalSupply() external view returns (uint256);\\n\\n function transfer(address dst, uint256 wad) external returns (bool);\\n\\n function transferFrom(\\n address src,\\n address dst,\\n uint256 wad\\n ) external returns (bool);\\n\\n function withdraw(uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x05b7dce6c24d3cd4e48b5c6346d86e5e40ecc3291bcdf3f3ef091c98fc826519\",\"license\":\"MIT\"},\"contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport { InitializableAbstractStrategy } from \\\"../../utils/InitializableAbstractStrategy.sol\\\";\\nimport { IWETH9 } from \\\"../../interfaces/IWETH9.sol\\\";\\nimport { CompoundingValidatorManager } from \\\"./CompoundingValidatorManager.sol\\\";\\n\\n/// @title Compounding Staking SSV Strategy\\n/// @notice Strategy to deploy funds into DVT validators powered by the SSV Network\\n/// @author Origin Protocol Inc\\ncontract CompoundingStakingSSVStrategy is\\n CompoundingValidatorManager,\\n InitializableAbstractStrategy\\n{\\n /// @notice SSV ERC20 token that serves as a payment for operating SSV validators\\n address public immutable SSV_TOKEN;\\n\\n // For future use\\n uint256[50] private __gap;\\n\\n /// @param _baseConfig Base strategy config with\\n /// `platformAddress` not used so empty address\\n /// `vaultAddress` the address of the OETH Vault contract\\n /// @param _wethAddress Address of the WETH Token contract\\n /// @param _ssvToken Address of the SSV Token contract\\n /// @param _ssvNetwork Address of the SSV Network contract\\n /// @param _beaconChainDepositContract Address of the beacon chain deposit contract\\n /// @param _beaconProofs Address of the Beacon Proofs contract that verifies beacon chain data\\n /// @param _beaconGenesisTimestamp The timestamp of the Beacon chain's genesis.\\n constructor(\\n BaseStrategyConfig memory _baseConfig,\\n address _wethAddress,\\n address _ssvToken,\\n address _ssvNetwork,\\n address _beaconChainDepositContract,\\n address _beaconProofs,\\n uint64 _beaconGenesisTimestamp\\n )\\n InitializableAbstractStrategy(_baseConfig)\\n CompoundingValidatorManager(\\n _wethAddress,\\n _baseConfig.vaultAddress,\\n _beaconChainDepositContract,\\n _ssvNetwork,\\n _beaconProofs,\\n _beaconGenesisTimestamp\\n )\\n {\\n SSV_TOKEN = _ssvToken;\\n\\n // Make sure nobody owns the implementation contract\\n _setGovernor(address(0));\\n }\\n\\n /// @notice Set up initial internal state including\\n /// 1. approving the SSVNetwork to transfer SSV tokens from this strategy contract\\n /// @param _rewardTokenAddresses Not used so empty array\\n /// @param _assets Not used so empty array\\n /// @param _pTokens Not used so empty array\\n function initialize(\\n address[] memory _rewardTokenAddresses,\\n address[] memory _assets,\\n address[] memory _pTokens\\n ) external onlyGovernor initializer {\\n InitializableAbstractStrategy._initialize(\\n _rewardTokenAddresses,\\n _assets,\\n _pTokens\\n );\\n\\n safeApproveAllTokens();\\n }\\n\\n /// @notice Unlike other strategies, this does not deposit assets into the underlying platform.\\n /// It just checks the asset is WETH and emits the Deposit event.\\n /// To deposit WETH into validators, `registerSsvValidator` and `stakeEth` must be used.\\n /// @param _asset Address of the WETH token.\\n /// @param _amount Amount of WETH that was transferred to the strategy by the vault.\\n function deposit(address _asset, uint256 _amount)\\n external\\n override\\n onlyVault\\n nonReentrant\\n {\\n require(_asset == WETH, \\\"Unsupported asset\\\");\\n require(_amount > 0, \\\"Must deposit something\\\");\\n\\n // Account for the new WETH\\n depositedWethAccountedFor += _amount;\\n\\n emit Deposit(_asset, address(0), _amount);\\n }\\n\\n /// @notice Unlike other strategies, this does not deposit assets into the underlying platform.\\n /// It just emits the Deposit event.\\n /// To deposit WETH into validators `registerSsvValidator` and `stakeEth` must be used.\\n function depositAll() external override onlyVault nonReentrant {\\n uint256 wethBalance = IERC20(WETH).balanceOf(address(this));\\n uint256 newWeth = wethBalance - depositedWethAccountedFor;\\n\\n if (newWeth > 0) {\\n // Account for the new WETH\\n depositedWethAccountedFor = wethBalance;\\n\\n emit Deposit(WETH, address(0), newWeth);\\n }\\n }\\n\\n /// @notice Withdraw ETH and WETH from this strategy contract.\\n /// @param _recipient Address to receive withdrawn assets.\\n /// @param _asset Address of the WETH token.\\n /// @param _amount Amount of WETH to withdraw.\\n function withdraw(\\n address _recipient,\\n address _asset,\\n uint256 _amount\\n ) external override nonReentrant {\\n require(_asset == WETH, \\\"Unsupported asset\\\");\\n require(\\n msg.sender == vaultAddress || msg.sender == validatorRegistrator,\\n \\\"Caller not Vault or Registrator\\\"\\n );\\n\\n _withdraw(_recipient, _amount, address(this).balance);\\n }\\n\\n function _withdraw(\\n address _recipient,\\n uint256 _withdrawAmount,\\n uint256 _ethBalance\\n ) internal {\\n require(_withdrawAmount > 0, \\\"Must withdraw something\\\");\\n require(_recipient == vaultAddress, \\\"Recipient not Vault\\\");\\n\\n // Convert any ETH from validator partial withdrawals, exits\\n // or execution rewards to WETH and do the necessary accounting.\\n if (_ethBalance > 0) _convertEthToWeth(_ethBalance);\\n\\n // Transfer WETH to the recipient and do the necessary accounting.\\n _transferWeth(_withdrawAmount, _recipient);\\n\\n emit Withdrawal(WETH, address(0), _withdrawAmount);\\n }\\n\\n /// @notice Transfer all WETH deposits, ETH from validator withdrawals and ETH from\\n /// execution rewards in this strategy to the vault.\\n /// This does not withdraw from the validators. That has to be done separately with the\\n /// `validatorWithdrawal` operation.\\n function withdrawAll() external override onlyVaultOrGovernor nonReentrant {\\n uint256 ethBalance = address(this).balance;\\n uint256 withdrawAmount = IERC20(WETH).balanceOf(address(this)) +\\n ethBalance;\\n\\n if (withdrawAmount > 0) {\\n _withdraw(vaultAddress, withdrawAmount, ethBalance);\\n }\\n }\\n\\n /// @notice Accounts for all the assets managed by this strategy which includes:\\n /// 1. The current WETH in this strategy contract\\n /// 2. The last verified ETH balance, total deposits and total validator balances\\n /// @param _asset Address of WETH asset.\\n /// @return balance Total value in ETH\\n function checkBalance(address _asset)\\n external\\n view\\n override\\n returns (uint256 balance)\\n {\\n require(_asset == WETH, \\\"Unsupported asset\\\");\\n\\n // Load the last verified balance from the storage\\n // and add to the latest WETH balance of this strategy.\\n balance =\\n lastVerifiedEthBalance +\\n IWETH9(WETH).balanceOf(address(this));\\n }\\n\\n /// @notice Returns bool indicating whether asset is supported by the strategy.\\n /// @param _asset The address of the WETH token.\\n function supportsAsset(address _asset) public view override returns (bool) {\\n return _asset == WETH;\\n }\\n\\n /// @notice Approves the SSV Network contract to transfer SSV tokens for validator registration.\\n function safeApproveAllTokens() public override {\\n // Approves the SSV Network contract to transfer SSV tokens when validators are registered\\n IERC20(SSV_TOKEN).approve(SSV_NETWORK, type(uint256).max);\\n }\\n\\n /**\\n * @notice We can accept ETH directly to this contract from anyone as it does not impact our accounting\\n * like it did in the legacy NativeStakingStrategy.\\n * The new ETH will be accounted for in `checkBalance` after the next snapBalances and verifyBalances txs.\\n */\\n receive() external payable {}\\n\\n /***************************************\\n Internal functions\\n ****************************************/\\n\\n /// @notice is not supported for this strategy as there is no platform token.\\n function setPTokenAddress(address, address) external pure override {\\n revert(\\\"Unsupported function\\\");\\n }\\n\\n /// @notice is not supported for this strategy as there is no platform token.\\n function removePToken(uint256) external pure override {\\n revert(\\\"Unsupported function\\\");\\n }\\n\\n /// @dev This strategy does not use a platform token like the old Aave and Compound strategies.\\n function _abstractSetPToken(address _asset, address) internal override {}\\n\\n /// @dev Consensus rewards are compounded to the validator's balance instead of being\\n /// swept to this strategy contract.\\n /// Execution rewards from MEV and tx priority accumulate as ETH in this strategy contract.\\n /// Withdrawals from validators also accumulate as ETH in this strategy contract.\\n /// It's too complex to separate the rewards from withdrawals so this function is not implemented.\\n /// Besides, ETH rewards are not sent to the Dripper any more. The Vault can now regulate\\n /// the increase in assets.\\n function _collectRewardTokens() internal pure override {\\n revert(\\\"Unsupported function\\\");\\n }\\n}\\n\",\"keccak256\":\"0xd504251acc8f5b90631f12eb2e23e6e8bd2e953b70d657f6c6d4fe9a3a37178b\",\"license\":\"BUSL-1.1\"},\"contracts/strategies/NativeStaking/CompoundingValidatorManager.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { SafeCast } from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport { Math } from \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { Pausable } from \\\"@openzeppelin/contracts/security/Pausable.sol\\\";\\nimport { Governable } from \\\"../../governance/Governable.sol\\\";\\nimport { IDepositContract } from \\\"../../interfaces/IDepositContract.sol\\\";\\nimport { IWETH9 } from \\\"../../interfaces/IWETH9.sol\\\";\\nimport { ISSVNetwork, Cluster } from \\\"../../interfaces/ISSVNetwork.sol\\\";\\nimport { BeaconRoots } from \\\"../../beacon/BeaconRoots.sol\\\";\\nimport { PartialWithdrawal } from \\\"../../beacon/PartialWithdrawal.sol\\\";\\nimport { IBeaconProofs } from \\\"../../interfaces/IBeaconProofs.sol\\\";\\n\\n/**\\n * @title Validator lifecycle management contract\\n * @notice This contract implements all the required functionality to\\n * register, deposit, withdraw, exit and remove validators.\\n * @author Origin Protocol Inc\\n */\\nabstract contract CompoundingValidatorManager is Governable, Pausable {\\n using SafeERC20 for IERC20;\\n\\n /// @dev The amount of ETH in wei that is required for a deposit to a new validator.\\n uint256 internal constant DEPOSIT_AMOUNT_WEI = 1 ether;\\n /// @dev Validator balances over this amount will eventually become active on the beacon chain.\\n /// Due to hysteresis, if the effective balance is 31 ETH, the actual balance\\n /// must rise to 32.25 ETH to trigger an effective balance update to 32 ETH.\\n /// https://eth2book.info/capella/part2/incentives/balances/#hysteresis\\n uint256 internal constant MIN_ACTIVATION_BALANCE_GWEI = 32.25 ether / 1e9;\\n /// @dev The maximum number of deposits that are waiting to be verified as processed on the beacon chain.\\n uint256 internal constant MAX_DEPOSITS = 12;\\n /// @dev The maximum number of validators that can be verified.\\n uint256 internal constant MAX_VERIFIED_VALIDATORS = 48;\\n /// @dev The default withdrawable epoch value on the Beacon chain.\\n /// A value in the far future means the validator is not exiting.\\n uint64 internal constant FAR_FUTURE_EPOCH = type(uint64).max;\\n /// @dev The number of seconds between each beacon chain slot.\\n uint64 internal constant SLOT_DURATION = 12;\\n /// @dev The number of slots in each beacon chain epoch.\\n uint64 internal constant SLOTS_PER_EPOCH = 32;\\n /// @dev Minimum time in seconds to allow snapped balances to be verified.\\n /// Set to 35 slots which is 3 slots more than 1 epoch (32 slots). Deposits get processed\\n /// once per epoch. This larger than 1 epoch delay should achieve that `snapBalances` sometimes\\n /// get called in the middle (or towards the end) of the epoch. Giving the off-chain script\\n /// sufficient time after the end of the epoch to prepare the proofs and call `verifyBalances`.\\n /// This is considering a malicious actor would keep calling `snapBalances` as frequent as possible\\n /// to disturb our operations.\\n uint64 internal constant SNAP_BALANCES_DELAY = 35 * SLOT_DURATION;\\n\\n /// @notice The address of the Wrapped ETH (WETH) token contract\\n address internal immutable WETH;\\n /// @notice The address of the beacon chain deposit contract\\n address internal immutable BEACON_CHAIN_DEPOSIT_CONTRACT;\\n /// @notice The address of the SSV Network contract used to interface with\\n address internal immutable SSV_NETWORK;\\n /// @notice Address of the OETH Vault proxy contract\\n address internal immutable VAULT_ADDRESS;\\n /// @notice Address of the Beacon Proofs contract that verifies beacon chain data\\n address public immutable BEACON_PROOFS;\\n /// @notice The timestamp of the Beacon chain genesis.\\n /// @dev this is different on Testnets like Hoodi so is set at deployment time.\\n uint64 internal immutable BEACON_GENESIS_TIMESTAMP;\\n\\n /// @notice Address of the registrator - allowed to register, withdraw, exit and remove validators\\n address public validatorRegistrator;\\n\\n /// @notice Deposit data for new compounding validators.\\n /// @dev A `VERIFIED` deposit can mean 3 separate things:\\n /// - a deposit has been processed by the beacon chain and shall be included in the\\n /// balance of the next verifyBalances call\\n /// - a deposit has been done to a slashed validator and has probably been recovered\\n /// back to this strategy. Probably because we can not know for certain. This contract\\n /// only detects when the validator has passed its withdrawal epoch. It is close to impossible\\n /// to prove with Merkle Proofs that the postponed deposit this contract is responsible for\\n /// creating is not present anymore in BeaconChain.state.pending_deposits. This in effect\\n /// means that there might be a period where this contract thinks the deposit has been already\\n /// returned as ETH balance before it happens. This will result in some days (or weeks)\\n /// -> depending on the size of deposit queue of showing a deficit when calling `checkBalance`.\\n /// As this only offsets the yield and doesn't cause a critical double-counting we are not addressing\\n /// this issue.\\n /// - A deposit has been done to the validator, but our deposit has been front run by a malicious\\n /// actor. Funds in the deposit this contract makes are not recoverable.\\n enum DepositStatus {\\n UNKNOWN, // default value\\n PENDING, // deposit is pending and waiting to be verified\\n VERIFIED // deposit has been verified\\n }\\n\\n /// @param pubKeyHash Hash of validator's public key using the Beacon Chain's format\\n /// @param amountGwei Amount of ETH in gwei that has been deposited to the beacon chain deposit contract\\n /// @param slot The beacon chain slot number when the deposit has been made\\n /// @param depositIndex The index of the deposit in the list of active deposits\\n /// @param status The status of the deposit, either UNKNOWN, PENDING or VERIFIED\\n struct DepositData {\\n bytes32 pubKeyHash;\\n uint64 amountGwei;\\n uint64 slot;\\n uint32 depositIndex;\\n DepositStatus status;\\n }\\n /// @notice Restricts to only one deposit to an unverified validator at a time.\\n /// This is to limit front-running attacks of deposits to the beacon chain contract.\\n ///\\n /// @dev The value is set to true when a deposit to a new validator has been done that has\\n /// not yet be verified.\\n bool public firstDeposit;\\n /// @notice Mapping of the pending deposit roots to the deposit data\\n mapping(bytes32 => DepositData) public deposits;\\n /// @notice List of strategy deposit IDs to a validator.\\n /// The ID is the merkle root of the pending deposit data which is unique for each validator, amount and block.\\n /// Duplicate pending deposit roots are prevented so can be used as an identifier to each strategy deposit.\\n /// The list can be for deposits waiting to be verified as processed on the beacon chain,\\n /// or deposits that have been verified to an exiting validator and is now waiting for the\\n /// validator's balance to be swept.\\n /// The list may not be ordered by time of deposit.\\n /// Removed deposits will move the last deposit to the removed index.\\n bytes32[] public depositList;\\n\\n enum ValidatorState {\\n NON_REGISTERED, // validator is not registered on the SSV network\\n REGISTERED, // validator is registered on the SSV network\\n STAKED, // validator has funds staked\\n VERIFIED, // validator has been verified to exist on the beacon chain\\n ACTIVE, // The validator balance is at least 32 ETH. The validator may not yet be active on the beacon chain.\\n EXITING, // The validator has been requested to exit\\n EXITED, // The validator has been verified to have a zero balance\\n REMOVED, // validator has funds withdrawn to this strategy contract and is removed from the SSV\\n INVALID // The validator has been front-run and the withdrawal address is not this strategy\\n }\\n\\n // Validator data\\n struct ValidatorData {\\n ValidatorState state; // The state of the validator known to this contract\\n uint40 index; // The index of the validator on the beacon chain\\n }\\n /// @notice List of validator public key hashes that have been verified to exist on the beacon chain.\\n /// These have had a deposit processed and the validator's balance increased.\\n /// Validators will be removed from this list when its verified they have a zero balance.\\n bytes32[] public verifiedValidators;\\n /// @notice Mapping of the hash of the validator's public key to the validator state and index.\\n /// Uses the Beacon chain hashing for BLSPubkey which is sha256(abi.encodePacked(validator.pubkey, bytes16(0)))\\n mapping(bytes32 => ValidatorData) public validator;\\n\\n /// @param blockRoot Beacon chain block root of the snapshot\\n /// @param timestamp Timestamp of the snapshot\\n /// @param ethBalance The balance of ETH in the strategy contract at the snapshot\\n struct Balances {\\n bytes32 blockRoot;\\n uint64 timestamp;\\n uint128 ethBalance;\\n }\\n /// @notice Mapping of the block root to the balances at that slot\\n Balances public snappedBalance;\\n /// @notice The last verified ETH balance of the strategy\\n uint256 public lastVerifiedEthBalance;\\n\\n /// @dev This contract receives WETH as the deposit asset, but unlike other strategies doesn't immediately\\n /// deposit it to an underlying platform. Rather a special privilege account stakes it to the validators.\\n /// For that reason calling WETH.balanceOf(this) in a deposit function can contain WETH that has just been\\n /// deposited and also WETH that has previously been deposited. To keep a correct count we need to keep track\\n /// of WETH that has already been accounted for.\\n /// This value represents the amount of WETH balance of this contract that has already been accounted for by the\\n /// deposit events.\\n /// It is important to note that this variable is not concerned with WETH that is a result of full/partial\\n /// withdrawal of the validators. It is strictly concerned with WETH that has been deposited and is waiting to\\n /// be staked.\\n uint256 public depositedWethAccountedFor;\\n\\n // For future use\\n uint256[41] private __gap;\\n\\n event RegistratorChanged(address indexed newAddress);\\n event FirstDepositReset();\\n event SSVValidatorRegistered(\\n bytes32 indexed pubKeyHash,\\n uint64[] operatorIds\\n );\\n event SSVValidatorRemoved(bytes32 indexed pubKeyHash, uint64[] operatorIds);\\n event ETHStaked(\\n bytes32 indexed pubKeyHash,\\n bytes32 indexed pendingDepositRoot,\\n bytes pubKey,\\n uint256 amountWei\\n );\\n event ValidatorVerified(\\n bytes32 indexed pubKeyHash,\\n uint40 indexed validatorIndex\\n );\\n event ValidatorInvalid(bytes32 indexed pubKeyHash);\\n event DepositVerified(\\n bytes32 indexed pendingDepositRoot,\\n uint256 amountWei\\n );\\n event ValidatorWithdraw(bytes32 indexed pubKeyHash, uint256 amountWei);\\n event BalancesSnapped(bytes32 indexed blockRoot, uint256 ethBalance);\\n event BalancesVerified(\\n uint64 indexed timestamp,\\n uint256 totalDepositsWei,\\n uint256 totalValidatorBalance,\\n uint256 ethBalance\\n );\\n\\n /// @dev Throws if called by any account other than the Registrator\\n modifier onlyRegistrator() {\\n require(msg.sender == validatorRegistrator, \\\"Not Registrator\\\");\\n _;\\n }\\n\\n /// @dev Throws if called by any account other than the Registrator or Governor\\n modifier onlyRegistratorOrGovernor() {\\n require(\\n msg.sender == validatorRegistrator || isGovernor(),\\n \\\"Not Registrator or Governor\\\"\\n );\\n _;\\n }\\n\\n /// @param _wethAddress Address of the Erc20 WETH Token contract\\n /// @param _vaultAddress Address of the Vault\\n /// @param _beaconChainDepositContract Address of the beacon chain deposit contract\\n /// @param _ssvNetwork Address of the SSV Network contract\\n /// @param _beaconProofs Address of the Beacon Proofs contract that verifies beacon chain data\\n /// @param _beaconGenesisTimestamp The timestamp of the Beacon chain's genesis.\\n constructor(\\n address _wethAddress,\\n address _vaultAddress,\\n address _beaconChainDepositContract,\\n address _ssvNetwork,\\n address _beaconProofs,\\n uint64 _beaconGenesisTimestamp\\n ) {\\n WETH = _wethAddress;\\n BEACON_CHAIN_DEPOSIT_CONTRACT = _beaconChainDepositContract;\\n SSV_NETWORK = _ssvNetwork;\\n VAULT_ADDRESS = _vaultAddress;\\n BEACON_PROOFS = _beaconProofs;\\n BEACON_GENESIS_TIMESTAMP = _beaconGenesisTimestamp;\\n\\n require(\\n block.timestamp > _beaconGenesisTimestamp,\\n \\\"Invalid genesis timestamp\\\"\\n );\\n }\\n\\n /**\\n *\\n * Admin Functions\\n *\\n */\\n\\n /// @notice Set the address of the registrator which can register, exit and remove validators\\n function setRegistrator(address _address) external onlyGovernor {\\n validatorRegistrator = _address;\\n emit RegistratorChanged(_address);\\n }\\n\\n /// @notice Reset the `firstDeposit` flag to false so deposits to unverified validators can be made again.\\n function resetFirstDeposit() external onlyGovernor {\\n require(firstDeposit, \\\"No first deposit\\\");\\n\\n firstDeposit = false;\\n\\n emit FirstDepositReset();\\n }\\n\\n function pause() external onlyRegistratorOrGovernor {\\n _pause();\\n }\\n\\n function unPause() external onlyGovernor {\\n _unpause();\\n }\\n\\n /**\\n *\\n * Validator Management\\n *\\n */\\n\\n /// @notice Registers a single validator in a SSV Cluster.\\n /// Only the Registrator can call this function.\\n /// @param publicKey The public key of the validator\\n /// @param operatorIds The operator IDs of the SSV Cluster\\n /// @param sharesData The shares data for the validator\\n /// @param ssvAmount The amount of SSV tokens to be deposited to the SSV cluster\\n /// @param cluster The SSV cluster details including the validator count and SSV balance\\n // slither-disable-start reentrancy-no-eth\\n function registerSsvValidator(\\n bytes calldata publicKey,\\n uint64[] calldata operatorIds,\\n bytes calldata sharesData,\\n uint256 ssvAmount,\\n Cluster calldata cluster\\n ) external onlyRegistrator whenNotPaused {\\n // Hash the public key using the Beacon Chain's format\\n bytes32 pubKeyHash = _hashPubKey(publicKey);\\n // Check each public key has not already been used\\n require(\\n validator[pubKeyHash].state == ValidatorState.NON_REGISTERED,\\n \\\"Validator already registered\\\"\\n );\\n\\n // Store the validator state as registered\\n validator[pubKeyHash].state = ValidatorState.REGISTERED;\\n\\n ISSVNetwork(SSV_NETWORK).registerValidator(\\n publicKey,\\n operatorIds,\\n sharesData,\\n ssvAmount,\\n cluster\\n );\\n\\n emit SSVValidatorRegistered(pubKeyHash, operatorIds);\\n }\\n\\n // slither-disable-end reentrancy-no-eth\\n\\n struct ValidatorStakeData {\\n bytes pubkey;\\n bytes signature;\\n bytes32 depositDataRoot;\\n }\\n\\n /// @notice Stakes WETH in this strategy to a compounding validator.\\n /// The first deposit to a new validator, the amount must be 1 ETH.\\n /// Another deposit of at least 31 ETH is required for the validator to be activated.\\n /// This second deposit has to be done after the validator has been verified.\\n /// Does not convert any ETH sitting in this strategy to WETH.\\n /// There can not be two deposits to the same validator in the same block for the same amount.\\n /// Function is pausable so in case a run-away Registrator can be prevented from continuing\\n /// to deposit funds to slashed or undesired validators.\\n /// @param validatorStakeData validator data needed to stake.\\n /// The `ValidatorStakeData` struct contains the pubkey, signature and depositDataRoot.\\n /// Only the registrator can call this function.\\n /// @param depositAmountGwei The amount of WETH to stake to the validator in Gwei.\\n // slither-disable-start reentrancy-eth,reentrancy-no-eth\\n function stakeEth(\\n ValidatorStakeData calldata validatorStakeData,\\n uint64 depositAmountGwei\\n ) external onlyRegistrator whenNotPaused {\\n uint256 depositAmountWei = uint256(depositAmountGwei) * 1 gwei;\\n // Check there is enough WETH from the deposits sitting in this strategy contract\\n // There could be ETH from withdrawals but we'll ignore that. If it's really needed\\n // the ETH can be withdrawn and then deposited back to the strategy.\\n require(\\n depositAmountWei <= IWETH9(WETH).balanceOf(address(this)),\\n \\\"Insufficient WETH\\\"\\n );\\n require(depositList.length < MAX_DEPOSITS, \\\"Max deposits\\\");\\n\\n // Convert required ETH from WETH and do the necessary accounting\\n _convertWethToEth(depositAmountWei);\\n\\n // Hash the public key using the Beacon Chain's hashing for BLSPubkey\\n bytes32 pubKeyHash = _hashPubKey(validatorStakeData.pubkey);\\n ValidatorState currentState = validator[pubKeyHash].state;\\n // Can only stake to a validator that has been registered, verified or active.\\n // Can not stake to a validator that has been staked but not yet verified.\\n require(\\n (currentState == ValidatorState.REGISTERED ||\\n currentState == ValidatorState.VERIFIED ||\\n currentState == ValidatorState.ACTIVE),\\n \\\"Not registered or verified\\\"\\n );\\n require(depositAmountWei >= 1 ether, \\\"Deposit too small\\\");\\n if (currentState == ValidatorState.REGISTERED) {\\n // Can only have one pending deposit to an unverified validator at a time.\\n // This is to limit front-running deposit attacks to a single deposit.\\n // The exiting deposit needs to be verified before another deposit can be made.\\n // If there was a front-running attack, the validator needs to be verified as invalid\\n // and the Governor calls `resetFirstDeposit` to set `firstDeposit` to false.\\n require(!firstDeposit, \\\"Existing first deposit\\\");\\n // Limits the amount of ETH that can be at risk from a front-running deposit attack.\\n require(\\n depositAmountWei == DEPOSIT_AMOUNT_WEI,\\n \\\"Invalid first deposit amount\\\"\\n );\\n // Limits the number of validator balance proofs to verifyBalances\\n require(\\n verifiedValidators.length + 1 <= MAX_VERIFIED_VALIDATORS,\\n \\\"Max validators\\\"\\n );\\n\\n // Flag a deposit to an unverified validator so no other deposits can be made\\n // to an unverified validator.\\n firstDeposit = true;\\n validator[pubKeyHash].state = ValidatorState.STAKED;\\n }\\n\\n /* 0x02 to indicate that withdrawal credentials are for a compounding validator\\n * that was introduced with the Pectra upgrade.\\n * bytes11(0) to fill up the required zeros\\n * remaining bytes20 are for the address\\n */\\n bytes memory withdrawalCredentials = abi.encodePacked(\\n bytes1(0x02),\\n bytes11(0),\\n address(this)\\n );\\n\\n /// After the Pectra upgrade the validators have a new restriction when proposing\\n /// blocks. The timestamps are at strict intervals of 12 seconds from the genesis block\\n /// forward. Each slot is created at strict 12 second intervals and those slots can\\n /// either have blocks attached to them or not. This way using the block.timestamp\\n /// the slot number can easily be calculated.\\n uint64 depositSlot = (SafeCast.toUint64(block.timestamp) -\\n BEACON_GENESIS_TIMESTAMP) / SLOT_DURATION;\\n\\n // Calculate the merkle root of the beacon chain pending deposit data.\\n // This is used as the unique ID of the deposit.\\n bytes32 pendingDepositRoot = IBeaconProofs(BEACON_PROOFS)\\n .merkleizePendingDeposit(\\n pubKeyHash,\\n withdrawalCredentials,\\n depositAmountGwei,\\n validatorStakeData.signature,\\n depositSlot\\n );\\n require(\\n deposits[pendingDepositRoot].status == DepositStatus.UNKNOWN,\\n \\\"Duplicate deposit\\\"\\n );\\n\\n // Store the deposit data for verifyDeposit and verifyBalances\\n deposits[pendingDepositRoot] = DepositData({\\n pubKeyHash: pubKeyHash,\\n amountGwei: depositAmountGwei,\\n slot: depositSlot,\\n depositIndex: SafeCast.toUint32(depositList.length),\\n status: DepositStatus.PENDING\\n });\\n depositList.push(pendingDepositRoot);\\n\\n // Deposit to the Beacon Chain deposit contract.\\n // This will create a deposit in the beacon chain's pending deposit queue.\\n IDepositContract(BEACON_CHAIN_DEPOSIT_CONTRACT).deposit{\\n value: depositAmountWei\\n }(\\n validatorStakeData.pubkey,\\n withdrawalCredentials,\\n validatorStakeData.signature,\\n validatorStakeData.depositDataRoot\\n );\\n\\n emit ETHStaked(\\n pubKeyHash,\\n pendingDepositRoot,\\n validatorStakeData.pubkey,\\n depositAmountWei\\n );\\n }\\n\\n // slither-disable-end reentrancy-eth,reentrancy-no-eth\\n\\n /// @notice Request a full or partial withdrawal from a validator.\\n /// A zero amount will trigger a full withdrawal.\\n /// If the remaining balance is < 32 ETH then only the amount in excess of 32 ETH will be withdrawn.\\n /// Only the Registrator can call this function.\\n /// 1 wei of value should be sent with the tx to pay for the withdrawal request fee.\\n /// If no value sent, 1 wei will be taken from the strategy's ETH balance if it has any.\\n /// If no ETH balance, the tx will revert.\\n /// @param publicKey The public key of the validator\\n /// @param amountGwei The amount of ETH to be withdrawn from the validator in Gwei.\\n /// A zero amount will trigger a full withdrawal.\\n // slither-disable-start reentrancy-no-eth\\n function validatorWithdrawal(bytes calldata publicKey, uint64 amountGwei)\\n external\\n payable\\n onlyRegistrator\\n {\\n // Hash the public key using the Beacon Chain's format\\n bytes32 pubKeyHash = _hashPubKey(publicKey);\\n ValidatorData memory validatorDataMem = validator[pubKeyHash];\\n // Validator full withdrawal could be denied due to multiple reasons:\\n // - the validator has not been activated or active long enough\\n // (current_epoch < activation_epoch + SHARD_COMMITTEE_PERIOD)\\n // - the validator has pending balance to withdraw from a previous partial withdrawal request\\n //\\n // Meaning that the on-chain to beacon chain full withdrawal request could fail. Instead\\n // of adding complexity of verifying if a validator is eligible for a full exit, we allow\\n // multiple full withdrawal requests per validator.\\n require(\\n validatorDataMem.state == ValidatorState.ACTIVE ||\\n validatorDataMem.state == ValidatorState.EXITING,\\n \\\"Validator not active/exiting\\\"\\n );\\n\\n // If a full withdrawal (validator exit)\\n if (amountGwei == 0) {\\n // For each staking strategy's deposits\\n uint256 depositsCount = depositList.length;\\n for (uint256 i = 0; i < depositsCount; ++i) {\\n bytes32 pendingDepositRoot = depositList[i];\\n // Check there is no pending deposits to the exiting validator\\n require(\\n pubKeyHash != deposits[pendingDepositRoot].pubKeyHash,\\n \\\"Pending deposit\\\"\\n );\\n }\\n\\n // Store the validator state as exiting so no more deposits can be made to it.\\n // This may already be EXITING if the previous exit request failed. eg the validator\\n // was not active long enough.\\n validator[pubKeyHash].state = ValidatorState.EXITING;\\n }\\n\\n // Do not remove from the list of verified validators.\\n // This is done in the verifyBalances function once the validator's balance has been verified to be zero.\\n // The validator state will be set to EXITED in the verifyBalances function.\\n\\n PartialWithdrawal.request(publicKey, amountGwei);\\n\\n emit ValidatorWithdraw(pubKeyHash, uint256(amountGwei) * 1 gwei);\\n }\\n\\n // slither-disable-end reentrancy-no-eth\\n\\n /// @notice Remove the validator from the SSV Cluster after:\\n /// - the validator has been exited from `validatorWithdrawal` or slashed\\n /// - the validator has incorrectly registered and can not be staked to\\n /// - the initial deposit was front-run and the withdrawal address is not this strategy's address.\\n /// Make sure `validatorWithdrawal` is called with a zero amount and the validator has exited the Beacon chain.\\n /// If removed before the validator has exited the beacon chain will result in the validator being slashed.\\n /// Only the registrator can call this function.\\n /// @param publicKey The public key of the validator\\n /// @param operatorIds The operator IDs of the SSV Cluster\\n /// @param cluster The SSV cluster details including the validator count and SSV balance\\n // slither-disable-start reentrancy-no-eth\\n function removeSsvValidator(\\n bytes calldata publicKey,\\n uint64[] calldata operatorIds,\\n Cluster calldata cluster\\n ) external onlyRegistrator {\\n // Hash the public key using the Beacon Chain's format\\n bytes32 pubKeyHash = _hashPubKey(publicKey);\\n ValidatorState currentState = validator[pubKeyHash].state;\\n // Can remove SSV validators that were incorrectly registered and can not be deposited to.\\n require(\\n currentState == ValidatorState.REGISTERED ||\\n currentState == ValidatorState.EXITED ||\\n currentState == ValidatorState.INVALID,\\n \\\"Validator not regd or exited\\\"\\n );\\n\\n validator[pubKeyHash].state = ValidatorState.REMOVED;\\n\\n ISSVNetwork(SSV_NETWORK).removeValidator(\\n publicKey,\\n operatorIds,\\n cluster\\n );\\n\\n emit SSVValidatorRemoved(pubKeyHash, operatorIds);\\n }\\n\\n /**\\n *\\n * SSV Management\\n *\\n */\\n\\n // slither-disable-end reentrancy-no-eth\\n\\n /// `depositSSV` has been removed as `deposit` on the SSVNetwork contract can be called directly\\n /// by the Strategist which is already holding SSV tokens.\\n\\n /// @notice Withdraws excess SSV Tokens from the SSV Network contract which was used to pay the SSV Operators.\\n /// @dev A SSV cluster is defined by the SSVOwnerAddress and the set of operatorIds.\\n /// @param operatorIds The operator IDs of the SSV Cluster\\n /// @param ssvAmount The amount of SSV tokens to be withdrawn from the SSV cluster\\n /// @param cluster The SSV cluster details including the validator count and SSV balance\\n function withdrawSSV(\\n uint64[] memory operatorIds,\\n uint256 ssvAmount,\\n Cluster memory cluster\\n ) external onlyGovernor {\\n ISSVNetwork(SSV_NETWORK).withdraw(operatorIds, ssvAmount, cluster);\\n }\\n\\n /**\\n *\\n * Beacon Chain Proofs\\n *\\n */\\n\\n /// @notice Verifies a validator's index to its public key.\\n /// Adds to the list of verified validators if the validator's withdrawal address is this strategy's address.\\n /// Marks the validator as invalid and removes the deposit if the withdrawal address is not this strategy's address.\\n /// @param nextBlockTimestamp The timestamp of the execution layer block after the beacon chain slot\\n /// we are verifying.\\n /// The next one is needed as the Beacon Oracle returns the parent beacon block root for a block timestamp,\\n /// which is the beacon block root of the previous block.\\n /// @param validatorIndex The index of the validator on the beacon chain.\\n /// @param pubKeyHash The hash of the validator's public key using the Beacon Chain's format\\n /// @param withdrawalCredentials contain the validator type and withdrawal address. These can be incorrect and/or\\n /// malformed. In case of incorrect withdrawalCredentials the validator deposit has been front run\\n /// @param validatorPubKeyProof The merkle proof for the validator public key to the beacon block root.\\n /// This is 53 witness hashes of 32 bytes each concatenated together starting from the leaf node.\\n /// BeaconBlock.state.validators[validatorIndex].pubkey\\n function verifyValidator(\\n uint64 nextBlockTimestamp,\\n uint40 validatorIndex,\\n bytes32 pubKeyHash,\\n bytes32 withdrawalCredentials,\\n bytes calldata validatorPubKeyProof\\n ) external {\\n require(\\n validator[pubKeyHash].state == ValidatorState.STAKED,\\n \\\"Validator not staked\\\"\\n );\\n\\n // Get the beacon block root of the slot we are verifying the validator in.\\n // The parent beacon block root of the next block is the beacon block root of the slot we are verifying.\\n bytes32 blockRoot = BeaconRoots.parentBlockRoot(nextBlockTimestamp);\\n\\n // Verify the validator index is for the validator with the given public key.\\n // Also verify the validator's withdrawal credentials\\n IBeaconProofs(BEACON_PROOFS).verifyValidator(\\n blockRoot,\\n pubKeyHash,\\n validatorPubKeyProof,\\n validatorIndex,\\n withdrawalCredentials\\n );\\n\\n // Store the validator state as verified\\n validator[pubKeyHash] = ValidatorData({\\n state: ValidatorState.VERIFIED,\\n index: validatorIndex\\n });\\n\\n bytes32 expectedWithdrawalCredentials = bytes32(\\n abi.encodePacked(bytes1(0x02), bytes11(0), address(this))\\n );\\n\\n // If the initial deposit was front-run and the withdrawal address is not this strategy\\n // or the validator type is not a compounding validator (0x02)\\n if (expectedWithdrawalCredentials != withdrawalCredentials) {\\n // override the validator state\\n validator[pubKeyHash].state = ValidatorState.INVALID;\\n\\n // Find and remove the deposit as the funds can not be recovered\\n uint256 depositCount = depositList.length;\\n for (uint256 i = 0; i < depositCount; i++) {\\n DepositData memory deposit = deposits[depositList[i]];\\n if (deposit.pubKeyHash == pubKeyHash) {\\n // next verifyBalances will correctly account for the loss of a front-run\\n // deposit. Doing it here accounts for the loss as soon as possible\\n lastVerifiedEthBalance -= Math.min(\\n lastVerifiedEthBalance,\\n uint256(deposit.amountGwei) * 1 gwei\\n );\\n _removeDeposit(depositList[i], deposit);\\n break;\\n }\\n }\\n\\n // Leave the `firstDeposit` flag as true so no more deposits to unverified validators can be made.\\n // The Governor has to reset the `firstDeposit` to false before another deposit to\\n // an unverified validator can be made.\\n // The Governor can set a new `validatorRegistrator` if they suspect it has been compromised.\\n\\n emit ValidatorInvalid(pubKeyHash);\\n return;\\n }\\n\\n // Add the new validator to the list of verified validators\\n verifiedValidators.push(pubKeyHash);\\n\\n // Reset the firstDeposit flag as the first deposit to an unverified validator has been verified.\\n firstDeposit = false;\\n\\n emit ValidatorVerified(pubKeyHash, validatorIndex);\\n }\\n\\n struct FirstPendingDepositSlotProofData {\\n uint64 slot;\\n bytes proof;\\n }\\n\\n struct StrategyValidatorProofData {\\n uint64 withdrawableEpoch;\\n bytes withdrawableEpochProof;\\n }\\n\\n /// @notice Verifies a deposit on the execution layer has been processed by the beacon chain.\\n /// This means the accounting of the strategy's ETH moves from a pending deposit to a validator balance.\\n ///\\n /// Important: this function has a limitation where `depositProcessedSlot` that is passed by the off-chain\\n /// verifier requires a slot immediately after it to propose a block otherwise the `BeaconRoots.parentBlockRoot`\\n /// will fail. This shouldn't be a problem, since by the current behaviour of beacon chain only 1%-3% slots\\n /// don't propose a block.\\n /// @param pendingDepositRoot The unique identifier of the deposit emitted in `ETHStaked` from\\n /// the `stakeEth` function.\\n /// @param depositProcessedSlot Any slot on or after the strategy's deposit was processed on the beacon chain.\\n /// Can not be a slot with pending deposits with the same slot as the deposit being verified.\\n /// Can not be a slot before a missed slot as the Beacon Root contract will have the parent block root\\n /// set for the next block timestamp in 12 seconds time.\\n /// @param firstPendingDeposit a `FirstPendingDepositSlotProofData` struct containing:\\n /// - slot: The beacon chain slot of the first deposit in the beacon chain's deposit queue.\\n /// Can be any non-zero value if the deposit queue is empty.\\n /// - proof: The merkle proof of the first pending deposit's slot to the beacon block root.\\n /// Can be either:\\n /// * 40 witness hashes for BeaconBlock.state.PendingDeposits[0].slot when the deposit queue is not empty.\\n /// * 37 witness hashes for BeaconBlock.state.PendingDeposits[0] when the deposit queue is empty.\\n /// The 32 byte witness hashes are concatenated together starting from the leaf node.\\n /// @param strategyValidatorData a `StrategyValidatorProofData` struct containing:\\n /// - withdrawableEpoch: The withdrawable epoch of the validator the strategy is depositing to.\\n /// - withdrawableEpochProof: The merkle proof for the withdrawable epoch of the validator the strategy\\n /// is depositing to, to the beacon block root.\\n /// This is 53 witness hashes of 32 bytes each concatenated together starting from the leaf node.\\n // slither-disable-start reentrancy-no-eth\\n function verifyDeposit(\\n bytes32 pendingDepositRoot,\\n uint64 depositProcessedSlot,\\n FirstPendingDepositSlotProofData calldata firstPendingDeposit,\\n StrategyValidatorProofData calldata strategyValidatorData\\n ) external {\\n // Load into memory the previously saved deposit data\\n DepositData memory deposit = deposits[pendingDepositRoot];\\n ValidatorData memory strategyValidator = validator[deposit.pubKeyHash];\\n require(deposit.status == DepositStatus.PENDING, \\\"Deposit not pending\\\");\\n require(firstPendingDeposit.slot != 0, \\\"Zero 1st pending deposit slot\\\");\\n\\n // We should allow the verification of deposits for validators that have been marked as exiting\\n // to cover this situation:\\n // - there are 2 pending deposits\\n // - beacon chain has slashed the validator\\n // - when verifyDeposit is called for the first deposit it sets the Validator state to EXITING\\n // - verifyDeposit should allow a secondary call for the other deposit to a slashed validator\\n require(\\n strategyValidator.state == ValidatorState.VERIFIED ||\\n strategyValidator.state == ValidatorState.ACTIVE ||\\n strategyValidator.state == ValidatorState.EXITING,\\n \\\"Not verified/active/exiting\\\"\\n );\\n // The verification slot must be after the deposit's slot.\\n // This is needed for when the deposit queue is empty.\\n require(deposit.slot < depositProcessedSlot, \\\"Slot not after deposit\\\");\\n\\n uint64 snapTimestamp = snappedBalance.timestamp;\\n\\n // This check prevents an accounting error that can happen if:\\n // - snapBalances are snapped at the time of T\\n // - deposit is processed on the beacon chain after time T and before verifyBalances()\\n // - verifyDeposit is called before verifyBalances which removes a deposit from depositList\\n // and deposit balance from totalDepositsWei\\n // - verifyBalances is called under-reporting the strategy's balance\\n require(\\n (_calcNextBlockTimestamp(depositProcessedSlot) <= snapTimestamp) ||\\n snapTimestamp == 0,\\n \\\"Deposit after balance snapshot\\\"\\n );\\n\\n // Get the parent beacon block root of the next block which is the block root of the deposit verification slot.\\n // This will revert if the slot after the verification slot was missed.\\n bytes32 depositBlockRoot = BeaconRoots.parentBlockRoot(\\n _calcNextBlockTimestamp(depositProcessedSlot)\\n );\\n\\n // Verify the slot of the first pending deposit matches the beacon chain\\n bool isDepositQueueEmpty = IBeaconProofs(BEACON_PROOFS)\\n .verifyFirstPendingDeposit(\\n depositBlockRoot,\\n firstPendingDeposit.slot,\\n firstPendingDeposit.proof\\n );\\n\\n // Verify the withdrawableEpoch on the validator of the strategy's deposit\\n IBeaconProofs(BEACON_PROOFS).verifyValidatorWithdrawable(\\n depositBlockRoot,\\n strategyValidator.index,\\n strategyValidatorData.withdrawableEpoch,\\n strategyValidatorData.withdrawableEpochProof\\n );\\n\\n uint64 firstPendingDepositEpoch = firstPendingDeposit.slot /\\n SLOTS_PER_EPOCH;\\n\\n // If deposit queue is empty all deposits have certainly been processed. If not\\n // a validator can either be not exiting and no further checks are required.\\n // Or a validator is exiting then this function needs to make sure that the\\n // pending deposit to an exited validator has certainly been processed. The\\n // slot/epoch of first pending deposit is the one that contains the transaction\\n // where the deposit to the ETH Deposit Contract has been made.\\n //\\n // Once the firstPendingDepositEpoch becomes greater than the withdrawableEpoch of\\n // the slashed validator then the deposit has certainly been processed. When the beacon\\n // chain reaches the withdrawableEpoch of the validator the deposit will no longer be\\n // postponed. And any new deposits created (and present in the deposit queue)\\n // will have an equal or larger withdrawableEpoch.\\n require(\\n strategyValidatorData.withdrawableEpoch == FAR_FUTURE_EPOCH ||\\n strategyValidatorData.withdrawableEpoch <=\\n firstPendingDepositEpoch ||\\n isDepositQueueEmpty,\\n \\\"Exit Deposit likely not proc.\\\"\\n );\\n\\n // solhint-disable max-line-length\\n // Check the deposit slot is before the first pending deposit's slot on the beacon chain.\\n // If this is not true then we can't guarantee the deposit has been processed by the beacon chain.\\n // The deposit's slot can not be the same slot as the first pending deposit as there could be\\n // many deposits in the same block, hence have the same pending deposit slot.\\n // If the deposit queue is empty then our deposit must have been processed on the beacon chain.\\n // The deposit slot can be zero for validators consolidating to a compounding validator or 0x01 validator\\n // being promoted to a compounding one. Reference:\\n // - [switch_to_compounding_validator](https://ethereum.github.io/consensus-specs/specs/electra/beacon-chain/#new-switch_to_compounding_validator\\n // - [queue_excess_active_balance](https://ethereum.github.io/consensus-specs/specs/electra/beacon-chain/#new-queue_excess_active_balance)\\n // - [process_consolidation_request](https://ethereum.github.io/consensus-specs/specs/electra/beacon-chain/#new-process_consolidation_request)\\n // We can not guarantee that the deposit has been processed in that case.\\n // solhint-enable max-line-length\\n require(\\n deposit.slot < firstPendingDeposit.slot || isDepositQueueEmpty,\\n \\\"Deposit likely not processed\\\"\\n );\\n\\n // Remove the deposit now it has been verified as processed on the beacon chain.\\n _removeDeposit(pendingDepositRoot, deposit);\\n\\n emit DepositVerified(\\n pendingDepositRoot,\\n uint256(deposit.amountGwei) * 1 gwei\\n );\\n }\\n\\n function _removeDeposit(\\n bytes32 pendingDepositRoot,\\n DepositData memory deposit\\n ) internal {\\n // After verifying the proof, update the contract storage\\n deposits[pendingDepositRoot].status = DepositStatus.VERIFIED;\\n // Move the last deposit to the index of the verified deposit\\n bytes32 lastDeposit = depositList[depositList.length - 1];\\n depositList[deposit.depositIndex] = lastDeposit;\\n deposits[lastDeposit].depositIndex = deposit.depositIndex;\\n // Delete the last deposit from the list\\n depositList.pop();\\n }\\n\\n /// @dev Calculates the timestamp of the next execution block from the given slot.\\n /// @param slot The beacon chain slot number used for merkle proof verification.\\n function _calcNextBlockTimestamp(uint64 slot)\\n internal\\n view\\n returns (uint64)\\n {\\n // Calculate the next block timestamp from the slot.\\n return SLOT_DURATION * slot + BEACON_GENESIS_TIMESTAMP + SLOT_DURATION;\\n }\\n\\n // slither-disable-end reentrancy-no-eth\\n\\n /// @notice Stores the current ETH balance at the current block and beacon block root\\n /// of the slot that is associated with the previous block.\\n ///\\n /// When snapping / verifying balance it is of a high importance that there is no\\n /// miss-match in respect to ETH that is held by the contract and balances that are\\n /// verified on the validators.\\n ///\\n /// First some context on the beacon-chain block building behaviour. Relevant parts of\\n /// constructing a block on the beacon chain consist of:\\n /// - process_withdrawals: ETH is deducted from the validator's balance\\n /// - process_execution_payload: immediately after the previous step executing all the\\n /// transactions\\n /// - apply the withdrawals: adding ETH to the recipient which is the withdrawal address\\n /// contained in the withdrawal credentials of the exited validators\\n ///\\n /// That means that balance increases which are part of the post-block execution state are\\n /// done within the block, but the transaction that are contained within that block can not\\n /// see / interact with the balance from the exited validators. Only transactions in the\\n /// next block can do that.\\n ///\\n /// When snap balances is performed the state of the chain is snapped across 2 separate\\n /// chain states:\\n /// - ETH balance of the contract is recorded on block X -> and corresponding slot Y\\n /// - beacon chain block root is recorded of block X - 1 -> and corresponding slot Y - 1\\n /// given there were no missed slots. It could also be Y - 2, Y - 3 depending on how\\n /// many slots have not managed to propose a block. For the sake of simplicity this slot\\n /// will be referred to as Y - 1 as it makes no difference in the argument\\n ///\\n /// Given these 2 separate chain states it is paramount that verify balances can not experience\\n /// miss-counting ETH or much more dangerous double counting of the ETH.\\n ///\\n /// When verifyBalances is called it is performed on the current block Z where Z > X. Verify\\n /// balances adds up all the ETH (omitting WETH) controlled by this contract:\\n /// - ETH balance in the contract on block X\\n /// - ETH balance in Deposits on block Z that haven't been yet processed in slot Y - 1\\n /// - ETH balance in validators that are active in slot Y - 1\\n /// - skips the ETH balance in validators that have withdrawn in slot Y - 1 (or sooner)\\n /// and have their balance visible to transactions in slot Y and corresponding block X\\n /// (or sooner)\\n ///\\n /// Lets verify the correctness of ETH accounting given the above described behaviour.\\n ///\\n /// *ETH balance in the contract on block X*\\n ///\\n /// This is an ETH balance of the contract on a non current X block. Any ETH leaving the\\n /// contract as a result of a withdrawal subtracts from the ETH accounted for on block X\\n /// if `verifyBalances` has already been called. It also invalidates a `snapBalances` in\\n /// case `verifyBalances` has not been called yet. Not performing this would result in not\\n /// accounting for the withdrawn ETH that has happened anywhere in the block interval [X + 1, Z].\\n ///\\n /// Similarly to withdrawals any `stakeEth` deposits to the deposit contract adds to the ETH\\n /// accounted for since the last `verifyBalances` has been called. And it invalidates the\\n /// `snapBalances` in case `verifyBalances` hasn't been yet called. Not performing this\\n /// would result in double counting the `stakedEth` since it would be present once in the\\n /// snapped contract balance and the second time in deposit storage variables.\\n ///\\n /// This behaviour is correct.\\n ///\\n /// *ETH balance in Deposits on block Z that haven't been yet processed in slot Y - 1*\\n ///\\n /// The contract sums up all the ETH that has been deposited to the Beacon chain deposit\\n /// contract at block Z. The execution layer doesn't have direct access to the state of\\n /// deposits on the beacon chain. And if it is to sum up all the ETH that is marked to be\\n /// deposited it needs to be sure to not double count ETH that is in deposits (storage vars)\\n /// and could also be part of the validator balances. It does that by verifying that at\\n /// slot Y - 1 none of the deposits visible on block Z have been processed. Meaning since\\n /// the last snap till now all are still in queue. Which ensures they can not be part of\\n /// the validator balances in later steps.\\n ///\\n /// This behaviour is correct.\\n ///\\n /// *ETH balance in validators that are active in slot Y - 1*\\n ///\\n /// The contract is verifying none of the deposits on Y - 1 slot have been processed and\\n /// for that reason it checks the validator balances in the same slot. Ensuring accounting\\n /// correctness.\\n ///\\n /// This behaviour is correct.\\n ///\\n /// *The withdrawn validators*\\n ///\\n /// The withdrawn validators could have their balances deducted in any slot before slot\\n /// Y - 1 and the execution layer sees the balance increase in the subsequent slot. Lets\\n /// look at the \\\"worst case scenario\\\" where the validator withdrawal is processed in the\\n /// slot Y - 1 (snapped slot) and see their balance increase (in execution layer) in slot\\n /// Y -> block X. The ETH balance on the contract is snapped at block X meaning that\\n /// even if the validator exits at the latest possible time it is paramount that the ETH\\n /// balance on the execution layer is recorded in the next block. Correctly accounting\\n /// for the withdrawn ETH.\\n ///\\n /// Worth mentioning if the validator exit is processed by the slot Y and balance increase\\n /// seen on the execution layer on block X + 1 the withdrawal is ignored by both the\\n /// validator balance verification as well as execution layer contract balance snap.\\n ///\\n /// This behaviour is correct.\\n ///\\n /// The validator balances on the beacon chain can then be proved with `verifyBalances`.\\n function snapBalances() external {\\n uint64 currentTimestamp = SafeCast.toUint64(block.timestamp);\\n require(\\n snappedBalance.timestamp + SNAP_BALANCES_DELAY < currentTimestamp,\\n \\\"Snap too soon\\\"\\n );\\n\\n bytes32 blockRoot = BeaconRoots.parentBlockRoot(currentTimestamp);\\n // Get the current ETH balance\\n uint256 ethBalance = address(this).balance;\\n\\n // Store the snapped balance\\n snappedBalance = Balances({\\n blockRoot: blockRoot,\\n timestamp: currentTimestamp,\\n ethBalance: SafeCast.toUint128(ethBalance)\\n });\\n\\n emit BalancesSnapped(blockRoot, ethBalance);\\n }\\n\\n // A struct is used to avoid stack too deep errors\\n struct BalanceProofs {\\n // BeaconBlock.state.balances\\n bytes32 balancesContainerRoot;\\n bytes balancesContainerProof;\\n // BeaconBlock.state.balances[validatorIndex]\\n bytes32[] validatorBalanceLeaves;\\n bytes[] validatorBalanceProofs;\\n }\\n\\n struct PendingDepositProofs {\\n bytes32 pendingDepositContainerRoot;\\n bytes pendingDepositContainerProof;\\n uint32[] pendingDepositIndexes;\\n bytes[] pendingDepositProofs;\\n }\\n\\n /// @notice Verifies the balances of all active validators on the beacon chain\\n /// and checks each of the strategy's deposits are still to be processed by the beacon chain.\\n /// @param balanceProofs a `BalanceProofs` struct containing the following:\\n /// - balancesContainerRoot: The merkle root of the balances container\\n /// - balancesContainerProof: The merkle proof for the balances container to the beacon block root.\\n /// This is 9 witness hashes of 32 bytes each concatenated together starting from the leaf node.\\n /// - validatorBalanceLeaves: Array of leaf nodes containing the validator balance with three other balances.\\n /// - validatorBalanceProofs: Array of merkle proofs for the validator balance to the Balances container root.\\n /// This is 39 witness hashes of 32 bytes each concatenated together starting from the leaf node.\\n /// @param pendingDepositProofs a `PendingDepositProofs` struct containing the following:\\n /// - pendingDepositContainerRoot: The merkle root of the pending deposits list container\\n /// - pendingDepositContainerProof: The merkle proof from the pending deposits list container\\n /// to the beacon block root.\\n /// This is 9 witness hashes of 32 bytes each concatenated together starting from the leaf node.\\n /// - pendingDepositIndexes: Array of indexes in the pending deposits list container for each\\n /// of the strategy's deposits.\\n /// - pendingDepositProofs: Array of merkle proofs for each strategy deposit in the\\n /// beacon chain's pending deposit list container to the pending deposits list container root.\\n /// These are 28 witness hashes of 32 bytes each concatenated together starting from the leaf node.\\n // slither-disable-start reentrancy-no-eth\\n function verifyBalances(\\n BalanceProofs calldata balanceProofs,\\n PendingDepositProofs calldata pendingDepositProofs\\n ) external {\\n // Load previously snapped balances for the given block root\\n Balances memory balancesMem = snappedBalance;\\n // Check the balances are the latest\\n require(balancesMem.timestamp > 0, \\\"No snapped balances\\\");\\n\\n uint256 verifiedValidatorsCount = verifiedValidators.length;\\n uint256 totalValidatorBalance = 0;\\n uint256 depositsCount = depositList.length;\\n\\n // If there are no verified validators then we can skip the balance verification\\n if (verifiedValidatorsCount > 0) {\\n require(\\n balanceProofs.validatorBalanceProofs.length ==\\n verifiedValidatorsCount,\\n \\\"Invalid balance proofs\\\"\\n );\\n require(\\n balanceProofs.validatorBalanceLeaves.length ==\\n verifiedValidatorsCount,\\n \\\"Invalid balance leaves\\\"\\n );\\n // verify beaconBlock.state.balances root to beacon block root\\n IBeaconProofs(BEACON_PROOFS).verifyBalancesContainer(\\n balancesMem.blockRoot,\\n balanceProofs.balancesContainerRoot,\\n balanceProofs.balancesContainerProof\\n );\\n\\n bytes32[]\\n memory validatorHashesMem = _getPendingDepositValidatorHashes(\\n depositsCount\\n );\\n\\n // for each validator in reverse order so we can pop off exited validators at the end\\n for (uint256 i = verifiedValidatorsCount; i > 0; ) {\\n --i;\\n ValidatorData memory validatorDataMem = validator[\\n verifiedValidators[i]\\n ];\\n // verify validator's balance in beaconBlock.state.balances to the\\n // beaconBlock.state.balances container root\\n uint256 validatorBalanceGwei = IBeaconProofs(BEACON_PROOFS)\\n .verifyValidatorBalance(\\n balanceProofs.balancesContainerRoot,\\n balanceProofs.validatorBalanceLeaves[i],\\n balanceProofs.validatorBalanceProofs[i],\\n validatorDataMem.index\\n );\\n\\n // If the validator has exited and the balance is now zero\\n if (validatorBalanceGwei == 0) {\\n // Check if there are any pending deposits to this validator\\n bool depositPending = false;\\n for (uint256 j = 0; j < validatorHashesMem.length; j++) {\\n if (validatorHashesMem[j] == verifiedValidators[i]) {\\n depositPending = true;\\n break;\\n }\\n }\\n\\n // If validator has a pending deposit we can not remove due to\\n // the following situation:\\n // - validator has a pending deposit\\n // - validator has been slashed\\n // - sweep cycle has withdrawn all ETH from the validator. Balance is 0\\n // - beacon chain has processed the deposit and set the validator balance\\n // to deposit amount\\n // - if validator is no longer in the list of verifiedValidators its\\n // balance will not be considered and be under-counted.\\n if (!depositPending) {\\n // Store the validator state as exited\\n // This could have been in VERIFIED, ACTIVE or EXITING state\\n validator[verifiedValidators[i]].state = ValidatorState\\n .EXITED;\\n\\n // Remove the validator with a zero balance from the list of verified validators\\n\\n // Reduce the count of verified validators which is the last index before the pop removes it.\\n verifiedValidatorsCount -= 1;\\n\\n // Move the last validator that has already been verified to the current index.\\n // There's an extra SSTORE if i is the last active validator but that's fine,\\n // It's not a common case and the code is simpler this way.\\n verifiedValidators[i] = verifiedValidators[\\n verifiedValidatorsCount\\n ];\\n // Delete the last validator from the list\\n verifiedValidators.pop();\\n }\\n\\n // The validator balance is zero so not need to add to totalValidatorBalance\\n continue;\\n } else if (\\n validatorDataMem.state == ValidatorState.VERIFIED &&\\n validatorBalanceGwei > MIN_ACTIVATION_BALANCE_GWEI\\n ) {\\n // Store the validator state as active. This does not necessarily mean the\\n // validator is active on the beacon chain yet. It just means the validator has\\n // enough balance that it can become active.\\n validator[verifiedValidators[i]].state = ValidatorState\\n .ACTIVE;\\n }\\n\\n // convert Gwei balance to Wei and add to the total validator balance\\n totalValidatorBalance += validatorBalanceGwei * 1 gwei;\\n }\\n }\\n\\n uint256 totalDepositsWei = 0;\\n\\n // If there are no deposits then we can skip the deposit verification.\\n // This section is after the validator balance verifications so an exited validator will be marked\\n // as EXITED before the deposits are verified. If there was a deposit to an exited validator\\n // then the deposit can only be removed once the validator is fully exited.\\n // It is possible that validator fully exits and a postponed deposit to an exited validator increases\\n // its balance again. In such case the contract will erroneously consider a deposit applied before it\\n // has been applied on the beacon chain showing a smaller than real `totalValidatorBalance`.\\n if (depositsCount > 0) {\\n require(\\n pendingDepositProofs.pendingDepositProofs.length ==\\n depositsCount,\\n \\\"Invalid deposit proofs\\\"\\n );\\n require(\\n pendingDepositProofs.pendingDepositIndexes.length ==\\n depositsCount,\\n \\\"Invalid deposit indexes\\\"\\n );\\n\\n // Verify from the root of the pending deposit list container to the beacon block root\\n IBeaconProofs(BEACON_PROOFS).verifyPendingDepositsContainer(\\n balancesMem.blockRoot,\\n pendingDepositProofs.pendingDepositContainerRoot,\\n pendingDepositProofs.pendingDepositContainerProof\\n );\\n\\n // For each staking strategy's deposit.\\n for (uint256 i = 0; i < depositsCount; ++i) {\\n bytes32 pendingDepositRoot = depositList[i];\\n\\n // Verify the strategy's deposit is still pending on the beacon chain.\\n IBeaconProofs(BEACON_PROOFS).verifyPendingDeposit(\\n pendingDepositProofs.pendingDepositContainerRoot,\\n pendingDepositRoot,\\n pendingDepositProofs.pendingDepositProofs[i],\\n pendingDepositProofs.pendingDepositIndexes[i]\\n );\\n\\n // Convert the deposit amount from Gwei to Wei and add to the total\\n totalDepositsWei +=\\n uint256(deposits[pendingDepositRoot].amountGwei) *\\n 1 gwei;\\n }\\n }\\n\\n // Store the verified balance in storage\\n lastVerifiedEthBalance =\\n totalDepositsWei +\\n totalValidatorBalance +\\n balancesMem.ethBalance;\\n // Reset the last snap timestamp so a new snapBalances has to be made\\n snappedBalance.timestamp = 0;\\n\\n emit BalancesVerified(\\n balancesMem.timestamp,\\n totalDepositsWei,\\n totalValidatorBalance,\\n balancesMem.ethBalance\\n );\\n }\\n\\n // slither-disable-end reentrancy-no-eth\\n\\n /// @notice get a list of all validator hashes present in the pending deposits\\n /// list can have duplicate entries\\n function _getPendingDepositValidatorHashes(uint256 depositsCount)\\n internal\\n view\\n returns (bytes32[] memory validatorHashes)\\n {\\n validatorHashes = new bytes32[](depositsCount);\\n for (uint256 i = 0; i < depositsCount; i++) {\\n validatorHashes[i] = deposits[depositList[i]].pubKeyHash;\\n }\\n }\\n\\n /// @notice Hash a validator public key using the Beacon Chain's format\\n function _hashPubKey(bytes memory pubKey) internal pure returns (bytes32) {\\n require(pubKey.length == 48, \\\"Invalid public key\\\");\\n return sha256(abi.encodePacked(pubKey, bytes16(0)));\\n }\\n\\n /**\\n *\\n * WETH and ETH Accounting\\n *\\n */\\n\\n /// @dev Called when WETH is transferred out of the strategy so\\n /// the strategy knows how much WETH it has on deposit.\\n /// This is so it can emit the correct amount in the Deposit event in depositAll().\\n function _transferWeth(uint256 _amount, address _recipient) internal {\\n IERC20(WETH).safeTransfer(_recipient, _amount);\\n\\n // The min is required as more WETH can be withdrawn than deposited\\n // as the strategy earns consensus and execution rewards.\\n uint256 deductAmount = Math.min(_amount, depositedWethAccountedFor);\\n depositedWethAccountedFor -= deductAmount;\\n\\n // No change in ETH balance so no need to snapshot the balances\\n }\\n\\n /// @dev Converts ETH to WETH and updates the accounting.\\n /// @param _ethAmount The amount of ETH in wei.\\n function _convertEthToWeth(uint256 _ethAmount) internal {\\n // slither-disable-next-line arbitrary-send-eth\\n IWETH9(WETH).deposit{ value: _ethAmount }();\\n\\n depositedWethAccountedFor += _ethAmount;\\n\\n // Store the reduced ETH balance.\\n // The ETH balance in this strategy contract can be more than the last verified ETH balance\\n // due to partial withdrawals or full exits being processed by the beacon chain since the last snapBalances.\\n // It can also happen from execution rewards (MEV) or ETH donations.\\n lastVerifiedEthBalance -= Math.min(lastVerifiedEthBalance, _ethAmount);\\n\\n // The ETH balance was decreased to WETH so we need to invalidate the last balances snap.\\n snappedBalance.timestamp = 0;\\n }\\n\\n /// @dev Converts WETH to ETH and updates the accounting.\\n /// @param _wethAmount The amount of WETH in wei.\\n function _convertWethToEth(uint256 _wethAmount) internal {\\n IWETH9(WETH).withdraw(_wethAmount);\\n\\n uint256 deductAmount = Math.min(_wethAmount, depositedWethAccountedFor);\\n depositedWethAccountedFor -= deductAmount;\\n\\n // Store the increased ETH balance\\n lastVerifiedEthBalance += _wethAmount;\\n\\n // The ETH balance was increased from WETH so we need to invalidate the last balances snap.\\n snappedBalance.timestamp = 0;\\n }\\n\\n /**\\n *\\n * View Functions\\n *\\n */\\n\\n /// @notice Returns the number of deposits waiting to be verified as processed on the beacon chain,\\n /// or deposits that have been verified to an exiting validator and is now waiting for the\\n /// validator's balance to be swept.\\n function depositListLength() external view returns (uint256) {\\n return depositList.length;\\n }\\n\\n /// @notice Returns the number of verified validators.\\n function verifiedValidatorsLength() external view returns (uint256) {\\n return verifiedValidators.length;\\n }\\n}\\n\",\"keccak256\":\"0xd5dc081edc76b803180a32c2f36dea22ae1a9de06b236fcb328442c48ad7e6f1\",\"license\":\"BUSL-1.1\"},\"contracts/token/OUSD.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title OUSD Token Contract\\n * @dev ERC20 compatible contract for OUSD\\n * @dev Implements an elastic supply\\n * @author Origin Protocol Inc\\n */\\nimport { IVault } from \\\"../interfaces/IVault.sol\\\";\\nimport { Governable } from \\\"../governance/Governable.sol\\\";\\nimport { SafeCast } from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\n\\ncontract OUSD is Governable {\\n using SafeCast for int256;\\n using SafeCast for uint256;\\n\\n /// @dev Event triggered when the supply changes\\n /// @param totalSupply Updated token total supply\\n /// @param rebasingCredits Updated token rebasing credits\\n /// @param rebasingCreditsPerToken Updated token rebasing credits per token\\n event TotalSupplyUpdatedHighres(\\n uint256 totalSupply,\\n uint256 rebasingCredits,\\n uint256 rebasingCreditsPerToken\\n );\\n /// @dev Event triggered when an account opts in for rebasing\\n /// @param account Address of the account\\n event AccountRebasingEnabled(address account);\\n /// @dev Event triggered when an account opts out of rebasing\\n /// @param account Address of the account\\n event AccountRebasingDisabled(address account);\\n /// @dev Emitted when `value` tokens are moved from one account `from` to\\n /// another `to`.\\n /// @param from Address of the account tokens are moved from\\n /// @param to Address of the account tokens are moved to\\n /// @param value Amount of tokens transferred\\n event Transfer(address indexed from, address indexed to, uint256 value);\\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 /// @param owner Address of the owner approving allowance\\n /// @param spender Address of the spender allowance is granted to\\n /// @param value Amount of tokens spender can transfer\\n event Approval(\\n address indexed owner,\\n address indexed spender,\\n uint256 value\\n );\\n /// @dev Yield resulting from {changeSupply} that a `source` account would\\n /// receive is directed to `target` account.\\n /// @param source Address of the source forwarding the yield\\n /// @param target Address of the target receiving the yield\\n event YieldDelegated(address source, address target);\\n /// @dev Yield delegation from `source` account to the `target` account is\\n /// suspended.\\n /// @param source Address of the source suspending yield forwarding\\n /// @param target Address of the target no longer receiving yield from `source`\\n /// account\\n event YieldUndelegated(address source, address target);\\n\\n enum RebaseOptions {\\n NotSet,\\n StdNonRebasing,\\n StdRebasing,\\n YieldDelegationSource,\\n YieldDelegationTarget\\n }\\n\\n uint256[154] private _gap; // Slots to align with deployed contract\\n uint256 private constant MAX_SUPPLY = type(uint128).max;\\n /// @dev The amount of tokens in existence\\n uint256 public totalSupply;\\n mapping(address => mapping(address => uint256)) private allowances;\\n /// @dev The vault with privileges to execute {mint}, {burn}\\n /// and {changeSupply}\\n address public vaultAddress;\\n mapping(address => uint256) internal creditBalances;\\n // the 2 storage variables below need trailing underscores to not name collide with public functions\\n uint256 private rebasingCredits_; // Sum of all rebasing credits (creditBalances for rebasing accounts)\\n uint256 private rebasingCreditsPerToken_;\\n /// @dev The amount of tokens that are not rebasing - receiving yield\\n uint256 public nonRebasingSupply;\\n mapping(address => uint256) internal alternativeCreditsPerToken;\\n /// @dev A map of all addresses and their respective RebaseOptions\\n mapping(address => RebaseOptions) public rebaseState;\\n mapping(address => uint256) private __deprecated_isUpgraded;\\n /// @dev A map of addresses that have yields forwarded to. This is an\\n /// inverse mapping of {yieldFrom}\\n /// Key Account forwarding yield\\n /// Value Account receiving yield\\n mapping(address => address) public yieldTo;\\n /// @dev A map of addresses that are receiving the yield. This is an\\n /// inverse mapping of {yieldTo}\\n /// Key Account receiving yield\\n /// Value Account forwarding yield\\n mapping(address => address) public yieldFrom;\\n\\n uint256 private constant RESOLUTION_INCREASE = 1e9;\\n uint256[34] private __gap; // including below gap totals up to 200\\n\\n /// @dev Verifies that the caller is the Governor or Strategist.\\n modifier onlyGovernorOrStrategist() {\\n require(\\n isGovernor() || msg.sender == IVault(vaultAddress).strategistAddr(),\\n \\\"Caller is not the Strategist or Governor\\\"\\n );\\n _;\\n }\\n\\n /// @dev Initializes the contract and sets necessary variables.\\n /// @param _vaultAddress Address of the vault contract\\n /// @param _initialCreditsPerToken The starting rebasing credits per token.\\n function initialize(address _vaultAddress, uint256 _initialCreditsPerToken)\\n external\\n onlyGovernor\\n {\\n require(_vaultAddress != address(0), \\\"Zero vault address\\\");\\n require(vaultAddress == address(0), \\\"Already initialized\\\");\\n\\n rebasingCreditsPerToken_ = _initialCreditsPerToken;\\n vaultAddress = _vaultAddress;\\n }\\n\\n /// @dev Returns the symbol of the token, a shorter version\\n /// of the name.\\n function symbol() external pure virtual returns (string memory) {\\n return \\\"OUSD\\\";\\n }\\n\\n /// @dev Returns the name of the token.\\n function name() external pure virtual returns (string memory) {\\n return \\\"Origin Dollar\\\";\\n }\\n\\n /// @dev Returns the number of decimals used to get its user representation.\\n function decimals() external pure virtual returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev Verifies that the caller is the Vault contract\\n */\\n modifier onlyVault() {\\n require(vaultAddress == msg.sender, \\\"Caller is not the Vault\\\");\\n _;\\n }\\n\\n /**\\n * @return High resolution rebasingCreditsPerToken\\n */\\n function rebasingCreditsPerTokenHighres() external view returns (uint256) {\\n return rebasingCreditsPerToken_;\\n }\\n\\n /**\\n * @return Low resolution rebasingCreditsPerToken\\n */\\n function rebasingCreditsPerToken() external view returns (uint256) {\\n return rebasingCreditsPerToken_ / RESOLUTION_INCREASE;\\n }\\n\\n /**\\n * @return High resolution total number of rebasing credits\\n */\\n function rebasingCreditsHighres() external view returns (uint256) {\\n return rebasingCredits_;\\n }\\n\\n /**\\n * @return Low resolution total number of rebasing credits\\n */\\n function rebasingCredits() external view returns (uint256) {\\n return rebasingCredits_ / RESOLUTION_INCREASE;\\n }\\n\\n /**\\n * @notice Gets the balance of the specified address.\\n * @param _account Address to query the balance of.\\n * @return A uint256 representing the amount of base units owned by the\\n * specified address.\\n */\\n function balanceOf(address _account) public view returns (uint256) {\\n RebaseOptions state = rebaseState[_account];\\n if (state == RebaseOptions.YieldDelegationSource) {\\n // Saves a slot read when transferring to or from a yield delegating source\\n // since we know creditBalances equals the balance.\\n return creditBalances[_account];\\n }\\n uint256 baseBalance = (creditBalances[_account] * 1e18) /\\n _creditsPerToken(_account);\\n if (state == RebaseOptions.YieldDelegationTarget) {\\n // creditBalances of yieldFrom accounts equals token balances\\n return baseBalance - creditBalances[yieldFrom[_account]];\\n }\\n return baseBalance;\\n }\\n\\n /**\\n * @notice Gets the credits balance of the specified address.\\n * @dev Backwards compatible with old low res credits per token.\\n * @param _account The address to query the balance of.\\n * @return (uint256, uint256) Credit balance and credits per token of the\\n * address\\n */\\n function creditsBalanceOf(address _account)\\n external\\n view\\n returns (uint256, uint256)\\n {\\n uint256 cpt = _creditsPerToken(_account);\\n if (cpt == 1e27) {\\n // For a period before the resolution upgrade, we created all new\\n // contract accounts at high resolution. Since they are not changing\\n // as a result of this upgrade, we will return their true values\\n return (creditBalances[_account], cpt);\\n } else {\\n return (\\n creditBalances[_account] / RESOLUTION_INCREASE,\\n cpt / RESOLUTION_INCREASE\\n );\\n }\\n }\\n\\n /**\\n * @notice Gets the credits balance of the specified address.\\n * @param _account The address to query the balance of.\\n * @return (uint256, uint256, bool) Credit balance, credits per token of the\\n * address, and isUpgraded\\n */\\n function creditsBalanceOfHighres(address _account)\\n external\\n view\\n returns (\\n uint256,\\n uint256,\\n bool\\n )\\n {\\n return (\\n creditBalances[_account],\\n _creditsPerToken(_account),\\n true // all accounts have their resolution \\\"upgraded\\\"\\n );\\n }\\n\\n // Backwards compatible view\\n function nonRebasingCreditsPerToken(address _account)\\n external\\n view\\n returns (uint256)\\n {\\n return alternativeCreditsPerToken[_account];\\n }\\n\\n /**\\n * @notice Transfer tokens to a specified address.\\n * @param _to the address to transfer to.\\n * @param _value the amount to be transferred.\\n * @return true on success.\\n */\\n function transfer(address _to, uint256 _value) external returns (bool) {\\n require(_to != address(0), \\\"Transfer to zero address\\\");\\n\\n _executeTransfer(msg.sender, _to, _value);\\n\\n emit Transfer(msg.sender, _to, _value);\\n return true;\\n }\\n\\n /**\\n * @notice Transfer tokens from one address to another.\\n * @param _from The address you want to send tokens from.\\n * @param _to The address you want to transfer to.\\n * @param _value The amount of tokens to be transferred.\\n * @return true on success.\\n */\\n function transferFrom(\\n address _from,\\n address _to,\\n uint256 _value\\n ) external returns (bool) {\\n require(_to != address(0), \\\"Transfer to zero address\\\");\\n uint256 userAllowance = allowances[_from][msg.sender];\\n require(_value <= userAllowance, \\\"Allowance exceeded\\\");\\n\\n unchecked {\\n allowances[_from][msg.sender] = userAllowance - _value;\\n }\\n\\n _executeTransfer(_from, _to, _value);\\n\\n emit Transfer(_from, _to, _value);\\n return true;\\n }\\n\\n function _executeTransfer(\\n address _from,\\n address _to,\\n uint256 _value\\n ) internal {\\n (\\n int256 fromRebasingCreditsDiff,\\n int256 fromNonRebasingSupplyDiff\\n ) = _adjustAccount(_from, -_value.toInt256());\\n (\\n int256 toRebasingCreditsDiff,\\n int256 toNonRebasingSupplyDiff\\n ) = _adjustAccount(_to, _value.toInt256());\\n\\n _adjustGlobals(\\n fromRebasingCreditsDiff + toRebasingCreditsDiff,\\n fromNonRebasingSupplyDiff + toNonRebasingSupplyDiff\\n );\\n }\\n\\n function _adjustAccount(address _account, int256 _balanceChange)\\n internal\\n returns (int256 rebasingCreditsDiff, int256 nonRebasingSupplyDiff)\\n {\\n RebaseOptions state = rebaseState[_account];\\n int256 currentBalance = balanceOf(_account).toInt256();\\n if (currentBalance + _balanceChange < 0) {\\n revert(\\\"Transfer amount exceeds balance\\\");\\n }\\n uint256 newBalance = (currentBalance + _balanceChange).toUint256();\\n\\n if (state == RebaseOptions.YieldDelegationSource) {\\n address target = yieldTo[_account];\\n uint256 targetOldBalance = balanceOf(target);\\n uint256 targetNewCredits = _balanceToRebasingCredits(\\n targetOldBalance + newBalance\\n );\\n rebasingCreditsDiff =\\n targetNewCredits.toInt256() -\\n creditBalances[target].toInt256();\\n\\n creditBalances[_account] = newBalance;\\n creditBalances[target] = targetNewCredits;\\n } else if (state == RebaseOptions.YieldDelegationTarget) {\\n uint256 newCredits = _balanceToRebasingCredits(\\n newBalance + creditBalances[yieldFrom[_account]]\\n );\\n rebasingCreditsDiff =\\n newCredits.toInt256() -\\n creditBalances[_account].toInt256();\\n creditBalances[_account] = newCredits;\\n } else {\\n _autoMigrate(_account);\\n uint256 alternativeCreditsPerTokenMem = alternativeCreditsPerToken[\\n _account\\n ];\\n if (alternativeCreditsPerTokenMem > 0) {\\n nonRebasingSupplyDiff = _balanceChange;\\n if (alternativeCreditsPerTokenMem != 1e18) {\\n alternativeCreditsPerToken[_account] = 1e18;\\n }\\n creditBalances[_account] = newBalance;\\n } else {\\n uint256 newCredits = _balanceToRebasingCredits(newBalance);\\n rebasingCreditsDiff =\\n newCredits.toInt256() -\\n creditBalances[_account].toInt256();\\n creditBalances[_account] = newCredits;\\n }\\n }\\n }\\n\\n function _adjustGlobals(\\n int256 _rebasingCreditsDiff,\\n int256 _nonRebasingSupplyDiff\\n ) internal {\\n if (_rebasingCreditsDiff != 0) {\\n rebasingCredits_ = (rebasingCredits_.toInt256() +\\n _rebasingCreditsDiff).toUint256();\\n }\\n if (_nonRebasingSupplyDiff != 0) {\\n nonRebasingSupply = (nonRebasingSupply.toInt256() +\\n _nonRebasingSupplyDiff).toUint256();\\n }\\n }\\n\\n /**\\n * @notice Function to check the amount of tokens that _owner has allowed\\n * to `_spender`.\\n * @param _owner The address which owns the funds.\\n * @param _spender The address which will spend the funds.\\n * @return The number of tokens still available for the _spender.\\n */\\n function allowance(address _owner, address _spender)\\n external\\n view\\n returns (uint256)\\n {\\n return allowances[_owner][_spender];\\n }\\n\\n /**\\n * @notice Approve the passed address to spend the specified amount of\\n * tokens on behalf of msg.sender.\\n * @param _spender The address which will spend the funds.\\n * @param _value The amount of tokens to be spent.\\n * @return true on success.\\n */\\n function approve(address _spender, uint256 _value) external returns (bool) {\\n allowances[msg.sender][_spender] = _value;\\n emit Approval(msg.sender, _spender, _value);\\n return true;\\n }\\n\\n /**\\n * @notice Creates `_amount` tokens and assigns them to `_account`,\\n * increasing the total supply.\\n */\\n function mint(address _account, uint256 _amount) external onlyVault {\\n require(_account != address(0), \\\"Mint to the zero address\\\");\\n\\n // Account\\n (\\n int256 toRebasingCreditsDiff,\\n int256 toNonRebasingSupplyDiff\\n ) = _adjustAccount(_account, _amount.toInt256());\\n // Globals\\n _adjustGlobals(toRebasingCreditsDiff, toNonRebasingSupplyDiff);\\n totalSupply = totalSupply + _amount;\\n\\n require(totalSupply < MAX_SUPPLY, \\\"Max supply\\\");\\n emit Transfer(address(0), _account, _amount);\\n }\\n\\n /**\\n * @notice Destroys `_amount` tokens from `_account`,\\n * reducing the total supply.\\n */\\n function burn(address _account, uint256 _amount) external onlyVault {\\n require(_account != address(0), \\\"Burn from the zero address\\\");\\n if (_amount == 0) {\\n return;\\n }\\n\\n // Account\\n (\\n int256 toRebasingCreditsDiff,\\n int256 toNonRebasingSupplyDiff\\n ) = _adjustAccount(_account, -_amount.toInt256());\\n // Globals\\n _adjustGlobals(toRebasingCreditsDiff, toNonRebasingSupplyDiff);\\n totalSupply = totalSupply - _amount;\\n\\n emit Transfer(_account, address(0), _amount);\\n }\\n\\n /**\\n * @dev Get the credits per token for an account. Returns a fixed amount\\n * if the account is non-rebasing.\\n * @param _account Address of the account.\\n */\\n function _creditsPerToken(address _account)\\n internal\\n view\\n returns (uint256)\\n {\\n uint256 alternativeCreditsPerTokenMem = alternativeCreditsPerToken[\\n _account\\n ];\\n if (alternativeCreditsPerTokenMem != 0) {\\n return alternativeCreditsPerTokenMem;\\n } else {\\n return rebasingCreditsPerToken_;\\n }\\n }\\n\\n /**\\n * @dev Auto migrate contracts to be non rebasing,\\n * unless they have opted into yield.\\n * @param _account Address of the account.\\n */\\n function _autoMigrate(address _account) internal {\\n uint256 codeLen = _account.code.length;\\n bool isEOA = (codeLen == 0) ||\\n (codeLen == 23 && bytes3(_account.code) == 0xef0100);\\n // In previous code versions, contracts would not have had their\\n // rebaseState[_account] set to RebaseOptions.NonRebasing when migrated\\n // therefore we check the actual accounting used on the account as well.\\n if (\\n (!isEOA) &&\\n rebaseState[_account] == RebaseOptions.NotSet &&\\n alternativeCreditsPerToken[_account] == 0\\n ) {\\n _rebaseOptOut(_account);\\n }\\n }\\n\\n /**\\n * @dev Calculates credits from contract's global rebasingCreditsPerToken_, and\\n * also balance that corresponds to those credits. The latter is important\\n * when adjusting the contract's global nonRebasingSupply to circumvent any\\n * possible rounding errors.\\n *\\n * @param _balance Balance of the account.\\n */\\n function _balanceToRebasingCredits(uint256 _balance)\\n internal\\n view\\n returns (uint256 rebasingCredits)\\n {\\n // Rounds up, because we need to ensure that accounts always have\\n // at least the balance that they should have.\\n // Note this should always be used on an absolute account value,\\n // not on a possibly negative diff, because then the rounding would be wrong.\\n return ((_balance) * rebasingCreditsPerToken_ + 1e18 - 1) / 1e18;\\n }\\n\\n /**\\n * @notice The calling account will start receiving yield after a successful call.\\n * @param _account Address of the account.\\n */\\n function governanceRebaseOptIn(address _account) external onlyGovernor {\\n require(_account != address(0), \\\"Zero address not allowed\\\");\\n _rebaseOptIn(_account);\\n }\\n\\n /**\\n * @notice The calling account will start receiving yield after a successful call.\\n */\\n function rebaseOptIn() external {\\n _rebaseOptIn(msg.sender);\\n }\\n\\n function _rebaseOptIn(address _account) internal {\\n uint256 balance = balanceOf(_account);\\n\\n // prettier-ignore\\n require(\\n alternativeCreditsPerToken[_account] > 0 ||\\n // Accounts may explicitly `rebaseOptIn` regardless of\\n // accounting if they have a 0 balance.\\n creditBalances[_account] == 0\\n ,\\n \\\"Account must be non-rebasing\\\"\\n );\\n RebaseOptions state = rebaseState[_account];\\n // prettier-ignore\\n require(\\n state == RebaseOptions.StdNonRebasing ||\\n state == RebaseOptions.NotSet,\\n \\\"Only standard non-rebasing accounts can opt in\\\"\\n );\\n\\n uint256 newCredits = _balanceToRebasingCredits(balance);\\n\\n // Account\\n rebaseState[_account] = RebaseOptions.StdRebasing;\\n alternativeCreditsPerToken[_account] = 0;\\n creditBalances[_account] = newCredits;\\n // Globals\\n _adjustGlobals(newCredits.toInt256(), -balance.toInt256());\\n\\n emit AccountRebasingEnabled(_account);\\n }\\n\\n /**\\n * @notice The calling account will no longer receive yield\\n */\\n function rebaseOptOut() external {\\n _rebaseOptOut(msg.sender);\\n }\\n\\n function _rebaseOptOut(address _account) internal {\\n require(\\n alternativeCreditsPerToken[_account] == 0,\\n \\\"Account must be rebasing\\\"\\n );\\n RebaseOptions state = rebaseState[_account];\\n require(\\n state == RebaseOptions.StdRebasing || state == RebaseOptions.NotSet,\\n \\\"Only standard rebasing accounts can opt out\\\"\\n );\\n\\n uint256 oldCredits = creditBalances[_account];\\n uint256 balance = balanceOf(_account);\\n\\n // Account\\n rebaseState[_account] = RebaseOptions.StdNonRebasing;\\n alternativeCreditsPerToken[_account] = 1e18;\\n creditBalances[_account] = balance;\\n // Globals\\n _adjustGlobals(-oldCredits.toInt256(), balance.toInt256());\\n\\n emit AccountRebasingDisabled(_account);\\n }\\n\\n /**\\n * @notice Distribute yield to users. This changes the exchange rate\\n * between \\\"credits\\\" and OUSD tokens to change rebasing user's balances.\\n * @param _newTotalSupply New total supply of OUSD.\\n */\\n function changeSupply(uint256 _newTotalSupply) external onlyVault {\\n require(totalSupply > 0, \\\"Cannot increase 0 supply\\\");\\n\\n if (totalSupply == _newTotalSupply) {\\n emit TotalSupplyUpdatedHighres(\\n totalSupply,\\n rebasingCredits_,\\n rebasingCreditsPerToken_\\n );\\n return;\\n }\\n\\n totalSupply = _newTotalSupply > MAX_SUPPLY\\n ? MAX_SUPPLY\\n : _newTotalSupply;\\n\\n uint256 rebasingSupply = totalSupply - nonRebasingSupply;\\n // round up in the favour of the protocol\\n rebasingCreditsPerToken_ =\\n (rebasingCredits_ * 1e18 + rebasingSupply - 1) /\\n rebasingSupply;\\n\\n require(rebasingCreditsPerToken_ > 0, \\\"Invalid change in supply\\\");\\n\\n emit TotalSupplyUpdatedHighres(\\n totalSupply,\\n rebasingCredits_,\\n rebasingCreditsPerToken_\\n );\\n }\\n\\n /*\\n * @notice Send the yield from one account to another account.\\n * Each account keeps its own balances.\\n */\\n function delegateYield(address _from, address _to)\\n external\\n onlyGovernorOrStrategist\\n {\\n require(_from != address(0), \\\"Zero from address not allowed\\\");\\n require(_to != address(0), \\\"Zero to address not allowed\\\");\\n\\n require(_from != _to, \\\"Cannot delegate to self\\\");\\n require(\\n yieldFrom[_to] == address(0) &&\\n yieldTo[_to] == address(0) &&\\n yieldFrom[_from] == address(0) &&\\n yieldTo[_from] == address(0),\\n \\\"Blocked by existing yield delegation\\\"\\n );\\n RebaseOptions stateFrom = rebaseState[_from];\\n RebaseOptions stateTo = rebaseState[_to];\\n\\n require(\\n stateFrom == RebaseOptions.NotSet ||\\n stateFrom == RebaseOptions.StdNonRebasing ||\\n stateFrom == RebaseOptions.StdRebasing,\\n \\\"Invalid rebaseState from\\\"\\n );\\n\\n require(\\n stateTo == RebaseOptions.NotSet ||\\n stateTo == RebaseOptions.StdNonRebasing ||\\n stateTo == RebaseOptions.StdRebasing,\\n \\\"Invalid rebaseState to\\\"\\n );\\n\\n if (alternativeCreditsPerToken[_from] == 0) {\\n _rebaseOptOut(_from);\\n }\\n if (alternativeCreditsPerToken[_to] > 0) {\\n _rebaseOptIn(_to);\\n }\\n\\n uint256 fromBalance = balanceOf(_from);\\n uint256 toBalance = balanceOf(_to);\\n uint256 oldToCredits = creditBalances[_to];\\n uint256 newToCredits = _balanceToRebasingCredits(\\n fromBalance + toBalance\\n );\\n\\n // Set up the bidirectional links\\n yieldTo[_from] = _to;\\n yieldFrom[_to] = _from;\\n\\n // Local\\n rebaseState[_from] = RebaseOptions.YieldDelegationSource;\\n alternativeCreditsPerToken[_from] = 1e18;\\n creditBalances[_from] = fromBalance;\\n rebaseState[_to] = RebaseOptions.YieldDelegationTarget;\\n creditBalances[_to] = newToCredits;\\n\\n // Global\\n int256 creditsChange = newToCredits.toInt256() -\\n oldToCredits.toInt256();\\n _adjustGlobals(creditsChange, -(fromBalance).toInt256());\\n emit YieldDelegated(_from, _to);\\n }\\n\\n /*\\n * @notice Stop sending the yield from one account to another account.\\n */\\n function undelegateYield(address _from) external onlyGovernorOrStrategist {\\n // Require a delegation, which will also ensure a valid delegation\\n require(yieldTo[_from] != address(0), \\\"Zero address not allowed\\\");\\n\\n address to = yieldTo[_from];\\n uint256 fromBalance = balanceOf(_from);\\n uint256 toBalance = balanceOf(to);\\n uint256 oldToCredits = creditBalances[to];\\n uint256 newToCredits = _balanceToRebasingCredits(toBalance);\\n\\n // Remove the bidirectional links\\n yieldFrom[to] = address(0);\\n yieldTo[_from] = address(0);\\n\\n // Local\\n rebaseState[_from] = RebaseOptions.StdNonRebasing;\\n // alternativeCreditsPerToken[from] already 1e18 from `delegateYield()`\\n creditBalances[_from] = fromBalance;\\n rebaseState[to] = RebaseOptions.StdRebasing;\\n // alternativeCreditsPerToken[to] already 0 from `delegateYield()`\\n creditBalances[to] = newToCredits;\\n\\n // Global\\n int256 creditsChange = newToCredits.toInt256() -\\n oldToCredits.toInt256();\\n _adjustGlobals(creditsChange, fromBalance.toInt256());\\n emit YieldUndelegated(_from, to);\\n }\\n}\\n\",\"keccak256\":\"0x73439bef6569f5adf6f5ce2cb54a5f0d3109d4819457532236e172a7091980a9\",\"license\":\"BUSL-1.1\"},\"contracts/utils/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\nimport { IBasicToken } from \\\"../interfaces/IBasicToken.sol\\\";\\n\\nlibrary Helpers {\\n /**\\n * @notice Fetch the `symbol()` from an ERC20 token\\n * @dev Grabs the `symbol()` from a contract\\n * @param _token Address of the ERC20 token\\n * @return string Symbol of the ERC20 token\\n */\\n function getSymbol(address _token) internal view returns (string memory) {\\n string memory symbol = IBasicToken(_token).symbol();\\n return symbol;\\n }\\n\\n /**\\n * @notice Fetch the `decimals()` from an ERC20 token\\n * @dev Grabs the `decimals()` from a contract and fails if\\n * the decimal value does not live within a certain range\\n * @param _token Address of the ERC20 token\\n * @return uint256 Decimals of the ERC20 token\\n */\\n function getDecimals(address _token) internal view returns (uint256) {\\n uint256 decimals = IBasicToken(_token).decimals();\\n require(\\n decimals >= 4 && decimals <= 18,\\n \\\"Token must have sufficient decimal places\\\"\\n );\\n\\n return decimals;\\n }\\n}\\n\",\"keccak256\":\"0x4366f8d90b34c1eef8bbaaf369b1e5cd59f04027bb3c111f208eaee65bbc0346\",\"license\":\"BUSL-1.1\"},\"contracts/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Base contract any contracts that need to initialize state after deployment.\\n * @author Origin Protocol Inc\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n require(\\n initializing || !initialized,\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n\\n bool isTopLevelCall = !initializing;\\n if (isTopLevelCall) {\\n initializing = true;\\n initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n initializing = false;\\n }\\n }\\n\\n uint256[50] private ______gap;\\n}\\n\",\"keccak256\":\"0x50d39ebf38a3d3111f2b77a6c75ece1d4ae731552fec4697ab16fcf6c0d4d5e8\",\"license\":\"BUSL-1.1\"},\"contracts/utils/InitializableAbstractStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Base contract for vault strategies.\\n * @author Origin Protocol Inc\\n */\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\nimport { Initializable } from \\\"../utils/Initializable.sol\\\";\\nimport { Governable } from \\\"../governance/Governable.sol\\\";\\nimport { IVault } from \\\"../interfaces/IVault.sol\\\";\\n\\nabstract contract InitializableAbstractStrategy is Initializable, Governable {\\n using SafeERC20 for IERC20;\\n\\n event PTokenAdded(address indexed _asset, address _pToken);\\n event PTokenRemoved(address indexed _asset, address _pToken);\\n event Deposit(address indexed _asset, address _pToken, uint256 _amount);\\n event Withdrawal(address indexed _asset, address _pToken, uint256 _amount);\\n event RewardTokenCollected(\\n address recipient,\\n address rewardToken,\\n uint256 amount\\n );\\n event RewardTokenAddressesUpdated(\\n address[] _oldAddresses,\\n address[] _newAddresses\\n );\\n event HarvesterAddressesUpdated(\\n address _oldHarvesterAddress,\\n address _newHarvesterAddress\\n );\\n\\n /// @notice Address of the underlying platform\\n address public immutable platformAddress;\\n /// @notice Address of the OToken vault\\n address public immutable vaultAddress;\\n\\n /// @dev Replaced with an immutable variable\\n // slither-disable-next-line constable-states\\n address private _deprecated_platformAddress;\\n\\n /// @dev Replaced with an immutable\\n // slither-disable-next-line constable-states\\n address private _deprecated_vaultAddress;\\n\\n /// @notice asset => pToken (Platform Specific Token Address)\\n mapping(address => address) public assetToPToken;\\n\\n /// @notice Full list of all assets supported by the strategy\\n address[] internal assetsMapped;\\n\\n // Deprecated: Reward token address\\n // slither-disable-next-line constable-states\\n address private _deprecated_rewardTokenAddress;\\n\\n // Deprecated: now resides in Harvester's rewardTokenConfigs\\n // slither-disable-next-line constable-states\\n uint256 private _deprecated_rewardLiquidationThreshold;\\n\\n /// @notice Address of the Harvester contract allowed to collect reward tokens\\n address public harvesterAddress;\\n\\n /// @notice Address of the reward tokens. eg CRV, BAL, CVX, AURA\\n address[] public rewardTokenAddresses;\\n\\n /* Reserved for future expansion. Used to be 100 storage slots\\n * and has decreased to accommodate:\\n * - harvesterAddress\\n * - rewardTokenAddresses\\n */\\n int256[98] private _reserved;\\n\\n struct BaseStrategyConfig {\\n address platformAddress; // Address of the underlying platform\\n address vaultAddress; // Address of the OToken's Vault\\n }\\n\\n /**\\n * @dev Verifies that the caller is the Governor or Strategist.\\n */\\n modifier onlyGovernorOrStrategist() {\\n require(\\n isGovernor() || msg.sender == IVault(vaultAddress).strategistAddr(),\\n \\\"Caller is not the Strategist or Governor\\\"\\n );\\n _;\\n }\\n\\n /**\\n * @param _config The platform and OToken vault addresses\\n */\\n constructor(BaseStrategyConfig memory _config) {\\n platformAddress = _config.platformAddress;\\n vaultAddress = _config.vaultAddress;\\n }\\n\\n /**\\n * @dev Internal initialize function, to set up initial internal state\\n * @param _rewardTokenAddresses Address of reward token for platform\\n * @param _assets Addresses of initial supported assets\\n * @param _pTokens Platform Token corresponding addresses\\n */\\n function _initialize(\\n address[] memory _rewardTokenAddresses,\\n address[] memory _assets,\\n address[] memory _pTokens\\n ) internal {\\n rewardTokenAddresses = _rewardTokenAddresses;\\n\\n uint256 assetCount = _assets.length;\\n require(assetCount == _pTokens.length, \\\"Invalid input arrays\\\");\\n for (uint256 i = 0; i < assetCount; ++i) {\\n _setPTokenAddress(_assets[i], _pTokens[i]);\\n }\\n }\\n\\n /**\\n * @notice Collect accumulated reward token and send to Vault.\\n */\\n function collectRewardTokens() external virtual onlyHarvester nonReentrant {\\n _collectRewardTokens();\\n }\\n\\n /**\\n * @dev Default implementation that transfers reward tokens to the Harvester\\n * Implementing strategies need to add custom logic to collect the rewards.\\n */\\n function _collectRewardTokens() internal virtual {\\n uint256 rewardTokenCount = rewardTokenAddresses.length;\\n for (uint256 i = 0; i < rewardTokenCount; ++i) {\\n IERC20 rewardToken = IERC20(rewardTokenAddresses[i]);\\n uint256 balance = rewardToken.balanceOf(address(this));\\n if (balance > 0) {\\n emit RewardTokenCollected(\\n harvesterAddress,\\n address(rewardToken),\\n balance\\n );\\n rewardToken.safeTransfer(harvesterAddress, balance);\\n }\\n }\\n }\\n\\n /**\\n * @dev Verifies that the caller is the Vault.\\n */\\n modifier onlyVault() {\\n require(msg.sender == vaultAddress, \\\"Caller is not the Vault\\\");\\n _;\\n }\\n\\n /**\\n * @dev Verifies that the caller is the Harvester.\\n */\\n modifier onlyHarvester() {\\n require(msg.sender == harvesterAddress, \\\"Caller is not the Harvester\\\");\\n _;\\n }\\n\\n /**\\n * @dev Verifies that the caller is the Vault or Governor.\\n */\\n modifier onlyVaultOrGovernor() {\\n require(\\n msg.sender == vaultAddress || msg.sender == governor(),\\n \\\"Caller is not the Vault or Governor\\\"\\n );\\n _;\\n }\\n\\n /**\\n * @dev Verifies that the caller is the Vault, Governor, or Strategist.\\n */\\n modifier onlyVaultOrGovernorOrStrategist() {\\n require(\\n msg.sender == vaultAddress ||\\n msg.sender == governor() ||\\n msg.sender == IVault(vaultAddress).strategistAddr(),\\n \\\"Caller is not the Vault, Governor, or Strategist\\\"\\n );\\n _;\\n }\\n\\n /**\\n * @notice Set the reward token addresses. Any old addresses will be overwritten.\\n * @param _rewardTokenAddresses Array of reward token addresses\\n */\\n function setRewardTokenAddresses(address[] calldata _rewardTokenAddresses)\\n external\\n onlyGovernor\\n {\\n uint256 rewardTokenCount = _rewardTokenAddresses.length;\\n for (uint256 i = 0; i < rewardTokenCount; ++i) {\\n require(\\n _rewardTokenAddresses[i] != address(0),\\n \\\"Can not set an empty address as a reward token\\\"\\n );\\n }\\n\\n emit RewardTokenAddressesUpdated(\\n rewardTokenAddresses,\\n _rewardTokenAddresses\\n );\\n rewardTokenAddresses = _rewardTokenAddresses;\\n }\\n\\n /**\\n * @notice Get the reward token addresses.\\n * @return address[] the reward token addresses.\\n */\\n function getRewardTokenAddresses()\\n external\\n view\\n returns (address[] memory)\\n {\\n return rewardTokenAddresses;\\n }\\n\\n /**\\n * @notice Provide support for asset by passing its pToken address.\\n * This method can only be called by the system Governor\\n * @param _asset Address for the asset\\n * @param _pToken Address for the corresponding platform token\\n */\\n function setPTokenAddress(address _asset, address _pToken)\\n external\\n virtual\\n onlyGovernor\\n {\\n _setPTokenAddress(_asset, _pToken);\\n }\\n\\n /**\\n * @notice Remove a supported asset by passing its index.\\n * This method can only be called by the system Governor\\n * @param _assetIndex Index of the asset to be removed\\n */\\n function removePToken(uint256 _assetIndex) external virtual onlyGovernor {\\n require(_assetIndex < assetsMapped.length, \\\"Invalid index\\\");\\n address asset = assetsMapped[_assetIndex];\\n address pToken = assetToPToken[asset];\\n\\n if (_assetIndex < assetsMapped.length - 1) {\\n assetsMapped[_assetIndex] = assetsMapped[assetsMapped.length - 1];\\n }\\n assetsMapped.pop();\\n assetToPToken[asset] = address(0);\\n\\n emit PTokenRemoved(asset, pToken);\\n }\\n\\n /**\\n * @notice Provide support for asset by passing its pToken address.\\n * Add to internal mappings and execute the platform specific,\\n * abstract method `_abstractSetPToken`\\n * @param _asset Address for the asset\\n * @param _pToken Address for the corresponding platform token\\n */\\n function _setPTokenAddress(address _asset, address _pToken) internal {\\n require(assetToPToken[_asset] == address(0), \\\"pToken already set\\\");\\n require(\\n _asset != address(0) && _pToken != address(0),\\n \\\"Invalid addresses\\\"\\n );\\n\\n assetToPToken[_asset] = _pToken;\\n assetsMapped.push(_asset);\\n\\n emit PTokenAdded(_asset, _pToken);\\n\\n _abstractSetPToken(_asset, _pToken);\\n }\\n\\n /**\\n * @notice Transfer token to governor. Intended for recovering tokens stuck in\\n * strategy contracts, i.e. mistaken sends.\\n * @param _asset Address for the asset\\n * @param _amount Amount of the asset to transfer\\n */\\n function transferToken(address _asset, uint256 _amount)\\n public\\n virtual\\n onlyGovernor\\n {\\n require(!supportsAsset(_asset), \\\"Cannot transfer supported asset\\\");\\n IERC20(_asset).safeTransfer(governor(), _amount);\\n }\\n\\n /**\\n * @notice Set the Harvester contract that can collect rewards.\\n * @param _harvesterAddress Address of the harvester contract.\\n */\\n function setHarvesterAddress(address _harvesterAddress)\\n external\\n onlyGovernor\\n {\\n emit HarvesterAddressesUpdated(harvesterAddress, _harvesterAddress);\\n harvesterAddress = _harvesterAddress;\\n }\\n\\n /***************************************\\n Abstract\\n ****************************************/\\n\\n function _abstractSetPToken(address _asset, address _pToken)\\n internal\\n virtual;\\n\\n function safeApproveAllTokens() external virtual;\\n\\n /**\\n * @notice Deposit an amount of assets into the platform\\n * @param _asset Address for the asset\\n * @param _amount Units of asset to deposit\\n */\\n function deposit(address _asset, uint256 _amount) external virtual;\\n\\n /**\\n * @notice Deposit all supported assets in this strategy contract to the platform\\n */\\n function depositAll() external virtual;\\n\\n /**\\n * @notice Withdraw an `amount` of assets from the platform and\\n * send to the `_recipient`.\\n * @param _recipient Address to which the asset should be sent\\n * @param _asset Address of the asset\\n * @param _amount Units of asset to withdraw\\n */\\n function withdraw(\\n address _recipient,\\n address _asset,\\n uint256 _amount\\n ) external virtual;\\n\\n /**\\n * @notice Withdraw all supported assets from platform and\\n * sends to the OToken's Vault.\\n */\\n function withdrawAll() external virtual;\\n\\n /**\\n * @notice Get the total asset value held in the platform.\\n * This includes any interest that was generated since depositing.\\n * @param _asset Address of the asset\\n * @return balance Total value of the asset in the platform\\n */\\n function checkBalance(address _asset)\\n external\\n view\\n virtual\\n returns (uint256 balance);\\n\\n /**\\n * @notice Check if an asset is supported.\\n * @param _asset Address of the asset\\n * @return bool Whether asset is supported\\n */\\n function supportsAsset(address _asset) public view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x0160d435384d75e8764f4a916764ba47c87fda46872ca5900d46e5e80e956ff9\",\"license\":\"BUSL-1.1\"},\"contracts/vault/VaultStorage.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title OToken VaultStorage contract\\n * @notice The VaultStorage contract defines the storage for the Vault contracts\\n * @author Origin Protocol Inc\\n */\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { Address } from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport { IStrategy } from \\\"../interfaces/IStrategy.sol\\\";\\nimport { Governable } from \\\"../governance/Governable.sol\\\";\\nimport { OUSD } from \\\"../token/OUSD.sol\\\";\\nimport { Initializable } from \\\"../utils/Initializable.sol\\\";\\nimport \\\"../utils/Helpers.sol\\\";\\n\\ncontract VaultStorage is Initializable, Governable {\\n using SafeERC20 for IERC20;\\n\\n event AssetSupported(address _asset);\\n event AssetRemoved(address _asset);\\n event AssetDefaultStrategyUpdated(address _asset, address _strategy);\\n event AssetAllocated(address _asset, address _strategy, uint256 _amount);\\n event StrategyApproved(address _addr);\\n event StrategyRemoved(address _addr);\\n event Mint(address _addr, uint256 _value);\\n event Redeem(address _addr, uint256 _value);\\n event CapitalPaused();\\n event CapitalUnpaused();\\n event RebasePaused();\\n event RebaseUnpaused();\\n event VaultBufferUpdated(uint256 _vaultBuffer);\\n event OusdMetaStrategyUpdated(address _ousdMetaStrategy);\\n event RedeemFeeUpdated(uint256 _redeemFeeBps);\\n event PriceProviderUpdated(address _priceProvider);\\n event AllocateThresholdUpdated(uint256 _threshold);\\n event RebaseThresholdUpdated(uint256 _threshold);\\n event StrategistUpdated(address _address);\\n event MaxSupplyDiffChanged(uint256 maxSupplyDiff);\\n event YieldDistribution(address _to, uint256 _yield, uint256 _fee);\\n event TrusteeFeeBpsChanged(uint256 _basis);\\n event TrusteeAddressChanged(address _address);\\n event NetOusdMintForStrategyThresholdChanged(uint256 _threshold);\\n event SwapperChanged(address _address);\\n event SwapAllowedUndervalueChanged(uint256 _basis);\\n event SwapSlippageChanged(address _asset, uint256 _basis);\\n event Swapped(\\n address indexed _fromAsset,\\n address indexed _toAsset,\\n uint256 _fromAssetAmount,\\n uint256 _toAssetAmount\\n );\\n event StrategyAddedToMintWhitelist(address indexed strategy);\\n event StrategyRemovedFromMintWhitelist(address indexed strategy);\\n event RebasePerSecondMaxChanged(uint256 rebaseRatePerSecond);\\n event DripDurationChanged(uint256 dripDuration);\\n event WithdrawalRequested(\\n address indexed _withdrawer,\\n uint256 indexed _requestId,\\n uint256 _amount,\\n uint256 _queued\\n );\\n event WithdrawalClaimed(\\n address indexed _withdrawer,\\n uint256 indexed _requestId,\\n uint256 _amount\\n );\\n event WithdrawalClaimable(uint256 _claimable, uint256 _newClaimable);\\n event WithdrawalClaimDelayUpdated(uint256 _newDelay);\\n\\n // Since we are proxy, all state should be uninitalized.\\n // Since this storage contract does not have logic directly on it\\n // we should not be checking for to see if these variables can be constant.\\n // slither-disable-start uninitialized-state\\n // slither-disable-start constable-states\\n\\n // Assets supported by the Vault, i.e. Stablecoins\\n enum UnitConversion {\\n DECIMALS,\\n GETEXCHANGERATE\\n }\\n // Changed to fit into a single storage slot so the decimals needs to be recached\\n struct Asset {\\n // Note: OETHVaultCore doesn't use `isSupported` when minting,\\n // redeeming or checking balance of assets.\\n bool isSupported;\\n UnitConversion unitConversion;\\n uint8 decimals;\\n // Max allowed slippage from the Oracle price when swapping collateral assets in basis points.\\n // For example 40 == 0.4% slippage\\n uint16 allowedOracleSlippageBps;\\n }\\n\\n /// @dev mapping of supported vault assets to their configuration\\n mapping(address => Asset) internal assets;\\n /// @dev list of all assets supported by the vault.\\n address[] internal allAssets;\\n\\n // Strategies approved for use by the Vault\\n struct Strategy {\\n bool isSupported;\\n uint256 _deprecated; // Deprecated storage slot\\n }\\n /// @dev mapping of strategy contracts to their configuration\\n mapping(address => Strategy) public strategies;\\n /// @dev list of all vault strategies\\n address[] internal allStrategies;\\n\\n /// @notice Address of the Oracle price provider contract\\n address public priceProvider;\\n /// @notice pause rebasing if true\\n bool public rebasePaused;\\n /// @notice pause operations that change the OToken supply.\\n /// eg mint, redeem, allocate, mint/burn for strategy\\n bool public capitalPaused;\\n /// @notice Redemption fee in basis points. eg 50 = 0.5%\\n uint256 public redeemFeeBps;\\n /// @notice Percentage of assets to keep in Vault to handle (most) withdrawals. 100% = 1e18.\\n uint256 public vaultBuffer;\\n /// @notice OToken mints over this amount automatically allocate funds. 18 decimals.\\n uint256 public autoAllocateThreshold;\\n /// @notice OToken mints over this amount automatically rebase. 18 decimals.\\n uint256 public rebaseThreshold;\\n\\n /// @dev Address of the OToken token. eg OUSD or OETH.\\n OUSD public oUSD;\\n\\n /// @dev Storage slot for the address of the VaultAdmin contract that is delegated to\\n // keccak256(\\\"OUSD.vault.governor.admin.impl\\\");\\n bytes32 public constant adminImplPosition =\\n 0xa2bd3d3cf188a41358c8b401076eb59066b09dec5775650c0de4c55187d17bd9;\\n\\n /// @dev Address of the contract responsible for post rebase syncs with AMMs\\n address private _deprecated_rebaseHooksAddr = address(0);\\n\\n /// @dev Deprecated: Address of Uniswap\\n address private _deprecated_uniswapAddr = address(0);\\n\\n /// @notice Address of the Strategist\\n address public strategistAddr = address(0);\\n\\n /// @notice Mapping of asset address to the Strategy that they should automatically\\n // be allocated to\\n mapping(address => address) public assetDefaultStrategies;\\n\\n /// @notice Max difference between total supply and total value of assets. 18 decimals.\\n uint256 public maxSupplyDiff;\\n\\n /// @notice Trustee contract that can collect a percentage of yield\\n address public trusteeAddress;\\n\\n /// @notice Amount of yield collected in basis points. eg 2000 = 20%\\n uint256 public trusteeFeeBps;\\n\\n /// @dev Deprecated: Tokens that should be swapped for stablecoins\\n address[] private _deprecated_swapTokens;\\n\\n uint256 constant MINT_MINIMUM_UNIT_PRICE = 0.998e18;\\n\\n /// @notice Metapool strategy that is allowed to mint/burn OTokens without changing collateral\\n\\n address public ousdMetaStrategy;\\n\\n /// @notice How much OTokens are currently minted by the strategy\\n int256 public netOusdMintedForStrategy;\\n\\n /// @notice How much net total OTokens are allowed to be minted by all strategies\\n uint256 public netOusdMintForStrategyThreshold;\\n\\n uint256 constant MIN_UNIT_PRICE_DRIFT = 0.7e18;\\n uint256 constant MAX_UNIT_PRICE_DRIFT = 1.3e18;\\n\\n /// @notice Collateral swap configuration.\\n /// @dev is packed into a single storage slot to save gas.\\n struct SwapConfig {\\n // Contract that swaps the vault's collateral assets\\n address swapper;\\n // Max allowed percentage the total value can drop below the total supply in basis points.\\n // For example 100 == 1%\\n uint16 allowedUndervalueBps;\\n }\\n SwapConfig internal swapConfig = SwapConfig(address(0), 0);\\n\\n // List of strategies that can mint oTokens directly\\n // Used in OETHBaseVaultCore\\n mapping(address => bool) public isMintWhitelistedStrategy;\\n\\n /// @notice Address of the Dripper contract that streams harvested rewards to the Vault\\n /// @dev The vault is proxied so needs to be set with setDripper against the proxy contract.\\n address private _deprecated_dripper;\\n\\n /// Withdrawal Queue Storage /////\\n\\n struct WithdrawalQueueMetadata {\\n // cumulative total of all withdrawal requests included the ones that have already been claimed\\n uint128 queued;\\n // cumulative total of all the requests that can be claimed including the ones that have already been claimed\\n uint128 claimable;\\n // total of all the requests that have been claimed\\n uint128 claimed;\\n // index of the next withdrawal request starting at 0\\n uint128 nextWithdrawalIndex;\\n }\\n\\n /// @notice Global metadata for the withdrawal queue including:\\n /// queued - cumulative total of all withdrawal requests included the ones that have already been claimed\\n /// claimable - cumulative total of all the requests that can be claimed including the ones already claimed\\n /// claimed - total of all the requests that have been claimed\\n /// nextWithdrawalIndex - index of the next withdrawal request starting at 0\\n WithdrawalQueueMetadata public withdrawalQueueMetadata;\\n\\n struct WithdrawalRequest {\\n address withdrawer;\\n bool claimed;\\n uint40 timestamp; // timestamp of the withdrawal request\\n // Amount of oTokens to redeem. eg OETH\\n uint128 amount;\\n // cumulative total of all withdrawal requests including this one.\\n // this request can be claimed when this queued amount is less than or equal to the queue's claimable amount.\\n uint128 queued;\\n }\\n\\n /// @notice Mapping of withdrawal request indices to the user withdrawal request data\\n mapping(uint256 => WithdrawalRequest) public withdrawalRequests;\\n\\n /// @notice Sets a minimum delay that is required to elapse between\\n /// requesting async withdrawals and claiming the request.\\n /// When set to 0 async withdrawals are disabled.\\n uint256 public withdrawalClaimDelay;\\n\\n /// @notice Time in seconds that the vault last rebased yield.\\n uint64 public lastRebase;\\n\\n /// @notice Automatic rebase yield calculations. In seconds. Set to 0 or 1 to disable.\\n uint64 public dripDuration;\\n\\n /// @notice max rebase percentage per second\\n /// Can be used to set maximum yield of the protocol,\\n /// spreading out yield over time\\n uint64 public rebasePerSecondMax;\\n\\n /// @notice target rebase rate limit, based on past rates and funds available.\\n uint64 public rebasePerSecondTarget;\\n\\n uint256 internal constant MAX_REBASE = 0.02 ether;\\n uint256 internal constant MAX_REBASE_PER_SECOND =\\n uint256(0.05 ether) / 1 days;\\n\\n // For future use\\n uint256[43] private __gap;\\n\\n // slither-disable-end constable-states\\n // slither-disable-end uninitialized-state\\n\\n /**\\n * @notice set the implementation for the admin, this needs to be in a base class else we cannot set it\\n * @param newImpl address of the implementation\\n */\\n function setAdminImpl(address newImpl) external onlyGovernor {\\n require(\\n Address.isContract(newImpl),\\n \\\"new implementation is not a contract\\\"\\n );\\n bytes32 position = adminImplPosition;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(position, newImpl)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe8c1056879e4d67e0085a30a525a4cb23b954ade0f22fce502278f35b9c69d3b\",\"license\":\"BUSL-1.1\"}},\"version\":1}", + "bytecode": "0x6101a060405234801561001157600080fd5b506040516163f03803806163f0833981016040819052610030916101ac565b60208701516033805460ff191690556001600160a01b0380881660805280851660a05280861660c05280821660e0528316610100526001600160401b03821661012081905288918891869088908790879042116100d35760405162461bcd60e51b815260206004820152601960248201527f496e76616c69642067656e657369732074696d657374616d7000000000000000604482015260640160405180910390fd5b505084516001600160a01b0390811661014052602090950151851661016052505050508516610180526101066000610112565b50505050505050610289565b6001600160a01b0381166101326000805160206163d08339815191525490565b6001600160a01b03167fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a60405160405180910390a36000805160206163d083398151915255565b80516001600160a01b038116811461019057600080fd5b919050565b80516001600160401b038116811461019057600080fd5b60008060008060008060008789036101008112156101c957600080fd5b60408112156101d757600080fd5b50604080519081016001600160401b038111828210171561020857634e487b7160e01b600052604160045260246000fd5b60405261021489610179565b815261022260208a01610179565b6020820152965061023560408901610179565b955061024360608901610179565b945061025160808901610179565b935061025f60a08901610179565b925061026d60c08901610179565b915061027b60e08901610195565b905092959891949750929550565b60805160a05160c05160e0516101005161012051610140516101605161018051615ffa6103d66000396000818161035a01526134b6015260008181610528015281816122b4015281816131b001528181613328015281816139c501528181613a6c01526145d8015260006109bf015260008181611f360152613cb601526000818161073201528181610d9801528181610e3c015281816112dd015281816114100152818161179d0152818161185a01528181611f800152612b670152600050506000818161305d0152818161348601528181613561015261370f015260006121c00152600081816108680152818161110701528181611b7e01528181612353015281816128aa0152818161290e0152818161329e0152818161396b01528181613b2101528181613bcc015281816140a90152818161467f01528181614aa30152614b700152615ffa6000f3fe6080604052600436106102e85760003560e01c80636e811d3811610190578063b6e2b520116100dc578063d38bfff411610095578063dbe55e561161006f578063dbe55e56146109ad578063de5f6268146109e1578063f6ca71b0146109f6578063f7b188a514610a1857600080fd5b8063d38bfff414610958578063d79e403214610978578063d9caed121461098d57600080fd5b8063b6e2b520146108ad578063b8ec6678146108cd578063bb1b918d146108ed578063c2e1e3f41461090d578063c7af33521461092d578063d059f6ef1461094257600080fd5b806387bae8671161014957806398245f1b1161012357806398245f1b146107de578063a5f5be541461082a578063aa388af61461084b578063ad1728cb1461089857600080fd5b806387bae8671461077e5780639136616a146107a357806396d538bb146107be57600080fd5b80636e811d38146106c057806371a735f3146106e05780637b2d9b2c146107005780637da9982a146107205780638456cb5914610754578063853828b61461076957600080fd5b80634583ef101161024f5780635a063f63116102085780635f515226116101e25780635f5152261461064b57806367c7066c1461066b5780636874469d1461068b5780636c341d1a146106a057600080fd5b80635a063f63146105fd5780635c975abb146106125780635d36b1901461063657600080fd5b80634583ef101461056a57806347e7ef241461058a5780634896b31a146105aa5780634c84e6f8146105bf578063522e4245146105d457806359ff4158146105e757600080fd5b80631072cbea116102a15780631072cbea146104005780631a1a15711461042057806325e2e9f3146104405780633d4dff7b146104a2578063430bf08a14610516578063435356d11461054a57600080fd5b80630c340a24146102f45780630d304174146103265780630df1ecfd146103485780630ed57b3a1461037c5780630ef998551461039c5780630fc3b4c4146103ca57600080fd5b366102ef57005b600080fd5b34801561030057600080fd5b50610309610a2d565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561033257600080fd5b50610346610341366004614dc5565b610a4a565b005b34801561035457600080fd5b506103097f000000000000000000000000000000000000000000000000000000000000000081565b34801561038857600080fd5b50610346610397366004614e5d565b611079565b3480156103a857600080fd5b506103bc6103b7366004614e90565b6110b8565b60405190815260200161031d565b3480156103d657600080fd5b506103096103e5366004614ea9565b6067602052600090815260409020546001600160a01b031681565b34801561040c57600080fd5b5061034661041b366004614ec4565b6110d9565b34801561042c57600080fd5b5061034661043b366004614f00565b611198565b34801561044c57600080fd5b5060385460395461047691906001600160401b03811690600160401b90046001600160801b031683565b604080519384526001600160401b0390921660208401526001600160801b03169082015260600161031d565b3480156104ae57600080fd5b506105056104bd366004614e90565b603460205260009081526040902080546001909101546001600160401b0380821691600160401b810490911690600160801b810463ffffffff1690600160a01b900460ff1685565b60405161031d959493929190614f7d565b34801561052257600080fd5b506103097f000000000000000000000000000000000000000000000000000000000000000081565b34801561055657600080fd5b506103466105653660046150a4565b611a0e565b34801561057657600080fd5b50610346610585366004615135565b611afb565b34801561059657600080fd5b506103466105a5366004614ec4565b6122a9565b3480156105b657600080fd5b506035546103bc565b3480156105cb57600080fd5b50610346612450565b6103466105e23660046151c6565b6124f8565b3480156105f357600080fd5b506103bc603a5481565b34801561060957600080fd5b50610346612761565b34801561061e57600080fd5b5060335460ff165b604051901515815260200161031d565b34801561064257600080fd5b50610346612800565b34801561065757600080fd5b506103bc610666366004614ea9565b6128a6565b34801561067757600080fd5b50606b54610309906001600160a01b031681565b34801561069757600080fd5b50610346612994565b3480156106ac57600080fd5b506103466106bb366004615219565b612ad9565b3480156106cc57600080fd5b506103466106db366004614ea9565b612ea1565b3480156106ec57600080fd5b506103466106fb3660046152f2565b612f17565b34801561070c57600080fd5b5061030961071b366004614e90565b613106565b34801561072c57600080fd5b506103097f000000000000000000000000000000000000000000000000000000000000000081565b34801561076057600080fd5b50610346613130565b34801561077557600080fd5b506103466131a5565b34801561078a57600080fd5b506033546103099061010090046001600160a01b031681565b3480156107af57600080fd5b50610346610397366004614e90565b3480156107ca57600080fd5b506103466107d9366004615377565b613358565b3480156107ea57600080fd5b5061081c6107f9366004614e90565b60376020526000908152604090205460ff811690610100900464ffffffffff1682565b60405161031d9291906153b8565b34801561083657600080fd5b5060335461062690600160a81b900460ff1681565b34801561085757600080fd5b50610626610866366004614ea9565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b3480156108a457600080fd5b5061034661346f565b3480156108b957600080fd5b506103466108c836600461548f565b613526565b3480156108d957600080fd5b506103bc6108e8366004614e90565b6135d1565b3480156108f957600080fd5b5061034661090836600461553d565b6135e1565b34801561091957600080fd5b50610346610928366004614ea9565b6137d1565b34801561093957600080fd5b5061062661385e565b34801561094e57600080fd5b506103bc603b5481565b34801561096457600080fd5b50610346610973366004614ea9565b61388f565b34801561098457600080fd5b506036546103bc565b34801561099957600080fd5b506103466109a83660046155fb565b613933565b3480156109b957600080fd5b506103097f000000000000000000000000000000000000000000000000000000000000000081565b3480156109ed57600080fd5b50610346613a61565b348015610a0257600080fd5b50610a0b613c22565b60405161031d9190615638565b348015610a2457600080fd5b50610346613c84565b6000610a45600080516020615fa58339815191525490565b905090565b6000848152603460209081526040808320815160a0810183528154815260018201546001600160401b0380821695830195909552600160401b810490941692810192909252600160801b830463ffffffff16606083015290916080830190600160a01b900460ff166002811115610ac357610ac3614f67565b6002811115610ad457610ad4614f67565b9052508051600090815260376020526040808220815180830190925280549394509192909190829060ff166008811115610b1057610b10614f67565b6008811115610b2157610b21614f67565b81529054610100900464ffffffffff166020909101529050600182608001516002811115610b5157610b51614f67565b14610b995760405162461bcd60e51b81526020600482015260136024820152724465706f736974206e6f742070656e64696e6760681b60448201526064015b60405180910390fd5b610ba66020850185615684565b6001600160401b0316600003610bfe5760405162461bcd60e51b815260206004820152601d60248201527f5a65726f203173742070656e64696e67206465706f73697420736c6f740000006044820152606401610b90565b600381516008811115610c1357610c13614f67565b1480610c315750600481516008811115610c2f57610c2f614f67565b145b80610c4e5750600581516008811115610c4c57610c4c614f67565b145b610c9a5760405162461bcd60e51b815260206004820152601b60248201527f4e6f742076657269666965642f6163746976652f65786974696e6700000000006044820152606401610b90565b846001600160401b031682604001516001600160401b031610610cf85760405162461bcd60e51b815260206004820152601660248201527514db1bdd081b9bdd0818599d195c8819195c1bdcda5d60521b6044820152606401610b90565b6039546001600160401b031680610d0e87613cb0565b6001600160401b0316111580610d2b57506001600160401b038116155b610d775760405162461bcd60e51b815260206004820152601e60248201527f4465706f7369742061667465722062616c616e636520736e617073686f7400006044820152606401610b90565b6000610d8a610d8588613cb0565b613cf3565b905060006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663d98a556483610dcb60208b018b615684565b610dd860208c018c61569f565b6040518563ffffffff1660e01b8152600401610df7949392919061570e565b602060405180830381865afa158015610e14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e389190615741565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663334a88fb838660200151896000016020810190610e829190615684565b610e8f60208c018c61569f565b6040518663ffffffff1660e01b8152600401610eaf95949392919061575e565b60006040518083038186803b158015610ec757600080fd5b505afa158015610edb573d6000803e3d6000fd5b506000925060209150610ef290508982018a615684565b610efc91906157aa565b90506001600160401b03610f136020890189615684565b6001600160401b03161480610f4657506001600160401b038116610f3a6020890189615684565b6001600160401b031611155b80610f4e5750815b610f9a5760405162461bcd60e51b815260206004820152601d60248201527f45786974204465706f736974206c696b656c79206e6f742070726f632e0000006044820152606401610b90565b610fa76020890189615684565b6001600160401b031686604001516001600160401b03161080610fc75750815b6110135760405162461bcd60e51b815260206004820152601c60248201527f4465706f736974206c696b656c79206e6f742070726f636573736564000000006044820152606401610b90565b61101d8a87613df8565b897fae0e4f727389efd70d748d667436e0264f370ae498b339b713797dbab57b12ff87602001516001600160401b0316633b9aca0061105c91906157e6565b60405190815260200160405180910390a250505050505050505050565b60405162461bcd60e51b81526020600482015260146024820152732ab739bab83837b93a32b210333ab731ba34b7b760611b6044820152606401610b90565b603681815481106110c857600080fd5b600091825260209091200154905081565b6110e161385e565b6110fd5760405162461bcd60e51b8152600401610b90906157fd565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116908316036111785760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74207472616e7366657220737570706f72746564206173736574006044820152606401610b90565b611194611183610a2d565b6001600160a01b0384169083613ed9565b5050565b6040805160608101825260385481526039546001600160401b03811660208301819052600160401b9091046001600160801b031692820192909252906112165760405162461bcd60e51b81526020600482015260136024820152724e6f20736e61707065642062616c616e63657360681b6044820152606401610b90565b60365460355460009082156116d657826112336060880188615834565b90501461127b5760405162461bcd60e51b8152602060048201526016602482015275496e76616c69642062616c616e63652070726f6f667360501b6044820152606401610b90565b826112896040880188615834565b9050146112d15760405162461bcd60e51b8152602060048201526016602482015275496e76616c69642062616c616e6365206c656176657360501b6044820152606401610b90565b83516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906391ad640d90883561131360208b018b61569f565b6040518563ffffffff1660e01b8152600401611332949392919061587d565b60006040518083038186803b15801561134a57600080fd5b505afa15801561135e573d6000803e3d6000fd5b50505050600061136d82613f30565b9050835b80156116d3576113808161589d565b90506000603760006036848154811061139b5761139b6158b4565b906000526020600020015481526020019081526020016000206040518060400160405290816000820160009054906101000a900460ff1660088111156113e3576113e3614f67565b60088111156113f4576113f4614f67565b81529054610100900464ffffffffff16602090910152905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663f34ad34c8b3561144c60408e018e615834565b8781811061145c5761145c6158b4565b905060200201358d80606001906114739190615834565b88818110611483576114836158b4565b9050602002810190611495919061569f565b87602001516040518663ffffffff1660e01b81526004016114ba9594939291906158ca565b602060405180830381865afa1580156114d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114fb9190615903565b905080600003611633576000805b85518110156115605760368581548110611525576115256158b4565b9060005260206000200154868281518110611542576115426158b4565b6020026020010151036115585760019150611560565b600101611509565b508061162b576006603760006036878154811061157f5761157f6158b4565b600091825260208083209091015483528201929092526040019020805460ff191660018360088111156115b4576115b4614f67565b02179055506115c460018961591c565b9750603688815481106115d9576115d96158b4565b9060005260206000200154603685815481106115f7576115f76158b4565b60009182526020909120015560368054806116145761161461592f565b600190038181906000526020600020016000905590555b505050611371565b60038251600881111561164857611648614f67565b14801561165957506407823ff28081115b156116b25760046037600060368681548110611677576116776158b4565b600091825260208083209091015483528201929092526040019020805460ff191660018360088111156116ac576116ac614f67565b02179055505b6116c081633b9aca006157e6565b6116ca9087615945565b95505050611371565b50505b6000811561197357816116ec6060880188615834565b9050146117345760405162461bcd60e51b8152602060048201526016602482015275496e76616c6964206465706f7369742070726f6f667360501b6044820152606401610b90565b816117426040880188615834565b9050146117915760405162461bcd60e51b815260206004820152601760248201527f496e76616c6964206465706f73697420696e64657865730000000000000000006044820152606401610b90565b84516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690632b00e7969088356117d360208b018b61569f565b6040518563ffffffff1660e01b81526004016117f2949392919061587d565b60006040518083038186803b15801561180a57600080fd5b505afa15801561181e573d6000803e3d6000fd5b5050505060005b8281101561197157600060358281548110611842576118426158b4565b60009182526020909120015490506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016638a050dd489358361188f60608d018d615834565b8781811061189f5761189f6158b4565b90506020028101906118b1919061569f565b6118be60408f018f615834565b898181106118ce576118ce6158b4565b90506020020160208101906118e39190615958565b6040518663ffffffff1660e01b8152600401611903959493929190615973565b60006040518083038186803b15801561191b57600080fd5b505afa15801561192f573d6000803e3d6000fd5b50505060008281526034602052604090206001015461195c91506001600160401b0316633b9aca006157e6565b6119669084615945565b925050600101611825565b505b60408501516001600160801b031661198b8483615945565b6119959190615945565b603a556039805467ffffffffffffffff1916905560208581015160408088015181518581529384018790526001600160801b0316908301526001600160401b0316907fed2528338eefb63fd1860078b91e35106bc25e3fd528634d180f662582fe5ec1906060015b60405180910390a250505050505050565b611a1661385e565b611a325760405162461bcd60e51b8152600401610b90906157fd565b600054610100900460ff1680611a4b575060005460ff16155b611aae5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610b90565b600054610100900460ff16158015611ad0576000805461ffff19166101011790555b611adb848484613fe0565b611ae361346f565b8015611af5576000805461ff00191690555b50505050565b60335461010090046001600160a01b03163314611b2a5760405162461bcd60e51b8152600401610b90906159ab565b60335460ff1615611b4d5760405162461bcd60e51b8152600401610b90906159d4565b6000611b666001600160401b038316633b9aca006157e6565b6040516370a0823160e01b81523060048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611bcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf19190615903565b811115611c345760405162461bcd60e51b8152602060048201526011602482015270092dce6eaccccd2c6d2cadce840ae8aa89607b1b6044820152606401610b90565b603554600c11611c755760405162461bcd60e51b815260206004820152600c60248201526b4d6178206465706f7369747360a01b6044820152606401610b90565b611c7e81614093565b6000611cc7611c8d858061569f565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061416292505050565b60008181526037602052604090205490915060ff166001816008811115611cf057611cf0614f67565b1480611d0d57506003816008811115611d0b57611d0b614f67565b145b80611d2957506004816008811115611d2757611d27614f67565b145b611d755760405162461bcd60e51b815260206004820152601a60248201527f4e6f742072656769737465726564206f722076657269666965640000000000006044820152606401610b90565b670de0b6b3a7640000831015611dc15760405162461bcd60e51b815260206004820152601160248201527011195c1bdcda5d081d1bdbc81cdb585b1b607a1b6044820152606401610b90565b6001816008811115611dd557611dd5614f67565b03611f0357603354600160a81b900460ff1615611e2d5760405162461bcd60e51b8152602060048201526016602482015275115e1a5cdd1a5b99c8199a5c9cdd0819195c1bdcda5d60521b6044820152606401610b90565b670de0b6b3a76400008314611e845760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206669727374206465706f73697420616d6f756e74000000006044820152606401610b90565b603654603090611e95906001615945565b1115611ed45760405162461bcd60e51b815260206004820152600e60248201526d4d61782076616c696461746f727360901b6044820152606401610b90565b60338054600160a81b60ff60a81b199091161790556000828152603760205260409020805460ff191660021790555b604051600090611f1f90600160f91b90839030906020016159fe565b60405160208183030381529060405290506000600c7f0000000000000000000000000000000000000000000000000000000000000000611f5e4261421b565b611f689190615a3c565b611f7291906157aa565b905060006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663afe7688786858a611fb560208e018e61569f565b886040518763ffffffff1660e01b8152600401611fd796959493929190615aab565b602060405180830381865afa158015611ff4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120189190615903565b905060008082815260346020526040902060010154600160a01b900460ff16600281111561204857612048614f67565b146120895760405162461bcd60e51b8152602060048201526011602482015270111d5c1b1a58d85d194819195c1bdcda5d607a1b6044820152606401610b90565b6040518060a00160405280868152602001886001600160401b03168152602001836001600160401b031681526020016120c6603580549050614287565b63ffffffff16815260200160019052600082815260346020908152604091829020835181559083015160018201805493850151606086015163ffffffff16600160801b0263ffffffff60801b196001600160401b03928316600160401b026001600160801b03199097169290941691909117949094179182168417815560808501519293909160ff60a01b1990911664ffffffffff60801b1990911617600160a01b83600281111561217a5761217a614f67565b021790555050603580546001810182556000919091527fcfa4bec1d3298408bb5afcfcd9c430549c5b31f8aa5c5848151c0a55f473c34d01829055506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166322895118876121f08b8061569f565b876121fe60208f018f61569f565b8f604001356040518863ffffffff1660e01b815260040161222496959493929190615b03565b6000604051808303818588803b15801561223d57600080fd5b505af1158015612251573d6000803e3d6000fd5b508493508892507faca97428a1d7f2b7c4cee2fbe4feda457e132b404b0c9c3ff73bf7a988d889a8915061228790508b8061569f565b8a60405161229793929190615b52565b60405180910390a35050505050505050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461231b5760405162461bcd60e51b815260206004820152601760248201527610d85b1b195c881a5cc81b9bdd081d1a194815985d5b1d604a1b6044820152606401610b90565b600080516020615f858339815191528054600119810161234d5760405162461bcd60e51b8152600401610b9090615b76565b600282557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146123a25760405162461bcd60e51b8152600401610b9090615b9e565b600083116123eb5760405162461bcd60e51b81526020600482015260166024820152754d757374206465706f73697420736f6d657468696e6760501b6044820152606401610b90565b82603b60008282546123fd9190615945565b90915550506040805160008152602081018590526001600160a01b038616917f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62910160405180910390a250600190555050565b61245861385e565b6124745760405162461bcd60e51b8152600401610b90906157fd565b603354600160a81b900460ff166124c05760405162461bcd60e51b815260206004820152601060248201526f139bc8199a5c9cdd0819195c1bdcda5d60821b6044820152606401610b90565b6033805460ff60a81b191690556040517fce77f85e30b0e6df0d12527ddf038f900fdeda0eeda4284c52be47b05de31a9790600090a1565b60335461010090046001600160a01b031633146125275760405162461bcd60e51b8152600401610b90906159ab565b600061256884848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061416292505050565b600081815260376020526040808220815180830190925280549394509192909190829060ff16600881111561259f5761259f614f67565b60088111156125b0576125b0614f67565b81529054610100900464ffffffffff1660209091015290506004815160088111156125dd576125dd614f67565b14806125fb57506005815160088111156125f9576125f9614f67565b145b6126475760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f72206e6f74206163746976652f65786974696e67000000006044820152606401610b90565b826001600160401b03166000036127045760355460005b818110156126e85760006035828154811061267b5761267b6158b4565b90600052602060002001549050603460008281526020019081526020016000206000015485036126df5760405162461bcd60e51b815260206004820152600f60248201526e14195b991a5b99c819195c1bdcda5d608a1b6044820152606401610b90565b5060010161265e565b50506000828152603760205260409020805460ff191660051790555b61270f8585856142ec565b50817f8dd83105dbd4263d41c76e5d414905babdd3f035bd2031f6ce8895715595979c6127496001600160401b038616633b9aca006157e6565b60405190815260200160405180910390a25050505050565b606b546001600160a01b031633146127bb5760405162461bcd60e51b815260206004820152601b60248201527f43616c6c6572206973206e6f74207468652048617276657374657200000000006044820152606401610b90565b600080516020615f85833981519152805460011981016127ed5760405162461bcd60e51b8152600401610b9090615b76565b600282556127f9611079565b5060019055565b7f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db546001600160a01b0316336001600160a01b03161461289b5760405162461bcd60e51b815260206004820152603060248201527f4f6e6c79207468652070656e64696e6720476f7665726e6f722063616e20636f60448201526f6d706c6574652074686520636c61696d60801b6064820152608401610b90565b6128a433614431565b565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316146128f95760405162461bcd60e51b8152600401610b9090615b9e565b6040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa15801561295d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129819190615903565b603a5461298e9190615945565b92915050565b600061299f4261421b565b90506001600160401b0381166129b7600c6023615bc9565b6039546129cd91906001600160401b0316615bf2565b6001600160401b031610612a135760405162461bcd60e51b815260206004820152600d60248201526c29b730b8103a37b79039b7b7b760991b6044820152606401610b90565b6000612a1e82613cf3565b905060004790506040518060600160405280838152602001846001600160401b03168152602001612a4e83614490565b6001600160801b039081169091528151603855602082015160398054604094850151909316600160401b026001600160c01b03199093166001600160401b03909216919091179190911790555182907fb7523e03ed4a74718427c422a01fee1138835adb5bd592240f30bd8b5e1b929a90612acc9084815260200190565b60405180910390a2505050565b600260008581526037602052604090205460ff166008811115612afe57612afe614f67565b14612b425760405162461bcd60e51b815260206004820152601460248201527315985b1a59185d1bdc881b9bdd081cdd185ad95960621b6044820152606401610b90565b6000612b4d87613cf3565b604051632a5d4ad960e11b81529091506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906354ba95b290612ba69084908990889088908d908c90600401615c11565b60006040518083038186803b158015612bbe57600080fd5b505afa158015612bd2573d6000803e3d6000fd5b50505050604051806040016040528060036008811115612bf457612bf4614f67565b815264ffffffffff8816602091820152600087815260379091526040902081518154829060ff19166001836008811115612c3057612c30614f67565b0217905550602091820151815464ffffffffff9091166101000265ffffffffff0019909116179055604051600091612c7291600160f91b9184913091016159fe565b604051602081830303815290604052612c8a90615c4d565b9050848114612e23576000868152603760205260408120805460ff19166008179055603554905b81811015612def5760006034600060358481548110612cd257612cd26158b4565b600091825260208083209091015483528281019390935260409182019020815160a0810183528154815260018201546001600160401b0380821695830195909552600160401b81049094169281019290925263ffffffff600160801b84041660608301529091608083019060ff600160a01b909104166002811115612d5957612d59614f67565b6002811115612d6a57612d6a614f67565b9052508051909150899003612de657612da1603a5482602001516001600160401b0316633b9aca00612d9c91906157e6565b6144f9565b603a6000828254612db2919061591c565b92505081905550612de060358381548110612dcf57612dcf6158b4565b906000526020600020015482613df8565b50612def565b50600101612cb1565b5060405187907fb8318df57b70f6381fb18aaf762e33efa2cc92627aae83d417f6710e1415d8d890600090a2505050612e99565b6036805460018101825560009182527f4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b8018790556033805460ff60a81b1916905560405164ffffffffff89169188917f8142f1367675d1a37dc1aa31258c38b05f5348de55b799764472d94ccb4a71f49190a350505b505050505050565b612ea961385e565b612ec55760405162461bcd60e51b8152600401610b90906157fd565b60338054610100600160a81b0319166101006001600160a01b038416908102919091179091556040517f83f29c79feb71f8fba9d0fbc4ba5f0982a28b6b1e868b3fc50e6400d100bca0f90600090a250565b60335461010090046001600160a01b03163314612f465760405162461bcd60e51b8152600401610b90906159ab565b6000612f8786868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061416292505050565b60008181526037602052604090205490915060ff166001816008811115612fb057612fb0614f67565b1480612fcd57506006816008811115612fcb57612fcb614f67565b145b80612fe957506008816008811115612fe757612fe7614f67565b145b6130355760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f72206e6f742072656764206f7220657869746564000000006044820152606401610b90565b60008281526037602052604090819020805460ff19166007179055516312b3fc1960e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906312b3fc19906130a2908a908a908a908a908a90600401615d1e565b600060405180830381600087803b1580156130bc57600080fd5b505af11580156130d0573d6000803e3d6000fd5b50505050817f63d54ea43f163d6e28fc23abec67eb7c3294e7e6f0620955a73cd8d17c7367f486866040516119fd929190615d55565b606c818154811061311657600080fd5b6000918252602090912001546001600160a01b0316905081565b60335461010090046001600160a01b0316331480613151575061315161385e565b61319d5760405162461bcd60e51b815260206004820152601b60248201527f4e6f74205265676973747261746f72206f7220476f7665726e6f7200000000006044820152606401610b90565b6128a4614511565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806131f457506131df610a2d565b6001600160a01b0316336001600160a01b0316145b61324c5760405162461bcd60e51b815260206004820152602360248201527f43616c6c6572206973206e6f7420746865205661756c74206f7220476f7665726044820152623737b960e91b6064820152608401610b90565b600080516020615f858339815191528054600119810161327e5760405162461bcd60e51b8152600401610b9090615b76565b600282556040516370a0823160e01b8152306004820152479060009082907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156132ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133119190615903565b61331b9190615945565b9050801561334e5761334e7f00000000000000000000000000000000000000000000000000000000000000008284614586565b5050600182555050565b61336061385e565b61337c5760405162461bcd60e51b8152600401610b90906157fd565b8060005b8181101561342657600084848381811061339c5761339c6158b4565b90506020020160208101906133b19190614ea9565b6001600160a01b03160361341e5760405162461bcd60e51b815260206004820152602e60248201527f43616e206e6f742073657420616e20656d70747920616464726573732061732060448201526d30903932bbb0b932103a37b5b2b760911b6064820152608401610b90565b600101613380565b507f04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc606c848460405161345b93929190615d69565b60405180910390a1611af5606c8484614cce565b60405163095ea7b360e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015260001960248301527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b3906044016020604051808303816000875af11580156134ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135239190615741565b50565b61352e61385e565b61354a5760405162461bcd60e51b8152600401610b90906157fd565b604051631a1b9a0b60e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063686e682c9061359a90869086908690600401615e02565b600060405180830381600087803b1580156135b457600080fd5b505af11580156135c8573d6000803e3d6000fd5b50505050505050565b603581815481106110c857600080fd5b60335461010090046001600160a01b031633146136105760405162461bcd60e51b8152600401610b90906159ab565b60335460ff16156136335760405162461bcd60e51b8152600401610b90906159d4565b600061367489898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061416292505050565b90506000808281526037602052604090205460ff16600881111561369a5761369a614f67565b146136e75760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f7220616c72656164792072656769737465726564000000006044820152606401610b90565b60008181526037602052604090819020805460ff19166001179055516301ba3ee760e21b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306e8fb9c9061375a908c908c908c908c908c908c908c908c90600401615ea4565b600060405180830381600087803b15801561377457600080fd5b505af1158015613788573d6000803e3d6000fd5b50505050807f50837f89f5e75ae0a7bcc858f53ea15fa398dc007fd52cbfe4683ae9a6c2d72288886040516137be929190615d55565b60405180910390a2505050505050505050565b6137d961385e565b6137f55760405162461bcd60e51b8152600401610b90906157fd565b606b54604080516001600160a01b03928316815291831660208301527fe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796910160405180910390a1606b80546001600160a01b0319166001600160a01b0392909216919091179055565b6000613876600080516020615fa58339815191525490565b6001600160a01b0316336001600160a01b031614905090565b61389761385e565b6138b35760405162461bcd60e51b8152600401610b90906157fd565b6138db817f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db55565b806001600160a01b03166138fb600080516020615fa58339815191525490565b6001600160a01b03167fa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d60405160405180910390a350565b600080516020615f85833981519152805460011981016139655760405162461bcd60e51b8152600401610b9090615b76565b600282557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146139ba5760405162461bcd60e51b8152600401610b9090615b9e565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480613a00575060335461010090046001600160a01b031633145b613a4c5760405162461bcd60e51b815260206004820152601f60248201527f43616c6c6572206e6f74205661756c74206f72205265676973747261746f72006044820152606401610b90565b613a57858447614586565b5060019055505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614613ad35760405162461bcd60e51b815260206004820152601760248201527610d85b1b195c881a5cc81b9bdd081d1a194815985d5b1d604a1b6044820152606401610b90565b600080516020615f8583398151915280546001198101613b055760405162461bcd60e51b8152600401610b9090615b76565b600282556040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015613b70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b949190615903565b90506000603b5482613ba6919061591c565b9050801561334e57603b8290556040805160008152602081018390526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62910160405180910390a25050600182555050565b6060606c805480602002602001604051908101604052809291908181526020018280548015613c7a57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613c5c575b5050505050905090565b613c8c61385e565b613ca85760405162461bcd60e51b8152600401610b90906157fd565b6128a46146c8565b6000600c7f0000000000000000000000000000000000000000000000000000000000000000613cdf8483615bc9565b613ce99190615bf2565b61298e9190615bf2565b604080516001600160401b038316602082015260009182918291720f3df6d732807ef1319fb7b8bb8522d0beac02910160408051601f1981840301815290829052613d3d91615f05565b600060405180830381855afa9150503d8060008114613d78576040519150601f19603f3d011682016040523d82523d6000602084013e613d7d565b606091505b5091509150818015613d90575060008151115b613ddc5760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420626561636f6e2074696d657374616d7000000000000000006044820152606401610b90565b80806020019051810190613df09190615903565b949350505050565b60008281526034602052604081206001908101805460ff60a01b1916600160a11b179055603580549091613e2b9161591c565b81548110613e3b57613e3b6158b4565b90600052602060002001549050806035836060015163ffffffff1681548110613e6657613e666158b4565b60009182526020808320909101929092556060840151838252603490925260409020600101805463ffffffff909216600160801b0263ffffffff60801b199092169190911790556035805480613ebe57613ebe61592f565b60019003818190600052602060002001600090559055505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052613f2b908490614742565b505050565b6060816001600160401b03811115613f4a57613f4a614fc7565b604051908082528060200260200182016040528015613f73578160200160208202803683370190505b50905060005b82811015613fda576034600060358381548110613f9857613f986158b4565b9060005260206000200154815260200190815260200160002060000154828281518110613fc757613fc76158b4565b6020908102919091010152600101613f79565b50919050565b8251613ff390606c906020860190614d2d565b5081518151811461403d5760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420696e7075742061727261797360601b6044820152606401610b90565b60005b8181101561408c5761408484828151811061405d5761405d6158b4565b6020026020010151848381518110614077576140776158b4565b6020026020010151614814565b600101614040565b5050505050565b604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156140f557600080fd5b505af1158015614109573d6000803e3d6000fd5b50505050600061411b82603b546144f9565b905080603b600082825461412f919061591c565b9250508190555081603a60008282546141489190615945565b90915550506039805467ffffffffffffffff191690555050565b600081516030146141aa5760405162461bcd60e51b8152602060048201526012602482015271496e76616c6964207075626c6963206b657960701b6044820152606401610b90565b6040516002906141c1908490600090602001615f21565b60408051601f19818403018152908290526141db91615f05565b602060405180830381855afa1580156141f8573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061298e9190615903565b60006001600160401b038211156142835760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b6064820152608401610b90565b5090565b600063ffffffff8211156142835760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b6064820152608401610b90565b60006030831461433e5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642076616c696461746f722062797465206c656e6774680000006044820152606401610b90565b614346614973565b90506000710961ef480eb55e80d19ad83579a64c0070026001600160a01b03168286868660405160200161437c93929190615f50565b60408051601f198184030181529082905261439691615f05565b60006040518083038185875af1925050503d80600081146143d3576040519150601f19603f3d011682016040523d82523d6000602084013e6143d8565b606091505b50509050806144295760405162461bcd60e51b815260206004820152601960248201527f5769746864726177616c2072657175657374206661696c6564000000000000006044820152606401610b90565b509392505050565b6001600160a01b0381166144875760405162461bcd60e51b815260206004820152601a60248201527f4e657720476f7665726e6f7220697320616464726573732830290000000000006044820152606401610b90565b61352381614a3a565b60006001600160801b038211156142835760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b6064820152608401610b90565b6000818310614508578161450a565b825b9392505050565b60335460ff16156145345760405162461bcd60e51b8152600401610b90906159d4565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586145693390565b6040516001600160a01b03909116815260200160405180910390a1565b600082116145d65760405162461bcd60e51b815260206004820152601760248201527f4d75737420776974686472617720736f6d657468696e670000000000000000006044820152606401610b90565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b03161461464d5760405162461bcd60e51b8152602060048201526013602482015272149958da5c1a595b9d081b9bdd0815985d5b1d606a1b6044820152606401610b90565b801561465c5761465c81614aa1565b6146668284614b63565b6040805160008152602081018490526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63989101612acc565b60335460ff166147115760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610b90565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33614569565b6000614797826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614bc39092919063ffffffff16565b805190915015613f2b57808060200190518101906147b59190615741565b613f2b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b90565b6001600160a01b0382811660009081526067602052604090205416156148715760405162461bcd60e51b81526020600482015260126024820152711c151bdad95b88185b1c9958591e481cd95d60721b6044820152606401610b90565b6001600160a01b0382161580159061489157506001600160a01b03811615155b6148d15760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642061646472657373657360781b6044820152606401610b90565b6001600160a01b03828116600081815260676020908152604080832080549587166001600160a01b031996871681179091556068805460018101825594527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c2209775390930180549095168417909455925190815290917fef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765910160405180910390a25050565b60405160009081908190710961ef480eb55e80d19ad83579a64c0070029082818181855afa9150503d80600081146149c7576040519150601f19603f3d011682016040523d82523d6000602084013e6149cc565b606091505b50915091508180156149df575060008151115b614a1f5760405162461bcd60e51b81526020600482015260116024820152704661696c656420746f206765742066656560781b6044820152606401610b90565b80806020019051810190614a339190615903565b9250505090565b806001600160a01b0316614a5a600080516020615fa58339815191525490565b6001600160a01b03167fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a60405160405180910390a3600080516020615fa583398151915255565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015614afc57600080fd5b505af1158015614b10573d6000803e3d6000fd5b505050505080603b6000828254614b279190615945565b9091555050603a54614b3990826144f9565b603a6000828254614b4a919061591c565b90915550506039805467ffffffffffffffff1916905550565b614b976001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168284613ed9565b6000614ba583603b546144f9565b905080603b6000828254614bb9919061591c565b9091555050505050565b6060613df0848460008585843b614c1c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b90565b600080866001600160a01b03168587604051614c389190615f05565b60006040518083038185875af1925050503d8060008114614c75576040519150601f19603f3d011682016040523d82523d6000602084013e614c7a565b606091505b5091509150614c8a828286614c95565b979650505050505050565b60608315614ca457508161450a565b825115614cb45782518084602001fd5b8160405162461bcd60e51b8152600401610b909190615f71565b828054828255906000526020600020908101928215614d21579160200282015b82811115614d215781546001600160a01b0319166001600160a01b03843516178255602090920191600190910190614cee565b50614283929150614d82565b828054828255906000526020600020908101928215614d21579160200282015b82811115614d2157825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614d4d565b5b808211156142835760008155600101614d83565b80356001600160401b0381168114614dae57600080fd5b919050565b600060408284031215613fda57600080fd5b60008060008060808587031215614ddb57600080fd5b84359350614deb60208601614d97565b925060408501356001600160401b03811115614e0657600080fd5b614e1287828801614db3565b92505060608501356001600160401b03811115614e2e57600080fd5b614e3a87828801614db3565b91505092959194509250565b80356001600160a01b0381168114614dae57600080fd5b60008060408385031215614e7057600080fd5b614e7983614e46565b9150614e8760208401614e46565b90509250929050565b600060208284031215614ea257600080fd5b5035919050565b600060208284031215614ebb57600080fd5b61450a82614e46565b60008060408385031215614ed757600080fd5b614ee083614e46565b946020939093013593505050565b600060808284031215613fda57600080fd5b60008060408385031215614f1357600080fd5b82356001600160401b03811115614f2957600080fd5b614f3585828601614eee565b92505060208301356001600160401b03811115614f5157600080fd5b614f5d85828601614eee565b9150509250929050565b634e487b7160e01b600052602160045260246000fd5b8581526001600160401b0385811660208301528416604082015263ffffffff8316606082015260a0810160038310614fb757614fb7614f67565b8260808301529695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561500557615005614fc7565b604052919050565b60006001600160401b0382111561502657615026614fc7565b5060051b60200190565b600082601f83011261504157600080fd5b813561505461504f8261500d565b614fdd565b8082825260208201915060208360051b86010192508583111561507657600080fd5b602085015b8381101561509a5761508c81614e46565b83526020928301920161507b565b5095945050505050565b6000806000606084860312156150b957600080fd5b83356001600160401b038111156150cf57600080fd5b6150db86828701615030565b93505060208401356001600160401b038111156150f757600080fd5b61510386828701615030565b92505060408401356001600160401b0381111561511f57600080fd5b61512b86828701615030565b9150509250925092565b6000806040838503121561514857600080fd5b82356001600160401b0381111561515e57600080fd5b83016060818603121561517057600080fd5b9150614e8760208401614d97565b60008083601f84011261519057600080fd5b5081356001600160401b038111156151a757600080fd5b6020830191508360208285010111156151bf57600080fd5b9250929050565b6000806000604084860312156151db57600080fd5b83356001600160401b038111156151f157600080fd5b6151fd8682870161517e565b9094509250615210905060208501614d97565b90509250925092565b60008060008060008060a0878903121561523257600080fd5b61523b87614d97565b9550602087013564ffffffffff8116811461525557600080fd5b9450604087013593506060870135925060808701356001600160401b0381111561527e57600080fd5b61528a89828a0161517e565b979a9699509497509295939492505050565b60008083601f8401126152ae57600080fd5b5081356001600160401b038111156152c557600080fd5b6020830191508360208260051b85010111156151bf57600080fd5b600060a08284031215613fda57600080fd5b600080600080600060e0868803121561530a57600080fd5b85356001600160401b0381111561532057600080fd5b61532c8882890161517e565b90965094505060208601356001600160401b0381111561534b57600080fd5b6153578882890161529c565b909450925061536b905087604088016152e0565b90509295509295909350565b6000806020838503121561538a57600080fd5b82356001600160401b038111156153a057600080fd5b6153ac8582860161529c565b90969095509350505050565b60408101600984106153cc576153cc614f67565b92815264ffffffffff9190911660209091015290565b803563ffffffff81168114614dae57600080fd5b801515811461352357600080fd5b600060a0828403121561541657600080fd5b60405160a081016001600160401b038111828210171561543857615438614fc7565b604052905080615447836153e2565b815261545560208401614d97565b602082015261546660408401614d97565b60408201526060830135615479816153f6565b6060820152608092830135920191909152919050565b600080600060e084860312156154a457600080fd5b83356001600160401b038111156154ba57600080fd5b8401601f810186136154cb57600080fd5b80356154d961504f8261500d565b8082825260208201915060208360051b8501019250888311156154fb57600080fd5b6020840193505b828410156155245761551384614d97565b825260209384019390910190615502565b9550505050602084013591506152108560408601615404565b600080600080600080600080610120898b03121561555a57600080fd5b88356001600160401b0381111561557057600080fd5b61557c8b828c0161517e565b90995097505060208901356001600160401b0381111561559b57600080fd5b6155a78b828c0161529c565b90975095505060408901356001600160401b038111156155c657600080fd5b6155d28b828c0161517e565b909550935050606089013591506155ec8a60808b016152e0565b90509295985092959890939650565b60008060006060848603121561561057600080fd5b61561984614e46565b925061562760208501614e46565b929592945050506040919091013590565b602080825282518282018190526000918401906040840190835b818110156156795783516001600160a01b0316835260209384019390920191600101615652565b509095945050505050565b60006020828403121561569657600080fd5b61450a82614d97565b6000808335601e198436030181126156b657600080fd5b8301803591506001600160401b038211156156d057600080fd5b6020019150368190038213156151bf57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8481526001600160401b03841660208201526060604082015260006157376060830184866156e5565b9695505050505050565b60006020828403121561575357600080fd5b815161450a816153f6565b85815264ffffffffff851660208201526001600160401b0384166040820152608060608201526000614c8a6080830184866156e5565b634e487b7160e01b600052601160045260246000fd5b60006001600160401b038316806157d157634e487b7160e01b600052601260045260246000fd5b806001600160401b0384160491505092915050565b808202811582820484141761298e5761298e615794565b6020808252601a908201527f43616c6c6572206973206e6f742074686520476f7665726e6f72000000000000604082015260600190565b6000808335601e1984360301811261584b57600080fd5b8301803591506001600160401b0382111561586557600080fd5b6020019150600581901b36038213156151bf57600080fd5b8481528360208201526060604082015260006157376060830184866156e5565b6000816158ac576158ac615794565b506000190190565b634e487b7160e01b600052603260045260246000fd5b8581528460208201526080604082015260006158ea6080830185876156e5565b905064ffffffffff831660608301529695505050505050565b60006020828403121561591557600080fd5b5051919050565b8181038181111561298e5761298e615794565b634e487b7160e01b600052603160045260246000fd5b8082018082111561298e5761298e615794565b60006020828403121561596a57600080fd5b61450a826153e2565b8581528460208201526080604082015260006159936080830185876156e5565b905063ffffffff831660608301529695505050505050565b6020808252600f908201526e2737ba102932b3b4b9ba3930ba37b960891b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6001600160f81b03199390931683526001600160a81b031991909116600183015260601b6bffffffffffffffffffffffff1916600c82015260200190565b6001600160401b03828116828216039081111561298e5761298e615794565b60005b83811015615a76578181015183820152602001615a5e565b50506000910152565b60008151808452615a97816020860160208601615a5b565b601f01601f19169290920160200192915050565b86815260a060208201526000615ac460a0830188615a7f565b6001600160401b03871660408401528281036060840152615ae68186886156e5565b9150506001600160401b0383166080830152979650505050505050565b608081526000615b1760808301888a6156e5565b8281036020840152615b298188615a7f565b90508281036040840152615b3e8186886156e5565b915050826060830152979650505050505050565b604081526000615b666040830185876156e5565b9050826020830152949350505050565b6020808252600e908201526d1499595b9d1c985b9d0818d85b1b60921b604082015260600190565b602080825260119082015270155b9cdd5c1c1bdc9d195908185cdcd95d607a1b604082015260600190565b6001600160401b038181168382160290811690818114615beb57615beb615794565b5092915050565b6001600160401b03818116838216019081111561298e5761298e615794565b86815285602082015260a060408201526000615c3160a0830186886156e5565b64ffffffffff9490941660608301525060800152949350505050565b80516020808301519190811015613fda5760001960209190910360031b1b16919050565b81835260208301925060008160005b84811015615caf576001600160401b03615c9983614d97565b1686526020958601959190910190600101615c80565b5093949350505050565b63ffffffff615cc7826153e2565b1682526001600160401b03615cde60208301614d97565b1660208301526001600160401b03615cf860408301614d97565b1660408301526060810135615d0c816153f6565b15156060830152608090810135910152565b60e081526000615d3260e0830187896156e5565b8281036020840152615d45818688615c71565b9150506157376040830184615cb9565b602081526000613df0602083018486615c71565b6040808252845490820181905260008581526020812090916060840190835b81811015615daf5783546001600160a01b0316835260019384019360209093019201615d88565b50508381036020808601919091528582520190508460005b85811015615df6576001600160a01b03615de083614e46565b1683526020928301929190910190600101615dc7565b50909695505050505050565b60e080825284519082018190526000906020860190610100840190835b81811015615e465783516001600160401b0316835260209384019390920191600101615e1f565b5050809250505083602083015263ffffffff83511660408301526001600160401b0360208401511660608301526001600160401b0360408401511660808301526060830151151560a0830152608083015160c0830152949350505050565b61012081526000615eba61012083018a8c6156e5565b8281036020840152615ecd81898b615c71565b90508281036040840152615ee28187896156e5565b915050836060830152615ef86080830184615cb9565b9998505050505050505050565b60008251615f17818460208701615a5b565b9190910192915050565b60008351615f33818460208801615a5b565b6001600160801b0319939093169190920190815260100192915050565b8284823760c09190911b6001600160c01b0319169101908152600801919050565b60208152600061450a6020830184615a7f56fe53bf423e48ed90e97d02ab0ebab13b2a235a6bfbe9c321847d5c175333ac45357bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4aa26469706673582212208a510b2c181230807f02fb536bfe47f607befc9721889a9a153ddfcefaf3588764736f6c634300081c00337bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4a", + "deployedBytecode": "0x6080604052600436106102e85760003560e01c80636e811d3811610190578063b6e2b520116100dc578063d38bfff411610095578063dbe55e561161006f578063dbe55e56146109ad578063de5f6268146109e1578063f6ca71b0146109f6578063f7b188a514610a1857600080fd5b8063d38bfff414610958578063d79e403214610978578063d9caed121461098d57600080fd5b8063b6e2b520146108ad578063b8ec6678146108cd578063bb1b918d146108ed578063c2e1e3f41461090d578063c7af33521461092d578063d059f6ef1461094257600080fd5b806387bae8671161014957806398245f1b1161012357806398245f1b146107de578063a5f5be541461082a578063aa388af61461084b578063ad1728cb1461089857600080fd5b806387bae8671461077e5780639136616a146107a357806396d538bb146107be57600080fd5b80636e811d38146106c057806371a735f3146106e05780637b2d9b2c146107005780637da9982a146107205780638456cb5914610754578063853828b61461076957600080fd5b80634583ef101161024f5780635a063f63116102085780635f515226116101e25780635f5152261461064b57806367c7066c1461066b5780636874469d1461068b5780636c341d1a146106a057600080fd5b80635a063f63146105fd5780635c975abb146106125780635d36b1901461063657600080fd5b80634583ef101461056a57806347e7ef241461058a5780634896b31a146105aa5780634c84e6f8146105bf578063522e4245146105d457806359ff4158146105e757600080fd5b80631072cbea116102a15780631072cbea146104005780631a1a15711461042057806325e2e9f3146104405780633d4dff7b146104a2578063430bf08a14610516578063435356d11461054a57600080fd5b80630c340a24146102f45780630d304174146103265780630df1ecfd146103485780630ed57b3a1461037c5780630ef998551461039c5780630fc3b4c4146103ca57600080fd5b366102ef57005b600080fd5b34801561030057600080fd5b50610309610a2d565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561033257600080fd5b50610346610341366004614dc5565b610a4a565b005b34801561035457600080fd5b506103097f000000000000000000000000000000000000000000000000000000000000000081565b34801561038857600080fd5b50610346610397366004614e5d565b611079565b3480156103a857600080fd5b506103bc6103b7366004614e90565b6110b8565b60405190815260200161031d565b3480156103d657600080fd5b506103096103e5366004614ea9565b6067602052600090815260409020546001600160a01b031681565b34801561040c57600080fd5b5061034661041b366004614ec4565b6110d9565b34801561042c57600080fd5b5061034661043b366004614f00565b611198565b34801561044c57600080fd5b5060385460395461047691906001600160401b03811690600160401b90046001600160801b031683565b604080519384526001600160401b0390921660208401526001600160801b03169082015260600161031d565b3480156104ae57600080fd5b506105056104bd366004614e90565b603460205260009081526040902080546001909101546001600160401b0380821691600160401b810490911690600160801b810463ffffffff1690600160a01b900460ff1685565b60405161031d959493929190614f7d565b34801561052257600080fd5b506103097f000000000000000000000000000000000000000000000000000000000000000081565b34801561055657600080fd5b506103466105653660046150a4565b611a0e565b34801561057657600080fd5b50610346610585366004615135565b611afb565b34801561059657600080fd5b506103466105a5366004614ec4565b6122a9565b3480156105b657600080fd5b506035546103bc565b3480156105cb57600080fd5b50610346612450565b6103466105e23660046151c6565b6124f8565b3480156105f357600080fd5b506103bc603a5481565b34801561060957600080fd5b50610346612761565b34801561061e57600080fd5b5060335460ff165b604051901515815260200161031d565b34801561064257600080fd5b50610346612800565b34801561065757600080fd5b506103bc610666366004614ea9565b6128a6565b34801561067757600080fd5b50606b54610309906001600160a01b031681565b34801561069757600080fd5b50610346612994565b3480156106ac57600080fd5b506103466106bb366004615219565b612ad9565b3480156106cc57600080fd5b506103466106db366004614ea9565b612ea1565b3480156106ec57600080fd5b506103466106fb3660046152f2565b612f17565b34801561070c57600080fd5b5061030961071b366004614e90565b613106565b34801561072c57600080fd5b506103097f000000000000000000000000000000000000000000000000000000000000000081565b34801561076057600080fd5b50610346613130565b34801561077557600080fd5b506103466131a5565b34801561078a57600080fd5b506033546103099061010090046001600160a01b031681565b3480156107af57600080fd5b50610346610397366004614e90565b3480156107ca57600080fd5b506103466107d9366004615377565b613358565b3480156107ea57600080fd5b5061081c6107f9366004614e90565b60376020526000908152604090205460ff811690610100900464ffffffffff1682565b60405161031d9291906153b8565b34801561083657600080fd5b5060335461062690600160a81b900460ff1681565b34801561085757600080fd5b50610626610866366004614ea9565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b3480156108a457600080fd5b5061034661346f565b3480156108b957600080fd5b506103466108c836600461548f565b613526565b3480156108d957600080fd5b506103bc6108e8366004614e90565b6135d1565b3480156108f957600080fd5b5061034661090836600461553d565b6135e1565b34801561091957600080fd5b50610346610928366004614ea9565b6137d1565b34801561093957600080fd5b5061062661385e565b34801561094e57600080fd5b506103bc603b5481565b34801561096457600080fd5b50610346610973366004614ea9565b61388f565b34801561098457600080fd5b506036546103bc565b34801561099957600080fd5b506103466109a83660046155fb565b613933565b3480156109b957600080fd5b506103097f000000000000000000000000000000000000000000000000000000000000000081565b3480156109ed57600080fd5b50610346613a61565b348015610a0257600080fd5b50610a0b613c22565b60405161031d9190615638565b348015610a2457600080fd5b50610346613c84565b6000610a45600080516020615fa58339815191525490565b905090565b6000848152603460209081526040808320815160a0810183528154815260018201546001600160401b0380821695830195909552600160401b810490941692810192909252600160801b830463ffffffff16606083015290916080830190600160a01b900460ff166002811115610ac357610ac3614f67565b6002811115610ad457610ad4614f67565b9052508051600090815260376020526040808220815180830190925280549394509192909190829060ff166008811115610b1057610b10614f67565b6008811115610b2157610b21614f67565b81529054610100900464ffffffffff166020909101529050600182608001516002811115610b5157610b51614f67565b14610b995760405162461bcd60e51b81526020600482015260136024820152724465706f736974206e6f742070656e64696e6760681b60448201526064015b60405180910390fd5b610ba66020850185615684565b6001600160401b0316600003610bfe5760405162461bcd60e51b815260206004820152601d60248201527f5a65726f203173742070656e64696e67206465706f73697420736c6f740000006044820152606401610b90565b600381516008811115610c1357610c13614f67565b1480610c315750600481516008811115610c2f57610c2f614f67565b145b80610c4e5750600581516008811115610c4c57610c4c614f67565b145b610c9a5760405162461bcd60e51b815260206004820152601b60248201527f4e6f742076657269666965642f6163746976652f65786974696e6700000000006044820152606401610b90565b846001600160401b031682604001516001600160401b031610610cf85760405162461bcd60e51b815260206004820152601660248201527514db1bdd081b9bdd0818599d195c8819195c1bdcda5d60521b6044820152606401610b90565b6039546001600160401b031680610d0e87613cb0565b6001600160401b0316111580610d2b57506001600160401b038116155b610d775760405162461bcd60e51b815260206004820152601e60248201527f4465706f7369742061667465722062616c616e636520736e617073686f7400006044820152606401610b90565b6000610d8a610d8588613cb0565b613cf3565b905060006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663d98a556483610dcb60208b018b615684565b610dd860208c018c61569f565b6040518563ffffffff1660e01b8152600401610df7949392919061570e565b602060405180830381865afa158015610e14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e389190615741565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663334a88fb838660200151896000016020810190610e829190615684565b610e8f60208c018c61569f565b6040518663ffffffff1660e01b8152600401610eaf95949392919061575e565b60006040518083038186803b158015610ec757600080fd5b505afa158015610edb573d6000803e3d6000fd5b506000925060209150610ef290508982018a615684565b610efc91906157aa565b90506001600160401b03610f136020890189615684565b6001600160401b03161480610f4657506001600160401b038116610f3a6020890189615684565b6001600160401b031611155b80610f4e5750815b610f9a5760405162461bcd60e51b815260206004820152601d60248201527f45786974204465706f736974206c696b656c79206e6f742070726f632e0000006044820152606401610b90565b610fa76020890189615684565b6001600160401b031686604001516001600160401b03161080610fc75750815b6110135760405162461bcd60e51b815260206004820152601c60248201527f4465706f736974206c696b656c79206e6f742070726f636573736564000000006044820152606401610b90565b61101d8a87613df8565b897fae0e4f727389efd70d748d667436e0264f370ae498b339b713797dbab57b12ff87602001516001600160401b0316633b9aca0061105c91906157e6565b60405190815260200160405180910390a250505050505050505050565b60405162461bcd60e51b81526020600482015260146024820152732ab739bab83837b93a32b210333ab731ba34b7b760611b6044820152606401610b90565b603681815481106110c857600080fd5b600091825260209091200154905081565b6110e161385e565b6110fd5760405162461bcd60e51b8152600401610b90906157fd565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116908316036111785760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74207472616e7366657220737570706f72746564206173736574006044820152606401610b90565b611194611183610a2d565b6001600160a01b0384169083613ed9565b5050565b6040805160608101825260385481526039546001600160401b03811660208301819052600160401b9091046001600160801b031692820192909252906112165760405162461bcd60e51b81526020600482015260136024820152724e6f20736e61707065642062616c616e63657360681b6044820152606401610b90565b60365460355460009082156116d657826112336060880188615834565b90501461127b5760405162461bcd60e51b8152602060048201526016602482015275496e76616c69642062616c616e63652070726f6f667360501b6044820152606401610b90565b826112896040880188615834565b9050146112d15760405162461bcd60e51b8152602060048201526016602482015275496e76616c69642062616c616e6365206c656176657360501b6044820152606401610b90565b83516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906391ad640d90883561131360208b018b61569f565b6040518563ffffffff1660e01b8152600401611332949392919061587d565b60006040518083038186803b15801561134a57600080fd5b505afa15801561135e573d6000803e3d6000fd5b50505050600061136d82613f30565b9050835b80156116d3576113808161589d565b90506000603760006036848154811061139b5761139b6158b4565b906000526020600020015481526020019081526020016000206040518060400160405290816000820160009054906101000a900460ff1660088111156113e3576113e3614f67565b60088111156113f4576113f4614f67565b81529054610100900464ffffffffff16602090910152905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663f34ad34c8b3561144c60408e018e615834565b8781811061145c5761145c6158b4565b905060200201358d80606001906114739190615834565b88818110611483576114836158b4565b9050602002810190611495919061569f565b87602001516040518663ffffffff1660e01b81526004016114ba9594939291906158ca565b602060405180830381865afa1580156114d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114fb9190615903565b905080600003611633576000805b85518110156115605760368581548110611525576115256158b4565b9060005260206000200154868281518110611542576115426158b4565b6020026020010151036115585760019150611560565b600101611509565b508061162b576006603760006036878154811061157f5761157f6158b4565b600091825260208083209091015483528201929092526040019020805460ff191660018360088111156115b4576115b4614f67565b02179055506115c460018961591c565b9750603688815481106115d9576115d96158b4565b9060005260206000200154603685815481106115f7576115f76158b4565b60009182526020909120015560368054806116145761161461592f565b600190038181906000526020600020016000905590555b505050611371565b60038251600881111561164857611648614f67565b14801561165957506407823ff28081115b156116b25760046037600060368681548110611677576116776158b4565b600091825260208083209091015483528201929092526040019020805460ff191660018360088111156116ac576116ac614f67565b02179055505b6116c081633b9aca006157e6565b6116ca9087615945565b95505050611371565b50505b6000811561197357816116ec6060880188615834565b9050146117345760405162461bcd60e51b8152602060048201526016602482015275496e76616c6964206465706f7369742070726f6f667360501b6044820152606401610b90565b816117426040880188615834565b9050146117915760405162461bcd60e51b815260206004820152601760248201527f496e76616c6964206465706f73697420696e64657865730000000000000000006044820152606401610b90565b84516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690632b00e7969088356117d360208b018b61569f565b6040518563ffffffff1660e01b81526004016117f2949392919061587d565b60006040518083038186803b15801561180a57600080fd5b505afa15801561181e573d6000803e3d6000fd5b5050505060005b8281101561197157600060358281548110611842576118426158b4565b60009182526020909120015490506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016638a050dd489358361188f60608d018d615834565b8781811061189f5761189f6158b4565b90506020028101906118b1919061569f565b6118be60408f018f615834565b898181106118ce576118ce6158b4565b90506020020160208101906118e39190615958565b6040518663ffffffff1660e01b8152600401611903959493929190615973565b60006040518083038186803b15801561191b57600080fd5b505afa15801561192f573d6000803e3d6000fd5b50505060008281526034602052604090206001015461195c91506001600160401b0316633b9aca006157e6565b6119669084615945565b925050600101611825565b505b60408501516001600160801b031661198b8483615945565b6119959190615945565b603a556039805467ffffffffffffffff1916905560208581015160408088015181518581529384018790526001600160801b0316908301526001600160401b0316907fed2528338eefb63fd1860078b91e35106bc25e3fd528634d180f662582fe5ec1906060015b60405180910390a250505050505050565b611a1661385e565b611a325760405162461bcd60e51b8152600401610b90906157fd565b600054610100900460ff1680611a4b575060005460ff16155b611aae5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610b90565b600054610100900460ff16158015611ad0576000805461ffff19166101011790555b611adb848484613fe0565b611ae361346f565b8015611af5576000805461ff00191690555b50505050565b60335461010090046001600160a01b03163314611b2a5760405162461bcd60e51b8152600401610b90906159ab565b60335460ff1615611b4d5760405162461bcd60e51b8152600401610b90906159d4565b6000611b666001600160401b038316633b9aca006157e6565b6040516370a0823160e01b81523060048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611bcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf19190615903565b811115611c345760405162461bcd60e51b8152602060048201526011602482015270092dce6eaccccd2c6d2cadce840ae8aa89607b1b6044820152606401610b90565b603554600c11611c755760405162461bcd60e51b815260206004820152600c60248201526b4d6178206465706f7369747360a01b6044820152606401610b90565b611c7e81614093565b6000611cc7611c8d858061569f565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061416292505050565b60008181526037602052604090205490915060ff166001816008811115611cf057611cf0614f67565b1480611d0d57506003816008811115611d0b57611d0b614f67565b145b80611d2957506004816008811115611d2757611d27614f67565b145b611d755760405162461bcd60e51b815260206004820152601a60248201527f4e6f742072656769737465726564206f722076657269666965640000000000006044820152606401610b90565b670de0b6b3a7640000831015611dc15760405162461bcd60e51b815260206004820152601160248201527011195c1bdcda5d081d1bdbc81cdb585b1b607a1b6044820152606401610b90565b6001816008811115611dd557611dd5614f67565b03611f0357603354600160a81b900460ff1615611e2d5760405162461bcd60e51b8152602060048201526016602482015275115e1a5cdd1a5b99c8199a5c9cdd0819195c1bdcda5d60521b6044820152606401610b90565b670de0b6b3a76400008314611e845760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206669727374206465706f73697420616d6f756e74000000006044820152606401610b90565b603654603090611e95906001615945565b1115611ed45760405162461bcd60e51b815260206004820152600e60248201526d4d61782076616c696461746f727360901b6044820152606401610b90565b60338054600160a81b60ff60a81b199091161790556000828152603760205260409020805460ff191660021790555b604051600090611f1f90600160f91b90839030906020016159fe565b60405160208183030381529060405290506000600c7f0000000000000000000000000000000000000000000000000000000000000000611f5e4261421b565b611f689190615a3c565b611f7291906157aa565b905060006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663afe7688786858a611fb560208e018e61569f565b886040518763ffffffff1660e01b8152600401611fd796959493929190615aab565b602060405180830381865afa158015611ff4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120189190615903565b905060008082815260346020526040902060010154600160a01b900460ff16600281111561204857612048614f67565b146120895760405162461bcd60e51b8152602060048201526011602482015270111d5c1b1a58d85d194819195c1bdcda5d607a1b6044820152606401610b90565b6040518060a00160405280868152602001886001600160401b03168152602001836001600160401b031681526020016120c6603580549050614287565b63ffffffff16815260200160019052600082815260346020908152604091829020835181559083015160018201805493850151606086015163ffffffff16600160801b0263ffffffff60801b196001600160401b03928316600160401b026001600160801b03199097169290941691909117949094179182168417815560808501519293909160ff60a01b1990911664ffffffffff60801b1990911617600160a01b83600281111561217a5761217a614f67565b021790555050603580546001810182556000919091527fcfa4bec1d3298408bb5afcfcd9c430549c5b31f8aa5c5848151c0a55f473c34d01829055506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166322895118876121f08b8061569f565b876121fe60208f018f61569f565b8f604001356040518863ffffffff1660e01b815260040161222496959493929190615b03565b6000604051808303818588803b15801561223d57600080fd5b505af1158015612251573d6000803e3d6000fd5b508493508892507faca97428a1d7f2b7c4cee2fbe4feda457e132b404b0c9c3ff73bf7a988d889a8915061228790508b8061569f565b8a60405161229793929190615b52565b60405180910390a35050505050505050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461231b5760405162461bcd60e51b815260206004820152601760248201527610d85b1b195c881a5cc81b9bdd081d1a194815985d5b1d604a1b6044820152606401610b90565b600080516020615f858339815191528054600119810161234d5760405162461bcd60e51b8152600401610b9090615b76565b600282557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146123a25760405162461bcd60e51b8152600401610b9090615b9e565b600083116123eb5760405162461bcd60e51b81526020600482015260166024820152754d757374206465706f73697420736f6d657468696e6760501b6044820152606401610b90565b82603b60008282546123fd9190615945565b90915550506040805160008152602081018590526001600160a01b038616917f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62910160405180910390a250600190555050565b61245861385e565b6124745760405162461bcd60e51b8152600401610b90906157fd565b603354600160a81b900460ff166124c05760405162461bcd60e51b815260206004820152601060248201526f139bc8199a5c9cdd0819195c1bdcda5d60821b6044820152606401610b90565b6033805460ff60a81b191690556040517fce77f85e30b0e6df0d12527ddf038f900fdeda0eeda4284c52be47b05de31a9790600090a1565b60335461010090046001600160a01b031633146125275760405162461bcd60e51b8152600401610b90906159ab565b600061256884848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061416292505050565b600081815260376020526040808220815180830190925280549394509192909190829060ff16600881111561259f5761259f614f67565b60088111156125b0576125b0614f67565b81529054610100900464ffffffffff1660209091015290506004815160088111156125dd576125dd614f67565b14806125fb57506005815160088111156125f9576125f9614f67565b145b6126475760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f72206e6f74206163746976652f65786974696e67000000006044820152606401610b90565b826001600160401b03166000036127045760355460005b818110156126e85760006035828154811061267b5761267b6158b4565b90600052602060002001549050603460008281526020019081526020016000206000015485036126df5760405162461bcd60e51b815260206004820152600f60248201526e14195b991a5b99c819195c1bdcda5d608a1b6044820152606401610b90565b5060010161265e565b50506000828152603760205260409020805460ff191660051790555b61270f8585856142ec565b50817f8dd83105dbd4263d41c76e5d414905babdd3f035bd2031f6ce8895715595979c6127496001600160401b038616633b9aca006157e6565b60405190815260200160405180910390a25050505050565b606b546001600160a01b031633146127bb5760405162461bcd60e51b815260206004820152601b60248201527f43616c6c6572206973206e6f74207468652048617276657374657200000000006044820152606401610b90565b600080516020615f85833981519152805460011981016127ed5760405162461bcd60e51b8152600401610b9090615b76565b600282556127f9611079565b5060019055565b7f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db546001600160a01b0316336001600160a01b03161461289b5760405162461bcd60e51b815260206004820152603060248201527f4f6e6c79207468652070656e64696e6720476f7665726e6f722063616e20636f60448201526f6d706c6574652074686520636c61696d60801b6064820152608401610b90565b6128a433614431565b565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316146128f95760405162461bcd60e51b8152600401610b9090615b9e565b6040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa15801561295d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129819190615903565b603a5461298e9190615945565b92915050565b600061299f4261421b565b90506001600160401b0381166129b7600c6023615bc9565b6039546129cd91906001600160401b0316615bf2565b6001600160401b031610612a135760405162461bcd60e51b815260206004820152600d60248201526c29b730b8103a37b79039b7b7b760991b6044820152606401610b90565b6000612a1e82613cf3565b905060004790506040518060600160405280838152602001846001600160401b03168152602001612a4e83614490565b6001600160801b039081169091528151603855602082015160398054604094850151909316600160401b026001600160c01b03199093166001600160401b03909216919091179190911790555182907fb7523e03ed4a74718427c422a01fee1138835adb5bd592240f30bd8b5e1b929a90612acc9084815260200190565b60405180910390a2505050565b600260008581526037602052604090205460ff166008811115612afe57612afe614f67565b14612b425760405162461bcd60e51b815260206004820152601460248201527315985b1a59185d1bdc881b9bdd081cdd185ad95960621b6044820152606401610b90565b6000612b4d87613cf3565b604051632a5d4ad960e11b81529091506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906354ba95b290612ba69084908990889088908d908c90600401615c11565b60006040518083038186803b158015612bbe57600080fd5b505afa158015612bd2573d6000803e3d6000fd5b50505050604051806040016040528060036008811115612bf457612bf4614f67565b815264ffffffffff8816602091820152600087815260379091526040902081518154829060ff19166001836008811115612c3057612c30614f67565b0217905550602091820151815464ffffffffff9091166101000265ffffffffff0019909116179055604051600091612c7291600160f91b9184913091016159fe565b604051602081830303815290604052612c8a90615c4d565b9050848114612e23576000868152603760205260408120805460ff19166008179055603554905b81811015612def5760006034600060358481548110612cd257612cd26158b4565b600091825260208083209091015483528281019390935260409182019020815160a0810183528154815260018201546001600160401b0380821695830195909552600160401b81049094169281019290925263ffffffff600160801b84041660608301529091608083019060ff600160a01b909104166002811115612d5957612d59614f67565b6002811115612d6a57612d6a614f67565b9052508051909150899003612de657612da1603a5482602001516001600160401b0316633b9aca00612d9c91906157e6565b6144f9565b603a6000828254612db2919061591c565b92505081905550612de060358381548110612dcf57612dcf6158b4565b906000526020600020015482613df8565b50612def565b50600101612cb1565b5060405187907fb8318df57b70f6381fb18aaf762e33efa2cc92627aae83d417f6710e1415d8d890600090a2505050612e99565b6036805460018101825560009182527f4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b8018790556033805460ff60a81b1916905560405164ffffffffff89169188917f8142f1367675d1a37dc1aa31258c38b05f5348de55b799764472d94ccb4a71f49190a350505b505050505050565b612ea961385e565b612ec55760405162461bcd60e51b8152600401610b90906157fd565b60338054610100600160a81b0319166101006001600160a01b038416908102919091179091556040517f83f29c79feb71f8fba9d0fbc4ba5f0982a28b6b1e868b3fc50e6400d100bca0f90600090a250565b60335461010090046001600160a01b03163314612f465760405162461bcd60e51b8152600401610b90906159ab565b6000612f8786868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061416292505050565b60008181526037602052604090205490915060ff166001816008811115612fb057612fb0614f67565b1480612fcd57506006816008811115612fcb57612fcb614f67565b145b80612fe957506008816008811115612fe757612fe7614f67565b145b6130355760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f72206e6f742072656764206f7220657869746564000000006044820152606401610b90565b60008281526037602052604090819020805460ff19166007179055516312b3fc1960e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906312b3fc19906130a2908a908a908a908a908a90600401615d1e565b600060405180830381600087803b1580156130bc57600080fd5b505af11580156130d0573d6000803e3d6000fd5b50505050817f63d54ea43f163d6e28fc23abec67eb7c3294e7e6f0620955a73cd8d17c7367f486866040516119fd929190615d55565b606c818154811061311657600080fd5b6000918252602090912001546001600160a01b0316905081565b60335461010090046001600160a01b0316331480613151575061315161385e565b61319d5760405162461bcd60e51b815260206004820152601b60248201527f4e6f74205265676973747261746f72206f7220476f7665726e6f7200000000006044820152606401610b90565b6128a4614511565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806131f457506131df610a2d565b6001600160a01b0316336001600160a01b0316145b61324c5760405162461bcd60e51b815260206004820152602360248201527f43616c6c6572206973206e6f7420746865205661756c74206f7220476f7665726044820152623737b960e91b6064820152608401610b90565b600080516020615f858339815191528054600119810161327e5760405162461bcd60e51b8152600401610b9090615b76565b600282556040516370a0823160e01b8152306004820152479060009082907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156132ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133119190615903565b61331b9190615945565b9050801561334e5761334e7f00000000000000000000000000000000000000000000000000000000000000008284614586565b5050600182555050565b61336061385e565b61337c5760405162461bcd60e51b8152600401610b90906157fd565b8060005b8181101561342657600084848381811061339c5761339c6158b4565b90506020020160208101906133b19190614ea9565b6001600160a01b03160361341e5760405162461bcd60e51b815260206004820152602e60248201527f43616e206e6f742073657420616e20656d70747920616464726573732061732060448201526d30903932bbb0b932103a37b5b2b760911b6064820152608401610b90565b600101613380565b507f04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc606c848460405161345b93929190615d69565b60405180910390a1611af5606c8484614cce565b60405163095ea7b360e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015260001960248301527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b3906044016020604051808303816000875af11580156134ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135239190615741565b50565b61352e61385e565b61354a5760405162461bcd60e51b8152600401610b90906157fd565b604051631a1b9a0b60e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063686e682c9061359a90869086908690600401615e02565b600060405180830381600087803b1580156135b457600080fd5b505af11580156135c8573d6000803e3d6000fd5b50505050505050565b603581815481106110c857600080fd5b60335461010090046001600160a01b031633146136105760405162461bcd60e51b8152600401610b90906159ab565b60335460ff16156136335760405162461bcd60e51b8152600401610b90906159d4565b600061367489898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061416292505050565b90506000808281526037602052604090205460ff16600881111561369a5761369a614f67565b146136e75760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f7220616c72656164792072656769737465726564000000006044820152606401610b90565b60008181526037602052604090819020805460ff19166001179055516301ba3ee760e21b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306e8fb9c9061375a908c908c908c908c908c908c908c908c90600401615ea4565b600060405180830381600087803b15801561377457600080fd5b505af1158015613788573d6000803e3d6000fd5b50505050807f50837f89f5e75ae0a7bcc858f53ea15fa398dc007fd52cbfe4683ae9a6c2d72288886040516137be929190615d55565b60405180910390a2505050505050505050565b6137d961385e565b6137f55760405162461bcd60e51b8152600401610b90906157fd565b606b54604080516001600160a01b03928316815291831660208301527fe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796910160405180910390a1606b80546001600160a01b0319166001600160a01b0392909216919091179055565b6000613876600080516020615fa58339815191525490565b6001600160a01b0316336001600160a01b031614905090565b61389761385e565b6138b35760405162461bcd60e51b8152600401610b90906157fd565b6138db817f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db55565b806001600160a01b03166138fb600080516020615fa58339815191525490565b6001600160a01b03167fa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d60405160405180910390a350565b600080516020615f85833981519152805460011981016139655760405162461bcd60e51b8152600401610b9090615b76565b600282557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146139ba5760405162461bcd60e51b8152600401610b9090615b9e565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480613a00575060335461010090046001600160a01b031633145b613a4c5760405162461bcd60e51b815260206004820152601f60248201527f43616c6c6572206e6f74205661756c74206f72205265676973747261746f72006044820152606401610b90565b613a57858447614586565b5060019055505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614613ad35760405162461bcd60e51b815260206004820152601760248201527610d85b1b195c881a5cc81b9bdd081d1a194815985d5b1d604a1b6044820152606401610b90565b600080516020615f8583398151915280546001198101613b055760405162461bcd60e51b8152600401610b9090615b76565b600282556040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015613b70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b949190615903565b90506000603b5482613ba6919061591c565b9050801561334e57603b8290556040805160008152602081018390526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62910160405180910390a25050600182555050565b6060606c805480602002602001604051908101604052809291908181526020018280548015613c7a57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613c5c575b5050505050905090565b613c8c61385e565b613ca85760405162461bcd60e51b8152600401610b90906157fd565b6128a46146c8565b6000600c7f0000000000000000000000000000000000000000000000000000000000000000613cdf8483615bc9565b613ce99190615bf2565b61298e9190615bf2565b604080516001600160401b038316602082015260009182918291720f3df6d732807ef1319fb7b8bb8522d0beac02910160408051601f1981840301815290829052613d3d91615f05565b600060405180830381855afa9150503d8060008114613d78576040519150601f19603f3d011682016040523d82523d6000602084013e613d7d565b606091505b5091509150818015613d90575060008151115b613ddc5760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420626561636f6e2074696d657374616d7000000000000000006044820152606401610b90565b80806020019051810190613df09190615903565b949350505050565b60008281526034602052604081206001908101805460ff60a01b1916600160a11b179055603580549091613e2b9161591c565b81548110613e3b57613e3b6158b4565b90600052602060002001549050806035836060015163ffffffff1681548110613e6657613e666158b4565b60009182526020808320909101929092556060840151838252603490925260409020600101805463ffffffff909216600160801b0263ffffffff60801b199092169190911790556035805480613ebe57613ebe61592f565b60019003818190600052602060002001600090559055505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052613f2b908490614742565b505050565b6060816001600160401b03811115613f4a57613f4a614fc7565b604051908082528060200260200182016040528015613f73578160200160208202803683370190505b50905060005b82811015613fda576034600060358381548110613f9857613f986158b4565b9060005260206000200154815260200190815260200160002060000154828281518110613fc757613fc76158b4565b6020908102919091010152600101613f79565b50919050565b8251613ff390606c906020860190614d2d565b5081518151811461403d5760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420696e7075742061727261797360601b6044820152606401610b90565b60005b8181101561408c5761408484828151811061405d5761405d6158b4565b6020026020010151848381518110614077576140776158b4565b6020026020010151614814565b600101614040565b5050505050565b604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156140f557600080fd5b505af1158015614109573d6000803e3d6000fd5b50505050600061411b82603b546144f9565b905080603b600082825461412f919061591c565b9250508190555081603a60008282546141489190615945565b90915550506039805467ffffffffffffffff191690555050565b600081516030146141aa5760405162461bcd60e51b8152602060048201526012602482015271496e76616c6964207075626c6963206b657960701b6044820152606401610b90565b6040516002906141c1908490600090602001615f21565b60408051601f19818403018152908290526141db91615f05565b602060405180830381855afa1580156141f8573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061298e9190615903565b60006001600160401b038211156142835760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b6064820152608401610b90565b5090565b600063ffffffff8211156142835760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b6064820152608401610b90565b60006030831461433e5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642076616c696461746f722062797465206c656e6774680000006044820152606401610b90565b614346614973565b90506000710961ef480eb55e80d19ad83579a64c0070026001600160a01b03168286868660405160200161437c93929190615f50565b60408051601f198184030181529082905261439691615f05565b60006040518083038185875af1925050503d80600081146143d3576040519150601f19603f3d011682016040523d82523d6000602084013e6143d8565b606091505b50509050806144295760405162461bcd60e51b815260206004820152601960248201527f5769746864726177616c2072657175657374206661696c6564000000000000006044820152606401610b90565b509392505050565b6001600160a01b0381166144875760405162461bcd60e51b815260206004820152601a60248201527f4e657720476f7665726e6f7220697320616464726573732830290000000000006044820152606401610b90565b61352381614a3a565b60006001600160801b038211156142835760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b6064820152608401610b90565b6000818310614508578161450a565b825b9392505050565b60335460ff16156145345760405162461bcd60e51b8152600401610b90906159d4565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586145693390565b6040516001600160a01b03909116815260200160405180910390a1565b600082116145d65760405162461bcd60e51b815260206004820152601760248201527f4d75737420776974686472617720736f6d657468696e670000000000000000006044820152606401610b90565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b03161461464d5760405162461bcd60e51b8152602060048201526013602482015272149958da5c1a595b9d081b9bdd0815985d5b1d606a1b6044820152606401610b90565b801561465c5761465c81614aa1565b6146668284614b63565b6040805160008152602081018490526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63989101612acc565b60335460ff166147115760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610b90565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33614569565b6000614797826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614bc39092919063ffffffff16565b805190915015613f2b57808060200190518101906147b59190615741565b613f2b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b90565b6001600160a01b0382811660009081526067602052604090205416156148715760405162461bcd60e51b81526020600482015260126024820152711c151bdad95b88185b1c9958591e481cd95d60721b6044820152606401610b90565b6001600160a01b0382161580159061489157506001600160a01b03811615155b6148d15760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642061646472657373657360781b6044820152606401610b90565b6001600160a01b03828116600081815260676020908152604080832080549587166001600160a01b031996871681179091556068805460018101825594527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c2209775390930180549095168417909455925190815290917fef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765910160405180910390a25050565b60405160009081908190710961ef480eb55e80d19ad83579a64c0070029082818181855afa9150503d80600081146149c7576040519150601f19603f3d011682016040523d82523d6000602084013e6149cc565b606091505b50915091508180156149df575060008151115b614a1f5760405162461bcd60e51b81526020600482015260116024820152704661696c656420746f206765742066656560781b6044820152606401610b90565b80806020019051810190614a339190615903565b9250505090565b806001600160a01b0316614a5a600080516020615fa58339815191525490565b6001600160a01b03167fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a60405160405180910390a3600080516020615fa583398151915255565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015614afc57600080fd5b505af1158015614b10573d6000803e3d6000fd5b505050505080603b6000828254614b279190615945565b9091555050603a54614b3990826144f9565b603a6000828254614b4a919061591c565b90915550506039805467ffffffffffffffff1916905550565b614b976001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168284613ed9565b6000614ba583603b546144f9565b905080603b6000828254614bb9919061591c565b9091555050505050565b6060613df0848460008585843b614c1c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b90565b600080866001600160a01b03168587604051614c389190615f05565b60006040518083038185875af1925050503d8060008114614c75576040519150601f19603f3d011682016040523d82523d6000602084013e614c7a565b606091505b5091509150614c8a828286614c95565b979650505050505050565b60608315614ca457508161450a565b825115614cb45782518084602001fd5b8160405162461bcd60e51b8152600401610b909190615f71565b828054828255906000526020600020908101928215614d21579160200282015b82811115614d215781546001600160a01b0319166001600160a01b03843516178255602090920191600190910190614cee565b50614283929150614d82565b828054828255906000526020600020908101928215614d21579160200282015b82811115614d2157825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614d4d565b5b808211156142835760008155600101614d83565b80356001600160401b0381168114614dae57600080fd5b919050565b600060408284031215613fda57600080fd5b60008060008060808587031215614ddb57600080fd5b84359350614deb60208601614d97565b925060408501356001600160401b03811115614e0657600080fd5b614e1287828801614db3565b92505060608501356001600160401b03811115614e2e57600080fd5b614e3a87828801614db3565b91505092959194509250565b80356001600160a01b0381168114614dae57600080fd5b60008060408385031215614e7057600080fd5b614e7983614e46565b9150614e8760208401614e46565b90509250929050565b600060208284031215614ea257600080fd5b5035919050565b600060208284031215614ebb57600080fd5b61450a82614e46565b60008060408385031215614ed757600080fd5b614ee083614e46565b946020939093013593505050565b600060808284031215613fda57600080fd5b60008060408385031215614f1357600080fd5b82356001600160401b03811115614f2957600080fd5b614f3585828601614eee565b92505060208301356001600160401b03811115614f5157600080fd5b614f5d85828601614eee565b9150509250929050565b634e487b7160e01b600052602160045260246000fd5b8581526001600160401b0385811660208301528416604082015263ffffffff8316606082015260a0810160038310614fb757614fb7614f67565b8260808301529695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561500557615005614fc7565b604052919050565b60006001600160401b0382111561502657615026614fc7565b5060051b60200190565b600082601f83011261504157600080fd5b813561505461504f8261500d565b614fdd565b8082825260208201915060208360051b86010192508583111561507657600080fd5b602085015b8381101561509a5761508c81614e46565b83526020928301920161507b565b5095945050505050565b6000806000606084860312156150b957600080fd5b83356001600160401b038111156150cf57600080fd5b6150db86828701615030565b93505060208401356001600160401b038111156150f757600080fd5b61510386828701615030565b92505060408401356001600160401b0381111561511f57600080fd5b61512b86828701615030565b9150509250925092565b6000806040838503121561514857600080fd5b82356001600160401b0381111561515e57600080fd5b83016060818603121561517057600080fd5b9150614e8760208401614d97565b60008083601f84011261519057600080fd5b5081356001600160401b038111156151a757600080fd5b6020830191508360208285010111156151bf57600080fd5b9250929050565b6000806000604084860312156151db57600080fd5b83356001600160401b038111156151f157600080fd5b6151fd8682870161517e565b9094509250615210905060208501614d97565b90509250925092565b60008060008060008060a0878903121561523257600080fd5b61523b87614d97565b9550602087013564ffffffffff8116811461525557600080fd5b9450604087013593506060870135925060808701356001600160401b0381111561527e57600080fd5b61528a89828a0161517e565b979a9699509497509295939492505050565b60008083601f8401126152ae57600080fd5b5081356001600160401b038111156152c557600080fd5b6020830191508360208260051b85010111156151bf57600080fd5b600060a08284031215613fda57600080fd5b600080600080600060e0868803121561530a57600080fd5b85356001600160401b0381111561532057600080fd5b61532c8882890161517e565b90965094505060208601356001600160401b0381111561534b57600080fd5b6153578882890161529c565b909450925061536b905087604088016152e0565b90509295509295909350565b6000806020838503121561538a57600080fd5b82356001600160401b038111156153a057600080fd5b6153ac8582860161529c565b90969095509350505050565b60408101600984106153cc576153cc614f67565b92815264ffffffffff9190911660209091015290565b803563ffffffff81168114614dae57600080fd5b801515811461352357600080fd5b600060a0828403121561541657600080fd5b60405160a081016001600160401b038111828210171561543857615438614fc7565b604052905080615447836153e2565b815261545560208401614d97565b602082015261546660408401614d97565b60408201526060830135615479816153f6565b6060820152608092830135920191909152919050565b600080600060e084860312156154a457600080fd5b83356001600160401b038111156154ba57600080fd5b8401601f810186136154cb57600080fd5b80356154d961504f8261500d565b8082825260208201915060208360051b8501019250888311156154fb57600080fd5b6020840193505b828410156155245761551384614d97565b825260209384019390910190615502565b9550505050602084013591506152108560408601615404565b600080600080600080600080610120898b03121561555a57600080fd5b88356001600160401b0381111561557057600080fd5b61557c8b828c0161517e565b90995097505060208901356001600160401b0381111561559b57600080fd5b6155a78b828c0161529c565b90975095505060408901356001600160401b038111156155c657600080fd5b6155d28b828c0161517e565b909550935050606089013591506155ec8a60808b016152e0565b90509295985092959890939650565b60008060006060848603121561561057600080fd5b61561984614e46565b925061562760208501614e46565b929592945050506040919091013590565b602080825282518282018190526000918401906040840190835b818110156156795783516001600160a01b0316835260209384019390920191600101615652565b509095945050505050565b60006020828403121561569657600080fd5b61450a82614d97565b6000808335601e198436030181126156b657600080fd5b8301803591506001600160401b038211156156d057600080fd5b6020019150368190038213156151bf57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8481526001600160401b03841660208201526060604082015260006157376060830184866156e5565b9695505050505050565b60006020828403121561575357600080fd5b815161450a816153f6565b85815264ffffffffff851660208201526001600160401b0384166040820152608060608201526000614c8a6080830184866156e5565b634e487b7160e01b600052601160045260246000fd5b60006001600160401b038316806157d157634e487b7160e01b600052601260045260246000fd5b806001600160401b0384160491505092915050565b808202811582820484141761298e5761298e615794565b6020808252601a908201527f43616c6c6572206973206e6f742074686520476f7665726e6f72000000000000604082015260600190565b6000808335601e1984360301811261584b57600080fd5b8301803591506001600160401b0382111561586557600080fd5b6020019150600581901b36038213156151bf57600080fd5b8481528360208201526060604082015260006157376060830184866156e5565b6000816158ac576158ac615794565b506000190190565b634e487b7160e01b600052603260045260246000fd5b8581528460208201526080604082015260006158ea6080830185876156e5565b905064ffffffffff831660608301529695505050505050565b60006020828403121561591557600080fd5b5051919050565b8181038181111561298e5761298e615794565b634e487b7160e01b600052603160045260246000fd5b8082018082111561298e5761298e615794565b60006020828403121561596a57600080fd5b61450a826153e2565b8581528460208201526080604082015260006159936080830185876156e5565b905063ffffffff831660608301529695505050505050565b6020808252600f908201526e2737ba102932b3b4b9ba3930ba37b960891b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6001600160f81b03199390931683526001600160a81b031991909116600183015260601b6bffffffffffffffffffffffff1916600c82015260200190565b6001600160401b03828116828216039081111561298e5761298e615794565b60005b83811015615a76578181015183820152602001615a5e565b50506000910152565b60008151808452615a97816020860160208601615a5b565b601f01601f19169290920160200192915050565b86815260a060208201526000615ac460a0830188615a7f565b6001600160401b03871660408401528281036060840152615ae68186886156e5565b9150506001600160401b0383166080830152979650505050505050565b608081526000615b1760808301888a6156e5565b8281036020840152615b298188615a7f565b90508281036040840152615b3e8186886156e5565b915050826060830152979650505050505050565b604081526000615b666040830185876156e5565b9050826020830152949350505050565b6020808252600e908201526d1499595b9d1c985b9d0818d85b1b60921b604082015260600190565b602080825260119082015270155b9cdd5c1c1bdc9d195908185cdcd95d607a1b604082015260600190565b6001600160401b038181168382160290811690818114615beb57615beb615794565b5092915050565b6001600160401b03818116838216019081111561298e5761298e615794565b86815285602082015260a060408201526000615c3160a0830186886156e5565b64ffffffffff9490941660608301525060800152949350505050565b80516020808301519190811015613fda5760001960209190910360031b1b16919050565b81835260208301925060008160005b84811015615caf576001600160401b03615c9983614d97565b1686526020958601959190910190600101615c80565b5093949350505050565b63ffffffff615cc7826153e2565b1682526001600160401b03615cde60208301614d97565b1660208301526001600160401b03615cf860408301614d97565b1660408301526060810135615d0c816153f6565b15156060830152608090810135910152565b60e081526000615d3260e0830187896156e5565b8281036020840152615d45818688615c71565b9150506157376040830184615cb9565b602081526000613df0602083018486615c71565b6040808252845490820181905260008581526020812090916060840190835b81811015615daf5783546001600160a01b0316835260019384019360209093019201615d88565b50508381036020808601919091528582520190508460005b85811015615df6576001600160a01b03615de083614e46565b1683526020928301929190910190600101615dc7565b50909695505050505050565b60e080825284519082018190526000906020860190610100840190835b81811015615e465783516001600160401b0316835260209384019390920191600101615e1f565b5050809250505083602083015263ffffffff83511660408301526001600160401b0360208401511660608301526001600160401b0360408401511660808301526060830151151560a0830152608083015160c0830152949350505050565b61012081526000615eba61012083018a8c6156e5565b8281036020840152615ecd81898b615c71565b90508281036040840152615ee28187896156e5565b915050836060830152615ef86080830184615cb9565b9998505050505050505050565b60008251615f17818460208701615a5b565b9190910192915050565b60008351615f33818460208801615a5b565b6001600160801b0319939093169190920190815260100192915050565b8284823760c09190911b6001600160c01b0319169101908152600801919050565b60208152600061450a6020830184615a7f56fe53bf423e48ed90e97d02ab0ebab13b2a235a6bfbe9c321847d5c175333ac45357bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4aa26469706673582212208a510b2c181230807f02fb536bfe47f607befc9721889a9a153ddfcefaf3588764736f6c634300081c0033", "libraries": {}, "devdoc": { "author": "Origin Protocol Inc", @@ -1694,9 +1668,6 @@ "BEACON_PROOFS()": { "notice": "Address of the Beacon Proofs contract that verifies beacon chain data" }, - "SSV_NETWORK()": { - "notice": "The address of the SSV Network contract used to interface with" - }, "SSV_TOKEN()": { "notice": "SSV ERC20 token that serves as a payment for operating SSV validators" }, @@ -1788,7 +1759,7 @@ "notice": "Mapping of the block root to the balances at that slot" }, "stakeEth((bytes,bytes,bytes32),uint64)": { - "notice": "Stakes WETH in this strategy to a compounding validator. The the first deposit to a new validator, the amount must be 1 ETH. Another deposit of at least 31 ETH is required for the validator to be activated. This second deposit has to be done after the validator has been verified. Does not convert any ETH sitting in this strategy to WETH. There can not be two deposits to the same validator in the same block for the same amount. Function is pausable so in case a run-away Registrator can be prevented from continuing to deposit funds to slashed or undesired validators." + "notice": "Stakes WETH in this strategy to a compounding validator. The first deposit to a new validator, the amount must be 1 ETH. Another deposit of at least 31 ETH is required for the validator to be activated. This second deposit has to be done after the validator has been verified. Does not convert any ETH sitting in this strategy to WETH. There can not be two deposits to the same validator in the same block for the same amount. Function is pausable so in case a run-away Registrator can be prevented from continuing to deposit funds to slashed or undesired validators." }, "supportsAsset(address)": { "notice": "Returns bool indicating whether asset is supported by the strategy." @@ -1842,7 +1813,7 @@ "storageLayout": { "storage": [ { - "astId": 8857, + "astId": 7172, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "initialized", "offset": 0, @@ -1850,7 +1821,7 @@ "type": "t_bool" }, { - "astId": 8860, + "astId": 7175, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "initializing", "offset": 1, @@ -1858,7 +1829,7 @@ "type": "t_bool" }, { - "astId": 8900, + "astId": 7215, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "______gap", "offset": 0, @@ -1874,7 +1845,7 @@ "type": "t_bool" }, { - "astId": 5323, + "astId": 3642, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "validatorRegistrator", "offset": 1, @@ -1882,7 +1853,7 @@ "type": "t_address" }, { - "astId": 5344, + "astId": 3663, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "firstDeposit", "offset": 21, @@ -1890,15 +1861,15 @@ "type": "t_bool" }, { - "astId": 5350, + "astId": 3669, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "deposits", "offset": 0, "slot": "52", - "type": "t_mapping(t_bytes32,t_struct(DepositData)5341_storage)" + "type": "t_mapping(t_bytes32,t_struct(DepositData)3660_storage)" }, { - "astId": 5354, + "astId": 3673, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "depositList", "offset": 0, @@ -1906,7 +1877,7 @@ "type": "t_array(t_bytes32)dyn_storage" }, { - "astId": 5374, + "astId": 3693, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "verifiedValidators", "offset": 0, @@ -1914,23 +1885,23 @@ "type": "t_array(t_bytes32)dyn_storage" }, { - "astId": 5380, + "astId": 3699, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "validator", "offset": 0, "slot": "55", - "type": "t_mapping(t_bytes32,t_struct(ValidatorData)5370_storage)" + "type": "t_mapping(t_bytes32,t_struct(ValidatorData)3689_storage)" }, { - "astId": 5392, + "astId": 3711, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "snappedBalance", "offset": 0, "slot": "56", - "type": "t_struct(Balances)5388_storage" + "type": "t_struct(Balances)3707_storage" }, { - "astId": 5395, + "astId": 3714, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "lastVerifiedEthBalance", "offset": 0, @@ -1938,7 +1909,7 @@ "type": "t_uint256" }, { - "astId": 5398, + "astId": 3717, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "depositedWethAccountedFor", "offset": 0, @@ -1946,7 +1917,7 @@ "type": "t_uint256" }, { - "astId": 5402, + "astId": 3721, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "__gap", "offset": 0, @@ -1954,7 +1925,7 @@ "type": "t_array(t_uint256)41_storage" }, { - "astId": 8980, + "astId": 7295, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "_deprecated_platformAddress", "offset": 0, @@ -1962,7 +1933,7 @@ "type": "t_address" }, { - "astId": 8983, + "astId": 7298, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "_deprecated_vaultAddress", "offset": 0, @@ -1970,7 +1941,7 @@ "type": "t_address" }, { - "astId": 8988, + "astId": 7303, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "assetToPToken", "offset": 0, @@ -1978,7 +1949,7 @@ "type": "t_mapping(t_address,t_address)" }, { - "astId": 8992, + "astId": 7307, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "assetsMapped", "offset": 0, @@ -1986,7 +1957,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 8994, + "astId": 7309, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "_deprecated_rewardTokenAddress", "offset": 0, @@ -1994,7 +1965,7 @@ "type": "t_address" }, { - "astId": 8996, + "astId": 7311, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "_deprecated_rewardLiquidationThreshold", "offset": 0, @@ -2002,7 +1973,7 @@ "type": "t_uint256" }, { - "astId": 8999, + "astId": 7314, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "harvesterAddress", "offset": 0, @@ -2010,7 +1981,7 @@ "type": "t_address" }, { - "astId": 9003, + "astId": 7318, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "rewardTokenAddresses", "offset": 0, @@ -2018,7 +1989,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 9007, + "astId": 7322, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "_reserved", "offset": 0, @@ -2026,7 +1997,7 @@ "type": "t_array(t_int256)98_storage" }, { - "astId": 4659, + "astId": 3138, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "__gap", "offset": 0, @@ -2080,12 +2051,12 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_enum(DepositStatus)5328": { + "t_enum(DepositStatus)3647": { "encoding": "inplace", "label": "enum CompoundingValidatorManager.DepositStatus", "numberOfBytes": "1" }, - "t_enum(ValidatorState)5364": { + "t_enum(ValidatorState)3683": { "encoding": "inplace", "label": "enum CompoundingValidatorManager.ValidatorState", "numberOfBytes": "1" @@ -2102,26 +2073,26 @@ "numberOfBytes": "32", "value": "t_address" }, - "t_mapping(t_bytes32,t_struct(DepositData)5341_storage)": { + "t_mapping(t_bytes32,t_struct(DepositData)3660_storage)": { "encoding": "mapping", "key": "t_bytes32", "label": "mapping(bytes32 => struct CompoundingValidatorManager.DepositData)", "numberOfBytes": "32", - "value": "t_struct(DepositData)5341_storage" + "value": "t_struct(DepositData)3660_storage" }, - "t_mapping(t_bytes32,t_struct(ValidatorData)5370_storage)": { + "t_mapping(t_bytes32,t_struct(ValidatorData)3689_storage)": { "encoding": "mapping", "key": "t_bytes32", "label": "mapping(bytes32 => struct CompoundingValidatorManager.ValidatorData)", "numberOfBytes": "32", - "value": "t_struct(ValidatorData)5370_storage" + "value": "t_struct(ValidatorData)3689_storage" }, - "t_struct(Balances)5388_storage": { + "t_struct(Balances)3707_storage": { "encoding": "inplace", "label": "struct CompoundingValidatorManager.Balances", "members": [ { - "astId": 5383, + "astId": 3702, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "blockRoot", "offset": 0, @@ -2129,7 +2100,7 @@ "type": "t_bytes32" }, { - "astId": 5385, + "astId": 3704, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "timestamp", "offset": 0, @@ -2137,7 +2108,7 @@ "type": "t_uint64" }, { - "astId": 5387, + "astId": 3706, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "ethBalance", "offset": 8, @@ -2147,12 +2118,12 @@ ], "numberOfBytes": "64" }, - "t_struct(DepositData)5341_storage": { + "t_struct(DepositData)3660_storage": { "encoding": "inplace", "label": "struct CompoundingValidatorManager.DepositData", "members": [ { - "astId": 5331, + "astId": 3650, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "pubKeyHash", "offset": 0, @@ -2160,7 +2131,7 @@ "type": "t_bytes32" }, { - "astId": 5333, + "astId": 3652, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "amountGwei", "offset": 0, @@ -2168,7 +2139,7 @@ "type": "t_uint64" }, { - "astId": 5335, + "astId": 3654, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "slot", "offset": 8, @@ -2176,7 +2147,7 @@ "type": "t_uint64" }, { - "astId": 5337, + "astId": 3656, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "depositIndex", "offset": 16, @@ -2184,30 +2155,30 @@ "type": "t_uint32" }, { - "astId": 5340, + "astId": 3659, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "status", "offset": 20, "slot": "1", - "type": "t_enum(DepositStatus)5328" + "type": "t_enum(DepositStatus)3647" } ], "numberOfBytes": "64" }, - "t_struct(ValidatorData)5370_storage": { + "t_struct(ValidatorData)3689_storage": { "encoding": "inplace", "label": "struct CompoundingValidatorManager.ValidatorData", "members": [ { - "astId": 5367, + "astId": 3686, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "state", "offset": 0, "slot": "0", - "type": "t_enum(ValidatorState)5364" + "type": "t_enum(ValidatorState)3683" }, { - "astId": 5369, + "astId": 3688, "contract": "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol:CompoundingStakingSSVStrategy", "label": "index", "offset": 1, diff --git a/contracts/deployments/hoodi/solcInputs/6009afe519e1f288a46249ae425a2ffb.json b/contracts/deployments/hoodi/solcInputs/6009afe519e1f288a46249ae425a2ffb.json new file mode 100644 index 0000000000..e247549f6f --- /dev/null +++ b/contracts/deployments/hoodi/solcInputs/6009afe519e1f288a46249ae425a2ffb.json @@ -0,0 +1,105 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/security/Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n require(!paused(), \"Pausable: paused\");\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n require(paused(), \"Pausable: not paused\");\n _;\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, 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 `sender` to `recipient` 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 sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\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" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.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 /**\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/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\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 function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 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\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" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits.\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128) {\n require(value >= type(int128).min && value <= type(int128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return int128(value);\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64) {\n require(value >= type(int64).min && value <= type(int64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return int64(value);\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32) {\n require(value >= type(int32).min && value <= type(int32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return int32(value);\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16) {\n require(value >= type(int16).min && value <= type(int16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return int16(value);\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits.\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8) {\n require(value >= type(int8).min && value <= type(int8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return int8(value);\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "contracts/beacon/BeaconRoots.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\n/**\n * @title Library to retrieve beacon block roots.\n * @author Origin Protocol Inc\n */\nlibrary BeaconRoots {\n /// @notice The address of beacon block roots oracle\n /// See https://eips.ethereum.org/EIPS/eip-4788\n address internal constant BEACON_ROOTS_ADDRESS =\n 0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02;\n\n /// @notice Returns the beacon block root for the previous block.\n /// This comes from the Beacon Roots contract defined in EIP-4788.\n /// This will revert if the block is more than 8,191 blocks old as\n /// that is the size of the beacon root's ring buffer.\n /// @param timestamp The timestamp of the block for which to get the parent root.\n /// @return parentRoot The parent block root for the given timestamp.\n function parentBlockRoot(uint64 timestamp)\n internal\n view\n returns (bytes32 parentRoot)\n {\n // Call the Beacon Roots contract to get the parent block root.\n // This does not have a function signature, so we use a staticcall.\n (bool success, bytes memory result) = BEACON_ROOTS_ADDRESS.staticcall(\n abi.encode(timestamp)\n );\n\n require(success && result.length > 0, \"Invalid beacon timestamp\");\n parentRoot = abi.decode(result, (bytes32));\n }\n}\n" + }, + "contracts/beacon/PartialWithdrawal.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\n/**\n * @title Library to request full or partial withdrawals from validators on the beacon chain.\n * @author Origin Protocol Inc\n */\nlibrary PartialWithdrawal {\n /// @notice The address where the withdrawal request is sent to\n /// See https://eips.ethereum.org/EIPS/eip-7002\n address internal constant WITHDRAWAL_REQUEST_ADDRESS =\n 0x00000961Ef480Eb55e80D19ad83579A64c007002;\n\n /// @notice Requests a partial withdrawal for a given validator public key and amount.\n /// @param validatorPubKey The public key of the validator to withdraw from\n /// @param amount The amount of ETH to withdraw\n function request(bytes calldata validatorPubKey, uint64 amount)\n internal\n returns (uint256 fee_)\n {\n require(validatorPubKey.length == 48, \"Invalid validator byte length\");\n fee_ = fee();\n\n // Call the Withdrawal Request contract with the validator public key\n // and amount to be withdrawn packed together\n\n // This is a general purpose EL to CL request:\n // https://eips.ethereum.org/EIPS/eip-7685\n (bool success, ) = WITHDRAWAL_REQUEST_ADDRESS.call{ value: fee_ }(\n abi.encodePacked(validatorPubKey, amount)\n );\n\n require(success, \"Withdrawal request failed\");\n }\n\n /// @notice Gets fee for withdrawal requests contract on Beacon chain\n function fee() internal view returns (uint256) {\n // Get fee from the withdrawal request contract\n (bool success, bytes memory result) = WITHDRAWAL_REQUEST_ADDRESS\n .staticcall(\"\");\n\n require(success && result.length > 0, \"Failed to get fee\");\n return abi.decode(result, (uint256));\n }\n}\n" + }, + "contracts/governance/Governable.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\n/**\n * @title Base for contracts that are managed by the Origin Protocol's Governor.\n * @dev Copy of the openzeppelin Ownable.sol contract with nomenclature change\n * from owner to governor and renounce methods removed. Does not use\n * Context.sol like Ownable.sol does for simplification.\n * @author Origin Protocol Inc\n */\nabstract contract Governable {\n // Storage position of the owner and pendingOwner of the contract\n // keccak256(\"OUSD.governor\");\n bytes32 private constant governorPosition =\n 0x7bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4a;\n\n // keccak256(\"OUSD.pending.governor\");\n bytes32 private constant pendingGovernorPosition =\n 0x44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db;\n\n // keccak256(\"OUSD.reentry.status\");\n bytes32 private constant reentryStatusPosition =\n 0x53bf423e48ed90e97d02ab0ebab13b2a235a6bfbe9c321847d5c175333ac4535;\n\n // See OpenZeppelin ReentrancyGuard implementation\n uint256 constant _NOT_ENTERED = 1;\n uint256 constant _ENTERED = 2;\n\n event PendingGovernorshipTransfer(\n address indexed previousGovernor,\n address indexed newGovernor\n );\n\n event GovernorshipTransferred(\n address indexed previousGovernor,\n address indexed newGovernor\n );\n\n /**\n * @notice Returns the address of the current Governor.\n */\n function governor() public view returns (address) {\n return _governor();\n }\n\n /**\n * @dev Returns the address of the current Governor.\n */\n function _governor() internal view returns (address governorOut) {\n bytes32 position = governorPosition;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n governorOut := sload(position)\n }\n }\n\n /**\n * @dev Returns the address of the pending Governor.\n */\n function _pendingGovernor()\n internal\n view\n returns (address pendingGovernor)\n {\n bytes32 position = pendingGovernorPosition;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n pendingGovernor := sload(position)\n }\n }\n\n /**\n * @dev Throws if called by any account other than the Governor.\n */\n modifier onlyGovernor() {\n require(isGovernor(), \"Caller is not the Governor\");\n _;\n }\n\n /**\n * @notice Returns true if the caller is the current Governor.\n */\n function isGovernor() public view returns (bool) {\n return msg.sender == _governor();\n }\n\n function _setGovernor(address newGovernor) internal {\n emit GovernorshipTransferred(_governor(), newGovernor);\n\n bytes32 position = governorPosition;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(position, newGovernor)\n }\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 make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n bytes32 position = reentryStatusPosition;\n uint256 _reentry_status;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n _reentry_status := sload(position)\n }\n\n // On the first call to nonReentrant, _notEntered will be true\n require(_reentry_status != _ENTERED, \"Reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(position, _ENTERED)\n }\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 // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(position, _NOT_ENTERED)\n }\n }\n\n function _setPendingGovernor(address newGovernor) internal {\n bytes32 position = pendingGovernorPosition;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(position, newGovernor)\n }\n }\n\n /**\n * @notice Transfers Governance of the contract to a new account (`newGovernor`).\n * Can only be called by the current Governor. Must be claimed for this to complete\n * @param _newGovernor Address of the new Governor\n */\n function transferGovernance(address _newGovernor) external onlyGovernor {\n _setPendingGovernor(_newGovernor);\n emit PendingGovernorshipTransfer(_governor(), _newGovernor);\n }\n\n /**\n * @notice Claim Governance of the contract to a new account (`newGovernor`).\n * Can only be called by the new Governor.\n */\n function claimGovernance() external {\n require(\n msg.sender == _pendingGovernor(),\n \"Only the pending Governor can complete the claim\"\n );\n _changeGovernor(msg.sender);\n }\n\n /**\n * @dev Change Governance of the contract to a new account (`newGovernor`).\n * @param _newGovernor Address of the new Governor\n */\n function _changeGovernor(address _newGovernor) internal {\n require(_newGovernor != address(0), \"New Governor is address(0)\");\n _setGovernor(_newGovernor);\n }\n}\n" + }, + "contracts/interfaces/IBasicToken.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IBasicToken {\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n" + }, + "contracts/interfaces/IBeaconProofs.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\ninterface IBeaconProofs {\n function verifyValidator(\n bytes32 beaconBlockRoot,\n bytes32 pubKeyHash,\n bytes calldata validatorPubKeyProof,\n uint40 validatorIndex,\n bytes32 withdrawalCredentials\n ) external view;\n\n function verifyValidatorWithdrawable(\n bytes32 beaconBlockRoot,\n uint40 validatorIndex,\n uint64 withdrawableEpoch,\n bytes calldata withdrawableEpochProof\n ) external view;\n\n function verifyBalancesContainer(\n bytes32 beaconBlockRoot,\n bytes32 balancesContainerLeaf,\n bytes calldata balancesContainerProof\n ) external view;\n\n function verifyValidatorBalance(\n bytes32 balancesContainerRoot,\n bytes32 validatorBalanceLeaf,\n bytes calldata balanceProof,\n uint40 validatorIndex\n ) external view returns (uint256 validatorBalance);\n\n function verifyPendingDepositsContainer(\n bytes32 beaconBlockRoot,\n bytes32 pendingDepositsContainerRoot,\n bytes calldata proof\n ) external view;\n\n function verifyPendingDeposit(\n bytes32 pendingDepositsContainerRoot,\n bytes32 pendingDepositRoot,\n bytes calldata proof,\n uint32 pendingDepositIndex\n ) external view;\n\n function verifyFirstPendingDeposit(\n bytes32 beaconBlockRoot,\n uint64 slot,\n bytes calldata firstPendingDepositSlotProof\n ) external view returns (bool isEmptyDepositQueue);\n\n function merkleizePendingDeposit(\n bytes32 pubKeyHash,\n bytes calldata withdrawalCredentials,\n uint64 amountGwei,\n bytes calldata signature,\n uint64 slot\n ) external pure returns (bytes32 root);\n\n function merkleizeSignature(bytes calldata signature)\n external\n pure\n returns (bytes32 root);\n}\n" + }, + "contracts/interfaces/IDepositContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IDepositContract {\n /// @notice A processed deposit event.\n event DepositEvent(\n bytes pubkey,\n bytes withdrawal_credentials,\n bytes amount,\n bytes signature,\n bytes index\n );\n\n /// @notice Submit a Phase 0 DepositData object.\n /// @param pubkey A BLS12-381 public key.\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\n /// @param signature A BLS12-381 signature.\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\n /// Used as a protection against malformed input.\n function deposit(\n bytes calldata pubkey,\n bytes calldata withdrawal_credentials,\n bytes calldata signature,\n bytes32 deposit_data_root\n ) external payable;\n\n /// @notice Query the current deposit root hash.\n /// @return The deposit root hash.\n function get_deposit_root() external view returns (bytes32);\n\n /// @notice Query the current deposit count.\n /// @return The deposit count encoded as a little endian 64-bit number.\n function get_deposit_count() external view returns (bytes memory);\n}\n" + }, + "contracts/interfaces/ISSVNetwork.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nstruct Cluster {\n uint32 validatorCount;\n uint64 networkFeeIndex;\n uint64 index;\n bool active;\n uint256 balance;\n}\n\ninterface ISSVNetwork {\n /**********/\n /* Errors */\n /**********/\n\n error CallerNotOwner(); // 0x5cd83192\n error CallerNotWhitelisted(); // 0x8c6e5d71\n error FeeTooLow(); // 0x732f9413\n error FeeExceedsIncreaseLimit(); // 0x958065d9\n error NoFeeDeclared(); // 0x1d226c30\n error ApprovalNotWithinTimeframe(); // 0x97e4b518\n error OperatorDoesNotExist(); // 0x961e3e8c\n error InsufficientBalance(); // 0xf4d678b8\n error ValidatorDoesNotExist(); // 0xe51315d2\n error ClusterNotLiquidatable(); // 0x60300a8d\n error InvalidPublicKeyLength(); // 0x637297a4\n error InvalidOperatorIdsLength(); // 0x38186224\n error ClusterAlreadyEnabled(); // 0x3babafd2\n error ClusterIsLiquidated(); // 0x95a0cf33\n error ClusterDoesNotExists(); // 0x185e2b16\n error IncorrectClusterState(); // 0x12e04c87\n error UnsortedOperatorsList(); // 0xdd020e25\n error NewBlockPeriodIsBelowMinimum(); // 0x6e6c9cac\n error ExceedValidatorLimit(); // 0x6df5ab76\n error TokenTransferFailed(); // 0x045c4b02\n error SameFeeChangeNotAllowed(); // 0xc81272f8\n error FeeIncreaseNotAllowed(); // 0x410a2b6c\n error NotAuthorized(); // 0xea8e4eb5\n error OperatorsListNotUnique(); // 0xa5a1ff5d\n error OperatorAlreadyExists(); // 0x289c9494\n error TargetModuleDoesNotExist(); // 0x8f9195fb\n error MaxValueExceeded(); // 0x91aa3017\n error FeeTooHigh(); // 0xcd4e6167\n error PublicKeysSharesLengthMismatch(); // 0x9ad467b8\n error IncorrectValidatorStateWithData(bytes publicKey); // 0x89307938\n error ValidatorAlreadyExistsWithData(bytes publicKey); // 0x388e7999\n error EmptyPublicKeysList(); // df83e679\n\n // legacy errors\n error ValidatorAlreadyExists(); // 0x8d09a73e\n error IncorrectValidatorState(); // 0x2feda3c1\n\n event AdminChanged(address previousAdmin, address newAdmin);\n event BeaconUpgraded(address indexed beacon);\n event ClusterDeposited(\n address indexed owner,\n uint64[] operatorIds,\n uint256 value,\n Cluster cluster\n );\n event ClusterLiquidated(\n address indexed owner,\n uint64[] operatorIds,\n Cluster cluster\n );\n event ClusterReactivated(\n address indexed owner,\n uint64[] operatorIds,\n Cluster cluster\n );\n event ClusterWithdrawn(\n address indexed owner,\n uint64[] operatorIds,\n uint256 value,\n Cluster cluster\n );\n event DeclareOperatorFeePeriodUpdated(uint64 value);\n event ExecuteOperatorFeePeriodUpdated(uint64 value);\n event FeeRecipientAddressUpdated(\n address indexed owner,\n address recipientAddress\n );\n event Initialized(uint8 version);\n event LiquidationThresholdPeriodUpdated(uint64 value);\n event MinimumLiquidationCollateralUpdated(uint256 value);\n event NetworkEarningsWithdrawn(uint256 value, address recipient);\n event NetworkFeeUpdated(uint256 oldFee, uint256 newFee);\n event OperatorAdded(\n uint64 indexed operatorId,\n address indexed owner,\n bytes publicKey,\n uint256 fee\n );\n event OperatorFeeDeclarationCancelled(\n address indexed owner,\n uint64 indexed operatorId\n );\n event OperatorFeeDeclared(\n address indexed owner,\n uint64 indexed operatorId,\n uint256 blockNumber,\n uint256 fee\n );\n event OperatorFeeExecuted(\n address indexed owner,\n uint64 indexed operatorId,\n uint256 blockNumber,\n uint256 fee\n );\n event OperatorFeeIncreaseLimitUpdated(uint64 value);\n event OperatorMaximumFeeUpdated(uint64 maxFee);\n event OperatorRemoved(uint64 indexed operatorId);\n event OperatorWhitelistUpdated(\n uint64 indexed operatorId,\n address whitelisted\n );\n event OperatorWithdrawn(\n address indexed owner,\n uint64 indexed operatorId,\n uint256 value\n );\n event OwnershipTransferStarted(\n address indexed previousOwner,\n address indexed newOwner\n );\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n event Upgraded(address indexed implementation);\n event ValidatorAdded(\n address indexed owner,\n uint64[] operatorIds,\n bytes publicKey,\n bytes shares,\n Cluster cluster\n );\n event ValidatorExited(\n address indexed owner,\n uint64[] operatorIds,\n bytes publicKey\n );\n event ValidatorRemoved(\n address indexed owner,\n uint64[] operatorIds,\n bytes publicKey,\n Cluster cluster\n );\n\n fallback() external;\n\n function acceptOwnership() external;\n\n function cancelDeclaredOperatorFee(uint64 operatorId) external;\n\n function declareOperatorFee(uint64 operatorId, uint256 fee) external;\n\n function deposit(\n address clusterOwner,\n uint64[] memory operatorIds,\n uint256 amount,\n Cluster memory cluster\n ) external;\n\n function executeOperatorFee(uint64 operatorId) external;\n\n function exitValidator(bytes memory publicKey, uint64[] memory operatorIds)\n external;\n\n function bulkExitValidator(\n bytes[] calldata publicKeys,\n uint64[] calldata operatorIds\n ) external;\n\n function getVersion() external pure returns (string memory version);\n\n function initialize(\n address token_,\n address ssvOperators_,\n address ssvClusters_,\n address ssvDAO_,\n address ssvViews_,\n uint64 minimumBlocksBeforeLiquidation_,\n uint256 minimumLiquidationCollateral_,\n uint32 validatorsPerOperatorLimit_,\n uint64 declareOperatorFeePeriod_,\n uint64 executeOperatorFeePeriod_,\n uint64 operatorMaxFeeIncrease_\n ) external;\n\n function liquidate(\n address clusterOwner,\n uint64[] memory operatorIds,\n Cluster memory cluster\n ) external;\n\n function owner() external view returns (address);\n\n function pendingOwner() external view returns (address);\n\n function proxiableUUID() external view returns (bytes32);\n\n function reactivate(\n uint64[] memory operatorIds,\n uint256 amount,\n Cluster memory cluster\n ) external;\n\n function reduceOperatorFee(uint64 operatorId, uint256 fee) external;\n\n function registerOperator(bytes memory publicKey, uint256 fee)\n external\n returns (uint64 id);\n\n function registerValidator(\n bytes memory publicKey,\n uint64[] memory operatorIds,\n bytes memory sharesData,\n uint256 amount,\n Cluster memory cluster\n ) external;\n\n function bulkRegisterValidator(\n bytes[] calldata publicKeys,\n uint64[] calldata operatorIds,\n bytes[] calldata sharesData,\n uint256 amount,\n Cluster memory cluster\n ) external;\n\n function removeOperator(uint64 operatorId) external;\n\n function removeValidator(\n bytes memory publicKey,\n uint64[] memory operatorIds,\n Cluster memory cluster\n ) external;\n\n function bulkRemoveValidator(\n bytes[] calldata publicKeys,\n uint64[] calldata operatorIds,\n Cluster memory cluster\n ) external;\n\n function renounceOwnership() external;\n\n function setFeeRecipientAddress(address recipientAddress) external;\n\n function setOperatorWhitelist(uint64 operatorId, address whitelisted)\n external;\n\n function transferOwnership(address newOwner) external;\n\n function updateDeclareOperatorFeePeriod(uint64 timeInSeconds) external;\n\n function updateExecuteOperatorFeePeriod(uint64 timeInSeconds) external;\n\n function updateLiquidationThresholdPeriod(uint64 blocks) external;\n\n function updateMaximumOperatorFee(uint64 maxFee) external;\n\n function updateMinimumLiquidationCollateral(uint256 amount) external;\n\n function updateModule(uint8 moduleId, address moduleAddress) external;\n\n function updateNetworkFee(uint256 fee) external;\n\n function updateOperatorFeeIncreaseLimit(uint64 percentage) external;\n\n function upgradeTo(address newImplementation) external;\n\n function upgradeToAndCall(address newImplementation, bytes memory data)\n external\n payable;\n\n function withdraw(\n uint64[] memory operatorIds,\n uint256 amount,\n Cluster memory cluster\n ) external;\n\n function withdrawAllOperatorEarnings(uint64 operatorId) external;\n\n function withdrawNetworkEarnings(uint256 amount) external;\n\n function withdrawOperatorEarnings(uint64 operatorId, uint256 amount)\n external;\n}\n" + }, + "contracts/interfaces/IStrategy.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\n/**\n * @title Platform interface to integrate with lending platform like Compound, AAVE etc.\n */\ninterface IStrategy {\n /**\n * @dev Deposit the given asset to platform\n * @param _asset asset address\n * @param _amount Amount to deposit\n */\n function deposit(address _asset, uint256 _amount) external;\n\n /**\n * @dev Deposit the entire balance of all supported assets in the Strategy\n * to the platform\n */\n function depositAll() external;\n\n /**\n * @dev Withdraw given asset from Lending platform\n */\n function withdraw(\n address _recipient,\n address _asset,\n uint256 _amount\n ) external;\n\n /**\n * @dev Liquidate all assets in strategy and return them to Vault.\n */\n function withdrawAll() external;\n\n /**\n * @dev Returns the current balance of the given asset.\n */\n function checkBalance(address _asset)\n external\n view\n returns (uint256 balance);\n\n /**\n * @dev Returns bool indicating whether strategy supports asset.\n */\n function supportsAsset(address _asset) external view returns (bool);\n\n /**\n * @dev Collect reward tokens from the Strategy.\n */\n function collectRewardTokens() external;\n\n /**\n * @dev The address array of the reward tokens for the Strategy.\n */\n function getRewardTokenAddresses() external view returns (address[] memory);\n\n function harvesterAddress() external view returns (address);\n\n function transferToken(address token, uint256 amount) external;\n\n function setRewardTokenAddresses(address[] calldata _rewardTokenAddresses)\n external;\n}\n" + }, + "contracts/interfaces/IVault.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\nimport { VaultStorage } from \"../vault/VaultStorage.sol\";\n\ninterface IVault {\n // slither-disable-start constable-states\n\n event AssetSupported(address _asset);\n event AssetDefaultStrategyUpdated(address _asset, address _strategy);\n event AssetAllocated(address _asset, address _strategy, uint256 _amount);\n event StrategyApproved(address _addr);\n event StrategyRemoved(address _addr);\n event Mint(address _addr, uint256 _value);\n event Redeem(address _addr, uint256 _value);\n event CapitalPaused();\n event CapitalUnpaused();\n event RebasePaused();\n event RebaseUnpaused();\n event VaultBufferUpdated(uint256 _vaultBuffer);\n event RedeemFeeUpdated(uint256 _redeemFeeBps);\n event PriceProviderUpdated(address _priceProvider);\n event AllocateThresholdUpdated(uint256 _threshold);\n event RebaseThresholdUpdated(uint256 _threshold);\n event StrategistUpdated(address _address);\n event MaxSupplyDiffChanged(uint256 maxSupplyDiff);\n event YieldDistribution(address _to, uint256 _yield, uint256 _fee);\n event TrusteeFeeBpsChanged(uint256 _basis);\n event TrusteeAddressChanged(address _address);\n event SwapperChanged(address _address);\n event SwapAllowedUndervalueChanged(uint256 _basis);\n event SwapSlippageChanged(address _asset, uint256 _basis);\n event Swapped(\n address indexed _fromAsset,\n address indexed _toAsset,\n uint256 _fromAssetAmount,\n uint256 _toAssetAmount\n );\n event StrategyAddedToMintWhitelist(address indexed strategy);\n event StrategyRemovedFromMintWhitelist(address indexed strategy);\n event DripperChanged(address indexed _dripper);\n event WithdrawalRequested(\n address indexed _withdrawer,\n uint256 indexed _requestId,\n uint256 _amount,\n uint256 _queued\n );\n event WithdrawalClaimed(\n address indexed _withdrawer,\n uint256 indexed _requestId,\n uint256 _amount\n );\n event WithdrawalClaimable(uint256 _claimable, uint256 _newClaimable);\n\n // Governable.sol\n function transferGovernance(address _newGovernor) external;\n\n function claimGovernance() external;\n\n function governor() external view returns (address);\n\n function ADMIN_IMPLEMENTATION() external view returns (address);\n\n // VaultAdmin.sol\n function setPriceProvider(address _priceProvider) external;\n\n function priceProvider() external view returns (address);\n\n function setRedeemFeeBps(uint256 _redeemFeeBps) external;\n\n function redeemFeeBps() external view returns (uint256);\n\n function setVaultBuffer(uint256 _vaultBuffer) external;\n\n function vaultBuffer() external view returns (uint256);\n\n function setAutoAllocateThreshold(uint256 _threshold) external;\n\n function autoAllocateThreshold() external view returns (uint256);\n\n function setRebaseThreshold(uint256 _threshold) external;\n\n function rebaseThreshold() external view returns (uint256);\n\n function setStrategistAddr(address _address) external;\n\n function strategistAddr() external view returns (address);\n\n function setMaxSupplyDiff(uint256 _maxSupplyDiff) external;\n\n function maxSupplyDiff() external view returns (uint256);\n\n function setTrusteeAddress(address _address) external;\n\n function trusteeAddress() external view returns (address);\n\n function setTrusteeFeeBps(uint256 _basis) external;\n\n function trusteeFeeBps() external view returns (uint256);\n\n function ousdMetaStrategy() external view returns (address);\n\n function setSwapper(address _swapperAddr) external;\n\n function setSwapAllowedUndervalue(uint16 _percentageBps) external;\n\n function setOracleSlippage(address _asset, uint16 _allowedOracleSlippageBps)\n external;\n\n function supportAsset(address _asset, uint8 _unitConversion) external;\n\n function approveStrategy(address _addr) external;\n\n function removeStrategy(address _addr) external;\n\n function setAssetDefaultStrategy(address _asset, address _strategy)\n external;\n\n function assetDefaultStrategies(address _asset)\n external\n view\n returns (address);\n\n function pauseRebase() external;\n\n function unpauseRebase() external;\n\n function rebasePaused() external view returns (bool);\n\n function pauseCapital() external;\n\n function unpauseCapital() external;\n\n function capitalPaused() external view returns (bool);\n\n function transferToken(address _asset, uint256 _amount) external;\n\n function priceUnitMint(address asset) external view returns (uint256);\n\n function priceUnitRedeem(address asset) external view returns (uint256);\n\n function withdrawAllFromStrategy(address _strategyAddr) external;\n\n function withdrawAllFromStrategies() external;\n\n function withdrawFromStrategy(\n address _strategyFromAddress,\n address[] calldata _assets,\n uint256[] calldata _amounts\n ) external;\n\n function depositToStrategy(\n address _strategyToAddress,\n address[] calldata _assets,\n uint256[] calldata _amounts\n ) external;\n\n // VaultCore.sol\n function mint(\n address _asset,\n uint256 _amount,\n uint256 _minimumOusdAmount\n ) external;\n\n function mintForStrategy(uint256 _amount) external;\n\n function redeem(uint256 _amount, uint256 _minimumUnitAmount) external;\n\n function burnForStrategy(uint256 _amount) external;\n\n function allocate() external;\n\n function rebase() external;\n\n function swapCollateral(\n address fromAsset,\n address toAsset,\n uint256 fromAssetAmount,\n uint256 minToAssetAmount,\n bytes calldata data\n ) external returns (uint256 toAssetAmount);\n\n function totalValue() external view returns (uint256 value);\n\n function checkBalance(address _asset) external view returns (uint256);\n\n function calculateRedeemOutputs(uint256 _amount)\n external\n view\n returns (uint256[] memory);\n\n function getAssetCount() external view returns (uint256);\n\n function getAssetConfig(address _asset)\n external\n view\n returns (VaultStorage.Asset memory config);\n\n function getAllAssets() external view returns (address[] memory);\n\n function getStrategyCount() external view returns (uint256);\n\n function swapper() external view returns (address);\n\n function allowedSwapUndervalue() external view returns (uint256);\n\n function getAllStrategies() external view returns (address[] memory);\n\n function isSupportedAsset(address _asset) external view returns (bool);\n\n function netOusdMintForStrategyThreshold() external view returns (uint256);\n\n function setOusdMetaStrategy(address _ousdMetaStrategy) external;\n\n function setNetOusdMintForStrategyThreshold(uint256 _threshold) external;\n\n function netOusdMintedForStrategy() external view returns (int256);\n\n function setDripper(address _dripper) external;\n\n function dripper() external view returns (address);\n\n function weth() external view returns (address);\n\n function cacheWETHAssetIndex() external;\n\n function wethAssetIndex() external view returns (uint256);\n\n function initialize(address, address) external;\n\n function setAdminImpl(address) external;\n\n function removeAsset(address _asset) external;\n\n // These are OETH specific functions\n function addWithdrawalQueueLiquidity() external;\n\n function requestWithdrawal(uint256 _amount)\n external\n returns (uint256 requestId, uint256 queued);\n\n function claimWithdrawal(uint256 requestId)\n external\n returns (uint256 amount);\n\n function claimWithdrawals(uint256[] memory requestIds)\n external\n returns (uint256[] memory amounts, uint256 totalAmount);\n\n function withdrawalQueueMetadata()\n external\n view\n returns (VaultStorage.WithdrawalQueueMetadata memory);\n\n function withdrawalRequests(uint256 requestId)\n external\n view\n returns (VaultStorage.WithdrawalRequest memory);\n\n // OETHb specific functions\n function addStrategyToMintWhitelist(address strategyAddr) external;\n\n function removeStrategyFromMintWhitelist(address strategyAddr) external;\n\n function isMintWhitelistedStrategy(address strategyAddr)\n external\n view\n returns (bool);\n\n function withdrawalClaimDelay() external view returns (uint256);\n\n function setWithdrawalClaimDelay(uint256 newDelay) external;\n\n function lastRebase() external view returns (uint64);\n\n function dripDuration() external view returns (uint64);\n\n function setDripDuration(uint256 _dripDuration) external;\n\n function rebasePerSecondMax() external view returns (uint64);\n\n function setRebaseRateMax(uint256 yearlyApr) external;\n\n function rebasePerSecondTarget() external view returns (uint64);\n\n function previewYield() external view returns (uint256 yield);\n\n // slither-disable-end constable-states\n}\n" + }, + "contracts/interfaces/IWETH9.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IWETH9 {\n event Approval(address indexed src, address indexed guy, uint256 wad);\n event Deposit(address indexed dst, uint256 wad);\n event Transfer(address indexed src, address indexed dst, uint256 wad);\n event Withdrawal(address indexed src, uint256 wad);\n\n function allowance(address, address) external view returns (uint256);\n\n function approve(address guy, uint256 wad) external returns (bool);\n\n function balanceOf(address) external view returns (uint256);\n\n function decimals() external view returns (uint8);\n\n function deposit() external payable;\n\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function totalSupply() external view returns (uint256);\n\n function transfer(address dst, uint256 wad) external returns (bool);\n\n function transferFrom(\n address src,\n address dst,\n uint256 wad\n ) external returns (bool);\n\n function withdraw(uint256 wad) external;\n}\n" + }, + "contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport { InitializableAbstractStrategy } from \"../../utils/InitializableAbstractStrategy.sol\";\nimport { IWETH9 } from \"../../interfaces/IWETH9.sol\";\nimport { CompoundingValidatorManager } from \"./CompoundingValidatorManager.sol\";\n\n/// @title Compounding Staking SSV Strategy\n/// @notice Strategy to deploy funds into DVT validators powered by the SSV Network\n/// @author Origin Protocol Inc\ncontract CompoundingStakingSSVStrategy is\n CompoundingValidatorManager,\n InitializableAbstractStrategy\n{\n /// @notice SSV ERC20 token that serves as a payment for operating SSV validators\n address public immutable SSV_TOKEN;\n\n // For future use\n uint256[50] private __gap;\n\n /// @param _baseConfig Base strategy config with\n /// `platformAddress` not used so empty address\n /// `vaultAddress` the address of the OETH Vault contract\n /// @param _wethAddress Address of the WETH Token contract\n /// @param _ssvToken Address of the SSV Token contract\n /// @param _ssvNetwork Address of the SSV Network contract\n /// @param _beaconChainDepositContract Address of the beacon chain deposit contract\n /// @param _beaconProofs Address of the Beacon Proofs contract that verifies beacon chain data\n /// @param _beaconGenesisTimestamp The timestamp of the Beacon chain's genesis.\n constructor(\n BaseStrategyConfig memory _baseConfig,\n address _wethAddress,\n address _ssvToken,\n address _ssvNetwork,\n address _beaconChainDepositContract,\n address _beaconProofs,\n uint64 _beaconGenesisTimestamp\n )\n InitializableAbstractStrategy(_baseConfig)\n CompoundingValidatorManager(\n _wethAddress,\n _baseConfig.vaultAddress,\n _beaconChainDepositContract,\n _ssvNetwork,\n _beaconProofs,\n _beaconGenesisTimestamp\n )\n {\n SSV_TOKEN = _ssvToken;\n\n // Make sure nobody owns the implementation contract\n _setGovernor(address(0));\n }\n\n /// @notice Set up initial internal state including\n /// 1. approving the SSVNetwork to transfer SSV tokens from this strategy contract\n /// @param _rewardTokenAddresses Not used so empty array\n /// @param _assets Not used so empty array\n /// @param _pTokens Not used so empty array\n function initialize(\n address[] memory _rewardTokenAddresses,\n address[] memory _assets,\n address[] memory _pTokens\n ) external onlyGovernor initializer {\n InitializableAbstractStrategy._initialize(\n _rewardTokenAddresses,\n _assets,\n _pTokens\n );\n\n safeApproveAllTokens();\n }\n\n /// @notice Unlike other strategies, this does not deposit assets into the underlying platform.\n /// It just checks the asset is WETH and emits the Deposit event.\n /// To deposit WETH into validators, `registerSsvValidator` and `stakeEth` must be used.\n /// @param _asset Address of the WETH token.\n /// @param _amount Amount of WETH that was transferred to the strategy by the vault.\n function deposit(address _asset, uint256 _amount)\n external\n override\n onlyVault\n nonReentrant\n {\n require(_asset == WETH, \"Unsupported asset\");\n require(_amount > 0, \"Must deposit something\");\n\n // Account for the new WETH\n depositedWethAccountedFor += _amount;\n\n emit Deposit(_asset, address(0), _amount);\n }\n\n /// @notice Unlike other strategies, this does not deposit assets into the underlying platform.\n /// It just emits the Deposit event.\n /// To deposit WETH into validators `registerSsvValidator` and `stakeEth` must be used.\n function depositAll() external override onlyVault nonReentrant {\n uint256 wethBalance = IERC20(WETH).balanceOf(address(this));\n uint256 newWeth = wethBalance - depositedWethAccountedFor;\n\n if (newWeth > 0) {\n // Account for the new WETH\n depositedWethAccountedFor = wethBalance;\n\n emit Deposit(WETH, address(0), newWeth);\n }\n }\n\n /// @notice Withdraw ETH and WETH from this strategy contract.\n /// @param _recipient Address to receive withdrawn assets.\n /// @param _asset Address of the WETH token.\n /// @param _amount Amount of WETH to withdraw.\n function withdraw(\n address _recipient,\n address _asset,\n uint256 _amount\n ) external override nonReentrant {\n require(_asset == WETH, \"Unsupported asset\");\n require(\n msg.sender == vaultAddress || msg.sender == validatorRegistrator,\n \"Caller not Vault or Registrator\"\n );\n\n _withdraw(_recipient, _amount, address(this).balance);\n }\n\n function _withdraw(\n address _recipient,\n uint256 _withdrawAmount,\n uint256 _ethBalance\n ) internal {\n require(_withdrawAmount > 0, \"Must withdraw something\");\n require(_recipient == vaultAddress, \"Recipient not Vault\");\n\n // Convert any ETH from validator partial withdrawals, exits\n // or execution rewards to WETH and do the necessary accounting.\n if (_ethBalance > 0) _convertEthToWeth(_ethBalance);\n\n // Transfer WETH to the recipient and do the necessary accounting.\n _transferWeth(_withdrawAmount, _recipient);\n\n emit Withdrawal(WETH, address(0), _withdrawAmount);\n }\n\n /// @notice Transfer all WETH deposits, ETH from validator withdrawals and ETH from\n /// execution rewards in this strategy to the vault.\n /// This does not withdraw from the validators. That has to be done separately with the\n /// `validatorWithdrawal` operation.\n function withdrawAll() external override onlyVaultOrGovernor nonReentrant {\n uint256 ethBalance = address(this).balance;\n uint256 withdrawAmount = IERC20(WETH).balanceOf(address(this)) +\n ethBalance;\n\n if (withdrawAmount > 0) {\n _withdraw(vaultAddress, withdrawAmount, ethBalance);\n }\n }\n\n /// @notice Accounts for all the assets managed by this strategy which includes:\n /// 1. The current WETH in this strategy contract\n /// 2. The last verified ETH balance, total deposits and total validator balances\n /// @param _asset Address of WETH asset.\n /// @return balance Total value in ETH\n function checkBalance(address _asset)\n external\n view\n override\n returns (uint256 balance)\n {\n require(_asset == WETH, \"Unsupported asset\");\n\n // Load the last verified balance from the storage\n // and add to the latest WETH balance of this strategy.\n balance =\n lastVerifiedEthBalance +\n IWETH9(WETH).balanceOf(address(this));\n }\n\n /// @notice Returns bool indicating whether asset is supported by the strategy.\n /// @param _asset The address of the WETH token.\n function supportsAsset(address _asset) public view override returns (bool) {\n return _asset == WETH;\n }\n\n /// @notice Approves the SSV Network contract to transfer SSV tokens for validator registration.\n function safeApproveAllTokens() public override {\n // Approves the SSV Network contract to transfer SSV tokens when validators are registered\n IERC20(SSV_TOKEN).approve(SSV_NETWORK, type(uint256).max);\n }\n\n /**\n * @notice We can accept ETH directly to this contract from anyone as it does not impact our accounting\n * like it did in the legacy NativeStakingStrategy.\n * The new ETH will be accounted for in `checkBalance` after the next snapBalances and verifyBalances txs.\n */\n receive() external payable {}\n\n /***************************************\n Internal functions\n ****************************************/\n\n /// @notice is not supported for this strategy as there is no platform token.\n function setPTokenAddress(address, address) external pure override {\n revert(\"Unsupported function\");\n }\n\n /// @notice is not supported for this strategy as there is no platform token.\n function removePToken(uint256) external pure override {\n revert(\"Unsupported function\");\n }\n\n /// @dev This strategy does not use a platform token like the old Aave and Compound strategies.\n function _abstractSetPToken(address _asset, address) internal override {}\n\n /// @dev Consensus rewards are compounded to the validator's balance instead of being\n /// swept to this strategy contract.\n /// Execution rewards from MEV and tx priority accumulate as ETH in this strategy contract.\n /// Withdrawals from validators also accumulate as ETH in this strategy contract.\n /// It's too complex to separate the rewards from withdrawals so this function is not implemented.\n /// Besides, ETH rewards are not sent to the Dripper any more. The Vault can now regulate\n /// the increase in assets.\n function _collectRewardTokens() internal pure override {\n revert(\"Unsupported function\");\n }\n}\n" + }, + "contracts/strategies/NativeStaking/CompoundingValidatorManager.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { SafeCast } from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { Pausable } from \"@openzeppelin/contracts/security/Pausable.sol\";\nimport { Governable } from \"../../governance/Governable.sol\";\nimport { IDepositContract } from \"../../interfaces/IDepositContract.sol\";\nimport { IWETH9 } from \"../../interfaces/IWETH9.sol\";\nimport { ISSVNetwork, Cluster } from \"../../interfaces/ISSVNetwork.sol\";\nimport { BeaconRoots } from \"../../beacon/BeaconRoots.sol\";\nimport { PartialWithdrawal } from \"../../beacon/PartialWithdrawal.sol\";\nimport { IBeaconProofs } from \"../../interfaces/IBeaconProofs.sol\";\n\n/**\n * @title Validator lifecycle management contract\n * @notice This contract implements all the required functionality to\n * register, deposit, withdraw, exit and remove validators.\n * @author Origin Protocol Inc\n */\nabstract contract CompoundingValidatorManager is Governable, Pausable {\n using SafeERC20 for IERC20;\n\n /// @dev The amount of ETH in wei that is required for a deposit to a new validator.\n uint256 internal constant DEPOSIT_AMOUNT_WEI = 1 ether;\n /// @dev Validator balances over this amount will eventually become active on the beacon chain.\n /// Due to hysteresis, if the effective balance is 31 ETH, the actual balance\n /// must rise to 32.25 ETH to trigger an effective balance update to 32 ETH.\n /// https://eth2book.info/capella/part2/incentives/balances/#hysteresis\n uint256 internal constant MIN_ACTIVATION_BALANCE_GWEI = 32.25 ether / 1e9;\n /// @dev The maximum number of deposits that are waiting to be verified as processed on the beacon chain.\n uint256 internal constant MAX_DEPOSITS = 12;\n /// @dev The maximum number of validators that can be verified.\n uint256 internal constant MAX_VERIFIED_VALIDATORS = 48;\n /// @dev The default withdrawable epoch value on the Beacon chain.\n /// A value in the far future means the validator is not exiting.\n uint64 internal constant FAR_FUTURE_EPOCH = type(uint64).max;\n /// @dev The number of seconds between each beacon chain slot.\n uint64 internal constant SLOT_DURATION = 12;\n /// @dev The number of slots in each beacon chain epoch.\n uint64 internal constant SLOTS_PER_EPOCH = 32;\n /// @dev Minimum time in seconds to allow snapped balances to be verified.\n /// Set to 35 slots which is 3 slots more than 1 epoch (32 slots). Deposits get processed\n /// once per epoch. This larger than 1 epoch delay should achieve that `snapBalances` sometimes\n /// get called in the middle (or towards the end) of the epoch. Giving the off-chain script\n /// sufficient time after the end of the epoch to prepare the proofs and call `verifyBalances`.\n /// This is considering a malicious actor would keep calling `snapBalances` as frequent as possible\n /// to disturb our operations.\n uint64 internal constant SNAP_BALANCES_DELAY = 35 * SLOT_DURATION;\n\n /// @notice The address of the Wrapped ETH (WETH) token contract\n address internal immutable WETH;\n /// @notice The address of the beacon chain deposit contract\n address internal immutable BEACON_CHAIN_DEPOSIT_CONTRACT;\n /// @notice The address of the SSV Network contract used to interface with\n address internal immutable SSV_NETWORK;\n /// @notice Address of the OETH Vault proxy contract\n address internal immutable VAULT_ADDRESS;\n /// @notice Address of the Beacon Proofs contract that verifies beacon chain data\n address public immutable BEACON_PROOFS;\n /// @notice The timestamp of the Beacon chain genesis.\n /// @dev this is different on Testnets like Hoodi so is set at deployment time.\n uint64 internal immutable BEACON_GENESIS_TIMESTAMP;\n\n /// @notice Address of the registrator - allowed to register, withdraw, exit and remove validators\n address public validatorRegistrator;\n\n /// @notice Deposit data for new compounding validators.\n /// @dev A `VERIFIED` deposit can mean 3 separate things:\n /// - a deposit has been processed by the beacon chain and shall be included in the\n /// balance of the next verifyBalances call\n /// - a deposit has been done to a slashed validator and has probably been recovered\n /// back to this strategy. Probably because we can not know for certain. This contract\n /// only detects when the validator has passed its withdrawal epoch. It is close to impossible\n /// to prove with Merkle Proofs that the postponed deposit this contract is responsible for\n /// creating is not present anymore in BeaconChain.state.pending_deposits. This in effect\n /// means that there might be a period where this contract thinks the deposit has been already\n /// returned as ETH balance before it happens. This will result in some days (or weeks)\n /// -> depending on the size of deposit queue of showing a deficit when calling `checkBalance`.\n /// As this only offsets the yield and doesn't cause a critical double-counting we are not addressing\n /// this issue.\n /// - A deposit has been done to the validator, but our deposit has been front run by a malicious\n /// actor. Funds in the deposit this contract makes are not recoverable.\n enum DepositStatus {\n UNKNOWN, // default value\n PENDING, // deposit is pending and waiting to be verified\n VERIFIED // deposit has been verified\n }\n\n /// @param pubKeyHash Hash of validator's public key using the Beacon Chain's format\n /// @param amountGwei Amount of ETH in gwei that has been deposited to the beacon chain deposit contract\n /// @param slot The beacon chain slot number when the deposit has been made\n /// @param depositIndex The index of the deposit in the list of active deposits\n /// @param status The status of the deposit, either UNKNOWN, PENDING or VERIFIED\n struct DepositData {\n bytes32 pubKeyHash;\n uint64 amountGwei;\n uint64 slot;\n uint32 depositIndex;\n DepositStatus status;\n }\n /// @notice Restricts to only one deposit to an unverified validator at a time.\n /// This is to limit front-running attacks of deposits to the beacon chain contract.\n ///\n /// @dev The value is set to true when a deposit to a new validator has been done that has\n /// not yet be verified.\n bool public firstDeposit;\n /// @notice Mapping of the pending deposit roots to the deposit data\n mapping(bytes32 => DepositData) public deposits;\n /// @notice List of strategy deposit IDs to a validator.\n /// The ID is the merkle root of the pending deposit data which is unique for each validator, amount and block.\n /// Duplicate pending deposit roots are prevented so can be used as an identifier to each strategy deposit.\n /// The list can be for deposits waiting to be verified as processed on the beacon chain,\n /// or deposits that have been verified to an exiting validator and is now waiting for the\n /// validator's balance to be swept.\n /// The list may not be ordered by time of deposit.\n /// Removed deposits will move the last deposit to the removed index.\n bytes32[] public depositList;\n\n enum ValidatorState {\n NON_REGISTERED, // validator is not registered on the SSV network\n REGISTERED, // validator is registered on the SSV network\n STAKED, // validator has funds staked\n VERIFIED, // validator has been verified to exist on the beacon chain\n ACTIVE, // The validator balance is at least 32 ETH. The validator may not yet be active on the beacon chain.\n EXITING, // The validator has been requested to exit\n EXITED, // The validator has been verified to have a zero balance\n REMOVED, // validator has funds withdrawn to this strategy contract and is removed from the SSV\n INVALID // The validator has been front-run and the withdrawal address is not this strategy\n }\n\n // Validator data\n struct ValidatorData {\n ValidatorState state; // The state of the validator known to this contract\n uint40 index; // The index of the validator on the beacon chain\n }\n /// @notice List of validator public key hashes that have been verified to exist on the beacon chain.\n /// These have had a deposit processed and the validator's balance increased.\n /// Validators will be removed from this list when its verified they have a zero balance.\n bytes32[] public verifiedValidators;\n /// @notice Mapping of the hash of the validator's public key to the validator state and index.\n /// Uses the Beacon chain hashing for BLSPubkey which is sha256(abi.encodePacked(validator.pubkey, bytes16(0)))\n mapping(bytes32 => ValidatorData) public validator;\n\n /// @param blockRoot Beacon chain block root of the snapshot\n /// @param timestamp Timestamp of the snapshot\n /// @param ethBalance The balance of ETH in the strategy contract at the snapshot\n struct Balances {\n bytes32 blockRoot;\n uint64 timestamp;\n uint128 ethBalance;\n }\n /// @notice Mapping of the block root to the balances at that slot\n Balances public snappedBalance;\n /// @notice The last verified ETH balance of the strategy\n uint256 public lastVerifiedEthBalance;\n\n /// @dev This contract receives WETH as the deposit asset, but unlike other strategies doesn't immediately\n /// deposit it to an underlying platform. Rather a special privilege account stakes it to the validators.\n /// For that reason calling WETH.balanceOf(this) in a deposit function can contain WETH that has just been\n /// deposited and also WETH that has previously been deposited. To keep a correct count we need to keep track\n /// of WETH that has already been accounted for.\n /// This value represents the amount of WETH balance of this contract that has already been accounted for by the\n /// deposit events.\n /// It is important to note that this variable is not concerned with WETH that is a result of full/partial\n /// withdrawal of the validators. It is strictly concerned with WETH that has been deposited and is waiting to\n /// be staked.\n uint256 public depositedWethAccountedFor;\n\n // For future use\n uint256[41] private __gap;\n\n event RegistratorChanged(address indexed newAddress);\n event FirstDepositReset();\n event SSVValidatorRegistered(\n bytes32 indexed pubKeyHash,\n uint64[] operatorIds\n );\n event SSVValidatorRemoved(bytes32 indexed pubKeyHash, uint64[] operatorIds);\n event ETHStaked(\n bytes32 indexed pubKeyHash,\n bytes32 indexed pendingDepositRoot,\n bytes pubKey,\n uint256 amountWei\n );\n event ValidatorVerified(\n bytes32 indexed pubKeyHash,\n uint40 indexed validatorIndex\n );\n event ValidatorInvalid(bytes32 indexed pubKeyHash);\n event DepositVerified(\n bytes32 indexed pendingDepositRoot,\n uint256 amountWei\n );\n event ValidatorWithdraw(bytes32 indexed pubKeyHash, uint256 amountWei);\n event BalancesSnapped(bytes32 indexed blockRoot, uint256 ethBalance);\n event BalancesVerified(\n uint64 indexed timestamp,\n uint256 totalDepositsWei,\n uint256 totalValidatorBalance,\n uint256 ethBalance\n );\n\n /// @dev Throws if called by any account other than the Registrator\n modifier onlyRegistrator() {\n require(msg.sender == validatorRegistrator, \"Not Registrator\");\n _;\n }\n\n /// @dev Throws if called by any account other than the Registrator or Governor\n modifier onlyRegistratorOrGovernor() {\n require(\n msg.sender == validatorRegistrator || isGovernor(),\n \"Not Registrator or Governor\"\n );\n _;\n }\n\n /// @param _wethAddress Address of the Erc20 WETH Token contract\n /// @param _vaultAddress Address of the Vault\n /// @param _beaconChainDepositContract Address of the beacon chain deposit contract\n /// @param _ssvNetwork Address of the SSV Network contract\n /// @param _beaconProofs Address of the Beacon Proofs contract that verifies beacon chain data\n /// @param _beaconGenesisTimestamp The timestamp of the Beacon chain's genesis.\n constructor(\n address _wethAddress,\n address _vaultAddress,\n address _beaconChainDepositContract,\n address _ssvNetwork,\n address _beaconProofs,\n uint64 _beaconGenesisTimestamp\n ) {\n WETH = _wethAddress;\n BEACON_CHAIN_DEPOSIT_CONTRACT = _beaconChainDepositContract;\n SSV_NETWORK = _ssvNetwork;\n VAULT_ADDRESS = _vaultAddress;\n BEACON_PROOFS = _beaconProofs;\n BEACON_GENESIS_TIMESTAMP = _beaconGenesisTimestamp;\n\n require(\n block.timestamp > _beaconGenesisTimestamp,\n \"Invalid genesis timestamp\"\n );\n }\n\n /**\n *\n * Admin Functions\n *\n */\n\n /// @notice Set the address of the registrator which can register, exit and remove validators\n function setRegistrator(address _address) external onlyGovernor {\n validatorRegistrator = _address;\n emit RegistratorChanged(_address);\n }\n\n /// @notice Reset the `firstDeposit` flag to false so deposits to unverified validators can be made again.\n function resetFirstDeposit() external onlyGovernor {\n require(firstDeposit, \"No first deposit\");\n\n firstDeposit = false;\n\n emit FirstDepositReset();\n }\n\n function pause() external onlyRegistratorOrGovernor {\n _pause();\n }\n\n function unPause() external onlyGovernor {\n _unpause();\n }\n\n /**\n *\n * Validator Management\n *\n */\n\n /// @notice Registers a single validator in a SSV Cluster.\n /// Only the Registrator can call this function.\n /// @param publicKey The public key of the validator\n /// @param operatorIds The operator IDs of the SSV Cluster\n /// @param sharesData The shares data for the validator\n /// @param ssvAmount The amount of SSV tokens to be deposited to the SSV cluster\n /// @param cluster The SSV cluster details including the validator count and SSV balance\n // slither-disable-start reentrancy-no-eth\n function registerSsvValidator(\n bytes calldata publicKey,\n uint64[] calldata operatorIds,\n bytes calldata sharesData,\n uint256 ssvAmount,\n Cluster calldata cluster\n ) external onlyRegistrator whenNotPaused {\n // Hash the public key using the Beacon Chain's format\n bytes32 pubKeyHash = _hashPubKey(publicKey);\n // Check each public key has not already been used\n require(\n validator[pubKeyHash].state == ValidatorState.NON_REGISTERED,\n \"Validator already registered\"\n );\n\n // Store the validator state as registered\n validator[pubKeyHash].state = ValidatorState.REGISTERED;\n\n ISSVNetwork(SSV_NETWORK).registerValidator(\n publicKey,\n operatorIds,\n sharesData,\n ssvAmount,\n cluster\n );\n\n emit SSVValidatorRegistered(pubKeyHash, operatorIds);\n }\n\n // slither-disable-end reentrancy-no-eth\n\n struct ValidatorStakeData {\n bytes pubkey;\n bytes signature;\n bytes32 depositDataRoot;\n }\n\n /// @notice Stakes WETH in this strategy to a compounding validator.\n /// The first deposit to a new validator, the amount must be 1 ETH.\n /// Another deposit of at least 31 ETH is required for the validator to be activated.\n /// This second deposit has to be done after the validator has been verified.\n /// Does not convert any ETH sitting in this strategy to WETH.\n /// There can not be two deposits to the same validator in the same block for the same amount.\n /// Function is pausable so in case a run-away Registrator can be prevented from continuing\n /// to deposit funds to slashed or undesired validators.\n /// @param validatorStakeData validator data needed to stake.\n /// The `ValidatorStakeData` struct contains the pubkey, signature and depositDataRoot.\n /// Only the registrator can call this function.\n /// @param depositAmountGwei The amount of WETH to stake to the validator in Gwei.\n // slither-disable-start reentrancy-eth,reentrancy-no-eth\n function stakeEth(\n ValidatorStakeData calldata validatorStakeData,\n uint64 depositAmountGwei\n ) external onlyRegistrator whenNotPaused {\n uint256 depositAmountWei = uint256(depositAmountGwei) * 1 gwei;\n // Check there is enough WETH from the deposits sitting in this strategy contract\n // There could be ETH from withdrawals but we'll ignore that. If it's really needed\n // the ETH can be withdrawn and then deposited back to the strategy.\n require(\n depositAmountWei <= IWETH9(WETH).balanceOf(address(this)),\n \"Insufficient WETH\"\n );\n require(depositList.length < MAX_DEPOSITS, \"Max deposits\");\n\n // Convert required ETH from WETH and do the necessary accounting\n _convertWethToEth(depositAmountWei);\n\n // Hash the public key using the Beacon Chain's hashing for BLSPubkey\n bytes32 pubKeyHash = _hashPubKey(validatorStakeData.pubkey);\n ValidatorState currentState = validator[pubKeyHash].state;\n // Can only stake to a validator that has been registered, verified or active.\n // Can not stake to a validator that has been staked but not yet verified.\n require(\n (currentState == ValidatorState.REGISTERED ||\n currentState == ValidatorState.VERIFIED ||\n currentState == ValidatorState.ACTIVE),\n \"Not registered or verified\"\n );\n require(depositAmountWei >= 1 ether, \"Deposit too small\");\n if (currentState == ValidatorState.REGISTERED) {\n // Can only have one pending deposit to an unverified validator at a time.\n // This is to limit front-running deposit attacks to a single deposit.\n // The exiting deposit needs to be verified before another deposit can be made.\n // If there was a front-running attack, the validator needs to be verified as invalid\n // and the Governor calls `resetFirstDeposit` to set `firstDeposit` to false.\n require(!firstDeposit, \"Existing first deposit\");\n // Limits the amount of ETH that can be at risk from a front-running deposit attack.\n require(\n depositAmountWei == DEPOSIT_AMOUNT_WEI,\n \"Invalid first deposit amount\"\n );\n // Limits the number of validator balance proofs to verifyBalances\n require(\n verifiedValidators.length + 1 <= MAX_VERIFIED_VALIDATORS,\n \"Max validators\"\n );\n\n // Flag a deposit to an unverified validator so no other deposits can be made\n // to an unverified validator.\n firstDeposit = true;\n validator[pubKeyHash].state = ValidatorState.STAKED;\n }\n\n /* 0x02 to indicate that withdrawal credentials are for a compounding validator\n * that was introduced with the Pectra upgrade.\n * bytes11(0) to fill up the required zeros\n * remaining bytes20 are for the address\n */\n bytes memory withdrawalCredentials = abi.encodePacked(\n bytes1(0x02),\n bytes11(0),\n address(this)\n );\n\n /// After the Pectra upgrade the validators have a new restriction when proposing\n /// blocks. The timestamps are at strict intervals of 12 seconds from the genesis block\n /// forward. Each slot is created at strict 12 second intervals and those slots can\n /// either have blocks attached to them or not. This way using the block.timestamp\n /// the slot number can easily be calculated.\n uint64 depositSlot = (SafeCast.toUint64(block.timestamp) -\n BEACON_GENESIS_TIMESTAMP) / SLOT_DURATION;\n\n // Calculate the merkle root of the beacon chain pending deposit data.\n // This is used as the unique ID of the deposit.\n bytes32 pendingDepositRoot = IBeaconProofs(BEACON_PROOFS)\n .merkleizePendingDeposit(\n pubKeyHash,\n withdrawalCredentials,\n depositAmountGwei,\n validatorStakeData.signature,\n depositSlot\n );\n require(\n deposits[pendingDepositRoot].status == DepositStatus.UNKNOWN,\n \"Duplicate deposit\"\n );\n\n // Store the deposit data for verifyDeposit and verifyBalances\n deposits[pendingDepositRoot] = DepositData({\n pubKeyHash: pubKeyHash,\n amountGwei: depositAmountGwei,\n slot: depositSlot,\n depositIndex: SafeCast.toUint32(depositList.length),\n status: DepositStatus.PENDING\n });\n depositList.push(pendingDepositRoot);\n\n // Deposit to the Beacon Chain deposit contract.\n // This will create a deposit in the beacon chain's pending deposit queue.\n IDepositContract(BEACON_CHAIN_DEPOSIT_CONTRACT).deposit{\n value: depositAmountWei\n }(\n validatorStakeData.pubkey,\n withdrawalCredentials,\n validatorStakeData.signature,\n validatorStakeData.depositDataRoot\n );\n\n emit ETHStaked(\n pubKeyHash,\n pendingDepositRoot,\n validatorStakeData.pubkey,\n depositAmountWei\n );\n }\n\n // slither-disable-end reentrancy-eth,reentrancy-no-eth\n\n /// @notice Request a full or partial withdrawal from a validator.\n /// A zero amount will trigger a full withdrawal.\n /// If the remaining balance is < 32 ETH then only the amount in excess of 32 ETH will be withdrawn.\n /// Only the Registrator can call this function.\n /// 1 wei of value should be sent with the tx to pay for the withdrawal request fee.\n /// If no value sent, 1 wei will be taken from the strategy's ETH balance if it has any.\n /// If no ETH balance, the tx will revert.\n /// @param publicKey The public key of the validator\n /// @param amountGwei The amount of ETH to be withdrawn from the validator in Gwei.\n /// A zero amount will trigger a full withdrawal.\n // slither-disable-start reentrancy-no-eth\n function validatorWithdrawal(bytes calldata publicKey, uint64 amountGwei)\n external\n payable\n onlyRegistrator\n {\n // Hash the public key using the Beacon Chain's format\n bytes32 pubKeyHash = _hashPubKey(publicKey);\n ValidatorData memory validatorDataMem = validator[pubKeyHash];\n // Validator full withdrawal could be denied due to multiple reasons:\n // - the validator has not been activated or active long enough\n // (current_epoch < activation_epoch + SHARD_COMMITTEE_PERIOD)\n // - the validator has pending balance to withdraw from a previous partial withdrawal request\n //\n // Meaning that the on-chain to beacon chain full withdrawal request could fail. Instead\n // of adding complexity of verifying if a validator is eligible for a full exit, we allow\n // multiple full withdrawal requests per validator.\n require(\n validatorDataMem.state == ValidatorState.ACTIVE ||\n validatorDataMem.state == ValidatorState.EXITING,\n \"Validator not active/exiting\"\n );\n\n // If a full withdrawal (validator exit)\n if (amountGwei == 0) {\n // For each staking strategy's deposits\n uint256 depositsCount = depositList.length;\n for (uint256 i = 0; i < depositsCount; ++i) {\n bytes32 pendingDepositRoot = depositList[i];\n // Check there is no pending deposits to the exiting validator\n require(\n pubKeyHash != deposits[pendingDepositRoot].pubKeyHash,\n \"Pending deposit\"\n );\n }\n\n // Store the validator state as exiting so no more deposits can be made to it.\n // This may already be EXITING if the previous exit request failed. eg the validator\n // was not active long enough.\n validator[pubKeyHash].state = ValidatorState.EXITING;\n }\n\n // Do not remove from the list of verified validators.\n // This is done in the verifyBalances function once the validator's balance has been verified to be zero.\n // The validator state will be set to EXITED in the verifyBalances function.\n\n PartialWithdrawal.request(publicKey, amountGwei);\n\n emit ValidatorWithdraw(pubKeyHash, uint256(amountGwei) * 1 gwei);\n }\n\n // slither-disable-end reentrancy-no-eth\n\n /// @notice Remove the validator from the SSV Cluster after:\n /// - the validator has been exited from `validatorWithdrawal` or slashed\n /// - the validator has incorrectly registered and can not be staked to\n /// - the initial deposit was front-run and the withdrawal address is not this strategy's address.\n /// Make sure `validatorWithdrawal` is called with a zero amount and the validator has exited the Beacon chain.\n /// If removed before the validator has exited the beacon chain will result in the validator being slashed.\n /// Only the registrator can call this function.\n /// @param publicKey The public key of the validator\n /// @param operatorIds The operator IDs of the SSV Cluster\n /// @param cluster The SSV cluster details including the validator count and SSV balance\n // slither-disable-start reentrancy-no-eth\n function removeSsvValidator(\n bytes calldata publicKey,\n uint64[] calldata operatorIds,\n Cluster calldata cluster\n ) external onlyRegistrator {\n // Hash the public key using the Beacon Chain's format\n bytes32 pubKeyHash = _hashPubKey(publicKey);\n ValidatorState currentState = validator[pubKeyHash].state;\n // Can remove SSV validators that were incorrectly registered and can not be deposited to.\n require(\n currentState == ValidatorState.REGISTERED ||\n currentState == ValidatorState.EXITED ||\n currentState == ValidatorState.INVALID,\n \"Validator not regd or exited\"\n );\n\n validator[pubKeyHash].state = ValidatorState.REMOVED;\n\n ISSVNetwork(SSV_NETWORK).removeValidator(\n publicKey,\n operatorIds,\n cluster\n );\n\n emit SSVValidatorRemoved(pubKeyHash, operatorIds);\n }\n\n /**\n *\n * SSV Management\n *\n */\n\n // slither-disable-end reentrancy-no-eth\n\n /// `depositSSV` has been removed as `deposit` on the SSVNetwork contract can be called directly\n /// by the Strategist which is already holding SSV tokens.\n\n /// @notice Withdraws excess SSV Tokens from the SSV Network contract which was used to pay the SSV Operators.\n /// @dev A SSV cluster is defined by the SSVOwnerAddress and the set of operatorIds.\n /// @param operatorIds The operator IDs of the SSV Cluster\n /// @param ssvAmount The amount of SSV tokens to be withdrawn from the SSV cluster\n /// @param cluster The SSV cluster details including the validator count and SSV balance\n function withdrawSSV(\n uint64[] memory operatorIds,\n uint256 ssvAmount,\n Cluster memory cluster\n ) external onlyGovernor {\n ISSVNetwork(SSV_NETWORK).withdraw(operatorIds, ssvAmount, cluster);\n }\n\n /**\n *\n * Beacon Chain Proofs\n *\n */\n\n /// @notice Verifies a validator's index to its public key.\n /// Adds to the list of verified validators if the validator's withdrawal address is this strategy's address.\n /// Marks the validator as invalid and removes the deposit if the withdrawal address is not this strategy's address.\n /// @param nextBlockTimestamp The timestamp of the execution layer block after the beacon chain slot\n /// we are verifying.\n /// The next one is needed as the Beacon Oracle returns the parent beacon block root for a block timestamp,\n /// which is the beacon block root of the previous block.\n /// @param validatorIndex The index of the validator on the beacon chain.\n /// @param pubKeyHash The hash of the validator's public key using the Beacon Chain's format\n /// @param withdrawalCredentials contain the validator type and withdrawal address. These can be incorrect and/or\n /// malformed. In case of incorrect withdrawalCredentials the validator deposit has been front run\n /// @param validatorPubKeyProof The merkle proof for the validator public key to the beacon block root.\n /// This is 53 witness hashes of 32 bytes each concatenated together starting from the leaf node.\n /// BeaconBlock.state.validators[validatorIndex].pubkey\n function verifyValidator(\n uint64 nextBlockTimestamp,\n uint40 validatorIndex,\n bytes32 pubKeyHash,\n bytes32 withdrawalCredentials,\n bytes calldata validatorPubKeyProof\n ) external {\n require(\n validator[pubKeyHash].state == ValidatorState.STAKED,\n \"Validator not staked\"\n );\n\n // Get the beacon block root of the slot we are verifying the validator in.\n // The parent beacon block root of the next block is the beacon block root of the slot we are verifying.\n bytes32 blockRoot = BeaconRoots.parentBlockRoot(nextBlockTimestamp);\n\n // Verify the validator index is for the validator with the given public key.\n // Also verify the validator's withdrawal credentials\n IBeaconProofs(BEACON_PROOFS).verifyValidator(\n blockRoot,\n pubKeyHash,\n validatorPubKeyProof,\n validatorIndex,\n withdrawalCredentials\n );\n\n // Store the validator state as verified\n validator[pubKeyHash] = ValidatorData({\n state: ValidatorState.VERIFIED,\n index: validatorIndex\n });\n\n bytes32 expectedWithdrawalCredentials = bytes32(\n abi.encodePacked(bytes1(0x02), bytes11(0), address(this))\n );\n\n // If the initial deposit was front-run and the withdrawal address is not this strategy\n // or the validator type is not a compounding validator (0x02)\n if (expectedWithdrawalCredentials != withdrawalCredentials) {\n // override the validator state\n validator[pubKeyHash].state = ValidatorState.INVALID;\n\n // Find and remove the deposit as the funds can not be recovered\n uint256 depositCount = depositList.length;\n for (uint256 i = 0; i < depositCount; i++) {\n DepositData memory deposit = deposits[depositList[i]];\n if (deposit.pubKeyHash == pubKeyHash) {\n // next verifyBalances will correctly account for the loss of a front-run\n // deposit. Doing it here accounts for the loss as soon as possible\n lastVerifiedEthBalance -= Math.min(\n lastVerifiedEthBalance,\n uint256(deposit.amountGwei) * 1 gwei\n );\n _removeDeposit(depositList[i], deposit);\n break;\n }\n }\n\n // Leave the `firstDeposit` flag as true so no more deposits to unverified validators can be made.\n // The Governor has to reset the `firstDeposit` to false before another deposit to\n // an unverified validator can be made.\n // The Governor can set a new `validatorRegistrator` if they suspect it has been compromised.\n\n emit ValidatorInvalid(pubKeyHash);\n return;\n }\n\n // Add the new validator to the list of verified validators\n verifiedValidators.push(pubKeyHash);\n\n // Reset the firstDeposit flag as the first deposit to an unverified validator has been verified.\n firstDeposit = false;\n\n emit ValidatorVerified(pubKeyHash, validatorIndex);\n }\n\n struct FirstPendingDepositSlotProofData {\n uint64 slot;\n bytes proof;\n }\n\n struct StrategyValidatorProofData {\n uint64 withdrawableEpoch;\n bytes withdrawableEpochProof;\n }\n\n /// @notice Verifies a deposit on the execution layer has been processed by the beacon chain.\n /// This means the accounting of the strategy's ETH moves from a pending deposit to a validator balance.\n ///\n /// Important: this function has a limitation where `depositProcessedSlot` that is passed by the off-chain\n /// verifier requires a slot immediately after it to propose a block otherwise the `BeaconRoots.parentBlockRoot`\n /// will fail. This shouldn't be a problem, since by the current behaviour of beacon chain only 1%-3% slots\n /// don't propose a block.\n /// @param pendingDepositRoot The unique identifier of the deposit emitted in `ETHStaked` from\n /// the `stakeEth` function.\n /// @param depositProcessedSlot Any slot on or after the strategy's deposit was processed on the beacon chain.\n /// Can not be a slot with pending deposits with the same slot as the deposit being verified.\n /// Can not be a slot before a missed slot as the Beacon Root contract will have the parent block root\n /// set for the next block timestamp in 12 seconds time.\n /// @param firstPendingDeposit a `FirstPendingDepositSlotProofData` struct containing:\n /// - slot: The beacon chain slot of the first deposit in the beacon chain's deposit queue.\n /// Can be any non-zero value if the deposit queue is empty.\n /// - proof: The merkle proof of the first pending deposit's slot to the beacon block root.\n /// Can be either:\n /// * 40 witness hashes for BeaconBlock.state.PendingDeposits[0].slot when the deposit queue is not empty.\n /// * 37 witness hashes for BeaconBlock.state.PendingDeposits[0] when the deposit queue is empty.\n /// The 32 byte witness hashes are concatenated together starting from the leaf node.\n /// @param strategyValidatorData a `StrategyValidatorProofData` struct containing:\n /// - withdrawableEpoch: The withdrawable epoch of the validator the strategy is depositing to.\n /// - withdrawableEpochProof: The merkle proof for the withdrawable epoch of the validator the strategy\n /// is depositing to, to the beacon block root.\n /// This is 53 witness hashes of 32 bytes each concatenated together starting from the leaf node.\n // slither-disable-start reentrancy-no-eth\n function verifyDeposit(\n bytes32 pendingDepositRoot,\n uint64 depositProcessedSlot,\n FirstPendingDepositSlotProofData calldata firstPendingDeposit,\n StrategyValidatorProofData calldata strategyValidatorData\n ) external {\n // Load into memory the previously saved deposit data\n DepositData memory deposit = deposits[pendingDepositRoot];\n ValidatorData memory strategyValidator = validator[deposit.pubKeyHash];\n require(deposit.status == DepositStatus.PENDING, \"Deposit not pending\");\n require(firstPendingDeposit.slot != 0, \"Zero 1st pending deposit slot\");\n\n // We should allow the verification of deposits for validators that have been marked as exiting\n // to cover this situation:\n // - there are 2 pending deposits\n // - beacon chain has slashed the validator\n // - when verifyDeposit is called for the first deposit it sets the Validator state to EXITING\n // - verifyDeposit should allow a secondary call for the other deposit to a slashed validator\n require(\n strategyValidator.state == ValidatorState.VERIFIED ||\n strategyValidator.state == ValidatorState.ACTIVE ||\n strategyValidator.state == ValidatorState.EXITING,\n \"Not verified/active/exiting\"\n );\n // The verification slot must be after the deposit's slot.\n // This is needed for when the deposit queue is empty.\n require(deposit.slot < depositProcessedSlot, \"Slot not after deposit\");\n\n uint64 snapTimestamp = snappedBalance.timestamp;\n\n // This check prevents an accounting error that can happen if:\n // - snapBalances are snapped at the time of T\n // - deposit is processed on the beacon chain after time T and before verifyBalances()\n // - verifyDeposit is called before verifyBalances which removes a deposit from depositList\n // and deposit balance from totalDepositsWei\n // - verifyBalances is called under-reporting the strategy's balance\n require(\n (_calcNextBlockTimestamp(depositProcessedSlot) <= snapTimestamp) ||\n snapTimestamp == 0,\n \"Deposit after balance snapshot\"\n );\n\n // Get the parent beacon block root of the next block which is the block root of the deposit verification slot.\n // This will revert if the slot after the verification slot was missed.\n bytes32 depositBlockRoot = BeaconRoots.parentBlockRoot(\n _calcNextBlockTimestamp(depositProcessedSlot)\n );\n\n // Verify the slot of the first pending deposit matches the beacon chain\n bool isDepositQueueEmpty = IBeaconProofs(BEACON_PROOFS)\n .verifyFirstPendingDeposit(\n depositBlockRoot,\n firstPendingDeposit.slot,\n firstPendingDeposit.proof\n );\n\n // Verify the withdrawableEpoch on the validator of the strategy's deposit\n IBeaconProofs(BEACON_PROOFS).verifyValidatorWithdrawable(\n depositBlockRoot,\n strategyValidator.index,\n strategyValidatorData.withdrawableEpoch,\n strategyValidatorData.withdrawableEpochProof\n );\n\n uint64 firstPendingDepositEpoch = firstPendingDeposit.slot /\n SLOTS_PER_EPOCH;\n\n // If deposit queue is empty all deposits have certainly been processed. If not\n // a validator can either be not exiting and no further checks are required.\n // Or a validator is exiting then this function needs to make sure that the\n // pending deposit to an exited validator has certainly been processed. The\n // slot/epoch of first pending deposit is the one that contains the transaction\n // where the deposit to the ETH Deposit Contract has been made.\n //\n // Once the firstPendingDepositEpoch becomes greater than the withdrawableEpoch of\n // the slashed validator then the deposit has certainly been processed. When the beacon\n // chain reaches the withdrawableEpoch of the validator the deposit will no longer be\n // postponed. And any new deposits created (and present in the deposit queue)\n // will have an equal or larger withdrawableEpoch.\n require(\n strategyValidatorData.withdrawableEpoch == FAR_FUTURE_EPOCH ||\n strategyValidatorData.withdrawableEpoch <=\n firstPendingDepositEpoch ||\n isDepositQueueEmpty,\n \"Exit Deposit likely not proc.\"\n );\n\n // solhint-disable max-line-length\n // Check the deposit slot is before the first pending deposit's slot on the beacon chain.\n // If this is not true then we can't guarantee the deposit has been processed by the beacon chain.\n // The deposit's slot can not be the same slot as the first pending deposit as there could be\n // many deposits in the same block, hence have the same pending deposit slot.\n // If the deposit queue is empty then our deposit must have been processed on the beacon chain.\n // The deposit slot can be zero for validators consolidating to a compounding validator or 0x01 validator\n // being promoted to a compounding one. Reference:\n // - [switch_to_compounding_validator](https://ethereum.github.io/consensus-specs/specs/electra/beacon-chain/#new-switch_to_compounding_validator\n // - [queue_excess_active_balance](https://ethereum.github.io/consensus-specs/specs/electra/beacon-chain/#new-queue_excess_active_balance)\n // - [process_consolidation_request](https://ethereum.github.io/consensus-specs/specs/electra/beacon-chain/#new-process_consolidation_request)\n // We can not guarantee that the deposit has been processed in that case.\n // solhint-enable max-line-length\n require(\n deposit.slot < firstPendingDeposit.slot || isDepositQueueEmpty,\n \"Deposit likely not processed\"\n );\n\n // Remove the deposit now it has been verified as processed on the beacon chain.\n _removeDeposit(pendingDepositRoot, deposit);\n\n emit DepositVerified(\n pendingDepositRoot,\n uint256(deposit.amountGwei) * 1 gwei\n );\n }\n\n function _removeDeposit(\n bytes32 pendingDepositRoot,\n DepositData memory deposit\n ) internal {\n // After verifying the proof, update the contract storage\n deposits[pendingDepositRoot].status = DepositStatus.VERIFIED;\n // Move the last deposit to the index of the verified deposit\n bytes32 lastDeposit = depositList[depositList.length - 1];\n depositList[deposit.depositIndex] = lastDeposit;\n deposits[lastDeposit].depositIndex = deposit.depositIndex;\n // Delete the last deposit from the list\n depositList.pop();\n }\n\n /// @dev Calculates the timestamp of the next execution block from the given slot.\n /// @param slot The beacon chain slot number used for merkle proof verification.\n function _calcNextBlockTimestamp(uint64 slot)\n internal\n view\n returns (uint64)\n {\n // Calculate the next block timestamp from the slot.\n return SLOT_DURATION * slot + BEACON_GENESIS_TIMESTAMP + SLOT_DURATION;\n }\n\n // slither-disable-end reentrancy-no-eth\n\n /// @notice Stores the current ETH balance at the current block and beacon block root\n /// of the slot that is associated with the previous block.\n ///\n /// When snapping / verifying balance it is of a high importance that there is no\n /// miss-match in respect to ETH that is held by the contract and balances that are\n /// verified on the validators.\n ///\n /// First some context on the beacon-chain block building behaviour. Relevant parts of\n /// constructing a block on the beacon chain consist of:\n /// - process_withdrawals: ETH is deducted from the validator's balance\n /// - process_execution_payload: immediately after the previous step executing all the\n /// transactions\n /// - apply the withdrawals: adding ETH to the recipient which is the withdrawal address\n /// contained in the withdrawal credentials of the exited validators\n ///\n /// That means that balance increases which are part of the post-block execution state are\n /// done within the block, but the transaction that are contained within that block can not\n /// see / interact with the balance from the exited validators. Only transactions in the\n /// next block can do that.\n ///\n /// When snap balances is performed the state of the chain is snapped across 2 separate\n /// chain states:\n /// - ETH balance of the contract is recorded on block X -> and corresponding slot Y\n /// - beacon chain block root is recorded of block X - 1 -> and corresponding slot Y - 1\n /// given there were no missed slots. It could also be Y - 2, Y - 3 depending on how\n /// many slots have not managed to propose a block. For the sake of simplicity this slot\n /// will be referred to as Y - 1 as it makes no difference in the argument\n ///\n /// Given these 2 separate chain states it is paramount that verify balances can not experience\n /// miss-counting ETH or much more dangerous double counting of the ETH.\n ///\n /// When verifyBalances is called it is performed on the current block Z where Z > X. Verify\n /// balances adds up all the ETH (omitting WETH) controlled by this contract:\n /// - ETH balance in the contract on block X\n /// - ETH balance in Deposits on block Z that haven't been yet processed in slot Y - 1\n /// - ETH balance in validators that are active in slot Y - 1\n /// - skips the ETH balance in validators that have withdrawn in slot Y - 1 (or sooner)\n /// and have their balance visible to transactions in slot Y and corresponding block X\n /// (or sooner)\n ///\n /// Lets verify the correctness of ETH accounting given the above described behaviour.\n ///\n /// *ETH balance in the contract on block X*\n ///\n /// This is an ETH balance of the contract on a non current X block. Any ETH leaving the\n /// contract as a result of a withdrawal subtracts from the ETH accounted for on block X\n /// if `verifyBalances` has already been called. It also invalidates a `snapBalances` in\n /// case `verifyBalances` has not been called yet. Not performing this would result in not\n /// accounting for the withdrawn ETH that has happened anywhere in the block interval [X + 1, Z].\n ///\n /// Similarly to withdrawals any `stakeEth` deposits to the deposit contract adds to the ETH\n /// accounted for since the last `verifyBalances` has been called. And it invalidates the\n /// `snapBalances` in case `verifyBalances` hasn't been yet called. Not performing this\n /// would result in double counting the `stakedEth` since it would be present once in the\n /// snapped contract balance and the second time in deposit storage variables.\n ///\n /// This behaviour is correct.\n ///\n /// *ETH balance in Deposits on block Z that haven't been yet processed in slot Y - 1*\n ///\n /// The contract sums up all the ETH that has been deposited to the Beacon chain deposit\n /// contract at block Z. The execution layer doesn't have direct access to the state of\n /// deposits on the beacon chain. And if it is to sum up all the ETH that is marked to be\n /// deposited it needs to be sure to not double count ETH that is in deposits (storage vars)\n /// and could also be part of the validator balances. It does that by verifying that at\n /// slot Y - 1 none of the deposits visible on block Z have been processed. Meaning since\n /// the last snap till now all are still in queue. Which ensures they can not be part of\n /// the validator balances in later steps.\n ///\n /// This behaviour is correct.\n ///\n /// *ETH balance in validators that are active in slot Y - 1*\n ///\n /// The contract is verifying none of the deposits on Y - 1 slot have been processed and\n /// for that reason it checks the validator balances in the same slot. Ensuring accounting\n /// correctness.\n ///\n /// This behaviour is correct.\n ///\n /// *The withdrawn validators*\n ///\n /// The withdrawn validators could have their balances deducted in any slot before slot\n /// Y - 1 and the execution layer sees the balance increase in the subsequent slot. Lets\n /// look at the \"worst case scenario\" where the validator withdrawal is processed in the\n /// slot Y - 1 (snapped slot) and see their balance increase (in execution layer) in slot\n /// Y -> block X. The ETH balance on the contract is snapped at block X meaning that\n /// even if the validator exits at the latest possible time it is paramount that the ETH\n /// balance on the execution layer is recorded in the next block. Correctly accounting\n /// for the withdrawn ETH.\n ///\n /// Worth mentioning if the validator exit is processed by the slot Y and balance increase\n /// seen on the execution layer on block X + 1 the withdrawal is ignored by both the\n /// validator balance verification as well as execution layer contract balance snap.\n ///\n /// This behaviour is correct.\n ///\n /// The validator balances on the beacon chain can then be proved with `verifyBalances`.\n function snapBalances() external {\n uint64 currentTimestamp = SafeCast.toUint64(block.timestamp);\n require(\n snappedBalance.timestamp + SNAP_BALANCES_DELAY < currentTimestamp,\n \"Snap too soon\"\n );\n\n bytes32 blockRoot = BeaconRoots.parentBlockRoot(currentTimestamp);\n // Get the current ETH balance\n uint256 ethBalance = address(this).balance;\n\n // Store the snapped balance\n snappedBalance = Balances({\n blockRoot: blockRoot,\n timestamp: currentTimestamp,\n ethBalance: SafeCast.toUint128(ethBalance)\n });\n\n emit BalancesSnapped(blockRoot, ethBalance);\n }\n\n // A struct is used to avoid stack too deep errors\n struct BalanceProofs {\n // BeaconBlock.state.balances\n bytes32 balancesContainerRoot;\n bytes balancesContainerProof;\n // BeaconBlock.state.balances[validatorIndex]\n bytes32[] validatorBalanceLeaves;\n bytes[] validatorBalanceProofs;\n }\n\n struct PendingDepositProofs {\n bytes32 pendingDepositContainerRoot;\n bytes pendingDepositContainerProof;\n uint32[] pendingDepositIndexes;\n bytes[] pendingDepositProofs;\n }\n\n /// @notice Verifies the balances of all active validators on the beacon chain\n /// and checks each of the strategy's deposits are still to be processed by the beacon chain.\n /// @param balanceProofs a `BalanceProofs` struct containing the following:\n /// - balancesContainerRoot: The merkle root of the balances container\n /// - balancesContainerProof: The merkle proof for the balances container to the beacon block root.\n /// This is 9 witness hashes of 32 bytes each concatenated together starting from the leaf node.\n /// - validatorBalanceLeaves: Array of leaf nodes containing the validator balance with three other balances.\n /// - validatorBalanceProofs: Array of merkle proofs for the validator balance to the Balances container root.\n /// This is 39 witness hashes of 32 bytes each concatenated together starting from the leaf node.\n /// @param pendingDepositProofs a `PendingDepositProofs` struct containing the following:\n /// - pendingDepositContainerRoot: The merkle root of the pending deposits list container\n /// - pendingDepositContainerProof: The merkle proof from the pending deposits list container\n /// to the beacon block root.\n /// This is 9 witness hashes of 32 bytes each concatenated together starting from the leaf node.\n /// - pendingDepositIndexes: Array of indexes in the pending deposits list container for each\n /// of the strategy's deposits.\n /// - pendingDepositProofs: Array of merkle proofs for each strategy deposit in the\n /// beacon chain's pending deposit list container to the pending deposits list container root.\n /// These are 28 witness hashes of 32 bytes each concatenated together starting from the leaf node.\n // slither-disable-start reentrancy-no-eth\n function verifyBalances(\n BalanceProofs calldata balanceProofs,\n PendingDepositProofs calldata pendingDepositProofs\n ) external {\n // Load previously snapped balances for the given block root\n Balances memory balancesMem = snappedBalance;\n // Check the balances are the latest\n require(balancesMem.timestamp > 0, \"No snapped balances\");\n\n uint256 verifiedValidatorsCount = verifiedValidators.length;\n uint256 totalValidatorBalance = 0;\n uint256 depositsCount = depositList.length;\n\n // If there are no verified validators then we can skip the balance verification\n if (verifiedValidatorsCount > 0) {\n require(\n balanceProofs.validatorBalanceProofs.length ==\n verifiedValidatorsCount,\n \"Invalid balance proofs\"\n );\n require(\n balanceProofs.validatorBalanceLeaves.length ==\n verifiedValidatorsCount,\n \"Invalid balance leaves\"\n );\n // verify beaconBlock.state.balances root to beacon block root\n IBeaconProofs(BEACON_PROOFS).verifyBalancesContainer(\n balancesMem.blockRoot,\n balanceProofs.balancesContainerRoot,\n balanceProofs.balancesContainerProof\n );\n\n bytes32[]\n memory validatorHashesMem = _getPendingDepositValidatorHashes(\n depositsCount\n );\n\n // for each validator in reverse order so we can pop off exited validators at the end\n for (uint256 i = verifiedValidatorsCount; i > 0; ) {\n --i;\n ValidatorData memory validatorDataMem = validator[\n verifiedValidators[i]\n ];\n // verify validator's balance in beaconBlock.state.balances to the\n // beaconBlock.state.balances container root\n uint256 validatorBalanceGwei = IBeaconProofs(BEACON_PROOFS)\n .verifyValidatorBalance(\n balanceProofs.balancesContainerRoot,\n balanceProofs.validatorBalanceLeaves[i],\n balanceProofs.validatorBalanceProofs[i],\n validatorDataMem.index\n );\n\n // If the validator has exited and the balance is now zero\n if (validatorBalanceGwei == 0) {\n // Check if there are any pending deposits to this validator\n bool depositPending = false;\n for (uint256 j = 0; j < validatorHashesMem.length; j++) {\n if (validatorHashesMem[j] == verifiedValidators[i]) {\n depositPending = true;\n break;\n }\n }\n\n // If validator has a pending deposit we can not remove due to\n // the following situation:\n // - validator has a pending deposit\n // - validator has been slashed\n // - sweep cycle has withdrawn all ETH from the validator. Balance is 0\n // - beacon chain has processed the deposit and set the validator balance\n // to deposit amount\n // - if validator is no longer in the list of verifiedValidators its\n // balance will not be considered and be under-counted.\n if (!depositPending) {\n // Store the validator state as exited\n // This could have been in VERIFIED, ACTIVE or EXITING state\n validator[verifiedValidators[i]].state = ValidatorState\n .EXITED;\n\n // Remove the validator with a zero balance from the list of verified validators\n\n // Reduce the count of verified validators which is the last index before the pop removes it.\n verifiedValidatorsCount -= 1;\n\n // Move the last validator that has already been verified to the current index.\n // There's an extra SSTORE if i is the last active validator but that's fine,\n // It's not a common case and the code is simpler this way.\n verifiedValidators[i] = verifiedValidators[\n verifiedValidatorsCount\n ];\n // Delete the last validator from the list\n verifiedValidators.pop();\n }\n\n // The validator balance is zero so not need to add to totalValidatorBalance\n continue;\n } else if (\n validatorDataMem.state == ValidatorState.VERIFIED &&\n validatorBalanceGwei > MIN_ACTIVATION_BALANCE_GWEI\n ) {\n // Store the validator state as active. This does not necessarily mean the\n // validator is active on the beacon chain yet. It just means the validator has\n // enough balance that it can become active.\n validator[verifiedValidators[i]].state = ValidatorState\n .ACTIVE;\n }\n\n // convert Gwei balance to Wei and add to the total validator balance\n totalValidatorBalance += validatorBalanceGwei * 1 gwei;\n }\n }\n\n uint256 totalDepositsWei = 0;\n\n // If there are no deposits then we can skip the deposit verification.\n // This section is after the validator balance verifications so an exited validator will be marked\n // as EXITED before the deposits are verified. If there was a deposit to an exited validator\n // then the deposit can only be removed once the validator is fully exited.\n // It is possible that validator fully exits and a postponed deposit to an exited validator increases\n // its balance again. In such case the contract will erroneously consider a deposit applied before it\n // has been applied on the beacon chain showing a smaller than real `totalValidatorBalance`.\n if (depositsCount > 0) {\n require(\n pendingDepositProofs.pendingDepositProofs.length ==\n depositsCount,\n \"Invalid deposit proofs\"\n );\n require(\n pendingDepositProofs.pendingDepositIndexes.length ==\n depositsCount,\n \"Invalid deposit indexes\"\n );\n\n // Verify from the root of the pending deposit list container to the beacon block root\n IBeaconProofs(BEACON_PROOFS).verifyPendingDepositsContainer(\n balancesMem.blockRoot,\n pendingDepositProofs.pendingDepositContainerRoot,\n pendingDepositProofs.pendingDepositContainerProof\n );\n\n // For each staking strategy's deposit.\n for (uint256 i = 0; i < depositsCount; ++i) {\n bytes32 pendingDepositRoot = depositList[i];\n\n // Verify the strategy's deposit is still pending on the beacon chain.\n IBeaconProofs(BEACON_PROOFS).verifyPendingDeposit(\n pendingDepositProofs.pendingDepositContainerRoot,\n pendingDepositRoot,\n pendingDepositProofs.pendingDepositProofs[i],\n pendingDepositProofs.pendingDepositIndexes[i]\n );\n\n // Convert the deposit amount from Gwei to Wei and add to the total\n totalDepositsWei +=\n uint256(deposits[pendingDepositRoot].amountGwei) *\n 1 gwei;\n }\n }\n\n // Store the verified balance in storage\n lastVerifiedEthBalance =\n totalDepositsWei +\n totalValidatorBalance +\n balancesMem.ethBalance;\n // Reset the last snap timestamp so a new snapBalances has to be made\n snappedBalance.timestamp = 0;\n\n emit BalancesVerified(\n balancesMem.timestamp,\n totalDepositsWei,\n totalValidatorBalance,\n balancesMem.ethBalance\n );\n }\n\n // slither-disable-end reentrancy-no-eth\n\n /// @notice get a list of all validator hashes present in the pending deposits\n /// list can have duplicate entries\n function _getPendingDepositValidatorHashes(uint256 depositsCount)\n internal\n view\n returns (bytes32[] memory validatorHashes)\n {\n validatorHashes = new bytes32[](depositsCount);\n for (uint256 i = 0; i < depositsCount; i++) {\n validatorHashes[i] = deposits[depositList[i]].pubKeyHash;\n }\n }\n\n /// @notice Hash a validator public key using the Beacon Chain's format\n function _hashPubKey(bytes memory pubKey) internal pure returns (bytes32) {\n require(pubKey.length == 48, \"Invalid public key\");\n return sha256(abi.encodePacked(pubKey, bytes16(0)));\n }\n\n /**\n *\n * WETH and ETH Accounting\n *\n */\n\n /// @dev Called when WETH is transferred out of the strategy so\n /// the strategy knows how much WETH it has on deposit.\n /// This is so it can emit the correct amount in the Deposit event in depositAll().\n function _transferWeth(uint256 _amount, address _recipient) internal {\n IERC20(WETH).safeTransfer(_recipient, _amount);\n\n // The min is required as more WETH can be withdrawn than deposited\n // as the strategy earns consensus and execution rewards.\n uint256 deductAmount = Math.min(_amount, depositedWethAccountedFor);\n depositedWethAccountedFor -= deductAmount;\n\n // No change in ETH balance so no need to snapshot the balances\n }\n\n /// @dev Converts ETH to WETH and updates the accounting.\n /// @param _ethAmount The amount of ETH in wei.\n function _convertEthToWeth(uint256 _ethAmount) internal {\n // slither-disable-next-line arbitrary-send-eth\n IWETH9(WETH).deposit{ value: _ethAmount }();\n\n depositedWethAccountedFor += _ethAmount;\n\n // Store the reduced ETH balance.\n // The ETH balance in this strategy contract can be more than the last verified ETH balance\n // due to partial withdrawals or full exits being processed by the beacon chain since the last snapBalances.\n // It can also happen from execution rewards (MEV) or ETH donations.\n lastVerifiedEthBalance -= Math.min(lastVerifiedEthBalance, _ethAmount);\n\n // The ETH balance was decreased to WETH so we need to invalidate the last balances snap.\n snappedBalance.timestamp = 0;\n }\n\n /// @dev Converts WETH to ETH and updates the accounting.\n /// @param _wethAmount The amount of WETH in wei.\n function _convertWethToEth(uint256 _wethAmount) internal {\n IWETH9(WETH).withdraw(_wethAmount);\n\n uint256 deductAmount = Math.min(_wethAmount, depositedWethAccountedFor);\n depositedWethAccountedFor -= deductAmount;\n\n // Store the increased ETH balance\n lastVerifiedEthBalance += _wethAmount;\n\n // The ETH balance was increased from WETH so we need to invalidate the last balances snap.\n snappedBalance.timestamp = 0;\n }\n\n /**\n *\n * View Functions\n *\n */\n\n /// @notice Returns the number of deposits waiting to be verified as processed on the beacon chain,\n /// or deposits that have been verified to an exiting validator and is now waiting for the\n /// validator's balance to be swept.\n function depositListLength() external view returns (uint256) {\n return depositList.length;\n }\n\n /// @notice Returns the number of verified validators.\n function verifiedValidatorsLength() external view returns (uint256) {\n return verifiedValidators.length;\n }\n}\n" + }, + "contracts/token/OUSD.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\n/**\n * @title OUSD Token Contract\n * @dev ERC20 compatible contract for OUSD\n * @dev Implements an elastic supply\n * @author Origin Protocol Inc\n */\nimport { IVault } from \"../interfaces/IVault.sol\";\nimport { Governable } from \"../governance/Governable.sol\";\nimport { SafeCast } from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\ncontract OUSD is Governable {\n using SafeCast for int256;\n using SafeCast for uint256;\n\n /// @dev Event triggered when the supply changes\n /// @param totalSupply Updated token total supply\n /// @param rebasingCredits Updated token rebasing credits\n /// @param rebasingCreditsPerToken Updated token rebasing credits per token\n event TotalSupplyUpdatedHighres(\n uint256 totalSupply,\n uint256 rebasingCredits,\n uint256 rebasingCreditsPerToken\n );\n /// @dev Event triggered when an account opts in for rebasing\n /// @param account Address of the account\n event AccountRebasingEnabled(address account);\n /// @dev Event triggered when an account opts out of rebasing\n /// @param account Address of the account\n event AccountRebasingDisabled(address account);\n /// @dev Emitted when `value` tokens are moved from one account `from` to\n /// another `to`.\n /// @param from Address of the account tokens are moved from\n /// @param to Address of the account tokens are moved to\n /// @param value Amount of tokens transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\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 /// @param owner Address of the owner approving allowance\n /// @param spender Address of the spender allowance is granted to\n /// @param value Amount of tokens spender can transfer\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n /// @dev Yield resulting from {changeSupply} that a `source` account would\n /// receive is directed to `target` account.\n /// @param source Address of the source forwarding the yield\n /// @param target Address of the target receiving the yield\n event YieldDelegated(address source, address target);\n /// @dev Yield delegation from `source` account to the `target` account is\n /// suspended.\n /// @param source Address of the source suspending yield forwarding\n /// @param target Address of the target no longer receiving yield from `source`\n /// account\n event YieldUndelegated(address source, address target);\n\n enum RebaseOptions {\n NotSet,\n StdNonRebasing,\n StdRebasing,\n YieldDelegationSource,\n YieldDelegationTarget\n }\n\n uint256[154] private _gap; // Slots to align with deployed contract\n uint256 private constant MAX_SUPPLY = type(uint128).max;\n /// @dev The amount of tokens in existence\n uint256 public totalSupply;\n mapping(address => mapping(address => uint256)) private allowances;\n /// @dev The vault with privileges to execute {mint}, {burn}\n /// and {changeSupply}\n address public vaultAddress;\n mapping(address => uint256) internal creditBalances;\n // the 2 storage variables below need trailing underscores to not name collide with public functions\n uint256 private rebasingCredits_; // Sum of all rebasing credits (creditBalances for rebasing accounts)\n uint256 private rebasingCreditsPerToken_;\n /// @dev The amount of tokens that are not rebasing - receiving yield\n uint256 public nonRebasingSupply;\n mapping(address => uint256) internal alternativeCreditsPerToken;\n /// @dev A map of all addresses and their respective RebaseOptions\n mapping(address => RebaseOptions) public rebaseState;\n mapping(address => uint256) private __deprecated_isUpgraded;\n /// @dev A map of addresses that have yields forwarded to. This is an\n /// inverse mapping of {yieldFrom}\n /// Key Account forwarding yield\n /// Value Account receiving yield\n mapping(address => address) public yieldTo;\n /// @dev A map of addresses that are receiving the yield. This is an\n /// inverse mapping of {yieldTo}\n /// Key Account receiving yield\n /// Value Account forwarding yield\n mapping(address => address) public yieldFrom;\n\n uint256 private constant RESOLUTION_INCREASE = 1e9;\n uint256[34] private __gap; // including below gap totals up to 200\n\n /// @dev Verifies that the caller is the Governor or Strategist.\n modifier onlyGovernorOrStrategist() {\n require(\n isGovernor() || msg.sender == IVault(vaultAddress).strategistAddr(),\n \"Caller is not the Strategist or Governor\"\n );\n _;\n }\n\n /// @dev Initializes the contract and sets necessary variables.\n /// @param _vaultAddress Address of the vault contract\n /// @param _initialCreditsPerToken The starting rebasing credits per token.\n function initialize(address _vaultAddress, uint256 _initialCreditsPerToken)\n external\n onlyGovernor\n {\n require(_vaultAddress != address(0), \"Zero vault address\");\n require(vaultAddress == address(0), \"Already initialized\");\n\n rebasingCreditsPerToken_ = _initialCreditsPerToken;\n vaultAddress = _vaultAddress;\n }\n\n /// @dev Returns the symbol of the token, a shorter version\n /// of the name.\n function symbol() external pure virtual returns (string memory) {\n return \"OUSD\";\n }\n\n /// @dev Returns the name of the token.\n function name() external pure virtual returns (string memory) {\n return \"Origin Dollar\";\n }\n\n /// @dev Returns the number of decimals used to get its user representation.\n function decimals() external pure virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev Verifies that the caller is the Vault contract\n */\n modifier onlyVault() {\n require(vaultAddress == msg.sender, \"Caller is not the Vault\");\n _;\n }\n\n /**\n * @return High resolution rebasingCreditsPerToken\n */\n function rebasingCreditsPerTokenHighres() external view returns (uint256) {\n return rebasingCreditsPerToken_;\n }\n\n /**\n * @return Low resolution rebasingCreditsPerToken\n */\n function rebasingCreditsPerToken() external view returns (uint256) {\n return rebasingCreditsPerToken_ / RESOLUTION_INCREASE;\n }\n\n /**\n * @return High resolution total number of rebasing credits\n */\n function rebasingCreditsHighres() external view returns (uint256) {\n return rebasingCredits_;\n }\n\n /**\n * @return Low resolution total number of rebasing credits\n */\n function rebasingCredits() external view returns (uint256) {\n return rebasingCredits_ / RESOLUTION_INCREASE;\n }\n\n /**\n * @notice Gets the balance of the specified address.\n * @param _account Address to query the balance of.\n * @return A uint256 representing the amount of base units owned by the\n * specified address.\n */\n function balanceOf(address _account) public view returns (uint256) {\n RebaseOptions state = rebaseState[_account];\n if (state == RebaseOptions.YieldDelegationSource) {\n // Saves a slot read when transferring to or from a yield delegating source\n // since we know creditBalances equals the balance.\n return creditBalances[_account];\n }\n uint256 baseBalance = (creditBalances[_account] * 1e18) /\n _creditsPerToken(_account);\n if (state == RebaseOptions.YieldDelegationTarget) {\n // creditBalances of yieldFrom accounts equals token balances\n return baseBalance - creditBalances[yieldFrom[_account]];\n }\n return baseBalance;\n }\n\n /**\n * @notice Gets the credits balance of the specified address.\n * @dev Backwards compatible with old low res credits per token.\n * @param _account The address to query the balance of.\n * @return (uint256, uint256) Credit balance and credits per token of the\n * address\n */\n function creditsBalanceOf(address _account)\n external\n view\n returns (uint256, uint256)\n {\n uint256 cpt = _creditsPerToken(_account);\n if (cpt == 1e27) {\n // For a period before the resolution upgrade, we created all new\n // contract accounts at high resolution. Since they are not changing\n // as a result of this upgrade, we will return their true values\n return (creditBalances[_account], cpt);\n } else {\n return (\n creditBalances[_account] / RESOLUTION_INCREASE,\n cpt / RESOLUTION_INCREASE\n );\n }\n }\n\n /**\n * @notice Gets the credits balance of the specified address.\n * @param _account The address to query the balance of.\n * @return (uint256, uint256, bool) Credit balance, credits per token of the\n * address, and isUpgraded\n */\n function creditsBalanceOfHighres(address _account)\n external\n view\n returns (\n uint256,\n uint256,\n bool\n )\n {\n return (\n creditBalances[_account],\n _creditsPerToken(_account),\n true // all accounts have their resolution \"upgraded\"\n );\n }\n\n // Backwards compatible view\n function nonRebasingCreditsPerToken(address _account)\n external\n view\n returns (uint256)\n {\n return alternativeCreditsPerToken[_account];\n }\n\n /**\n * @notice Transfer tokens to a specified address.\n * @param _to the address to transfer to.\n * @param _value the amount to be transferred.\n * @return true on success.\n */\n function transfer(address _to, uint256 _value) external returns (bool) {\n require(_to != address(0), \"Transfer to zero address\");\n\n _executeTransfer(msg.sender, _to, _value);\n\n emit Transfer(msg.sender, _to, _value);\n return true;\n }\n\n /**\n * @notice Transfer tokens from one address to another.\n * @param _from The address you want to send tokens from.\n * @param _to The address you want to transfer to.\n * @param _value The amount of tokens to be transferred.\n * @return true on success.\n */\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n ) external returns (bool) {\n require(_to != address(0), \"Transfer to zero address\");\n uint256 userAllowance = allowances[_from][msg.sender];\n require(_value <= userAllowance, \"Allowance exceeded\");\n\n unchecked {\n allowances[_from][msg.sender] = userAllowance - _value;\n }\n\n _executeTransfer(_from, _to, _value);\n\n emit Transfer(_from, _to, _value);\n return true;\n }\n\n function _executeTransfer(\n address _from,\n address _to,\n uint256 _value\n ) internal {\n (\n int256 fromRebasingCreditsDiff,\n int256 fromNonRebasingSupplyDiff\n ) = _adjustAccount(_from, -_value.toInt256());\n (\n int256 toRebasingCreditsDiff,\n int256 toNonRebasingSupplyDiff\n ) = _adjustAccount(_to, _value.toInt256());\n\n _adjustGlobals(\n fromRebasingCreditsDiff + toRebasingCreditsDiff,\n fromNonRebasingSupplyDiff + toNonRebasingSupplyDiff\n );\n }\n\n function _adjustAccount(address _account, int256 _balanceChange)\n internal\n returns (int256 rebasingCreditsDiff, int256 nonRebasingSupplyDiff)\n {\n RebaseOptions state = rebaseState[_account];\n int256 currentBalance = balanceOf(_account).toInt256();\n if (currentBalance + _balanceChange < 0) {\n revert(\"Transfer amount exceeds balance\");\n }\n uint256 newBalance = (currentBalance + _balanceChange).toUint256();\n\n if (state == RebaseOptions.YieldDelegationSource) {\n address target = yieldTo[_account];\n uint256 targetOldBalance = balanceOf(target);\n uint256 targetNewCredits = _balanceToRebasingCredits(\n targetOldBalance + newBalance\n );\n rebasingCreditsDiff =\n targetNewCredits.toInt256() -\n creditBalances[target].toInt256();\n\n creditBalances[_account] = newBalance;\n creditBalances[target] = targetNewCredits;\n } else if (state == RebaseOptions.YieldDelegationTarget) {\n uint256 newCredits = _balanceToRebasingCredits(\n newBalance + creditBalances[yieldFrom[_account]]\n );\n rebasingCreditsDiff =\n newCredits.toInt256() -\n creditBalances[_account].toInt256();\n creditBalances[_account] = newCredits;\n } else {\n _autoMigrate(_account);\n uint256 alternativeCreditsPerTokenMem = alternativeCreditsPerToken[\n _account\n ];\n if (alternativeCreditsPerTokenMem > 0) {\n nonRebasingSupplyDiff = _balanceChange;\n if (alternativeCreditsPerTokenMem != 1e18) {\n alternativeCreditsPerToken[_account] = 1e18;\n }\n creditBalances[_account] = newBalance;\n } else {\n uint256 newCredits = _balanceToRebasingCredits(newBalance);\n rebasingCreditsDiff =\n newCredits.toInt256() -\n creditBalances[_account].toInt256();\n creditBalances[_account] = newCredits;\n }\n }\n }\n\n function _adjustGlobals(\n int256 _rebasingCreditsDiff,\n int256 _nonRebasingSupplyDiff\n ) internal {\n if (_rebasingCreditsDiff != 0) {\n rebasingCredits_ = (rebasingCredits_.toInt256() +\n _rebasingCreditsDiff).toUint256();\n }\n if (_nonRebasingSupplyDiff != 0) {\n nonRebasingSupply = (nonRebasingSupply.toInt256() +\n _nonRebasingSupplyDiff).toUint256();\n }\n }\n\n /**\n * @notice Function to check the amount of tokens that _owner has allowed\n * to `_spender`.\n * @param _owner The address which owns the funds.\n * @param _spender The address which will spend the funds.\n * @return The number of tokens still available for the _spender.\n */\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256)\n {\n return allowances[_owner][_spender];\n }\n\n /**\n * @notice Approve the passed address to spend the specified amount of\n * tokens on behalf of msg.sender.\n * @param _spender The address which will spend the funds.\n * @param _value The amount of tokens to be spent.\n * @return true on success.\n */\n function approve(address _spender, uint256 _value) external returns (bool) {\n allowances[msg.sender][_spender] = _value;\n emit Approval(msg.sender, _spender, _value);\n return true;\n }\n\n /**\n * @notice Creates `_amount` tokens and assigns them to `_account`,\n * increasing the total supply.\n */\n function mint(address _account, uint256 _amount) external onlyVault {\n require(_account != address(0), \"Mint to the zero address\");\n\n // Account\n (\n int256 toRebasingCreditsDiff,\n int256 toNonRebasingSupplyDiff\n ) = _adjustAccount(_account, _amount.toInt256());\n // Globals\n _adjustGlobals(toRebasingCreditsDiff, toNonRebasingSupplyDiff);\n totalSupply = totalSupply + _amount;\n\n require(totalSupply < MAX_SUPPLY, \"Max supply\");\n emit Transfer(address(0), _account, _amount);\n }\n\n /**\n * @notice Destroys `_amount` tokens from `_account`,\n * reducing the total supply.\n */\n function burn(address _account, uint256 _amount) external onlyVault {\n require(_account != address(0), \"Burn from the zero address\");\n if (_amount == 0) {\n return;\n }\n\n // Account\n (\n int256 toRebasingCreditsDiff,\n int256 toNonRebasingSupplyDiff\n ) = _adjustAccount(_account, -_amount.toInt256());\n // Globals\n _adjustGlobals(toRebasingCreditsDiff, toNonRebasingSupplyDiff);\n totalSupply = totalSupply - _amount;\n\n emit Transfer(_account, address(0), _amount);\n }\n\n /**\n * @dev Get the credits per token for an account. Returns a fixed amount\n * if the account is non-rebasing.\n * @param _account Address of the account.\n */\n function _creditsPerToken(address _account)\n internal\n view\n returns (uint256)\n {\n uint256 alternativeCreditsPerTokenMem = alternativeCreditsPerToken[\n _account\n ];\n if (alternativeCreditsPerTokenMem != 0) {\n return alternativeCreditsPerTokenMem;\n } else {\n return rebasingCreditsPerToken_;\n }\n }\n\n /**\n * @dev Auto migrate contracts to be non rebasing,\n * unless they have opted into yield.\n * @param _account Address of the account.\n */\n function _autoMigrate(address _account) internal {\n uint256 codeLen = _account.code.length;\n bool isEOA = (codeLen == 0) ||\n (codeLen == 23 && bytes3(_account.code) == 0xef0100);\n // In previous code versions, contracts would not have had their\n // rebaseState[_account] set to RebaseOptions.NonRebasing when migrated\n // therefore we check the actual accounting used on the account as well.\n if (\n (!isEOA) &&\n rebaseState[_account] == RebaseOptions.NotSet &&\n alternativeCreditsPerToken[_account] == 0\n ) {\n _rebaseOptOut(_account);\n }\n }\n\n /**\n * @dev Calculates credits from contract's global rebasingCreditsPerToken_, and\n * also balance that corresponds to those credits. The latter is important\n * when adjusting the contract's global nonRebasingSupply to circumvent any\n * possible rounding errors.\n *\n * @param _balance Balance of the account.\n */\n function _balanceToRebasingCredits(uint256 _balance)\n internal\n view\n returns (uint256 rebasingCredits)\n {\n // Rounds up, because we need to ensure that accounts always have\n // at least the balance that they should have.\n // Note this should always be used on an absolute account value,\n // not on a possibly negative diff, because then the rounding would be wrong.\n return ((_balance) * rebasingCreditsPerToken_ + 1e18 - 1) / 1e18;\n }\n\n /**\n * @notice The calling account will start receiving yield after a successful call.\n * @param _account Address of the account.\n */\n function governanceRebaseOptIn(address _account) external onlyGovernor {\n require(_account != address(0), \"Zero address not allowed\");\n _rebaseOptIn(_account);\n }\n\n /**\n * @notice The calling account will start receiving yield after a successful call.\n */\n function rebaseOptIn() external {\n _rebaseOptIn(msg.sender);\n }\n\n function _rebaseOptIn(address _account) internal {\n uint256 balance = balanceOf(_account);\n\n // prettier-ignore\n require(\n alternativeCreditsPerToken[_account] > 0 ||\n // Accounts may explicitly `rebaseOptIn` regardless of\n // accounting if they have a 0 balance.\n creditBalances[_account] == 0\n ,\n \"Account must be non-rebasing\"\n );\n RebaseOptions state = rebaseState[_account];\n // prettier-ignore\n require(\n state == RebaseOptions.StdNonRebasing ||\n state == RebaseOptions.NotSet,\n \"Only standard non-rebasing accounts can opt in\"\n );\n\n uint256 newCredits = _balanceToRebasingCredits(balance);\n\n // Account\n rebaseState[_account] = RebaseOptions.StdRebasing;\n alternativeCreditsPerToken[_account] = 0;\n creditBalances[_account] = newCredits;\n // Globals\n _adjustGlobals(newCredits.toInt256(), -balance.toInt256());\n\n emit AccountRebasingEnabled(_account);\n }\n\n /**\n * @notice The calling account will no longer receive yield\n */\n function rebaseOptOut() external {\n _rebaseOptOut(msg.sender);\n }\n\n function _rebaseOptOut(address _account) internal {\n require(\n alternativeCreditsPerToken[_account] == 0,\n \"Account must be rebasing\"\n );\n RebaseOptions state = rebaseState[_account];\n require(\n state == RebaseOptions.StdRebasing || state == RebaseOptions.NotSet,\n \"Only standard rebasing accounts can opt out\"\n );\n\n uint256 oldCredits = creditBalances[_account];\n uint256 balance = balanceOf(_account);\n\n // Account\n rebaseState[_account] = RebaseOptions.StdNonRebasing;\n alternativeCreditsPerToken[_account] = 1e18;\n creditBalances[_account] = balance;\n // Globals\n _adjustGlobals(-oldCredits.toInt256(), balance.toInt256());\n\n emit AccountRebasingDisabled(_account);\n }\n\n /**\n * @notice Distribute yield to users. This changes the exchange rate\n * between \"credits\" and OUSD tokens to change rebasing user's balances.\n * @param _newTotalSupply New total supply of OUSD.\n */\n function changeSupply(uint256 _newTotalSupply) external onlyVault {\n require(totalSupply > 0, \"Cannot increase 0 supply\");\n\n if (totalSupply == _newTotalSupply) {\n emit TotalSupplyUpdatedHighres(\n totalSupply,\n rebasingCredits_,\n rebasingCreditsPerToken_\n );\n return;\n }\n\n totalSupply = _newTotalSupply > MAX_SUPPLY\n ? MAX_SUPPLY\n : _newTotalSupply;\n\n uint256 rebasingSupply = totalSupply - nonRebasingSupply;\n // round up in the favour of the protocol\n rebasingCreditsPerToken_ =\n (rebasingCredits_ * 1e18 + rebasingSupply - 1) /\n rebasingSupply;\n\n require(rebasingCreditsPerToken_ > 0, \"Invalid change in supply\");\n\n emit TotalSupplyUpdatedHighres(\n totalSupply,\n rebasingCredits_,\n rebasingCreditsPerToken_\n );\n }\n\n /*\n * @notice Send the yield from one account to another account.\n * Each account keeps its own balances.\n */\n function delegateYield(address _from, address _to)\n external\n onlyGovernorOrStrategist\n {\n require(_from != address(0), \"Zero from address not allowed\");\n require(_to != address(0), \"Zero to address not allowed\");\n\n require(_from != _to, \"Cannot delegate to self\");\n require(\n yieldFrom[_to] == address(0) &&\n yieldTo[_to] == address(0) &&\n yieldFrom[_from] == address(0) &&\n yieldTo[_from] == address(0),\n \"Blocked by existing yield delegation\"\n );\n RebaseOptions stateFrom = rebaseState[_from];\n RebaseOptions stateTo = rebaseState[_to];\n\n require(\n stateFrom == RebaseOptions.NotSet ||\n stateFrom == RebaseOptions.StdNonRebasing ||\n stateFrom == RebaseOptions.StdRebasing,\n \"Invalid rebaseState from\"\n );\n\n require(\n stateTo == RebaseOptions.NotSet ||\n stateTo == RebaseOptions.StdNonRebasing ||\n stateTo == RebaseOptions.StdRebasing,\n \"Invalid rebaseState to\"\n );\n\n if (alternativeCreditsPerToken[_from] == 0) {\n _rebaseOptOut(_from);\n }\n if (alternativeCreditsPerToken[_to] > 0) {\n _rebaseOptIn(_to);\n }\n\n uint256 fromBalance = balanceOf(_from);\n uint256 toBalance = balanceOf(_to);\n uint256 oldToCredits = creditBalances[_to];\n uint256 newToCredits = _balanceToRebasingCredits(\n fromBalance + toBalance\n );\n\n // Set up the bidirectional links\n yieldTo[_from] = _to;\n yieldFrom[_to] = _from;\n\n // Local\n rebaseState[_from] = RebaseOptions.YieldDelegationSource;\n alternativeCreditsPerToken[_from] = 1e18;\n creditBalances[_from] = fromBalance;\n rebaseState[_to] = RebaseOptions.YieldDelegationTarget;\n creditBalances[_to] = newToCredits;\n\n // Global\n int256 creditsChange = newToCredits.toInt256() -\n oldToCredits.toInt256();\n _adjustGlobals(creditsChange, -(fromBalance).toInt256());\n emit YieldDelegated(_from, _to);\n }\n\n /*\n * @notice Stop sending the yield from one account to another account.\n */\n function undelegateYield(address _from) external onlyGovernorOrStrategist {\n // Require a delegation, which will also ensure a valid delegation\n require(yieldTo[_from] != address(0), \"Zero address not allowed\");\n\n address to = yieldTo[_from];\n uint256 fromBalance = balanceOf(_from);\n uint256 toBalance = balanceOf(to);\n uint256 oldToCredits = creditBalances[to];\n uint256 newToCredits = _balanceToRebasingCredits(toBalance);\n\n // Remove the bidirectional links\n yieldFrom[to] = address(0);\n yieldTo[_from] = address(0);\n\n // Local\n rebaseState[_from] = RebaseOptions.StdNonRebasing;\n // alternativeCreditsPerToken[from] already 1e18 from `delegateYield()`\n creditBalances[_from] = fromBalance;\n rebaseState[to] = RebaseOptions.StdRebasing;\n // alternativeCreditsPerToken[to] already 0 from `delegateYield()`\n creditBalances[to] = newToCredits;\n\n // Global\n int256 creditsChange = newToCredits.toInt256() -\n oldToCredits.toInt256();\n _adjustGlobals(creditsChange, fromBalance.toInt256());\n emit YieldUndelegated(_from, to);\n }\n}\n" + }, + "contracts/utils/Helpers.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\nimport { IBasicToken } from \"../interfaces/IBasicToken.sol\";\n\nlibrary Helpers {\n /**\n * @notice Fetch the `symbol()` from an ERC20 token\n * @dev Grabs the `symbol()` from a contract\n * @param _token Address of the ERC20 token\n * @return string Symbol of the ERC20 token\n */\n function getSymbol(address _token) internal view returns (string memory) {\n string memory symbol = IBasicToken(_token).symbol();\n return symbol;\n }\n\n /**\n * @notice Fetch the `decimals()` from an ERC20 token\n * @dev Grabs the `decimals()` from a contract and fails if\n * the decimal value does not live within a certain range\n * @param _token Address of the ERC20 token\n * @return uint256 Decimals of the ERC20 token\n */\n function getDecimals(address _token) internal view returns (uint256) {\n uint256 decimals = IBasicToken(_token).decimals();\n require(\n decimals >= 4 && decimals <= 18,\n \"Token must have sufficient decimal places\"\n );\n\n return decimals;\n }\n}\n" + }, + "contracts/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\n/**\n * @title Base contract any contracts that need to initialize state after deployment.\n * @author Origin Protocol Inc\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n */\n bool private initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private initializing;\n\n /**\n * @dev Modifier to protect an initializer function from being invoked twice.\n */\n modifier initializer() {\n require(\n initializing || !initialized,\n \"Initializable: contract is already initialized\"\n );\n\n bool isTopLevelCall = !initializing;\n if (isTopLevelCall) {\n initializing = true;\n initialized = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n initializing = false;\n }\n }\n\n uint256[50] private ______gap;\n}\n" + }, + "contracts/utils/InitializableAbstractStrategy.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\n/**\n * @title Base contract for vault strategies.\n * @author Origin Protocol Inc\n */\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport { Initializable } from \"../utils/Initializable.sol\";\nimport { Governable } from \"../governance/Governable.sol\";\nimport { IVault } from \"../interfaces/IVault.sol\";\n\nabstract contract InitializableAbstractStrategy is Initializable, Governable {\n using SafeERC20 for IERC20;\n\n event PTokenAdded(address indexed _asset, address _pToken);\n event PTokenRemoved(address indexed _asset, address _pToken);\n event Deposit(address indexed _asset, address _pToken, uint256 _amount);\n event Withdrawal(address indexed _asset, address _pToken, uint256 _amount);\n event RewardTokenCollected(\n address recipient,\n address rewardToken,\n uint256 amount\n );\n event RewardTokenAddressesUpdated(\n address[] _oldAddresses,\n address[] _newAddresses\n );\n event HarvesterAddressesUpdated(\n address _oldHarvesterAddress,\n address _newHarvesterAddress\n );\n\n /// @notice Address of the underlying platform\n address public immutable platformAddress;\n /// @notice Address of the OToken vault\n address public immutable vaultAddress;\n\n /// @dev Replaced with an immutable variable\n // slither-disable-next-line constable-states\n address private _deprecated_platformAddress;\n\n /// @dev Replaced with an immutable\n // slither-disable-next-line constable-states\n address private _deprecated_vaultAddress;\n\n /// @notice asset => pToken (Platform Specific Token Address)\n mapping(address => address) public assetToPToken;\n\n /// @notice Full list of all assets supported by the strategy\n address[] internal assetsMapped;\n\n // Deprecated: Reward token address\n // slither-disable-next-line constable-states\n address private _deprecated_rewardTokenAddress;\n\n // Deprecated: now resides in Harvester's rewardTokenConfigs\n // slither-disable-next-line constable-states\n uint256 private _deprecated_rewardLiquidationThreshold;\n\n /// @notice Address of the Harvester contract allowed to collect reward tokens\n address public harvesterAddress;\n\n /// @notice Address of the reward tokens. eg CRV, BAL, CVX, AURA\n address[] public rewardTokenAddresses;\n\n /* Reserved for future expansion. Used to be 100 storage slots\n * and has decreased to accommodate:\n * - harvesterAddress\n * - rewardTokenAddresses\n */\n int256[98] private _reserved;\n\n struct BaseStrategyConfig {\n address platformAddress; // Address of the underlying platform\n address vaultAddress; // Address of the OToken's Vault\n }\n\n /**\n * @dev Verifies that the caller is the Governor or Strategist.\n */\n modifier onlyGovernorOrStrategist() {\n require(\n isGovernor() || msg.sender == IVault(vaultAddress).strategistAddr(),\n \"Caller is not the Strategist or Governor\"\n );\n _;\n }\n\n /**\n * @param _config The platform and OToken vault addresses\n */\n constructor(BaseStrategyConfig memory _config) {\n platformAddress = _config.platformAddress;\n vaultAddress = _config.vaultAddress;\n }\n\n /**\n * @dev Internal initialize function, to set up initial internal state\n * @param _rewardTokenAddresses Address of reward token for platform\n * @param _assets Addresses of initial supported assets\n * @param _pTokens Platform Token corresponding addresses\n */\n function _initialize(\n address[] memory _rewardTokenAddresses,\n address[] memory _assets,\n address[] memory _pTokens\n ) internal {\n rewardTokenAddresses = _rewardTokenAddresses;\n\n uint256 assetCount = _assets.length;\n require(assetCount == _pTokens.length, \"Invalid input arrays\");\n for (uint256 i = 0; i < assetCount; ++i) {\n _setPTokenAddress(_assets[i], _pTokens[i]);\n }\n }\n\n /**\n * @notice Collect accumulated reward token and send to Vault.\n */\n function collectRewardTokens() external virtual onlyHarvester nonReentrant {\n _collectRewardTokens();\n }\n\n /**\n * @dev Default implementation that transfers reward tokens to the Harvester\n * Implementing strategies need to add custom logic to collect the rewards.\n */\n function _collectRewardTokens() internal virtual {\n uint256 rewardTokenCount = rewardTokenAddresses.length;\n for (uint256 i = 0; i < rewardTokenCount; ++i) {\n IERC20 rewardToken = IERC20(rewardTokenAddresses[i]);\n uint256 balance = rewardToken.balanceOf(address(this));\n if (balance > 0) {\n emit RewardTokenCollected(\n harvesterAddress,\n address(rewardToken),\n balance\n );\n rewardToken.safeTransfer(harvesterAddress, balance);\n }\n }\n }\n\n /**\n * @dev Verifies that the caller is the Vault.\n */\n modifier onlyVault() {\n require(msg.sender == vaultAddress, \"Caller is not the Vault\");\n _;\n }\n\n /**\n * @dev Verifies that the caller is the Harvester.\n */\n modifier onlyHarvester() {\n require(msg.sender == harvesterAddress, \"Caller is not the Harvester\");\n _;\n }\n\n /**\n * @dev Verifies that the caller is the Vault or Governor.\n */\n modifier onlyVaultOrGovernor() {\n require(\n msg.sender == vaultAddress || msg.sender == governor(),\n \"Caller is not the Vault or Governor\"\n );\n _;\n }\n\n /**\n * @dev Verifies that the caller is the Vault, Governor, or Strategist.\n */\n modifier onlyVaultOrGovernorOrStrategist() {\n require(\n msg.sender == vaultAddress ||\n msg.sender == governor() ||\n msg.sender == IVault(vaultAddress).strategistAddr(),\n \"Caller is not the Vault, Governor, or Strategist\"\n );\n _;\n }\n\n /**\n * @notice Set the reward token addresses. Any old addresses will be overwritten.\n * @param _rewardTokenAddresses Array of reward token addresses\n */\n function setRewardTokenAddresses(address[] calldata _rewardTokenAddresses)\n external\n onlyGovernor\n {\n uint256 rewardTokenCount = _rewardTokenAddresses.length;\n for (uint256 i = 0; i < rewardTokenCount; ++i) {\n require(\n _rewardTokenAddresses[i] != address(0),\n \"Can not set an empty address as a reward token\"\n );\n }\n\n emit RewardTokenAddressesUpdated(\n rewardTokenAddresses,\n _rewardTokenAddresses\n );\n rewardTokenAddresses = _rewardTokenAddresses;\n }\n\n /**\n * @notice Get the reward token addresses.\n * @return address[] the reward token addresses.\n */\n function getRewardTokenAddresses()\n external\n view\n returns (address[] memory)\n {\n return rewardTokenAddresses;\n }\n\n /**\n * @notice Provide support for asset by passing its pToken address.\n * This method can only be called by the system Governor\n * @param _asset Address for the asset\n * @param _pToken Address for the corresponding platform token\n */\n function setPTokenAddress(address _asset, address _pToken)\n external\n virtual\n onlyGovernor\n {\n _setPTokenAddress(_asset, _pToken);\n }\n\n /**\n * @notice Remove a supported asset by passing its index.\n * This method can only be called by the system Governor\n * @param _assetIndex Index of the asset to be removed\n */\n function removePToken(uint256 _assetIndex) external virtual onlyGovernor {\n require(_assetIndex < assetsMapped.length, \"Invalid index\");\n address asset = assetsMapped[_assetIndex];\n address pToken = assetToPToken[asset];\n\n if (_assetIndex < assetsMapped.length - 1) {\n assetsMapped[_assetIndex] = assetsMapped[assetsMapped.length - 1];\n }\n assetsMapped.pop();\n assetToPToken[asset] = address(0);\n\n emit PTokenRemoved(asset, pToken);\n }\n\n /**\n * @notice Provide support for asset by passing its pToken address.\n * Add to internal mappings and execute the platform specific,\n * abstract method `_abstractSetPToken`\n * @param _asset Address for the asset\n * @param _pToken Address for the corresponding platform token\n */\n function _setPTokenAddress(address _asset, address _pToken) internal {\n require(assetToPToken[_asset] == address(0), \"pToken already set\");\n require(\n _asset != address(0) && _pToken != address(0),\n \"Invalid addresses\"\n );\n\n assetToPToken[_asset] = _pToken;\n assetsMapped.push(_asset);\n\n emit PTokenAdded(_asset, _pToken);\n\n _abstractSetPToken(_asset, _pToken);\n }\n\n /**\n * @notice Transfer token to governor. Intended for recovering tokens stuck in\n * strategy contracts, i.e. mistaken sends.\n * @param _asset Address for the asset\n * @param _amount Amount of the asset to transfer\n */\n function transferToken(address _asset, uint256 _amount)\n public\n virtual\n onlyGovernor\n {\n require(!supportsAsset(_asset), \"Cannot transfer supported asset\");\n IERC20(_asset).safeTransfer(governor(), _amount);\n }\n\n /**\n * @notice Set the Harvester contract that can collect rewards.\n * @param _harvesterAddress Address of the harvester contract.\n */\n function setHarvesterAddress(address _harvesterAddress)\n external\n onlyGovernor\n {\n emit HarvesterAddressesUpdated(harvesterAddress, _harvesterAddress);\n harvesterAddress = _harvesterAddress;\n }\n\n /***************************************\n Abstract\n ****************************************/\n\n function _abstractSetPToken(address _asset, address _pToken)\n internal\n virtual;\n\n function safeApproveAllTokens() external virtual;\n\n /**\n * @notice Deposit an amount of assets into the platform\n * @param _asset Address for the asset\n * @param _amount Units of asset to deposit\n */\n function deposit(address _asset, uint256 _amount) external virtual;\n\n /**\n * @notice Deposit all supported assets in this strategy contract to the platform\n */\n function depositAll() external virtual;\n\n /**\n * @notice Withdraw an `amount` of assets from the platform and\n * send to the `_recipient`.\n * @param _recipient Address to which the asset should be sent\n * @param _asset Address of the asset\n * @param _amount Units of asset to withdraw\n */\n function withdraw(\n address _recipient,\n address _asset,\n uint256 _amount\n ) external virtual;\n\n /**\n * @notice Withdraw all supported assets from platform and\n * sends to the OToken's Vault.\n */\n function withdrawAll() external virtual;\n\n /**\n * @notice Get the total asset value held in the platform.\n * This includes any interest that was generated since depositing.\n * @param _asset Address of the asset\n * @return balance Total value of the asset in the platform\n */\n function checkBalance(address _asset)\n external\n view\n virtual\n returns (uint256 balance);\n\n /**\n * @notice Check if an asset is supported.\n * @param _asset Address of the asset\n * @return bool Whether asset is supported\n */\n function supportsAsset(address _asset) public view virtual returns (bool);\n}\n" + }, + "contracts/vault/VaultStorage.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\n/**\n * @title OToken VaultStorage contract\n * @notice The VaultStorage contract defines the storage for the Vault contracts\n * @author Origin Protocol Inc\n */\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport { IStrategy } from \"../interfaces/IStrategy.sol\";\nimport { Governable } from \"../governance/Governable.sol\";\nimport { OUSD } from \"../token/OUSD.sol\";\nimport { Initializable } from \"../utils/Initializable.sol\";\nimport \"../utils/Helpers.sol\";\n\ncontract VaultStorage is Initializable, Governable {\n using SafeERC20 for IERC20;\n\n event AssetSupported(address _asset);\n event AssetRemoved(address _asset);\n event AssetDefaultStrategyUpdated(address _asset, address _strategy);\n event AssetAllocated(address _asset, address _strategy, uint256 _amount);\n event StrategyApproved(address _addr);\n event StrategyRemoved(address _addr);\n event Mint(address _addr, uint256 _value);\n event Redeem(address _addr, uint256 _value);\n event CapitalPaused();\n event CapitalUnpaused();\n event RebasePaused();\n event RebaseUnpaused();\n event VaultBufferUpdated(uint256 _vaultBuffer);\n event OusdMetaStrategyUpdated(address _ousdMetaStrategy);\n event RedeemFeeUpdated(uint256 _redeemFeeBps);\n event PriceProviderUpdated(address _priceProvider);\n event AllocateThresholdUpdated(uint256 _threshold);\n event RebaseThresholdUpdated(uint256 _threshold);\n event StrategistUpdated(address _address);\n event MaxSupplyDiffChanged(uint256 maxSupplyDiff);\n event YieldDistribution(address _to, uint256 _yield, uint256 _fee);\n event TrusteeFeeBpsChanged(uint256 _basis);\n event TrusteeAddressChanged(address _address);\n event NetOusdMintForStrategyThresholdChanged(uint256 _threshold);\n event SwapperChanged(address _address);\n event SwapAllowedUndervalueChanged(uint256 _basis);\n event SwapSlippageChanged(address _asset, uint256 _basis);\n event Swapped(\n address indexed _fromAsset,\n address indexed _toAsset,\n uint256 _fromAssetAmount,\n uint256 _toAssetAmount\n );\n event StrategyAddedToMintWhitelist(address indexed strategy);\n event StrategyRemovedFromMintWhitelist(address indexed strategy);\n event RebasePerSecondMaxChanged(uint256 rebaseRatePerSecond);\n event DripDurationChanged(uint256 dripDuration);\n event WithdrawalRequested(\n address indexed _withdrawer,\n uint256 indexed _requestId,\n uint256 _amount,\n uint256 _queued\n );\n event WithdrawalClaimed(\n address indexed _withdrawer,\n uint256 indexed _requestId,\n uint256 _amount\n );\n event WithdrawalClaimable(uint256 _claimable, uint256 _newClaimable);\n event WithdrawalClaimDelayUpdated(uint256 _newDelay);\n\n // Since we are proxy, all state should be uninitalized.\n // Since this storage contract does not have logic directly on it\n // we should not be checking for to see if these variables can be constant.\n // slither-disable-start uninitialized-state\n // slither-disable-start constable-states\n\n // Assets supported by the Vault, i.e. Stablecoins\n enum UnitConversion {\n DECIMALS,\n GETEXCHANGERATE\n }\n // Changed to fit into a single storage slot so the decimals needs to be recached\n struct Asset {\n // Note: OETHVaultCore doesn't use `isSupported` when minting,\n // redeeming or checking balance of assets.\n bool isSupported;\n UnitConversion unitConversion;\n uint8 decimals;\n // Max allowed slippage from the Oracle price when swapping collateral assets in basis points.\n // For example 40 == 0.4% slippage\n uint16 allowedOracleSlippageBps;\n }\n\n /// @dev mapping of supported vault assets to their configuration\n mapping(address => Asset) internal assets;\n /// @dev list of all assets supported by the vault.\n address[] internal allAssets;\n\n // Strategies approved for use by the Vault\n struct Strategy {\n bool isSupported;\n uint256 _deprecated; // Deprecated storage slot\n }\n /// @dev mapping of strategy contracts to their configuration\n mapping(address => Strategy) public strategies;\n /// @dev list of all vault strategies\n address[] internal allStrategies;\n\n /// @notice Address of the Oracle price provider contract\n address public priceProvider;\n /// @notice pause rebasing if true\n bool public rebasePaused;\n /// @notice pause operations that change the OToken supply.\n /// eg mint, redeem, allocate, mint/burn for strategy\n bool public capitalPaused;\n /// @notice Redemption fee in basis points. eg 50 = 0.5%\n uint256 public redeemFeeBps;\n /// @notice Percentage of assets to keep in Vault to handle (most) withdrawals. 100% = 1e18.\n uint256 public vaultBuffer;\n /// @notice OToken mints over this amount automatically allocate funds. 18 decimals.\n uint256 public autoAllocateThreshold;\n /// @notice OToken mints over this amount automatically rebase. 18 decimals.\n uint256 public rebaseThreshold;\n\n /// @dev Address of the OToken token. eg OUSD or OETH.\n OUSD public oUSD;\n\n /// @dev Storage slot for the address of the VaultAdmin contract that is delegated to\n // keccak256(\"OUSD.vault.governor.admin.impl\");\n bytes32 public constant adminImplPosition =\n 0xa2bd3d3cf188a41358c8b401076eb59066b09dec5775650c0de4c55187d17bd9;\n\n /// @dev Address of the contract responsible for post rebase syncs with AMMs\n address private _deprecated_rebaseHooksAddr = address(0);\n\n /// @dev Deprecated: Address of Uniswap\n address private _deprecated_uniswapAddr = address(0);\n\n /// @notice Address of the Strategist\n address public strategistAddr = address(0);\n\n /// @notice Mapping of asset address to the Strategy that they should automatically\n // be allocated to\n mapping(address => address) public assetDefaultStrategies;\n\n /// @notice Max difference between total supply and total value of assets. 18 decimals.\n uint256 public maxSupplyDiff;\n\n /// @notice Trustee contract that can collect a percentage of yield\n address public trusteeAddress;\n\n /// @notice Amount of yield collected in basis points. eg 2000 = 20%\n uint256 public trusteeFeeBps;\n\n /// @dev Deprecated: Tokens that should be swapped for stablecoins\n address[] private _deprecated_swapTokens;\n\n uint256 constant MINT_MINIMUM_UNIT_PRICE = 0.998e18;\n\n /// @notice Metapool strategy that is allowed to mint/burn OTokens without changing collateral\n\n address public ousdMetaStrategy;\n\n /// @notice How much OTokens are currently minted by the strategy\n int256 public netOusdMintedForStrategy;\n\n /// @notice How much net total OTokens are allowed to be minted by all strategies\n uint256 public netOusdMintForStrategyThreshold;\n\n uint256 constant MIN_UNIT_PRICE_DRIFT = 0.7e18;\n uint256 constant MAX_UNIT_PRICE_DRIFT = 1.3e18;\n\n /// @notice Collateral swap configuration.\n /// @dev is packed into a single storage slot to save gas.\n struct SwapConfig {\n // Contract that swaps the vault's collateral assets\n address swapper;\n // Max allowed percentage the total value can drop below the total supply in basis points.\n // For example 100 == 1%\n uint16 allowedUndervalueBps;\n }\n SwapConfig internal swapConfig = SwapConfig(address(0), 0);\n\n // List of strategies that can mint oTokens directly\n // Used in OETHBaseVaultCore\n mapping(address => bool) public isMintWhitelistedStrategy;\n\n /// @notice Address of the Dripper contract that streams harvested rewards to the Vault\n /// @dev The vault is proxied so needs to be set with setDripper against the proxy contract.\n address private _deprecated_dripper;\n\n /// Withdrawal Queue Storage /////\n\n struct WithdrawalQueueMetadata {\n // cumulative total of all withdrawal requests included the ones that have already been claimed\n uint128 queued;\n // cumulative total of all the requests that can be claimed including the ones that have already been claimed\n uint128 claimable;\n // total of all the requests that have been claimed\n uint128 claimed;\n // index of the next withdrawal request starting at 0\n uint128 nextWithdrawalIndex;\n }\n\n /// @notice Global metadata for the withdrawal queue including:\n /// queued - cumulative total of all withdrawal requests included the ones that have already been claimed\n /// claimable - cumulative total of all the requests that can be claimed including the ones already claimed\n /// claimed - total of all the requests that have been claimed\n /// nextWithdrawalIndex - index of the next withdrawal request starting at 0\n WithdrawalQueueMetadata public withdrawalQueueMetadata;\n\n struct WithdrawalRequest {\n address withdrawer;\n bool claimed;\n uint40 timestamp; // timestamp of the withdrawal request\n // Amount of oTokens to redeem. eg OETH\n uint128 amount;\n // cumulative total of all withdrawal requests including this one.\n // this request can be claimed when this queued amount is less than or equal to the queue's claimable amount.\n uint128 queued;\n }\n\n /// @notice Mapping of withdrawal request indices to the user withdrawal request data\n mapping(uint256 => WithdrawalRequest) public withdrawalRequests;\n\n /// @notice Sets a minimum delay that is required to elapse between\n /// requesting async withdrawals and claiming the request.\n /// When set to 0 async withdrawals are disabled.\n uint256 public withdrawalClaimDelay;\n\n /// @notice Time in seconds that the vault last rebased yield.\n uint64 public lastRebase;\n\n /// @notice Automatic rebase yield calculations. In seconds. Set to 0 or 1 to disable.\n uint64 public dripDuration;\n\n /// @notice max rebase percentage per second\n /// Can be used to set maximum yield of the protocol,\n /// spreading out yield over time\n uint64 public rebasePerSecondMax;\n\n /// @notice target rebase rate limit, based on past rates and funds available.\n uint64 public rebasePerSecondTarget;\n\n uint256 internal constant MAX_REBASE = 0.02 ether;\n uint256 internal constant MAX_REBASE_PER_SECOND =\n uint256(0.05 ether) / 1 days;\n\n // For future use\n uint256[43] private __gap;\n\n // slither-disable-end constable-states\n // slither-disable-end uninitialized-state\n\n /**\n * @notice set the implementation for the admin, this needs to be in a base class else we cannot set it\n * @param newImpl address of the implementation\n */\n function setAdminImpl(address newImpl) external onlyGovernor {\n require(\n Address.isContract(newImpl),\n \"new implementation is not a contract\"\n );\n bytes32 position = adminImplPosition;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(position, newImpl)\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file From e3a4ed6c992dc118948d7892d22515cc12467b85 Mon Sep 17 00:00:00 2001 From: Nicholas Addison Date: Mon, 13 Oct 2025 20:32:30 +1100 Subject: [PATCH 4/7] Added autoValidatorWithdrawals Hardhat task --- contracts/tasks/tasks.js | 25 ++++ contracts/tasks/validatorCompound.js | 208 +++++++++++++++++++++++++++ contracts/utils/addresses.js | 1 + 3 files changed, 234 insertions(+) diff --git a/contracts/tasks/tasks.js b/contracts/tasks/tasks.js index 546a471a36..edbe34883c 100644 --- a/contracts/tasks/tasks.js +++ b/contracts/tasks/tasks.js @@ -111,6 +111,7 @@ const { stakeValidator, withdrawValidator, removeValidator, + autoValidatorWithdrawals, setRegistrator, } = require("./validatorCompound"); const { tenderlySync, tenderlyUpload } = require("./tenderly"); @@ -2136,6 +2137,30 @@ task("removeValidator").setAction(async (_, __, runSuper) => { return runSuper(); }); +subtask( + "autoValidatorWithdrawals", + "Automatically withdraws funds from a validator" +) + .addParam( + "buffer", + "Withdrawal buffer in basis points. 100 = 1%", + 100, + types.int + ) + .addParam( + "execute", + "Whether to execute the withdrawals or just display them", + true, + types.boolean + ) + .setAction(async (taskArgs) => { + const signer = await getSigner(); + await autoValidatorWithdrawals({ ...taskArgs, signer }); + }); +task("autoValidatorWithdrawals").setAction(async (_, __, runSuper) => { + return runSuper(); +}); + subtask( "stakeValidatorUuid", "Converts WETH to ETH and deposits to a validator from the Compounding Staking Strategy" diff --git a/contracts/tasks/validatorCompound.js b/contracts/tasks/validatorCompound.js index 4644541151..dda4fd0f81 100644 --- a/contracts/tasks/validatorCompound.js +++ b/contracts/tasks/validatorCompound.js @@ -238,6 +238,213 @@ async function withdrawValidator({ pubkey, amount, signer }) { await logTxDetails(tx, "validatorWithdrawal"); } +async function autoValidatorWithdrawals({ + signer, + slot, // undefined = latest slot + buffer: bufferBps = 100, // 1% buffer + minValidatorWithdrawAmount = BigInt(10e18), + minStrategyWithdrawAmount = parseUnits("0.1", 18), + execute = true, +}) { + const networkName = await getNetworkName(); + const wethAddress = addresses[networkName].WETH; + const weth = await ethers.getContractAt("IERC20", wethAddress); + const vaultAddress = addresses[networkName].OETHVaultProxy; + const vault = await ethers.getContractAt("IVault", vaultAddress); + const strategy = await resolveContract( + "CompoundingStakingSSVStrategyProxy", + "CompoundingStakingSSVStrategy" + ); + const strategyView = await resolveContract("CompoundingStakingStrategyView"); + + // 1. Calculate the WETH available in the vault = WETH balance - withdrawals queued + withdrawals claimed + + const wethInVault = await weth.balanceOf( + addresses[networkName].OETHVaultProxy + ); + log(`WETH balance in vault ${formatUnits(wethInVault, 18)}`); + + const vaultWithdrawals = await vault.withdrawalQueueMetadata(); + + const availableInVault = wethInVault + .sub(vaultWithdrawals.queued) + .add(vaultWithdrawals.claimed); + log(`WETH available in vault ${formatUnits(availableInVault, 18)}`); + + // 2. Get the staking strategy's active validator indexes + + const activeValidators = await strategyView.getVerifiedValidators(); + const validatorIndexes = activeValidators.map((v) => v.index); + + // 3. Calculate pending validator partial withdrawal = sum amount in the partial withdrawal from the beacon chain data + + // Get beacon chain data + const { stateView } = await getBeaconBlock(slot); + + // Iterate over the pending partial withdrawals + let totalPendingPartialWithdrawals = BigNumber.from(0); + let countPendingPartialWithdrawals = 0; + for (let i = 0; i < stateView.pendingPartialWithdrawals.length; i++) { + const withdrawal = stateView.pendingPartialWithdrawals.get(i); + + if (validatorIndexes.includes(withdrawal.validatorIndex)) { + log( + ` Pending partial withdrawal of ${formatUnits( + withdrawal.amount, + 18 + )} ETH from validator index ${withdrawal.validatorIndex}` + ); + totalPendingPartialWithdrawals = totalPendingPartialWithdrawals.add( + withdrawal.amount + ); + countPendingPartialWithdrawals++; + } + } + log( + `${countPendingPartialWithdrawals} pending partial withdrawals from beacon chain totalling ${formatUnits( + totalPendingPartialWithdrawals, + 18 + )} ETH` + ); + + // 5. Calculate the buffer amount = total assets * buffer in basis points + const totalAssets = await vault.totalValue(); + const buffer = totalAssets.mul(bufferBps).div(10000); + log(`Buffer amount ${formatUnits(buffer, 18)} (${bufferBps} bps)`); + + // 4. Remaining amount = WETH available in the vault * -1 + buffer - pending withdrawals - any ETH or WETH in the staking strategy + + let remainingAmount = availableInVault + .mul(-1) + .add(buffer) + .sub(totalPendingPartialWithdrawals); + + log(`Remaining amount to withdraw ${formatUnits(remainingAmount, 18)}`); + + // End job if remaining amount < 0 + if (remainingAmount.lt(0)) { + log(`No need to withdraw from the validators.`); + return; + } + + // 5. Withdraw any WETH or ETH in the staking strategy + + const wethInStrategy = await weth.balanceOf(strategy.address); + const ethInStrategy = await ethers.provider.getBalance(strategy.address); + const availableInStrategy = wethInStrategy.add(ethInStrategy); + log( + `${formatUnits(wethInStrategy, 18)} WETH and ${formatUnits( + ethInStrategy, + 18 + )} ETH in strategy = ${formatUnits( + availableInStrategy, + 18 + )} available in strategy` + ); + + const withdrawAmount = remainingAmount.lt(availableInStrategy) + ? remainingAmount + : availableInStrategy; + if (withdrawAmount.gt(minStrategyWithdrawAmount)) { + log( + `Withdrawing ${formatUnits( + withdrawAmount, + 18 + )} ETH/WETH from the strategy` + ); + + if (execute) { + const tx = await strategy + .connect(signer) + .withdraw(vaultAddress, wethAddress, withdrawAmount); + await logTxDetails(tx, "withdrawFromStrategy"); + } + + remainingAmount = remainingAmount.sub(withdrawAmount); + if (remainingAmount.lte(0)) { + log(`Reached the required withdrawal amount`); + return; + } + } + + // 6. Withdraw from the validators is necessary + + // Get validator balances from the beacon chain data + const validators = []; + for (let i = 0; i < activeValidators.length; i++) { + const validatorIndex = activeValidators[i].index; + const validator = stateView.validators.get(validatorIndex); + const balanceGwei = stateView.balances.get(validatorIndex); + validators.push({ + index: validatorIndex, + pubKey: toHex(validator.pubkey), + balanceWei: parseUnits(balanceGwei.toString(), 9), + }); + log( + ` Validator ${validatorIndex} balance ${formatUnits(balanceGwei, 9)} ETH` + ); + } + + // Sort validators by smallest to highest balance + const sortedValidators = validators.sort((a, b) => + a.balanceWei.lt(b.balanceWei) ? -1 : 1 + ); + log(sortedValidators); + + // For each validator + for (const validator of sortedValidators) { + const maxValidatorWithdrawal = validator.balanceWei.sub( + parseUnits("32.25", 18) + ); + const withdrawalAmount = maxValidatorWithdrawal.lt(remainingAmount) + ? maxValidatorWithdrawal + : remainingAmount; + + // continue if withdrawal amount < min partial withdraw amount + if (withdrawalAmount < minValidatorWithdrawAmount) { + log( + ` Skipping validator ${ + validator.index + } as withdrawal amount ${formatUnits( + withdrawalAmount.toString(), + 18 + )} is less than the minimum partial withdrawal amount` + ); + continue; + } + + log( + ` Withdrawing ${formatUnits(withdrawalAmount, 18)} ETH from validator ${ + validator.index + }` + ); + + if (execute) { + // Call strategy to partially withdraw from the validator + await strategy + .connect(signer) + .validatorWithdrawal(validator.pubKey, withdrawalAmount.toString(), { + value: 1, + }); + } + + remainingAmount = remainingAmount.sub(withdrawalAmount); + if (remainingAmount.lte(0)) { + log(` Reached the required withdrawal amount`); + break; + } + } + + if (remainingAmount.gt(0)) { + log( + ` Still need to withdraw ${formatUnits( + remainingAmount, + 18 + )} ETH from the validators next time` + ); + } +} + async function snapStakingStrategy({ block }) { let blockTag = await getBlock(block); // Don't use the latest block as the slot probably won't be available yet @@ -466,5 +673,6 @@ module.exports = { setRegistrator, validatorStatus, withdrawValidator, + autoValidatorWithdrawals, removeValidator, }; diff --git a/contracts/utils/addresses.js b/contracts/utils/addresses.js index 85e641b0fd..a201e28eb3 100644 --- a/contracts/utils/addresses.js +++ b/contracts/utils/addresses.js @@ -655,6 +655,7 @@ addresses.plume.BridgedWOETHOracleFeed = "0x4915600Ed7d85De62011433eEf0BD5399f677e9b"; addresses.hoodi = {}; +addresses.hoodi.OETHVaultProxy = "0xD0cC28bc8F4666286F3211e465ecF1fe5c72AC8B"; addresses.hoodi.WETH = "0x2387fD72C1DA19f6486B843F5da562679FbB4057"; addresses.hoodi.SSV = "0x9F5d4Ec84fC4785788aB44F9de973cF34F7A038e"; addresses.hoodi.SSVNetwork = "0x58410Bef803ECd7E63B23664C586A6DB72DAf59c"; From aab52bb871faaeea8d34e4caa7191d406885eec9 Mon Sep 17 00:00:00 2001 From: Nicholas Addison Date: Mon, 13 Oct 2025 21:35:43 +1100 Subject: [PATCH 5/7] Fixed unit tests --- contracts/hardhat.config.js | 14 ++++++++ contracts/test/_fixture.js | 7 ++-- contracts/test/behaviour/strategy.js | 15 +++++--- .../test/strategies/compoundingSSVStaking.js | 35 +++++++++++++------ 4 files changed, 54 insertions(+), 17 deletions(-) diff --git a/contracts/hardhat.config.js b/contracts/hardhat.config.js index 0c2574704f..6500d9aa8c 100644 --- a/contracts/hardhat.config.js +++ b/contracts/hardhat.config.js @@ -73,6 +73,7 @@ const SONIC_DEPLOYER = MAINNET_DEPLOYER; const SONIC_ADMIN = "0xAdDEA7933Db7d83855786EB43a238111C69B00b6"; // 2/8 multi-sig that controls fund allocations. Aka "Guardian". const SONIC_STRATEGIST = "0x63cdd3072F25664eeC6FAEFf6dAeB668Ea4de94a"; +const MAINNET_RELAYER = "0x4b91827516f79d6F6a1F292eD99671663b09169a"; const MULTICHAIN_STRATEGIST = "0x4FF1b9D9ba8558F5EAfCec096318eA0d8b541971"; @@ -201,6 +202,13 @@ const localEnvStrategist = : MULTICHAIN_STRATEGIST : 0; +const localEnvRegistrator = + process.env.FORK === "true" + ? isHoodiFork + ? HOODI_RELAYER + : MAINNET_RELAYER + : 1; // signer at index 2 + module.exports = { solidity: { version: "0.8.28", @@ -407,6 +415,12 @@ module.exports = { multichainStrategistAddr: { default: MULTICHAIN_STRATEGIST, }, + registratorAddr: { + default: 2, + localhost: localEnvRegistrator, + mainnet: MAINNET_RELAYER, + hoodi: HOODI_RELAYER, + }, }, contractSizer: { alphaSort: true, diff --git a/contracts/test/_fixture.js b/contracts/test/_fixture.js index 7106b7d5eb..76ef741a5e 100644 --- a/contracts/test/_fixture.js +++ b/contracts/test/_fixture.js @@ -2034,9 +2034,10 @@ async function compoundingStakingSSVStrategyFixture() { */ } else { fixture.ssvNetwork = await ethers.getContract("MockSSVNetwork"); - const { governorAddr } = await getNamedAccounts(); + const { governorAddr, registratorAddr } = await getNamedAccounts(); const { oethVault, weth } = fixture; const sGovernor = await ethers.provider.getSigner(governorAddr); + const sRegistrator = await ethers.provider.getSigner(registratorAddr); // Approve Strategy await oethVault @@ -2053,13 +2054,13 @@ async function compoundingStakingSSVStrategyFixture() { await compoundingStakingSSVStrategy .connect(sGovernor) - .setRegistrator(governorAddr); + .setRegistrator(registratorAddr); await compoundingStakingSSVStrategy .connect(sGovernor) .setHarvesterAddress(fixture.oethHarvester.address); - fixture.validatorRegistrator = sGovernor; + fixture.validatorRegistrator = sRegistrator; } return fixture; diff --git a/contracts/test/behaviour/strategy.js b/contracts/test/behaviour/strategy.js index be8affd252..1fcdba8d1d 100644 --- a/contracts/test/behaviour/strategy.js +++ b/contracts/test/behaviour/strategy.js @@ -218,11 +218,18 @@ const shouldBehaveLikeStrategy = (context) => { const harvesterSigner = await impersonateAndFund(harvester.address); for (const signer of [harvesterSigner, governor, strategist, matt]) { - await expect( - strategy + try { + await strategy .connect(signer) - .withdraw(vault.address, assets[0].address, parseUnits("10")) - ).to.revertedWith("Caller is not the Vault"); + .withdraw(vault.address, assets[0].address, parseUnits("1")); + expect.fail("Expected transaction to revert"); + } catch (error) { + console.log("Error message:", error.message); + expect(error.message).to.be.oneOf([ + "VM Exception while processing transaction: reverted with reason string 'Caller is not the Vault'", + "VM Exception while processing transaction: reverted with reason string 'Caller not Vault or Registrator'", + ]); + } } }); it("Should be able to call withdraw all by vault", async () => { diff --git a/contracts/test/strategies/compoundingSSVStaking.js b/contracts/test/strategies/compoundingSSVStaking.js index 0069fa48c6..24e9a6982b 100644 --- a/contracts/test/strategies/compoundingSSVStaking.js +++ b/contracts/test/strategies/compoundingSSVStaking.js @@ -8,7 +8,7 @@ const { setBalance, setStorageAt, } = require("@nomicfoundation/hardhat-network-helpers"); -const { isCI } = require("../helpers"); +const { isCI, getAssetAddresses } = require("../helpers"); const { shouldBehaveLikeGovernable } = require("../behaviour/governable"); const { shouldBehaveLikeStrategy } = require("../behaviour/strategy"); const { MAX_UINT256, ZERO_BYTES32 } = require("../../utils/constants"); @@ -143,12 +143,11 @@ describe("Unit test: Compounding SSV Staking Strategy", function () { it("SSV network should have allowance to spend SSV tokens of the strategy", async () => { const { compoundingStakingSSVStrategy, ssv } = fixture; - const ssvNetworkAddress = - await compoundingStakingSSVStrategy.SSV_NETWORK(); + const ssvNetworkAddress = await getAssetAddresses(deployments); await expect( await ssv.allowance( compoundingStakingSSVStrategy.address, - ssvNetworkAddress + ssvNetworkAddress.SSVNetwork ) ).to.equal(MAX_UINT256); }); @@ -1864,7 +1863,7 @@ describe("Unit test: Compounding SSV Staking Strategy", function () { }); it("Should withdraw ETH from the strategy, no ETH", async () => { - const { compoundingStakingSSVStrategy, weth, josh } = fixture; + const { compoundingStakingSSVStrategy, weth, josh, oethVault } = fixture; const depositAmount = parseEther("10"); await weth @@ -1879,7 +1878,7 @@ describe("Unit test: Compounding SSV Staking Strategy", function () { const withdrawTx = compoundingStakingSSVStrategy .connect(sVault) - .withdraw(josh.address, weth.address, depositAmount); + .withdraw(oethVault.address, weth.address, depositAmount); await expect(withdrawTx) .to.emit(compoundingStakingSSVStrategy, "Withdrawal") @@ -1898,7 +1897,13 @@ describe("Unit test: Compounding SSV Staking Strategy", function () { }); it("Should withdraw ETH from the strategy, withdraw some ETH", async () => { - const { compoundingStakingSSVStrategy, weth, josh } = fixture; + const { + compoundingStakingSSVStrategy, + weth, + josh, + oethVault, + validatorRegistrator, + } = fixture; const depositAmount = parseEther("10"); await weth @@ -1915,9 +1920,9 @@ describe("Unit test: Compounding SSV Staking Strategy", function () { await compoundingStakingSSVStrategy.checkBalance(weth.address); const withdrawTx = compoundingStakingSSVStrategy - .connect(sVault) + .connect(validatorRegistrator) .withdraw( - josh.address, + oethVault.address, weth.address, depositAmount.add(parseEther("5")) ); @@ -1970,7 +1975,17 @@ describe("Unit test: Compounding SSV Staking Strategy", function () { weth.address, parseEther("10") ) - ).to.be.revertedWith("Must specify recipient"); + ).to.be.revertedWith("Recipient not Vault"); + }); + + it("Should revert when withdrawing to a user", async () => { + const { compoundingStakingSSVStrategy, weth, josh } = fixture; + + await expect( + compoundingStakingSSVStrategy + .connect(sVault) + .withdraw(josh.address, weth.address, parseEther("10")) + ).to.be.revertedWith("Recipient not Vault"); }); it("Should withdrawAll ETH from the strategy, no ETH", async () => { From a5430f62e641025f1f84bdefb372f9e0843bd5f3 Mon Sep 17 00:00:00 2001 From: Nicholas Addison Date: Tue, 14 Oct 2025 11:50:00 +1100 Subject: [PATCH 6/7] Changed execute option to dryrun --- contracts/tasks/tasks.js | 6 +++--- contracts/tasks/validatorCompound.js | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/contracts/tasks/tasks.js b/contracts/tasks/tasks.js index edbe34883c..5854e417b1 100644 --- a/contracts/tasks/tasks.js +++ b/contracts/tasks/tasks.js @@ -2148,9 +2148,9 @@ subtask( types.int ) .addParam( - "execute", - "Whether to execute the withdrawals or just display them", - true, + "dryrun", + "Do not send any txs to the staking strategy contract", + false, types.boolean ) .setAction(async (taskArgs) => { diff --git a/contracts/tasks/validatorCompound.js b/contracts/tasks/validatorCompound.js index dda4fd0f81..15d3ee851e 100644 --- a/contracts/tasks/validatorCompound.js +++ b/contracts/tasks/validatorCompound.js @@ -244,7 +244,7 @@ async function autoValidatorWithdrawals({ buffer: bufferBps = 100, // 1% buffer minValidatorWithdrawAmount = BigInt(10e18), minStrategyWithdrawAmount = parseUnits("0.1", 18), - execute = true, + dryrun = false, }) { const networkName = await getNetworkName(); const wethAddress = addresses[networkName].WETH; @@ -353,7 +353,7 @@ async function autoValidatorWithdrawals({ )} ETH/WETH from the strategy` ); - if (execute) { + if (!dryrun) { const tx = await strategy .connect(signer) .withdraw(vaultAddress, wethAddress, withdrawAmount); @@ -389,7 +389,6 @@ async function autoValidatorWithdrawals({ const sortedValidators = validators.sort((a, b) => a.balanceWei.lt(b.balanceWei) ? -1 : 1 ); - log(sortedValidators); // For each validator for (const validator of sortedValidators) { @@ -419,7 +418,7 @@ async function autoValidatorWithdrawals({ }` ); - if (execute) { + if (!dryrun) { // Call strategy to partially withdraw from the validator await strategy .connect(signer) From 70e1befd973d63a6beb000256f24fb6455ce8fd4 Mon Sep 17 00:00:00 2001 From: Nicholas Addison Date: Tue, 14 Oct 2025 12:10:32 +1100 Subject: [PATCH 7/7] Created reusable totalPartialWithdrawals function Fixed summing of partial withdrawal amount as its in Gwei --- contracts/tasks/validatorCompound.js | 64 +++++++++++++++++----------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/contracts/tasks/validatorCompound.js b/contracts/tasks/validatorCompound.js index 15d3ee851e..e57ddf0286 100644 --- a/contracts/tasks/validatorCompound.js +++ b/contracts/tasks/validatorCompound.js @@ -281,30 +281,9 @@ async function autoValidatorWithdrawals({ // Get beacon chain data const { stateView } = await getBeaconBlock(slot); - // Iterate over the pending partial withdrawals - let totalPendingPartialWithdrawals = BigNumber.from(0); - let countPendingPartialWithdrawals = 0; - for (let i = 0; i < stateView.pendingPartialWithdrawals.length; i++) { - const withdrawal = stateView.pendingPartialWithdrawals.get(i); - - if (validatorIndexes.includes(withdrawal.validatorIndex)) { - log( - ` Pending partial withdrawal of ${formatUnits( - withdrawal.amount, - 18 - )} ETH from validator index ${withdrawal.validatorIndex}` - ); - totalPendingPartialWithdrawals = totalPendingPartialWithdrawals.add( - withdrawal.amount - ); - countPendingPartialWithdrawals++; - } - } - log( - `${countPendingPartialWithdrawals} pending partial withdrawals from beacon chain totalling ${formatUnits( - totalPendingPartialWithdrawals, - 18 - )} ETH` + const totalPendingPartialWithdrawals = await totalPartialWithdrawals( + stateView, + validatorIndexes ); // 5. Calculate the buffer amount = total assets * buffer in basis points @@ -444,6 +423,43 @@ async function autoValidatorWithdrawals({ } } +/** + * Sums the pending partial withdrawals for a set of validator indexes + * @param {*} stateView + * @param {*} validatorIndexes array of validator indexes to check for pending partial withdrawals + * @returns the total amount to 18 decimal places + */ +async function totalPartialWithdrawals(stateView, validatorIndexes) { + // Iterate over the pending partial withdrawals + let totalGwei = BigNumber.from(0); + let count = 0; + for (let i = 0; i < stateView.pendingPartialWithdrawals.length; i++) { + const withdrawal = stateView.pendingPartialWithdrawals.get(i); + + if (validatorIndexes.includes(withdrawal.validatorIndex)) { + log( + ` Pending partial withdrawal of ${formatUnits( + withdrawal.amount, + 9 + )} ETH from validator index ${withdrawal.validatorIndex}` + ); + totalGwei = totalGwei.add(withdrawal.amount); + count++; + } + } + log( + `${count} of ${ + stateView.pendingPartialWithdrawals.length + } pending partial withdrawals from beacon chain totalling ${formatUnits( + totalGwei, + 9 + )} ETH` + ); + + // Scale up to 18 decimals + return parseUnits(totalGwei.toString(), 9); +} + async function snapStakingStrategy({ block }) { let blockTag = await getBlock(block); // Don't use the latest block as the slot probably won't be available yet