@venusprotocol/governance-contracts
Version:
1 lines • 688 kB
JSON
{"id":"a21b557e32017b4e515b5ae793afd5ce","_format":"hh-sol-build-info-1","solcVersion":"0.5.16","solcLongVersion":"0.5.16+commit.9c3226ce","input":{"language":"Solidity","sources":{"@venusprotocol/venus-protocol/contracts/Tokens/Prime/IPrime.sol":{"content":"// SPDX-License-Identifier: BSD-3-Clause\npragma solidity ^0.5.16;\npragma experimental ABIEncoderV2;\n\n/**\n * @title IPrime\n * @author Venus\n * @notice Interface for Prime Token\n */\ninterface IPrime {\n /**\n * @notice Executed by XVSVault whenever user's XVSVault balance changes\n * @param user the account address whose balance was updated\n */\n function xvsUpdated(address user) external;\n\n /**\n * @notice accrues interest and updates score for an user for a specific market\n * @param user the account address for which to accrue interest and update score\n * @param market the market for which to accrue interest and update score\n */\n function accrueInterestAndUpdateScore(address user, address market) external;\n\n /**\n * @notice Distributes income from market since last distribution\n * @param vToken the market for which to distribute the income\n */\n function accrueInterest(address vToken) external;\n\n /**\n * @notice Returns if user is a prime holder\n * @param isPrimeHolder returns if the user is a prime holder\n */\n function isUserPrimeHolder(address user) external view returns (bool isPrimeHolder);\n}\n"},"@venusprotocol/venus-protocol/contracts/Utils/Address.sol":{"content":"pragma solidity ^0.5.5;\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 // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\n // for accounts without code, i.e. `keccak256('')`\n bytes32 codehash;\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n codehash := extcodehash(account)\n }\n return (codehash != accountHash && codehash != 0x0);\n }\n\n /**\n * @dev Converts an `address` into `address payable`. Note that this is\n * simply a type cast: the actual underlying value is not changed.\n *\n * _Available since v2.4.0._\n */\n function toPayable(address account) internal pure returns (address payable) {\n return address(uint160(account));\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 * _Available since v2.4.0._\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-call-value\n // solium-disable-next-line security/no-call-value\n (bool success, ) = recipient.call.value(amount)(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n}\n"},"@venusprotocol/venus-protocol/contracts/Utils/IBEP20.sol":{"content":"pragma solidity ^0.5.0;\n\n/**\n * @dev Interface of the BEP20 standard as defined in the EIP. Does not include\n * the optional functions; to access them see {BEP20Detailed}.\n */\ninterface IBEP20 {\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(address sender, address recipient, uint256 amount) 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"},"@venusprotocol/venus-protocol/contracts/Utils/SafeBEP20.sol":{"content":"pragma solidity ^0.5.0;\n\nimport \"./SafeMath.sol\";\nimport \"./IBEP20.sol\";\nimport \"./Address.sol\";\n\n/**\n * @title SafeBEP20\n * @dev Wrappers around BEP20 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 SafeBEP20 for BEP20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeBEP20 {\n using SafeMath for uint256;\n using Address for address;\n\n function safeTransfer(IBEP20 token, address to, uint256 value) internal {\n callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(IBEP20 token, address from, address to, uint256 value) internal {\n callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n function safeApprove(IBEP20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n // solhint-disable-next-line max-line-length\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeBEP20: approve from non-zero to non-zero allowance\"\n );\n callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(IBEP20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender).add(value);\n callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(IBEP20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender).sub(\n value,\n \"SafeBEP20: decreased allowance below zero\"\n );\n callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\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(IBEP20 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.\n\n // A Solidity high level call has three parts:\n // 1. The target address is checked to verify it contains contract code\n // 2. The call itself is made, and success asserted\n // 3. The return value is decoded, which in turn checks the size of the returned data.\n // solhint-disable-next-line max-line-length\n require(address(token).isContract(), \"SafeBEP20: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = address(token).call(data);\n require(success, \"SafeBEP20: low-level call failed\");\n\n if (returndata.length > 0) {\n // Return data is optional\n // solhint-disable-next-line max-line-length\n require(abi.decode(returndata, (bool)), \"SafeBEP20: BEP20 operation did not succeed\");\n }\n }\n}\n"},"@venusprotocol/venus-protocol/contracts/Utils/SafeMath.sol":{"content":"pragma solidity ^0.5.16;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * 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 */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return add(a, b, \"SafeMath: addition overflow\");\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n * - Subtraction cannot overflow.\n */\n function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, errorMessage);\n\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0, errorMessage);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return mod(a, b, \"SafeMath: modulo by zero\");\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts with custom message when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b != 0, errorMessage);\n return a % b;\n }\n}\n"},"@venusprotocol/venus-protocol/contracts/XVSVault/XVSStore.sol":{"content":"pragma solidity 0.5.16;\nimport \"../Utils/SafeBEP20.sol\";\nimport \"../Utils/IBEP20.sol\";\n\n/**\n * @title XVS Store\n * @author Venus\n * @notice XVS Store responsible for distributing XVS rewards\n */\ncontract XVSStore {\n using SafeMath for uint256;\n using SafeBEP20 for IBEP20;\n\n /// @notice The Admin Address\n address public admin;\n\n /// @notice The pending admin address\n address public pendingAdmin;\n\n /// @notice The Owner Address\n address public owner;\n\n /// @notice The reward tokens\n mapping(address => bool) public rewardTokens;\n\n /// @notice Emitted when pendingAdmin is changed\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\n\n /// @notice Event emitted when admin changed\n event AdminTransferred(address indexed oldAdmin, address indexed newAdmin);\n\n /// @notice Event emitted when owner changed\n event OwnerTransferred(address indexed oldOwner, address indexed newOwner);\n\n constructor() public {\n admin = msg.sender;\n }\n\n modifier onlyAdmin() {\n require(msg.sender == admin, \"only admin can\");\n _;\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"only owner can\");\n _;\n }\n\n /**\n * @notice Safely transfer rewards. Only active reward tokens can be sent using this function.\n * Only callable by owner\n * @dev Safe reward token transfer function, just in case if rounding error causes pool to not have enough tokens.\n * @param token Reward token to transfer\n * @param _to Destination address of the reward\n * @param _amount Amount to transfer\n */\n function safeRewardTransfer(address token, address _to, uint256 _amount) external onlyOwner {\n require(rewardTokens[token] == true, \"only reward token can\");\n\n if (address(token) != address(0)) {\n uint256 tokenBalance = IBEP20(token).balanceOf(address(this));\n if (_amount > tokenBalance) {\n IBEP20(token).safeTransfer(_to, tokenBalance);\n } else {\n IBEP20(token).safeTransfer(_to, _amount);\n }\n }\n }\n\n /**\n * @notice Allows the admin to propose a new admin\n * Only callable admin\n * @param _admin Propose an account as admin of the XVS store\n */\n function setPendingAdmin(address _admin) external onlyAdmin {\n address oldPendingAdmin = pendingAdmin;\n pendingAdmin = _admin;\n emit NewPendingAdmin(oldPendingAdmin, _admin);\n }\n\n /**\n * @notice Allows an account that is pending as admin to accept the role\n * nly calllable by the pending admin\n */\n function acceptAdmin() external {\n require(msg.sender == pendingAdmin, \"only pending admin\");\n address oldAdmin = admin;\n address oldPendingAdmin = pendingAdmin;\n\n admin = pendingAdmin;\n pendingAdmin = address(0);\n\n emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);\n emit AdminTransferred(oldAdmin, admin);\n }\n\n /**\n * @notice Set the contract owner\n * @param _owner The address of the owner to set\n * Only callable admin\n */\n function setNewOwner(address _owner) external onlyAdmin {\n require(_owner != address(0), \"new owner is the zero address\");\n address oldOwner = owner;\n owner = _owner;\n emit OwnerTransferred(oldOwner, _owner);\n }\n\n /**\n * @notice Set or disable a reward token\n * @param _tokenAddress The address of a token to set as active or inactive\n * @param status Set whether a reward token is active or not\n */\n function setRewardToken(address _tokenAddress, bool status) external {\n require(msg.sender == admin || msg.sender == owner, \"only admin or owner can\");\n rewardTokens[_tokenAddress] = status;\n }\n\n /**\n * @notice Security function to allow the owner of the contract to withdraw from the contract\n * @param _tokenAddress Reward token address to withdraw\n * @param _amount Amount of token to withdraw\n */\n function emergencyRewardWithdraw(address _tokenAddress, uint256 _amount) external onlyOwner {\n IBEP20(_tokenAddress).safeTransfer(address(msg.sender), _amount);\n }\n}\n"},"@venusprotocol/venus-protocol/contracts/XVSVault/XVSVaultErrorReporter.sol":{"content":"pragma solidity ^0.5.16;\n\ncontract XVSVaultErrorReporter {\n enum Error {\n NO_ERROR,\n UNAUTHORIZED\n }\n\n enum FailureInfo {\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\n SET_PENDING_ADMIN_OWNER_CHECK,\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK\n }\n\n /**\n * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary\n * contract-specific code that enables us to report opaque error codes from upgradeable contracts.\n **/\n event Failure(uint error, uint info, uint detail);\n\n /**\n * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator\n */\n function fail(Error err, FailureInfo info) internal returns (uint) {\n emit Failure(uint(err), uint(info), 0);\n\n return uint(err);\n }\n\n /**\n * @dev use this when reporting an opaque error from an upgradeable collaborator contract\n */\n function failOpaque(Error err, FailureInfo info, uint opaqueError) internal returns (uint) {\n emit Failure(uint(err), uint(info), opaqueError);\n\n return uint(err);\n }\n}\n"},"@venusprotocol/venus-protocol/contracts/XVSVault/XVSVaultProxy.sol":{"content":"pragma solidity ^0.5.16;\n\nimport \"./XVSVaultStorage.sol\";\nimport \"./XVSVaultErrorReporter.sol\";\n\n/**\n * @title XVS Vault Proxy\n * @author Venus\n * @notice XVS Vault Proxy contract\n */\ncontract XVSVaultProxy is XVSVaultAdminStorage, XVSVaultErrorReporter {\n /**\n * @notice Emitted when pendingXVSVaultImplementation is changed\n */\n event NewPendingImplementation(address oldPendingImplementation, address newPendingImplementation);\n\n /**\n * @notice Emitted when pendingXVSVaultImplementation is accepted, which means XVS Vault implementation is updated\n */\n event NewImplementation(address oldImplementation, address newImplementation);\n\n /**\n * @notice Emitted when pendingAdmin is changed\n */\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\n\n /**\n * @notice Emitted when pendingAdmin is accepted, which means admin is updated\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n constructor() public {\n // Set admin to caller\n admin = msg.sender;\n }\n\n /*** Admin Functions ***/\n function _setPendingImplementation(address newPendingImplementation) public returns (uint) {\n if (msg.sender != admin) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_IMPLEMENTATION_OWNER_CHECK);\n }\n\n address oldPendingImplementation = pendingXVSVaultImplementation;\n\n pendingXVSVaultImplementation = newPendingImplementation;\n\n emit NewPendingImplementation(oldPendingImplementation, pendingXVSVaultImplementation);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Accepts new implementation of XVS Vault. msg.sender must be pendingImplementation\n * @dev Admin function for new implementation to accept it's role as implementation\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _acceptImplementation() public returns (uint) {\n // Check caller is pendingImplementation\n if (msg.sender != pendingXVSVaultImplementation) {\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK);\n }\n\n // Save current values for inclusion in log\n address oldImplementation = implementation;\n address oldPendingImplementation = pendingXVSVaultImplementation;\n\n implementation = pendingXVSVaultImplementation;\n\n pendingXVSVaultImplementation = address(0);\n\n emit NewImplementation(oldImplementation, implementation);\n emit NewPendingImplementation(oldPendingImplementation, pendingXVSVaultImplementation);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\n * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\n * @param newPendingAdmin New pending admin.\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPendingAdmin(address newPendingAdmin) public returns (uint) {\n // Check caller = admin\n if (msg.sender != admin) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);\n }\n\n // Save current value, if any, for inclusion in log\n address oldPendingAdmin = pendingAdmin;\n\n // Store pendingAdmin with value newPendingAdmin\n pendingAdmin = newPendingAdmin;\n\n // Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin)\n emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin\n * @dev Admin function for pending admin to accept role and update admin\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _acceptAdmin() public returns (uint) {\n // Check caller is pendingAdmin\n if (msg.sender != pendingAdmin) {\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);\n }\n\n // Save current values for inclusion in log\n address oldAdmin = admin;\n address oldPendingAdmin = pendingAdmin;\n\n // Store admin with value pendingAdmin\n admin = pendingAdmin;\n\n // Clear the pending value\n pendingAdmin = address(0);\n\n emit NewAdmin(oldAdmin, admin);\n emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @dev Delegates execution to an implementation contract.\n * It returns to the external caller whatever the implementation returns\n * or forwards reverts.\n */\n function() external payable {\n // delegate all other functions to current implementation\n (bool success, ) = implementation.delegatecall(msg.data);\n\n assembly {\n let free_mem_ptr := mload(0x40)\n returndatacopy(free_mem_ptr, 0, returndatasize)\n\n switch success\n case 0 {\n revert(free_mem_ptr, returndatasize)\n }\n default {\n return(free_mem_ptr, returndatasize)\n }\n }\n }\n}\n"},"@venusprotocol/venus-protocol/contracts/XVSVault/XVSVaultStorage.sol":{"content":"pragma solidity ^0.5.16;\n\nimport \"../Utils/SafeMath.sol\";\nimport \"../Utils/IBEP20.sol\";\nimport \"../Tokens/Prime/IPrime.sol\";\n\ncontract XVSVaultAdminStorage {\n /**\n * @notice Administrator for this contract\n */\n address public admin;\n\n /**\n * @notice Pending administrator for this contract\n */\n address public pendingAdmin;\n\n /**\n * @notice Active brains of XVS Vault\n */\n address public implementation;\n\n /**\n * @notice Pending brains of XVS Vault\n */\n address public pendingXVSVaultImplementation;\n}\n\ncontract XVSVaultStorageV1 is XVSVaultAdminStorage {\n /// @notice Guard variable for re-entrancy checks\n bool internal _notEntered;\n\n /// @notice The reward token store\n address public xvsStore;\n\n /// @notice The xvs token address\n address public xvsAddress;\n\n // Reward tokens created per block or second indentified by reward token address.\n mapping(address => uint256) public rewardTokenAmountsPerBlockOrSecond;\n\n /// @notice Info of each user.\n struct UserInfo {\n uint256 amount;\n uint256 rewardDebt;\n uint256 pendingWithdrawals;\n }\n\n // Info of each pool.\n struct PoolInfo {\n IBEP20 token; // Address of token contract to stake.\n uint256 allocPoint; // How many allocation points assigned to this pool.\n uint256 lastRewardBlockOrSecond; // Last block number or second that reward tokens distribution occurs.\n uint256 accRewardPerShare; // Accumulated per share, times 1e12. See below.\n uint256 lockPeriod; // Min time between withdrawal request and its execution.\n }\n\n // Infomation about a withdrawal request\n struct WithdrawalRequest {\n uint256 amount;\n uint128 lockedUntil;\n uint128 afterUpgrade;\n }\n\n // Info of each user that stakes tokens.\n mapping(address => mapping(uint256 => mapping(address => UserInfo))) internal userInfos;\n\n // Info of each pool.\n mapping(address => PoolInfo[]) public poolInfos;\n\n // Total allocation points. Must be the sum of all allocation points in all pools.\n mapping(address => uint256) public totalAllocPoints;\n\n // Info of requested but not yet executed withdrawals\n mapping(address => mapping(uint256 => mapping(address => WithdrawalRequest[]))) internal withdrawalRequests;\n\n /// @notice DEPRECATED A record of each accounts delegate (before the voting power fix)\n mapping(address => address) private __oldDelegatesSlot;\n\n /// @notice A checkpoint for marking number of votes from a given block or second\n struct Checkpoint {\n uint32 fromBlockOrSecond;\n uint96 votes;\n }\n\n /// @notice DEPRECATED A record of votes checkpoints for each account, by index (before the voting power fix)\n mapping(address => mapping(uint32 => Checkpoint)) private __oldCheckpointsSlot;\n\n /// @notice DEPRECATED The number of checkpoints for each account (before the voting power fix)\n mapping(address => uint32) private __oldNumCheckpointsSlot;\n\n /// @notice A record of states for signing / validating signatures\n mapping(address => uint) public nonces;\n\n /// @notice The EIP-712 typehash for the contract's domain\n bytes32 public constant DOMAIN_TYPEHASH =\n keccak256(\"EIP712Domain(string name,uint256 chainId,address verifyingContract)\");\n\n /// @notice The EIP-712 typehash for the delegation struct used by the contract\n bytes32 public constant DELEGATION_TYPEHASH =\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n}\n\ncontract XVSVaultStorage is XVSVaultStorageV1 {\n /// @notice A record of each accounts delegate\n mapping(address => address) public delegates;\n\n /// @notice A record of votes checkpoints for each account, by index\n mapping(address => mapping(uint32 => Checkpoint)) public checkpoints;\n\n /// @notice The number of checkpoints for each account\n mapping(address => uint32) public numCheckpoints;\n\n /// @notice Tracks pending withdrawals for all users for a particular reward token and pool id\n mapping(address => mapping(uint256 => uint256)) public totalPendingWithdrawals;\n\n /// @notice pause indicator for Vault\n bool public vaultPaused;\n\n /// @notice if the token is added to any of the pools\n mapping(address => bool) public isStakedToken;\n\n /// @notice Amount we owe to users because of failed transfer attempts\n mapping(address => mapping(address => uint256)) public pendingRewardTransfers;\n\n /// @notice Prime token contract address\n IPrime public primeToken;\n\n /// @notice Reward token for which prime token is issued for staking\n address public primeRewardToken;\n\n /// @notice Pool ID for which prime token is issued for staking\n uint256 public primePoolId;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[46] private __gap;\n}\n"},"contracts/hardhat-dependency-compiler/@venusprotocol/venus-protocol/contracts/XVSVault/XVSStore.sol":{"content":"// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@venusprotocol/venus-protocol/contracts/XVSVault/XVSStore.sol';\n"},"contracts/hardhat-dependency-compiler/@venusprotocol/venus-protocol/contracts/XVSVault/XVSVaultErrorReporter.sol":{"content":"// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@venusprotocol/venus-protocol/contracts/XVSVault/XVSVaultErrorReporter.sol';\n"},"contracts/hardhat-dependency-compiler/@venusprotocol/venus-protocol/contracts/XVSVault/XVSVaultProxy.sol":{"content":"// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@venusprotocol/venus-protocol/contracts/XVSVault/XVSVaultProxy.sol';\n"},"contracts/hardhat-dependency-compiler/@venusprotocol/venus-protocol/contracts/XVSVault/XVSVaultStorage.sol":{"content":"// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@venusprotocol/venus-protocol/contracts/XVSVault/XVSVaultStorage.sol';\n"}},"settings":{"optimizer":{"enabled":true,"runs":200},"outputSelection":{"*":{"*":["storageLayout","abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata","devdoc","userdoc","evm.gasEstimates"],"":["ast"]}},"metadata":{"useLiteralContent":true}}},"output":{"errors":[{"component":"general","formattedMessage":"@venusprotocol/venus-protocol/contracts/Tokens/Prime/IPrime.sol:3:1: Warning: Experimental features are turned on. Do not use experimental features on live deployments.\npragma experimental ABIEncoderV2;\n^-------------------------------^\n","message":"Experimental features are turned on. Do not use experimental features on live deployments.","severity":"warning","sourceLocation":{"end":99,"file":"@venusprotocol/venus-protocol/contracts/Tokens/Prime/IPrime.sol","start":66},"type":"Warning"}],"sources":{"@venusprotocol/venus-protocol/contracts/Tokens/Prime/IPrime.sol":{"ast":{"absolutePath":"@venusprotocol/venus-protocol/contracts/Tokens/Prime/IPrime.sol","exportedSymbols":{"IPrime":[27]},"id":28,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity","^","0.5",".16"],"nodeType":"PragmaDirective","src":"41:24:0"},{"id":2,"literals":["experimental","ABIEncoderV2"],"nodeType":"PragmaDirective","src":"66:33:0"},{"baseContracts":[],"contractDependencies":[],"contractKind":"interface","documentation":"@title IPrime\n@author Venus\n@notice Interface for Prime Token","fullyImplemented":false,"id":27,"linearizedBaseContracts":[27],"name":"IPrime","nodeType":"ContractDefinition","nodes":[{"body":null,"documentation":"@notice Executed by XVSVault whenever user's XVSVault balance changes\n@param user the account address whose balance was updated","id":7,"implemented":false,"kind":"function","modifiers":[],"name":"xvsUpdated","nodeType":"FunctionDefinition","parameters":{"id":5,"nodeType":"ParameterList","parameters":[{"constant":false,"id":4,"name":"user","nodeType":"VariableDeclaration","scope":7,"src":"381:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":3,"name":"address","nodeType":"ElementaryTypeName","src":"381:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"}],"src":"380:14:0"},"returnParameters":{"id":6,"nodeType":"ParameterList","parameters":[],"src":"403:0:0"},"scope":27,"src":"361:43:0","stateMutability":"nonpayable","superFunction":null,"visibility":"external"},{"body":null,"documentation":"@notice accrues interest and updates score for an user for a specific market\n@param user the account address for which to accrue interest and update score\n@param market the market for which to accrue interest and update score","id":14,"implemented":false,"kind":"function","modifiers":[],"name":"accrueInterestAndUpdateScore","nodeType":"FunctionDefinition","parameters":{"id":12,"nodeType":"ParameterList","parameters":[{"constant":false,"id":9,"name":"user","nodeType":"VariableDeclaration","scope":14,"src":"711:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":8,"name":"address","nodeType":"ElementaryTypeName","src":"711:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"},{"constant":false,"id":11,"name":"market","nodeType":"VariableDeclaration","scope":14,"src":"725:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":10,"name":"address","nodeType":"ElementaryTypeName","src":"725:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"}],"src":"710:30:0"},"returnParameters":{"id":13,"nodeType":"ParameterList","parameters":[],"src":"749:0:0"},"scope":27,"src":"673:77:0","stateMutability":"nonpayable","superFunction":null,"visibility":"external"},{"body":null,"documentation":"@notice Distributes income from market since last distribution\n@param vToken the market for which to distribute the income","id":19,"implemented":false,"kind":"function","modifiers":[],"name":"accrueInterest","nodeType":"FunctionDefinition","parameters":{"id":17,"nodeType":"ParameterList","parameters":[{"constant":false,"id":16,"name":"vToken","nodeType":"VariableDeclaration","scope":19,"src":"933:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":15,"name":"address","nodeType":"ElementaryTypeName","src":"933:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"}],"src":"932:16:0"},"returnParameters":{"id":18,"nodeType":"ParameterList","parameters":[],"src":"957:0:0"},"scope":27,"src":"909:49:0","stateMutability":"nonpayable","superFunction":null,"visibility":"external"},{"body":null,"documentation":"@notice Returns if user is a prime holder\n@param isPrimeHolder returns if the user is a prime holder","id":26,"implemented":false,"kind":"function","modifiers":[],"name":"isUserPrimeHolder","nodeType":"FunctionDefinition","parameters":{"id":22,"nodeType":"ParameterList","parameters":[{"constant":false,"id":21,"name":"user","nodeType":"VariableDeclaration","scope":26,"src":"1122:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":20,"name":"address","nodeType":"ElementaryTypeName","src":"1122:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"}],"src":"1121:14:0"},"returnParameters":{"id":25,"nodeType":"ParameterList","parameters":[{"constant":false,"id":24,"name":"isPrimeHolder","nodeType":"VariableDeclaration","scope":26,"src":"1159:18:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":23,"name":"bool","nodeType":"ElementaryTypeName","src":"1159:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"}],"src":"1158:20:0"},"scope":27,"src":"1095:84:0","stateMutability":"view","superFunction":null,"visibility":"external"}],"scope":28,"src":"180:1001:0"}],"src":"41:1141:0"},"id":0},"@venusprotocol/venus-protocol/contracts/Utils/Address.sol":{"ast":{"absolutePath":"@venusprotocol/venus-protocol/contracts/Utils/Address.sol","exportedSymbols":{"Address":[102]},"id":103,"nodeType":"SourceUnit","nodes":[{"id":29,"literals":["solidity","^","0.5",".5"],"nodeType":"PragmaDirective","src":"0:23:1"},{"baseContracts":[],"contractDependencies":[],"contractKind":"library","documentation":"@dev Collection of functions related to the address type","fullyImplemented":true,"id":102,"linearizedBaseContracts":[102],"name":"Address","nodeType":"ContractDefinition","nodes":[{"body":{"id":53,"nodeType":"Block","src":"751:564:1","statements":[{"assignments":[37],"declarations":[{"constant":false,"id":37,"name":"codehash","nodeType":"VariableDeclaration","scope":53,"src":"1003:16:1","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bytes32","typeString":"bytes32"},"typeName":{"id":36,"name":"bytes32","nodeType":"ElementaryTypeName","src":"1003:7:1","typeDescriptions":{"typeIdentifier":"t_bytes32","typeString":"bytes32"}},"value":null,"visibility":"internal"}],"id":38,"initialValue":null,"nodeType":"VariableDeclarationStatement","src":"1003:16:1"},{"assignments":[40],"declarations":[{"constant":false,"id":40,"name":"accountHash","nodeType":"VariableDeclaration","scope":53,"src":"1029:19:1","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bytes32","typeString":"bytes32"},"typeName":{"id":39,"name":"bytes32","nodeType":"ElementaryTypeName","src":"1029:7:1","typeDescriptions":{"typeIdentifier":"t_bytes32","typeString":"bytes32"}},"value":null,"visibility":"internal"}],"id":42,"initialValue":{"argumentTypes":null,"hexValue":"307863356432343630313836663732333363393237653764623264636337303363306535303062363533636138323237336237626661643830343564383561343730","id":41,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1051:66:1","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_89477152217924674838424037953991966239322087453347756267410168184682657981552_by_1","typeString":"int_const 8947...(69 digits omitted)...1552"},"value":"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"},"nodeType":"VariableDeclarationStatement","src":"1029:88:1"},{"externalReferences":[{"codehash":{"declaration":37,"isOffset":false,"isSlot":false,"src":"1206:8:1","valueSize":1}},{"account":{"declaration":31,"isOffset":false,"isSlot":false,"src":"1230:7:1","valueSize":1}}],"id":43,"nodeType":"InlineAssembly","operations":"{\n codehash := extcodehash(account)\n}","src":"1183:65:1"},{"expression":{"argumentTypes":null,"components":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_bool","typeString":"bool"},"id":50,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_bytes32","typeString":"bytes32"},"id":46,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":44,"name":"codehash","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":37,"src":"1265:8:1","typeDescriptions":{"typeIdentifier":"t_bytes32","typeString":"bytes32"}},"nodeType":"BinaryOperation","operator":"!=","rightExpression":{"argumentTypes":null,"id":45,"name":"accountHash","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":40,"src":"1277:11:1","typeDescriptions":{"typeIdentifier":"t_bytes32","typeString":"bytes32"}},"src":"1265:23:1","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"BinaryOperation","operator":"&&","rightExpression":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_bytes32","typeString":"bytes32"},"id":49,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":47,"name":"codehash","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":37,"src":"1292:8:1","typeDescriptions":{"typeIdentifier":"t_bytes32","typeString":"bytes32"}},"nodeType":"BinaryOperation","operator":"!=","rightExpression":{"argumentTypes":null,"hexValue":"307830","id":48,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1304:3:1","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0x0"},"src":"1292:15:1","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"src":"1265:42:1","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}}],"id":51,"isConstant":false,"isInlineArray":false,"isLValue":false,"isPure":false,"lValueRequested":false,"nodeType":"TupleExpression","src":"1264:44:1","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"functionReturnParameters":35,"id":52,"nodeType":"Return","src":"1257:51:1"}]},"documentation":"@dev Returns true if `account` is a contract.\n * [IMPORTANT]\n====\nIt is unsafe to assume that an address for which this function returns\nfalse is an externally-owned account (EOA) and not a contract.\n * Among others, `isContract` will return false for the following\ntypes of addresses:\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====","id":54,"implemented":true,"kind":"function","modifiers":[],"name":"isContract","nodeType":"FunctionDefinition","parameters":{"id":32,"nodeType":"ParameterList","parameters":[{"constant":false,"id":31,"name":"account","nodeType":"VariableDeclaration","scope":54,"src":"705:15:1","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":30,"name":"address","nodeType":"ElementaryTypeName","src":"705:7:1","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"}],"src":"704:17:1"},"returnParameters":{"id":35,"nodeType":"ParameterList","parameters":[{"constant":false,"id":34,"name":"","nodeType":"VariableDeclaration","scope":54,"src":"745:4:1","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":33,"name":"bool","nodeType":"ElementaryTypeName","src":"745:4:1","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"}],"src":"744:6:1"},"scope":102,"src":"685:630:1","stateMutability":"view","superFunction":null,"visibility":"internal"},{"body":{"id":67,"nodeType":"Block","src":"1600:49:1","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":63,"name":"account","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":56,"src":"1633:7:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"}],"id":62,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1625:7:1","typeDescriptions":{"typeIdentifier":"t_type$_t_uint160_$","typeString":"type(uint160)"},"typeName":"uint160"},"id":64,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1625:16:1","typeDescriptions":{"typeIdentifier":"t_uint160","typeString":"uint160"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint160","typeString":"uint160"}],"id":61,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1617:7:1","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":"address"},"id":65,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1617:25:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"functionReturnParameters":60,"id":66,"nodeType":"Return","src":"1610:32:1"}