{ "language": "Solidity", "settings": { "optimizer": { "enabled": true, "runs": 100 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } } }, "sources": { "contracts/src/ELFeeRecipient.1.sol": { "content": "//SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.10;\n\nimport \"./interfaces/IRiver.1.sol\";\nimport \"./interfaces/IELFeeRecipient.1.sol\";\n\nimport \"./libraries/LibUint256.sol\";\n\nimport \"./Initializable.sol\";\n\nimport \"./state/shared/RiverAddress.sol\";\n\n/// @title Execution Layer Fee Recipient (v1)\n/// @author Kiln\n/// @notice This contract receives all the execution layer fees from the proposed blocks + bribes\ncontract ELFeeRecipientV1 is Initializable, IELFeeRecipientV1 {\n /// @inheritdoc IELFeeRecipientV1\n function initELFeeRecipientV1(address _riverAddress) external init(0) {\n RiverAddress.set(_riverAddress);\n emit SetRiver(_riverAddress);\n }\n\n /// @inheritdoc IELFeeRecipientV1\n function pullELFees(uint256 _maxAmount) external {\n address river = RiverAddress.get();\n if (msg.sender != river) {\n revert LibErrors.Unauthorized(msg.sender);\n }\n uint256 amount = LibUint256.min(_maxAmount, address(this).balance);\n\n IRiverV1(payable(river)).sendELFees{value: amount}();\n }\n\n /// @inheritdoc IELFeeRecipientV1\n receive() external payable {\n this;\n }\n\n /// @inheritdoc IELFeeRecipientV1\n fallback() external payable {\n revert InvalidCall();\n }\n}\n" }, "contracts/src/Initializable.sol": { "content": "//SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.10;\n\nimport \"./state/shared/Version.sol\";\n\n/// @title Initializable\n/// @author Kiln\n/// @notice This contract ensures that initializers are called only once per version\ncontract Initializable {\n /// @notice An error occured during the initialization\n /// @param version The version that was attempting to be initialized\n /// @param expectedVersion The version that was expected\n error InvalidInitialization(uint256 version, uint256 expectedVersion);\n\n /// @notice Emitted when the contract is properly initialized\n /// @param version New version of the contracts\n /// @param cdata Complete calldata that was used during the initialization\n event Initialize(uint256 version, bytes cdata);\n\n /// @notice Use this modifier on initializers along with a hard-coded version number\n /// @param _version Version to initialize\n modifier init(uint256 _version) {\n if (_version != Version.get()) {\n revert InvalidInitialization(_version, Version.get());\n }\n Version.set(_version + 1); // prevents reentrency on the called method\n _;\n emit Initialize(_version, msg.data);\n }\n}\n" }, "contracts/src/interfaces/IELFeeRecipient.1.sol": { "content": "//SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.10;\n\n/// @title Execution Layer Fee Recipient Interface (v1)\n/// @author Kiln\n/// @notice This interface exposes methods to receive all the execution layer fees from the proposed blocks + bribes\ninterface IELFeeRecipientV1 {\n /// @notice The storage river address has changed\n /// @param river The new river address\n event SetRiver(address indexed river);\n\n /// @notice The fallback has been triggered\n error InvalidCall();\n\n /// @notice Initialize the fee recipient with the required arguments\n /// @param _riverAddress Address of River\n function initELFeeRecipientV1(address _riverAddress) external;\n\n /// @notice Pulls all the ETH to the River contract\n /// @dev Only callable by the River contract\n /// @param _maxAmount The maximum amount to pull into the system\n function pullELFees(uint256 _maxAmount) external;\n\n /// @notice Ether receiver\n receive() external payable;\n\n /// @notice Invalid fallback detector\n fallback() external payable;\n}\n" }, "contracts/src/interfaces/IRiver.1.sol": { "content": "//SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.10;\n\nimport \"./components/IConsensusLayerDepositManager.1.sol\";\nimport \"./components/IOracleManager.1.sol\";\nimport \"./components/ISharesManager.1.sol\";\nimport \"./components/IUserDepositManager.1.sol\";\n\n/// @title River Interface (v1)\n/// @author Kiln\n/// @notice The main system interface\ninterface IRiverV1 is IConsensusLayerDepositManagerV1, IUserDepositManagerV1, ISharesManagerV1, IOracleManagerV1 {\n /// @notice Funds have been pulled from the Execution Layer Fee Recipient\n /// @param amount The amount pulled\n event PulledELFees(uint256 amount);\n\n /// @notice The stored Execution Layer Fee Recipient has been changed\n /// @param elFeeRecipient The new Execution Layer Fee Recipient\n event SetELFeeRecipient(address indexed elFeeRecipient);\n\n /// @notice The stored Collector has been changed\n /// @param collector The new Collector\n event SetCollector(address indexed collector);\n\n /// @notice The stored Allowlist has been changed\n /// @param allowlist The new Allowlist\n event SetAllowlist(address indexed allowlist);\n\n /// @notice The stored Global Fee has been changed\n /// @param fee The new Global Fee\n event SetGlobalFee(uint256 fee);\n\n /// @notice The stored Operators Registry has been changed\n /// @param operatorRegistry The new Operators Registry\n event SetOperatorsRegistry(address indexed operatorRegistry);\n\n /// @notice The system underlying supply increased. This is a snapshot of the balances for accounting purposes\n /// @param _collector The address of the collector during this event\n /// @param _oldTotalUnderlyingBalance Old total ETH balance under management by River\n /// @param _oldTotalSupply Old total supply in shares\n /// @param _newTotalUnderlyingBalance New total ETH balance under management by River\n /// @param _newTotalSupply New total supply in shares\n event RewardsEarned(\n address indexed _collector,\n uint256 _oldTotalUnderlyingBalance,\n uint256 _oldTotalSupply,\n uint256 _newTotalUnderlyingBalance,\n uint256 _newTotalSupply\n );\n\n /// @notice The computed amount of shares to mint is 0\n error ZeroMintedShares();\n\n /// @notice The access was denied\n /// @param account The account that was denied\n error Denied(address account);\n\n /// @notice Initializes the River system\n /// @param _depositContractAddress Address to make Consensus Layer deposits\n /// @param _elFeeRecipientAddress Address that receives the execution layer fees\n /// @param _withdrawalCredentials Credentials to use for every validator deposit\n /// @param _oracleAddress The address of the Oracle contract\n /// @param _systemAdministratorAddress Administrator address\n /// @param _allowlistAddress Address of the allowlist contract\n /// @param _operatorRegistryAddress Address of the operator registry\n /// @param _collectorAddress Address receiving the the global fee on revenue\n /// @param _globalFee Amount retained when the ETH balance increases and sent to the collector\n function initRiverV1(\n address _depositContractAddress,\n address _elFeeRecipientAddress,\n bytes32 _withdrawalCredentials,\n address _oracleAddress,\n address _systemAdministratorAddress,\n address _allowlistAddress,\n address _operatorRegistryAddress,\n address _collectorAddress,\n uint256 _globalFee\n ) external;\n\n /// @notice Get the current global fee\n /// @return The global fee\n function getGlobalFee() external view returns (uint256);\n\n /// @notice Retrieve the allowlist address\n /// @return The allowlist address\n function getAllowlist() external view returns (address);\n\n /// @notice Retrieve the collector address\n /// @return The collector address\n function getCollector() external view returns (address);\n\n /// @notice Retrieve the execution layer fee recipient\n /// @return The execution layer fee recipient address\n function getELFeeRecipient() external view returns (address);\n\n /// @notice Retrieve the operators registry\n /// @return The operators registry address\n function getOperatorsRegistry() external view returns (address);\n\n /// @notice Changes the global fee parameter\n /// @param newFee New fee value\n function setGlobalFee(uint256 newFee) external;\n\n /// @notice Changes the allowlist address\n /// @param _newAllowlist New address for the allowlist\n function setAllowlist(address _newAllowlist) external;\n\n /// @notice Changes the collector address\n /// @param _newCollector New address for the collector\n function setCollector(address _newCollector) external;\n\n /// @notice Changes the execution layer fee recipient\n /// @param _newELFeeRecipient New address for the recipient\n function setELFeeRecipient(address _newELFeeRecipient) external;\n\n /// @notice Input for execution layer fee earnings\n function sendELFees() external payable;\n}\n" }, "contracts/src/interfaces/components/IConsensusLayerDepositManager.1.sol": { "content": "//SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.10;\n\n/// @title Consensys Layer Deposit Manager Interface (v1)\n/// @author Kiln\n/// @notice This interface exposes methods to handle the interactions with the official deposit contract\ninterface IConsensusLayerDepositManagerV1 {\n /// @notice A validator key got funded on the deposit contract\n /// @param publicKey BLS Public key that got funded\n event FundedValidatorKey(bytes publicKey);\n\n /// @notice The stored deposit contract address changed\n /// @param depositContract Address of the deposit contract\n event SetDepositContractAddress(address indexed depositContract);\n\n /// @notice The stored withdrawal credentials changed\n /// @param withdrawalCredentials The withdrawal credentials to use for deposits\n event SetWithdrawalCredentials(bytes32 withdrawalCredentials);\n\n /// @notice Not enough funds to deposit one validator\n error NotEnoughFunds();\n\n /// @notice The length of the BLS Public key is invalid during deposit\n error InconsistentPublicKeys();\n\n /// @notice The length of the BLS Signature is invalid during deposit\n error InconsistentSignatures();\n\n /// @notice The internal key retrieval returned no keys\n error NoAvailableValidatorKeys();\n\n /// @notice The received count of public keys to deposit is invalid\n error InvalidPublicKeyCount();\n\n /// @notice The received count of signatures to deposit is invalid\n error InvalidSignatureCount();\n\n /// @notice The withdrawal credentials value is null\n error InvalidWithdrawalCredentials();\n\n /// @notice An error occured during the deposit\n error ErrorOnDeposit();\n\n /// @notice Returns the amount of pending ETH\n /// @return The amount of pending ETH\n function getBalanceToDeposit() external view returns (uint256);\n\n /// @notice Retrieve the withdrawal credentials\n /// @return The withdrawal credentials\n function getWithdrawalCredentials() external view returns (bytes32);\n\n /// @notice Get the deposited validator count (the count of deposits made by the contract)\n /// @return The deposited validator count\n function getDepositedValidatorCount() external view returns (uint256);\n\n /// @notice Deposits current balance to the Consensus Layer by batches of 32 ETH\n /// @param _maxCount The maximum amount of validator keys to fund\n function depositToConsensusLayer(uint256 _maxCount) external;\n}\n" }, "contracts/src/interfaces/components/IOracleManager.1.sol": { "content": "//SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.10;\n\n/// @title Oracle Manager (v1)\n/// @author Kiln\n/// @notice This interface exposes methods to handle the inputs provided by the oracle\ninterface IOracleManagerV1 {\n /// @notice The stored oracle address changed\n /// @param oracleAddress The new oracle address\n event SetOracle(address indexed oracleAddress);\n\n /// @notice The consensus layer data provided by the oracle has been updated\n /// @param validatorCount The new count of validators running on the consensus layer\n /// @param validatorTotalBalance The new total balance sum of all validators\n /// @param roundId Round identifier\n event ConsensusLayerDataUpdate(uint256 validatorCount, uint256 validatorTotalBalance, bytes32 roundId);\n\n /// @notice The reported validator count is invalid\n /// @param providedValidatorCount The received validator count value\n /// @param depositedValidatorCount The number of deposits performed by the system\n error InvalidValidatorCountReport(uint256 providedValidatorCount, uint256 depositedValidatorCount);\n\n /// @notice Get oracle address\n /// @return The oracle address\n function getOracle() external view returns (address);\n\n /// @notice Get CL validator total balance\n /// @return The CL Validator total balance\n function getCLValidatorTotalBalance() external view returns (uint256);\n\n /// @notice Get CL validator count (the amount of validator reported by the oracles)\n /// @return The CL validator count\n function getCLValidatorCount() external view returns (uint256);\n\n /// @notice Set the oracle address\n /// @param _oracleAddress Address of the oracle\n function setOracle(address _oracleAddress) external;\n\n /// @notice Sets the validator count and validator total balance sum reported by the oracle\n /// @dev Can only be called by the oracle address\n /// @dev The round id is a blackbox value that should only be used to identify unique reports\n /// @dev When a report is performed, River computes the amount of fees that can be pulled\n /// @dev from the execution layer fee recipient. This amount is capped by the max allowed\n /// @dev increase provided during the report.\n /// @dev If the total asset balance increases (from the reported total balance and the pulled funds)\n /// @dev we then compute the share that must be taken for the collector on the positive delta.\n /// @dev The execution layer fees are taken into account here because they are the product of\n /// @dev node operator's work, just like consensus layer fees, and both should be handled in the\n /// @dev same manner, as a single revenue stream for the users and the collector.\n /// @param _validatorCount The number of active validators on the consensus layer\n /// @param _validatorTotalBalance The balance sum of the active validators on the consensus layer\n /// @param _roundId An identifier for this update\n /// @param _maxIncrease The maximum allowed increase in the total balance\n function setConsensusLayerData(\n uint256 _validatorCount,\n uint256 _validatorTotalBalance,\n bytes32 _roundId,\n uint256 _maxIncrease\n ) external;\n}\n" }, "contracts/src/interfaces/components/ISharesManager.1.sol": { "content": "//SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.10;\n\nimport \"openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\";\n\n/// @title Shares Manager Interface (v1)\n/// @author Kiln\n/// @notice This interface exposes methods to handle the shares of the depositor and the ERC20 interface\ninterface ISharesManagerV1 is IERC20 {\n /// @notice Balance too low to perform operation\n error BalanceTooLow();\n\n /// @notice Allowance too low to perform operation\n /// @param _from Account where funds are sent from\n /// @param _operator Account attempting the transfer\n /// @param _allowance Current allowance\n /// @param _value Requested transfer value in shares\n error AllowanceTooLow(address _from, address _operator, uint256 _allowance, uint256 _value);\n\n /// @notice Invalid empty transfer\n error NullTransfer();\n\n /// @notice Invalid transfer recipients\n /// @param _from Account sending the funds in the invalid transfer\n /// @param _to Account receiving the funds in the invalid transfer\n error UnauthorizedTransfer(address _from, address _to);\n\n /// @notice Retrieve the token name\n /// @return The token name\n function name() external pure returns (string memory);\n\n /// @notice Retrieve the token symbol\n /// @return The token symbol\n function symbol() external pure returns (string memory);\n\n /// @notice Retrieve the decimal count\n /// @return The decimal count\n function decimals() external pure returns (uint8);\n\n /// @notice Retrieve the total token supply\n /// @return The total supply in shares\n function totalSupply() external view returns (uint256);\n\n /// @notice Retrieve the total underlying asset supply\n /// @return The total underlying asset supply\n function totalUnderlyingSupply() external view returns (uint256);\n\n /// @notice Retrieve the balance of an account\n /// @param _owner Address to be checked\n /// @return The balance of the account in shares\n function balanceOf(address _owner) external view returns (uint256);\n\n /// @notice Retrieve the underlying asset balance of an account\n /// @param _owner Address to be checked\n /// @return The underlying balance of the account\n function balanceOfUnderlying(address _owner) external view returns (uint256);\n\n /// @notice Retrieve the underlying asset balance from an amount of shares\n /// @param _shares Amount of shares to convert\n /// @return The underlying asset balance represented by the shares\n function underlyingBalanceFromShares(uint256 _shares) external view returns (uint256);\n\n /// @notice Retrieve the shares count from an underlying asset amount\n /// @param _underlyingAssetAmount Amount of underlying asset to convert\n /// @return The amount of shares worth the underlying asset amopunt\n function sharesFromUnderlyingBalance(uint256 _underlyingAssetAmount) external view returns (uint256);\n\n /// @notice Retrieve the allowance value for a spender\n /// @param _owner Address that issued the allowance\n /// @param _spender Address that received the allowance\n /// @return The allowance in shares for a given spender\n function allowance(address _owner, address _spender) external view returns (uint256);\n\n /// @notice Performs a transfer from the message sender to the provided account\n /// @param _to Address receiving the tokens\n /// @param _value Amount of shares to be sent\n /// @return True if success\n function transfer(address _to, uint256 _value) external returns (bool);\n\n /// @notice Performs a transfer between two recipients\n /// @param _from Address sending the tokens\n /// @param _to Address receiving the tokens\n /// @param _value Amount of shares to be sent\n /// @return True if success\n function transferFrom(address _from, address _to, uint256 _value) external returns (bool);\n\n /// @notice Approves an account for future spendings\n /// @dev An approved account can use transferFrom to transfer funds on behalf of the token owner\n /// @param _spender Address that is allowed to spend the tokens\n /// @param _value The allowed amount in shares, will override previous value\n /// @return True if success\n function approve(address _spender, uint256 _value) external returns (bool);\n\n /// @notice Increase allowance to another account\n /// @param _spender Spender that receives the allowance\n /// @param _additionalValue Amount of shares to add\n /// @return True if success\n function increaseAllowance(address _spender, uint256 _additionalValue) external returns (bool);\n\n /// @notice Decrease allowance to another account\n /// @param _spender Spender that receives the allowance\n /// @param _subtractableValue Amount of shares to subtract\n /// @return True if success\n function decreaseAllowance(address _spender, uint256 _subtractableValue) external returns (bool);\n}\n" }, "contracts/src/interfaces/components/IUserDepositManager.1.sol": { "content": "//SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.10;\n\n/// @title User Deposit Manager (v1)\n/// @author Kiln\n/// @notice This interface exposes methods to handle the inbound transfers cases or the explicit submissions\ninterface IUserDepositManagerV1 {\n /// @notice User deposited ETH in the system\n /// @param depositor Address performing the deposit\n /// @param recipient Address receiving the minted shares\n /// @param amount Amount in ETH deposited\n event UserDeposit(address indexed depositor, address indexed recipient, uint256 amount);\n\n /// @notice And empty deposit attempt was made\n error EmptyDeposit();\n\n /// @notice Explicit deposit method to mint on msg.sender\n function deposit() external payable;\n\n /// @notice Explicit deposit method to mint on msg.sender and transfer to _recipient\n /// @param _recipient Address receiving the minted LsETH\n function depositAndTransfer(address _recipient) external payable;\n\n /// @notice Implicit deposit method, when the user performs a regular transfer to the contract\n receive() external payable;\n\n /// @notice Invalid call, when the user sends a transaction with a data payload but no method matched\n fallback() external payable;\n}\n" }, "contracts/src/libraries/LibBasisPoints.sol": { "content": "//SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.10;\n\n/// @title Lib Basis Points\n/// @notice Holds the basis points max value\nlibrary LibBasisPoints {\n /// @notice The max value for basis points (represents 100%)\n uint256 internal constant BASIS_POINTS_MAX = 10_000;\n}\n" }, "contracts/src/libraries/LibErrors.sol": { "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.10;\n\n/// @title Lib Errors\n/// @notice Library of common errors\nlibrary LibErrors {\n /// @notice The operator is unauthorized for the caller\n /// @param caller Address performing the call\n error Unauthorized(address caller);\n\n /// @notice The call was invalid\n error InvalidCall();\n\n /// @notice The argument was invalid\n error InvalidArgument();\n\n /// @notice The address is zero\n error InvalidZeroAddress();\n\n /// @notice The string is empty\n error InvalidEmptyString();\n\n /// @notice The fee is invalid\n error InvalidFee();\n}\n" }, "contracts/src/libraries/LibSanitize.sol": { "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.10;\n\nimport \"./LibErrors.sol\";\nimport \"./LibBasisPoints.sol\";\n\n/// @title Lib Sanitize\n/// @notice Utilities to sanitize input values\nlibrary LibSanitize {\n /// @notice Reverts if address is 0\n /// @param _address Address to check\n function _notZeroAddress(address _address) internal pure {\n if (_address == address(0)) {\n revert LibErrors.InvalidZeroAddress();\n }\n }\n\n /// @notice Reverts if string is empty\n /// @param _string String to check\n function _notEmptyString(string memory _string) internal pure {\n if (bytes(_string).length == 0) {\n revert LibErrors.InvalidEmptyString();\n }\n }\n\n /// @notice Reverts if fee is invalid\n /// @param _fee Fee to check\n function _validFee(uint256 _fee) internal pure {\n if (_fee > LibBasisPoints.BASIS_POINTS_MAX) {\n revert LibErrors.InvalidFee();\n }\n }\n}\n" }, "contracts/src/libraries/LibUint256.sol": { "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.10;\n\n/// @title Lib Uint256\n/// @notice Utilities to perform uint operations\nlibrary LibUint256 {\n /// @notice Converts a value to little endian (64 bits)\n /// @param _value The value to convert\n /// @return result The converted value\n function toLittleEndian64(uint256 _value) internal pure returns (uint256 result) {\n result = 0;\n uint256 tempValue = _value;\n result = tempValue & 0xFF;\n tempValue >>= 8;\n\n result = (result << 8) | (tempValue & 0xFF);\n tempValue >>= 8;\n\n result = (result << 8) | (tempValue & 0xFF);\n tempValue >>= 8;\n\n result = (result << 8) | (tempValue & 0xFF);\n tempValue >>= 8;\n\n result = (result << 8) | (tempValue & 0xFF);\n tempValue >>= 8;\n\n result = (result << 8) | (tempValue & 0xFF);\n tempValue >>= 8;\n\n result = (result << 8) | (tempValue & 0xFF);\n tempValue >>= 8;\n\n result = (result << 8) | (tempValue & 0xFF);\n tempValue >>= 8;\n\n assert(0 == tempValue); // fully converted\n result <<= (24 * 8);\n }\n\n /// @notice Returns the minimum value\n /// @param _a First value\n /// @param _b Second value\n /// @return Smallest value between _a and _b\n function min(uint256 _a, uint256 _b) internal pure returns (uint256) {\n return (_a > _b ? _b : _a);\n }\n}\n" }, "contracts/src/libraries/LibUnstructuredStorage.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.10;\n\n/// @title Lib Unstructured Storage\n/// @notice Utilities to work with unstructured storage\nlibrary LibUnstructuredStorage {\n /// @notice Retrieve a bool value at a storage slot\n /// @param _position The storage slot to retrieve\n /// @return data The bool value\n function getStorageBool(bytes32 _position) internal view returns (bool data) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n data := sload(_position)\n }\n }\n\n /// @notice Retrieve an address value at a storage slot\n /// @param _position The storage slot to retrieve\n /// @return data The address value\n function getStorageAddress(bytes32 _position) internal view returns (address data) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n data := sload(_position)\n }\n }\n\n /// @notice Retrieve a bytes32 value at a storage slot\n /// @param _position The storage slot to retrieve\n /// @return data The bytes32 value\n function getStorageBytes32(bytes32 _position) internal view returns (bytes32 data) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n data := sload(_position)\n }\n }\n\n /// @notice Retrieve an uint256 value at a storage slot\n /// @param _position The storage slot to retrieve\n /// @return data The uint256 value\n function getStorageUint256(bytes32 _position) internal view returns (uint256 data) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n data := sload(_position)\n }\n }\n\n /// @notice Sets a bool value at a storage slot\n /// @param _position The storage slot to set\n /// @param _data The bool value to set\n function setStorageBool(bytes32 _position, bool _data) internal {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(_position, _data)\n }\n }\n\n /// @notice Sets an address value at a storage slot\n /// @param _position The storage slot to set\n /// @param _data The address value to set\n function setStorageAddress(bytes32 _position, address _data) internal {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(_position, _data)\n }\n }\n\n /// @notice Sets a bytes32 value at a storage slot\n /// @param _position The storage slot to set\n /// @param _data The bytes32 value to set\n function setStorageBytes32(bytes32 _position, bytes32 _data) internal {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(_position, _data)\n }\n }\n\n /// @notice Sets an uint256 value at a storage slot\n /// @param _position The storage slot to set\n /// @param _data The uint256 value to set\n function setStorageUint256(bytes32 _position, uint256 _data) internal {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(_position, _data)\n }\n }\n}\n" }, "contracts/src/state/shared/RiverAddress.sol": { "content": "//SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.10;\n\nimport \"../../libraries/LibSanitize.sol\";\nimport \"../../libraries/LibUnstructuredStorage.sol\";\n\n/// @title River Address Storage\n/// @notice Utility to manage the River Address in storage\nlibrary RiverAddress {\n /// @notice Storage slot of the River Address\n bytes32 internal constant RIVER_ADDRESS_SLOT = bytes32(uint256(keccak256(\"river.state.riverAddress\")) - 1);\n\n /// @notice Retrieve the River Address\n /// @return The River Address\n function get() internal view returns (address) {\n return LibUnstructuredStorage.getStorageAddress(RIVER_ADDRESS_SLOT);\n }\n\n /// @notice Sets the River Address\n /// @param _newValue New River Address\n function set(address _newValue) internal {\n LibSanitize._notZeroAddress(_newValue);\n LibUnstructuredStorage.setStorageAddress(RIVER_ADDRESS_SLOT, _newValue);\n }\n}\n" }, "contracts/src/state/shared/Version.sol": { "content": "//SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.10;\n\nimport \"../../libraries/LibUnstructuredStorage.sol\";\n\n/// @title Version Storage\n/// @notice Utility to manage the Version in storage\nlibrary Version {\n /// @notice Storage slot of the Version\n bytes32 public constant VERSION_SLOT = bytes32(uint256(keccak256(\"river.state.version\")) - 1);\n\n /// @notice Retrieve the Version\n /// @return The Version\n function get() internal view returns (uint256) {\n return LibUnstructuredStorage.getStorageUint256(VERSION_SLOT);\n }\n\n /// @notice Sets the Version\n /// @param _newValue New Version\n function set(uint256 _newValue) internal {\n LibUnstructuredStorage.setStorageUint256(VERSION_SLOT, _newValue);\n }\n}\n" }, "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" } } }