From df6028e393e234bacd86e2bff87e234efaf99ba7 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Wed, 16 Oct 2024 17:00:19 +0530 Subject: [PATCH 1/5] feat: add TWT market in core pool on bsctestnet --- deploy/011-deploy-markets.ts | 2 +- ...slope2000bps_jump30000bps_kink5000bps.json | 380 +++ .../a2594572bdae270af6749f50c8019b6c.json | 366 +++ deployments/bsctestnet/vTWT.json | 2382 +++++++++++++++++ helpers/deploymentConfig.ts | 25 +- yarn.lock | 53 +- 6 files changed, 3154 insertions(+), 54 deletions(-) create mode 100644 deployments/bsctestnet/JumpRateModel_base200bps_slope2000bps_jump30000bps_kink5000bps.json create mode 100644 deployments/bsctestnet/solcInputs/a2594572bdae270af6749f50c8019b6c.json create mode 100644 deployments/bsctestnet/vTWT.json diff --git a/deploy/011-deploy-markets.ts b/deploy/011-deploy-markets.ts index 6a06e59f0..961f13dc0 100644 --- a/deploy/011-deploy-markets.ts +++ b/deploy/011-deploy-markets.ts @@ -66,7 +66,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const underlyingDecimals = Number(await tokenContract.decimals()); const normalTimelock = await ethers.getContract("NormalTimelock"); - const vBep20DelegateDeployment = await deploy("VBep20Delegate", { from: deployer }); + const vBep20DelegateDeployment = await deploy("VBep20Delegate", { from: deployer, skipIfAlreadyDeployed: true }); console.log(`Deploying VBep20 Proxy for ${symbol} with Implementation ${vBep20DelegateDeployment.address}`); await deploy(`${symbol}`, { diff --git a/deployments/bsctestnet/JumpRateModel_base200bps_slope2000bps_jump30000bps_kink5000bps.json b/deployments/bsctestnet/JumpRateModel_base200bps_slope2000bps_jump30000bps_kink5000bps.json new file mode 100644 index 000000000..a44c894c9 --- /dev/null +++ b/deployments/bsctestnet/JumpRateModel_base200bps_slope2000bps_jump30000bps_kink5000bps.json @@ -0,0 +1,380 @@ +{ + "address": "0xF1A8B40CA68d08EFfa31a16a83f4fd9b5c174872", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "baseRatePerYear", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "multiplierPerYear", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "jumpMultiplierPerYear", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink_", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "baseRatePerBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "multiplierPerBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "jumpMultiplierPerBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "kink", + "type": "uint256" + } + ], + "name": "NewInterestParams", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "baseRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "blocksPerYear", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "cash", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrows", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserves", + "type": "uint256" + } + ], + "name": "getBorrowRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "cash", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrows", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveFactorMantissa", + "type": "uint256" + } + ], + "name": "getSupplyRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isInterestRateModel", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "jumpMultiplierPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "kink", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "multiplierPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "cash", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrows", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserves", + "type": "uint256" + } + ], + "name": "utilizationRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x3395627f1fe15fc60c8470e195aa76ce95c75f44bcb0787d108e22f4258457ee", + "receipt": { + "to": null, + "from": "0x14A1c22EF6d2eF6cE33c0b018d8A34D02021e5c8", + "contractAddress": "0xF1A8B40CA68d08EFfa31a16a83f4fd9b5c174872", + "transactionIndex": 1, + "gasUsed": "488660", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000080000000080000000000000000000000000000000000000000000000000000000000040000000000000008000000000000000000000000000000000000000000000000000000000000000000080000000000", + "blockHash": "0xa334be7be1c124f2b54e203926d858f860128253788ad91b6d0c094d0045af19", + "transactionHash": "0x3395627f1fe15fc60c8470e195aa76ce95c75f44bcb0787d108e22f4258457ee", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 44785556, + "transactionHash": "0x3395627f1fe15fc60c8470e195aa76ce95c75f44bcb0787d108e22f4258457ee", + "address": "0xF1A8B40CA68d08EFfa31a16a83f4fd9b5c174872", + "topics": ["0x6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d"], + "data": "0x0000000000000000000000000000000000000000000000000000000071672e7f000000000000000000000000000000000000000000000000000000046e07d0f60000000000000000000000000000000000000000000000000000004272753e6d00000000000000000000000000000000000000000000000006f05b59d3b20000", + "logIndex": 3, + "blockHash": "0xa334be7be1c124f2b54e203926d858f860128253788ad91b6d0c094d0045af19" + } + ], + "blockNumber": 44785556, + "cumulativeGasUsed": "570652", + "status": 1, + "byzantium": true + }, + "args": ["20000000000000000", "200000000000000000", "3000000000000000000", "500000000000000000"], + "numDeployments": 1, + "solcInputHash": "a2594572bdae270af6749f50c8019b6c", + "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"baseRatePerYear\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"multiplierPerYear\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jumpMultiplierPerYear\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"kink_\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"baseRatePerBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"multiplierPerBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jumpMultiplierPerBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"kink\",\"type\":\"uint256\"}],\"name\":\"NewInterestParams\",\"type\":\"event\"},{\"constant\":true,\"inputs\":[],\"name\":\"baseRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"blocksPerYear\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cash\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"borrows\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserves\",\"type\":\"uint256\"}],\"name\":\"getBorrowRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cash\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"borrows\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserves\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"getSupplyRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isInterestRateModel\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"jumpMultiplierPerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"kink\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"multiplierPerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cash\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"borrows\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserves\",\"type\":\"uint256\"}],\"name\":\"utilizationRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Venus\",\"methods\":{\"constructor\":{\"params\":{\"baseRatePerYear\":\"The approximate target base APR, as a mantissa (scaled by 1e18)\",\"jumpMultiplierPerYear\":\"The multiplierPerBlock after hitting a specified utilization point\",\"kink_\":\"The utilization point at which the jump multiplier is applied\",\"multiplierPerYear\":\"The rate of increase in interest rate wrt utilization (scaled by 1e18)\"}},\"getBorrowRate(uint256,uint256,uint256)\":{\"params\":{\"borrows\":\"The amount of borrows in the market\",\"cash\":\"The amount of cash in the market\",\"reserves\":\"The amount of reserves in the market\"},\"return\":\"The borrow rate percentage per block as a mantissa (scaled by 1e18)\"},\"getSupplyRate(uint256,uint256,uint256,uint256)\":{\"params\":{\"borrows\":\"The amount of borrows in the market\",\"cash\":\"The amount of cash in the market\",\"reserveFactorMantissa\":\"The current reserve factor for the market\",\"reserves\":\"The amount of reserves in the market\"},\"return\":\"The supply rate percentage per block as a mantissa (scaled by 1e18)\"},\"utilizationRate(uint256,uint256,uint256)\":{\"params\":{\"borrows\":\"The amount of borrows in the market\",\"cash\":\"The amount of cash in the market\",\"reserves\":\"The amount of reserves in the market (currently unused)\"},\"return\":\"The utilization rate as a mantissa between [0, 1e18]\"}},\"title\":\"Venus's JumpRateModel Contract\"},\"userdoc\":{\"methods\":{\"constructor\":\"Construct an interest rate model\",\"getBorrowRate(uint256,uint256,uint256)\":{\"notice\":\"Calculates the current borrow rate per block, with the error code expected by the market\"},\"getSupplyRate(uint256,uint256,uint256,uint256)\":{\"notice\":\"Calculates the current supply rate per block\"},\"utilizationRate(uint256,uint256,uint256)\":{\"notice\":\"Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\"}}}},\"settings\":{\"compilationTarget\":{\"contracts/InterestRateModels/JumpRateModel.sol\":\"JumpRateModel\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/InterestRateModels/InterestRateModel.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\n/**\\n * @title Venus's InterestRateModel Interface\\n * @author Venus\\n */\\ncontract InterestRateModel {\\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\\n bool public constant isInterestRateModel = true;\\n\\n /**\\n * @notice Calculates the current borrow interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amnount of reserves the market has\\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);\\n\\n /**\\n * @notice Calculates the current supply interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amnount of reserves the market has\\n * @param reserveFactorMantissa The current reserve factor the market has\\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint cash,\\n uint borrows,\\n uint reserves,\\n uint reserveFactorMantissa\\n ) external view returns (uint);\\n}\\n\",\"keccak256\":\"0x7896290ed5d98f1b744676c0cf5cb0bc656befdd8a79ae4cd2d9f90d83aaa52d\"},\"contracts/InterestRateModels/JumpRateModel.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"../Utils/SafeMath.sol\\\";\\nimport \\\"./InterestRateModel.sol\\\";\\n\\n/**\\n * @title Venus's JumpRateModel Contract\\n * @author Venus\\n */\\ncontract JumpRateModel is InterestRateModel {\\n using SafeMath for uint;\\n\\n event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock, uint jumpMultiplierPerBlock, uint kink);\\n\\n /**\\n * @notice The approximate number of blocks per year that is assumed by the interest rate model\\n */\\n uint public constant blocksPerYear = (60 * 60 * 24 * 365) / 3; // (assuming 3s blocks)\\n\\n /**\\n * @notice The multiplier of utilization rate that gives the slope of the interest rate\\n */\\n uint public multiplierPerBlock;\\n\\n /**\\n * @notice The base interest rate which is the y-intercept when utilization rate is 0\\n */\\n uint public baseRatePerBlock;\\n\\n /**\\n * @notice The multiplierPerBlock after hitting a specified utilization point\\n */\\n uint public jumpMultiplierPerBlock;\\n\\n /**\\n * @notice The utilization point at which the jump multiplier is applied\\n */\\n uint public kink;\\n\\n /**\\n * @notice Construct an interest rate model\\n * @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)\\n * @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)\\n * @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point\\n * @param kink_ The utilization point at which the jump multiplier is applied\\n */\\n constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) public {\\n baseRatePerBlock = baseRatePerYear.div(blocksPerYear);\\n multiplierPerBlock = multiplierPerYear.div(blocksPerYear);\\n jumpMultiplierPerBlock = jumpMultiplierPerYear.div(blocksPerYear);\\n kink = kink_;\\n\\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);\\n }\\n\\n /**\\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\\n * @param cash The amount of cash in the market\\n * @param borrows The amount of borrows in the market\\n * @param reserves The amount of reserves in the market (currently unused)\\n * @return The utilization rate as a mantissa between [0, 1e18]\\n */\\n function utilizationRate(uint cash, uint borrows, uint reserves) public pure returns (uint) {\\n // Utilization rate is 0 when there are no borrows\\n if (borrows == 0) {\\n return 0;\\n }\\n\\n return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));\\n }\\n\\n /**\\n * @notice Calculates the current borrow rate per block, with the error code expected by the market\\n * @param cash The amount of cash in the market\\n * @param borrows The amount of borrows in the market\\n * @param reserves The amount of reserves in the market\\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18)\\n */\\n function getBorrowRate(uint cash, uint borrows, uint reserves) public view returns (uint) {\\n uint util = utilizationRate(cash, borrows, reserves);\\n\\n if (util <= kink) {\\n return util.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\\n } else {\\n uint normalRate = kink.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\\n uint excessUtil = util.sub(kink);\\n return excessUtil.mul(jumpMultiplierPerBlock).div(1e18).add(normalRate);\\n }\\n }\\n\\n /**\\n * @notice Calculates the current supply rate per block\\n * @param cash The amount of cash in the market\\n * @param borrows The amount of borrows in the market\\n * @param reserves The amount of reserves in the market\\n * @param reserveFactorMantissa The current reserve factor for the market\\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint cash,\\n uint borrows,\\n uint reserves,\\n uint reserveFactorMantissa\\n ) public view returns (uint) {\\n uint oneMinusReserveFactor = uint(1e18).sub(reserveFactorMantissa);\\n uint borrowRate = getBorrowRate(cash, borrows, reserves);\\n uint rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);\\n return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);\\n }\\n}\\n\",\"keccak256\":\"0x0c90d867067f823ca47664590f132385830ed66d2cfccdf242c028d0a85bd7c9\"},\"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\",\"keccak256\":\"0x9431fd772ed4abc038cdfe9ce6c0066897bd1685ad45848748d1952935d5b8ef\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516108113803806108118339818101604052608081101561003357600080fd5b508051602080830151604084015160609094015192939092909161006590859062a066809061039e6100fd821b17901c565b6001556100808362a066806100fd602090811b61039e17901c565b60005561009b8262a066806100fd602090811b61039e17901c565b60028190556003829055600154600054604080519283526020830191909152818101929092526060810183905290517f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9181900360800190a1505050506101ee565b600061014583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061014c60201b60201c565b9392505050565b600081836101d85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561019d578181015183820152602001610185565b50505050905090810190601f1680156101ca5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816101e457fe5b0495945050505050565b610614806101fd6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063a385fb9611610066578063a385fb9614610120578063b816881614610128578063b9f9850a14610157578063f14039de1461015f578063fd2da3391461016757610093565b806315f24053146100985780632191f92a146100d35780636e71e2d8146100ef5780638726bb8914610118575b600080fd5b6100c1600480360360608110156100ae57600080fd5b508035906020810135906040013561016f565b60408051918252519081900360200190f35b6100db610247565b604080519115158252519081900360200190f35b6100c16004803603606081101561010557600080fd5b508035906020810135906040013561024c565b6100c161029e565b6100c16102a4565b6100c16004803603608081101561013e57600080fd5b50803590602081013590604081013590606001356102ab565b6100c161032a565b6100c1610330565b6100c1610336565b60008061017d85858561024c565b905060035481116101cf576101c76001546101bb670de0b6b3a76400006101af6000548661033c90919063ffffffff16565b9063ffffffff61039e16565b9063ffffffff6103e016565b915050610240565b60006101fa6001546101bb670de0b6b3a76400006101af60005460035461033c90919063ffffffff16565b905060006102136003548461042290919063ffffffff16565b905061023a826101bb670de0b6b3a76400006101af6002548661033c90919063ffffffff16565b93505050505b9392505050565b600181565b60008261025b57506000610240565b61029661027e83610272878763ffffffff6103e016565b9063ffffffff61042216565b6101af85670de0b6b3a764000063ffffffff61033c16565b949350505050565b60005481565b62a0668081565b6000806102c6670de0b6b3a76400008463ffffffff61042216565b905060006102d587878761016f565b905060006102f5670de0b6b3a76400006101af848663ffffffff61033c16565b905061031e670de0b6b3a76400006101af836103128c8c8c61024c565b9063ffffffff61033c16565b98975050505050505050565b60025481565b60015481565b60035481565b60008261034b57506000610398565b8282028284828161035857fe5b04146103955760405162461bcd60e51b81526004018080602001828103825260218152602001806105bf6021913960400191505060405180910390fd5b90505b92915050565b600061039583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610464565b600061039583836040518060400160405280601b81526020017f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815250610506565b600061039583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610564565b600081836104f05760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156104b557818101518382015260200161049d565b50505050905090810190601f1680156104e25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816104fc57fe5b0495945050505050565b6000838301828582101561055b5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104b557818101518382015260200161049d565b50949350505050565b600081848411156105b65760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104b557818101518382015260200161049d565b50505090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158208d524531d4bd676b08c415f951c89512128d7ce72185b07b426ac97c6c3b50a564736f6c63430005100032", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063a385fb9611610066578063a385fb9614610120578063b816881614610128578063b9f9850a14610157578063f14039de1461015f578063fd2da3391461016757610093565b806315f24053146100985780632191f92a146100d35780636e71e2d8146100ef5780638726bb8914610118575b600080fd5b6100c1600480360360608110156100ae57600080fd5b508035906020810135906040013561016f565b60408051918252519081900360200190f35b6100db610247565b604080519115158252519081900360200190f35b6100c16004803603606081101561010557600080fd5b508035906020810135906040013561024c565b6100c161029e565b6100c16102a4565b6100c16004803603608081101561013e57600080fd5b50803590602081013590604081013590606001356102ab565b6100c161032a565b6100c1610330565b6100c1610336565b60008061017d85858561024c565b905060035481116101cf576101c76001546101bb670de0b6b3a76400006101af6000548661033c90919063ffffffff16565b9063ffffffff61039e16565b9063ffffffff6103e016565b915050610240565b60006101fa6001546101bb670de0b6b3a76400006101af60005460035461033c90919063ffffffff16565b905060006102136003548461042290919063ffffffff16565b905061023a826101bb670de0b6b3a76400006101af6002548661033c90919063ffffffff16565b93505050505b9392505050565b600181565b60008261025b57506000610240565b61029661027e83610272878763ffffffff6103e016565b9063ffffffff61042216565b6101af85670de0b6b3a764000063ffffffff61033c16565b949350505050565b60005481565b62a0668081565b6000806102c6670de0b6b3a76400008463ffffffff61042216565b905060006102d587878761016f565b905060006102f5670de0b6b3a76400006101af848663ffffffff61033c16565b905061031e670de0b6b3a76400006101af836103128c8c8c61024c565b9063ffffffff61033c16565b98975050505050505050565b60025481565b60015481565b60035481565b60008261034b57506000610398565b8282028284828161035857fe5b04146103955760405162461bcd60e51b81526004018080602001828103825260218152602001806105bf6021913960400191505060405180910390fd5b90505b92915050565b600061039583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610464565b600061039583836040518060400160405280601b81526020017f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815250610506565b600061039583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610564565b600081836104f05760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156104b557818101518382015260200161049d565b50505050905090810190601f1680156104e25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816104fc57fe5b0495945050505050565b6000838301828582101561055b5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104b557818101518382015260200161049d565b50949350505050565b600081848411156105b65760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104b557818101518382015260200161049d565b50505090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158208d524531d4bd676b08c415f951c89512128d7ce72185b07b426ac97c6c3b50a564736f6c63430005100032", + "devdoc": { + "author": "Venus", + "methods": { + "constructor": { + "params": { + "baseRatePerYear": "The approximate target base APR, as a mantissa (scaled by 1e18)", + "jumpMultiplierPerYear": "The multiplierPerBlock after hitting a specified utilization point", + "kink_": "The utilization point at which the jump multiplier is applied", + "multiplierPerYear": "The rate of increase in interest rate wrt utilization (scaled by 1e18)" + } + }, + "getBorrowRate(uint256,uint256,uint256)": { + "params": { + "borrows": "The amount of borrows in the market", + "cash": "The amount of cash in the market", + "reserves": "The amount of reserves in the market" + }, + "return": "The borrow rate percentage per block as a mantissa (scaled by 1e18)" + }, + "getSupplyRate(uint256,uint256,uint256,uint256)": { + "params": { + "borrows": "The amount of borrows in the market", + "cash": "The amount of cash in the market", + "reserveFactorMantissa": "The current reserve factor for the market", + "reserves": "The amount of reserves in the market" + }, + "return": "The supply rate percentage per block as a mantissa (scaled by 1e18)" + }, + "utilizationRate(uint256,uint256,uint256)": { + "params": { + "borrows": "The amount of borrows in the market", + "cash": "The amount of cash in the market", + "reserves": "The amount of reserves in the market (currently unused)" + }, + "return": "The utilization rate as a mantissa between [0, 1e18]" + } + }, + "title": "Venus's JumpRateModel Contract" + }, + "userdoc": { + "methods": { + "constructor": "Construct an interest rate model", + "getBorrowRate(uint256,uint256,uint256)": { + "notice": "Calculates the current borrow rate per block, with the error code expected by the market" + }, + "getSupplyRate(uint256,uint256,uint256,uint256)": { + "notice": "Calculates the current supply rate per block" + }, + "utilizationRate(uint256,uint256,uint256)": { + "notice": "Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`" + } + } + }, + "storageLayout": { + "storage": [ + { + "astId": 9329, + "contract": "contracts/InterestRateModels/JumpRateModel.sol:JumpRateModel", + "label": "multiplierPerBlock", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 9331, + "contract": "contracts/InterestRateModels/JumpRateModel.sol:JumpRateModel", + "label": "baseRatePerBlock", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 9333, + "contract": "contracts/InterestRateModels/JumpRateModel.sol:JumpRateModel", + "label": "jumpMultiplierPerBlock", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 9335, + "contract": "contracts/InterestRateModels/JumpRateModel.sol:JumpRateModel", + "label": "kink", + "offset": 0, + "slot": "3", + "type": "t_uint256" + } + ], + "types": { + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/deployments/bsctestnet/solcInputs/a2594572bdae270af6749f50c8019b6c.json b/deployments/bsctestnet/solcInputs/a2594572bdae270af6749f50c8019b6c.json new file mode 100644 index 000000000..9b8c5e750 --- /dev/null +++ b/deployments/bsctestnet/solcInputs/a2594572bdae270af6749f50c8019b6c.json @@ -0,0 +1,366 @@ +{ + "language": "Solidity", + "sources": { + "@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV5.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity 0.5.16;\n\nimport \"./IAccessControlManagerV5.sol\";\n\n/**\n * @title AccessControlledV5\n * @author Venus\n * @notice This contract is helper between access control manager and actual contract. This contract further inherited by other contract (using solidity 0.5.16)\n * to integrate access controlled mechanism. It provides initialise methods and verifying access methods.\n */\ncontract AccessControlledV5 {\n /// @notice Access control manager contract\n IAccessControlManagerV5 private _accessControlManager;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n\n /// @notice Emitted when access control manager contract address is changed\n event NewAccessControlManager(address oldAccessControlManager, address newAccessControlManager);\n\n /**\n * @notice Returns the address of the access control manager contract\n */\n function accessControlManager() external view returns (IAccessControlManagerV5) {\n return _accessControlManager;\n }\n\n /**\n * @dev Internal function to set address of AccessControlManager\n * @param accessControlManager_ The new address of the AccessControlManager\n */\n function _setAccessControlManager(address accessControlManager_) internal {\n require(address(accessControlManager_) != address(0), \"invalid acess control manager address\");\n address oldAccessControlManager = address(_accessControlManager);\n _accessControlManager = IAccessControlManagerV5(accessControlManager_);\n emit NewAccessControlManager(oldAccessControlManager, accessControlManager_);\n }\n\n /**\n * @notice Reverts if the call is not allowed by AccessControlManager\n * @param signature Method signature\n */\n function _checkAccessAllowed(string memory signature) internal view {\n bool isAllowedToCall = _accessControlManager.isAllowedToCall(msg.sender, signature);\n\n if (!isAllowedToCall) {\n revert(\"Unauthorized\");\n }\n }\n}\n" + }, + "@venusprotocol/governance-contracts/contracts/Governance/GovernorBravoDelegate.sol": { + "content": "pragma solidity ^0.5.16;\npragma experimental ABIEncoderV2;\n\nimport \"./GovernorBravoInterfaces.sol\";\n\n/**\n * @title GovernorBravoDelegate\n * @notice Venus Governance latest on chain governance includes several new features including variable proposal routes and fine grained pause control.\n * Variable routes for proposals allows for governance paramaters such as voting threshold and timelocks to be customized based on the risk level and\n * impact of the proposal. Added granularity to the pause control mechanism allows governance to pause individual actions on specific markets,\n * which reduces impact on the protocol as a whole. This is particularly useful when applied to isolated pools.\n *\n * The goal of **Governance** is to increase governance efficiency, while mitigating and eliminating malicious or erroneous proposals.\n *\n * ## Details\n *\n * Governance has **3 main contracts**: **GovernanceBravoDelegate, XVSVault, XVS** token.\n *\n * - XVS token is the protocol token used for protocol users to cast their vote on submitted proposals.\n * - XVSVault is the main staking contract for XVS. Users first stake their XVS in the vault and receive voting power proportional to their staked\n * tokens that they can use to vote on proposals. Users also can choose to delegate their voting power to other users.\n *\n * # Governor Bravo\n *\n * `GovernanceBravoDelegate` is main Venus Governance contract. Users interact with it to:\n * - Submit new proposal\n * - Vote on a proposal\n * - Cancel a proposal\n * - Queue a proposal for execution with a timelock executor contract.\n * `GovernanceBravoDelegate` uses the XVSVault to get restrict certain actions based on a user's voting power. The governance rules it inforces are:\n * - A user's voting power must be greater than the `proposalThreshold` to submit a proposal\n * - If a user's voting power drops below certain amount, anyone can cancel the the proposal. The governance guardian and proposal creator can also\n * cancel a proposal at anytime before it is queued for execution.\n *\n * ## Venus Improvement Proposal\n *\n * Venus Governance allows for Venus Improvement Proposals (VIPs) to be categorized based on their impact and risk levels. This allows for optimizing proposals\n * execution to allow for things such as expediting interest rate changes and quickly updating risk parameters, while moving slower on other types of proposals\n * that can prevent a larger risk to the protocol and are not urgent. There are three different types of VIPs with different proposal paramters:\n *\n * - `NORMAL`\n * - `FASTTRACK`\n * - `CRITICAL`\n *\n * When initializing the `GovernorBravo` contract, the parameters for the three routes are set. The parameters are:\n *\n * - `votingDelay`: The delay in blocks between submitting a proposal and when voting begins\n * - `votingPeriod`: The number of blocks where voting will be open\n * - `proposalThreshold`: The number of votes required in order submit a proposal\n *\n * There is also a separate timelock executor contract for each route, which is used to dispatch the VIP for execution, giving even more control over the\n * flow of each type of VIP.\n *\n * ## Voting\n *\n * After a VIP is proposed, voting is opened after the `votingDelay` has passed. For example, if `votingDelay = 0`, then voting will begin in the next block\n * after the proposal has been submitted. After the delay, the proposal state is `ACTIVE` and users can cast their vote `for`, `against`, or `abstain`,\n * weighted by their total voting power (tokens + delegated voting power). Abstaining from a voting allows for a vote to be cast and optionally include a\n * comment, without the incrementing for or against vote count. The total voting power for the user is obtained by calling XVSVault's `getPriorVotes`.\n *\n * `GovernorBravoDelegate` also accepts [EIP-712](https://eips.ethereum.org/EIPS/eip-712) signatures for voting on proposals via the external function\n * `castVoteBySig`.\n *\n * ## Delegating\n *\n * A users voting power includes the amount of staked XVS the have staked as well as the votes delegate to them. Delegating is the process of a user loaning\n * their voting power to another, so that the latter has the combined voting power of both users. This is an important feature because it allows for a user\n * to let another user who they trust propose or vote in their place.\n *\n * The delegation of votes happens through the `XVSVault` contract by calling the `delegate` or `delegateBySig` functions. These same functions can revert\n * vote delegation by calling the same function with a value of `0`.\n */\ncontract GovernorBravoDelegate is GovernorBravoDelegateStorageV2, GovernorBravoEvents {\n /// @notice The name of this contract\n string public constant name = \"Venus Governor Bravo\";\n\n /// @notice The minimum setable proposal threshold\n uint public constant MIN_PROPOSAL_THRESHOLD = 150000e18; // 150,000 Xvs\n\n /// @notice The maximum setable proposal threshold\n uint public constant MAX_PROPOSAL_THRESHOLD = 300000e18; //300,000 Xvs\n\n /// @notice The minimum setable voting period\n uint public constant MIN_VOTING_PERIOD = 20 * 60 * 3; // About 3 hours, 3 secs per block\n\n /// @notice The max setable voting period\n uint public constant MAX_VOTING_PERIOD = 20 * 60 * 24 * 14; // About 2 weeks, 3 secs per block\n\n /// @notice The min setable voting delay\n uint public constant MIN_VOTING_DELAY = 1;\n\n /// @notice The max setable voting delay\n uint public constant MAX_VOTING_DELAY = 20 * 60 * 24 * 7; // About 1 week, 3 secs per block\n\n /// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed\n uint public constant quorumVotes = 600000e18; // 600,000 = 2% of Xvs\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 ballot struct used by the contract\n bytes32 public constant BALLOT_TYPEHASH = keccak256(\"Ballot(uint256 proposalId,uint8 support)\");\n\n /**\n * @notice Used to initialize the contract during delegator contructor\n * @param xvsVault_ The address of the XvsVault\n * @param proposalConfigs_ Governance configs for each governance route\n * @param timelocks Timelock addresses for each governance route\n */\n function initialize(\n address xvsVault_,\n ProposalConfig[] memory proposalConfigs_,\n TimelockInterface[] memory timelocks,\n address guardian_\n ) public {\n require(address(proposalTimelocks[0]) == address(0), \"GovernorBravo::initialize: cannot initialize twice\");\n require(msg.sender == admin, \"GovernorBravo::initialize: admin only\");\n require(xvsVault_ != address(0), \"GovernorBravo::initialize: invalid xvs address\");\n require(guardian_ != address(0), \"GovernorBravo::initialize: invalid guardian\");\n require(\n timelocks.length == uint8(ProposalType.CRITICAL) + 1,\n \"GovernorBravo::initialize:number of timelocks should match number of governance routes\"\n );\n require(\n proposalConfigs_.length == uint8(ProposalType.CRITICAL) + 1,\n \"GovernorBravo::initialize:number of proposal configs should match number of governance routes\"\n );\n\n xvsVault = XvsVaultInterface(xvsVault_);\n proposalMaxOperations = 10;\n guardian = guardian_;\n\n //Set parameters for each Governance Route\n uint256 arrLength = proposalConfigs_.length;\n for (uint256 i; i < arrLength; ++i) {\n require(\n proposalConfigs_[i].votingPeriod >= MIN_VOTING_PERIOD,\n \"GovernorBravo::initialize: invalid min voting period\"\n );\n require(\n proposalConfigs_[i].votingPeriod <= MAX_VOTING_PERIOD,\n \"GovernorBravo::initialize: invalid max voting period\"\n );\n require(\n proposalConfigs_[i].votingDelay >= MIN_VOTING_DELAY,\n \"GovernorBravo::initialize: invalid min voting delay\"\n );\n require(\n proposalConfigs_[i].votingDelay <= MAX_VOTING_DELAY,\n \"GovernorBravo::initialize: invalid max voting delay\"\n );\n require(\n proposalConfigs_[i].proposalThreshold >= MIN_PROPOSAL_THRESHOLD,\n \"GovernorBravo::initialize: invalid min proposal threshold\"\n );\n require(\n proposalConfigs_[i].proposalThreshold <= MAX_PROPOSAL_THRESHOLD,\n \"GovernorBravo::initialize: invalid max proposal threshold\"\n );\n require(address(timelocks[i]) != address(0), \"GovernorBravo::initialize:invalid timelock address\");\n\n proposalConfigs[i] = proposalConfigs_[i];\n proposalTimelocks[i] = timelocks[i];\n }\n }\n\n /**\n * @notice Function used to propose a new proposal. Sender must have delegates above the proposal threshold.\n * targets, values, signatures, and calldatas must be of equal length\n * @dev NOTE: Proposals with duplicate set of actions can not be queued for execution. If the proposals consists\n * of duplicate actions, it's recommended to split those actions into separate proposals\n * @param targets Target addresses for proposal calls\n * @param values BNB values for proposal calls\n * @param signatures Function signatures for proposal calls\n * @param calldatas Calldatas for proposal calls\n * @param description String description of the proposal\n * @param proposalType the type of the proposal (e.g NORMAL, FASTTRACK, CRITICAL)\n * @return Proposal id of new proposal\n */\n function propose(\n address[] memory targets,\n uint[] memory values,\n string[] memory signatures,\n bytes[] memory calldatas,\n string memory description,\n ProposalType proposalType\n ) public returns (uint) {\n // Reject proposals before initiating as Governor\n require(initialProposalId != 0, \"GovernorBravo::propose: Governor Bravo not active\");\n require(\n xvsVault.getPriorVotes(msg.sender, sub256(block.number, 1)) >=\n proposalConfigs[uint8(proposalType)].proposalThreshold,\n \"GovernorBravo::propose: proposer votes below proposal threshold\"\n );\n require(\n targets.length == values.length &&\n targets.length == signatures.length &&\n targets.length == calldatas.length,\n \"GovernorBravo::propose: proposal function information arity mismatch\"\n );\n require(targets.length != 0, \"GovernorBravo::propose: must provide actions\");\n require(targets.length <= proposalMaxOperations, \"GovernorBravo::propose: too many actions\");\n\n uint latestProposalId = latestProposalIds[msg.sender];\n if (latestProposalId != 0) {\n ProposalState proposersLatestProposalState = state(latestProposalId);\n require(\n proposersLatestProposalState != ProposalState.Active,\n \"GovernorBravo::propose: one live proposal per proposer, found an already active proposal\"\n );\n require(\n proposersLatestProposalState != ProposalState.Pending,\n \"GovernorBravo::propose: one live proposal per proposer, found an already pending proposal\"\n );\n }\n\n uint startBlock = add256(block.number, proposalConfigs[uint8(proposalType)].votingDelay);\n uint endBlock = add256(startBlock, proposalConfigs[uint8(proposalType)].votingPeriod);\n\n proposalCount++;\n Proposal memory newProposal = Proposal({\n id: proposalCount,\n proposer: msg.sender,\n eta: 0,\n targets: targets,\n values: values,\n signatures: signatures,\n calldatas: calldatas,\n startBlock: startBlock,\n endBlock: endBlock,\n forVotes: 0,\n againstVotes: 0,\n abstainVotes: 0,\n canceled: false,\n executed: false,\n proposalType: uint8(proposalType)\n });\n\n proposals[newProposal.id] = newProposal;\n latestProposalIds[newProposal.proposer] = newProposal.id;\n\n emit ProposalCreated(\n newProposal.id,\n msg.sender,\n targets,\n values,\n signatures,\n calldatas,\n startBlock,\n endBlock,\n description,\n uint8(proposalType)\n );\n return newProposal.id;\n }\n\n /**\n * @notice Queues a proposal of state succeeded\n * @param proposalId The id of the proposal to queue\n */\n function queue(uint proposalId) external {\n require(\n state(proposalId) == ProposalState.Succeeded,\n \"GovernorBravo::queue: proposal can only be queued if it is succeeded\"\n );\n Proposal storage proposal = proposals[proposalId];\n uint eta = add256(block.timestamp, proposalTimelocks[uint8(proposal.proposalType)].delay());\n for (uint i; i < proposal.targets.length; ++i) {\n queueOrRevertInternal(\n proposal.targets[i],\n proposal.values[i],\n proposal.signatures[i],\n proposal.calldatas[i],\n eta,\n uint8(proposal.proposalType)\n );\n }\n proposal.eta = eta;\n emit ProposalQueued(proposalId, eta);\n }\n\n function queueOrRevertInternal(\n address target,\n uint value,\n string memory signature,\n bytes memory data,\n uint eta,\n uint8 proposalType\n ) internal {\n require(\n !proposalTimelocks[proposalType].queuedTransactions(\n keccak256(abi.encode(target, value, signature, data, eta))\n ),\n \"GovernorBravo::queueOrRevertInternal: identical proposal action already queued at eta\"\n );\n proposalTimelocks[proposalType].queueTransaction(target, value, signature, data, eta);\n }\n\n /**\n * @notice Executes a queued proposal if eta has passed\n * @param proposalId The id of the proposal to execute\n */\n function execute(uint proposalId) external {\n require(\n state(proposalId) == ProposalState.Queued,\n \"GovernorBravo::execute: proposal can only be executed if it is queued\"\n );\n Proposal storage proposal = proposals[proposalId];\n proposal.executed = true;\n for (uint i; i < proposal.targets.length; ++i) {\n proposalTimelocks[uint8(proposal.proposalType)].executeTransaction(\n proposal.targets[i],\n proposal.values[i],\n proposal.signatures[i],\n proposal.calldatas[i],\n proposal.eta\n );\n }\n emit ProposalExecuted(proposalId);\n }\n\n /**\n * @notice Cancels a proposal only if sender is the proposer, or proposer delegates dropped below proposal threshold\n * @param proposalId The id of the proposal to cancel\n */\n function cancel(uint proposalId) external {\n require(state(proposalId) != ProposalState.Executed, \"GovernorBravo::cancel: cannot cancel executed proposal\");\n\n Proposal storage proposal = proposals[proposalId];\n require(\n msg.sender == guardian ||\n msg.sender == proposal.proposer ||\n xvsVault.getPriorVotes(proposal.proposer, sub256(block.number, 1)) <\n proposalConfigs[proposal.proposalType].proposalThreshold,\n \"GovernorBravo::cancel: proposer above threshold\"\n );\n\n proposal.canceled = true;\n for (uint i = 0; i < proposal.targets.length; i++) {\n proposalTimelocks[proposal.proposalType].cancelTransaction(\n proposal.targets[i],\n proposal.values[i],\n proposal.signatures[i],\n proposal.calldatas[i],\n proposal.eta\n );\n }\n\n emit ProposalCanceled(proposalId);\n }\n\n /**\n * @notice Gets actions of a proposal\n * @param proposalId the id of the proposal\n * @return targets, values, signatures, and calldatas of the proposal actions\n */\n function getActions(\n uint proposalId\n )\n external\n view\n returns (address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas)\n {\n Proposal storage p = proposals[proposalId];\n return (p.targets, p.values, p.signatures, p.calldatas);\n }\n\n /**\n * @notice Gets the receipt for a voter on a given proposal\n * @param proposalId the id of proposal\n * @param voter The address of the voter\n * @return The voting receipt\n */\n function getReceipt(uint proposalId, address voter) external view returns (Receipt memory) {\n return proposals[proposalId].receipts[voter];\n }\n\n /**\n * @notice Gets the state of a proposal\n * @param proposalId The id of the proposal\n * @return Proposal state\n */\n function state(uint proposalId) public view returns (ProposalState) {\n require(\n proposalCount >= proposalId && proposalId > initialProposalId,\n \"GovernorBravo::state: invalid proposal id\"\n );\n Proposal storage proposal = proposals[proposalId];\n if (proposal.canceled) {\n return ProposalState.Canceled;\n } else if (block.number <= proposal.startBlock) {\n return ProposalState.Pending;\n } else if (block.number <= proposal.endBlock) {\n return ProposalState.Active;\n } else if (proposal.forVotes <= proposal.againstVotes || proposal.forVotes < quorumVotes) {\n return ProposalState.Defeated;\n } else if (proposal.eta == 0) {\n return ProposalState.Succeeded;\n } else if (proposal.executed) {\n return ProposalState.Executed;\n } else if (\n block.timestamp >= add256(proposal.eta, proposalTimelocks[uint8(proposal.proposalType)].GRACE_PERIOD())\n ) {\n return ProposalState.Expired;\n } else {\n return ProposalState.Queued;\n }\n }\n\n /**\n * @notice Cast a vote for a proposal\n * @param proposalId The id of the proposal to vote on\n * @param support The support value for the vote. 0=against, 1=for, 2=abstain\n */\n function castVote(uint proposalId, uint8 support) external {\n emit VoteCast(msg.sender, proposalId, support, castVoteInternal(msg.sender, proposalId, support), \"\");\n }\n\n /**\n * @notice Cast a vote for a proposal with a reason\n * @param proposalId The id of the proposal to vote on\n * @param support The support value for the vote. 0=against, 1=for, 2=abstain\n * @param reason The reason given for the vote by the voter\n */\n function castVoteWithReason(uint proposalId, uint8 support, string calldata reason) external {\n emit VoteCast(msg.sender, proposalId, support, castVoteInternal(msg.sender, proposalId, support), reason);\n }\n\n /**\n * @notice Cast a vote for a proposal by signature\n * @dev External function that accepts EIP-712 signatures for voting on proposals.\n * @param proposalId The id of the proposal to vote on\n * @param support The support value for the vote. 0=against, 1=for, 2=abstain\n * @param v recovery id of ECDSA signature\n * @param r part of the ECDSA sig output\n * @param s part of the ECDSA sig output\n */\n function castVoteBySig(uint proposalId, uint8 support, uint8 v, bytes32 r, bytes32 s) external {\n bytes32 domainSeparator = keccak256(\n abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainIdInternal(), address(this))\n );\n bytes32 structHash = keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support));\n bytes32 digest = keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n address signatory = ecrecover(digest, v, r, s);\n require(signatory != address(0), \"GovernorBravo::castVoteBySig: invalid signature\");\n emit VoteCast(signatory, proposalId, support, castVoteInternal(signatory, proposalId, support), \"\");\n }\n\n /**\n * @notice Internal function that caries out voting logic\n * @param voter The voter that is casting their vote\n * @param proposalId The id of the proposal to vote on\n * @param support The support value for the vote. 0=against, 1=for, 2=abstain\n * @return The number of votes cast\n */\n function castVoteInternal(address voter, uint proposalId, uint8 support) internal returns (uint96) {\n require(state(proposalId) == ProposalState.Active, \"GovernorBravo::castVoteInternal: voting is closed\");\n require(support <= 2, \"GovernorBravo::castVoteInternal: invalid vote type\");\n Proposal storage proposal = proposals[proposalId];\n Receipt storage receipt = proposal.receipts[voter];\n require(receipt.hasVoted == false, \"GovernorBravo::castVoteInternal: voter already voted\");\n uint96 votes = xvsVault.getPriorVotes(voter, proposal.startBlock);\n\n if (support == 0) {\n proposal.againstVotes = add256(proposal.againstVotes, votes);\n } else if (support == 1) {\n proposal.forVotes = add256(proposal.forVotes, votes);\n } else if (support == 2) {\n proposal.abstainVotes = add256(proposal.abstainVotes, votes);\n }\n\n receipt.hasVoted = true;\n receipt.support = support;\n receipt.votes = votes;\n\n return votes;\n }\n\n /**\n * @notice Sets the new governance guardian\n * @param newGuardian the address of the new guardian\n */\n function _setGuardian(address newGuardian) external {\n require(msg.sender == guardian || msg.sender == admin, \"GovernorBravo::_setGuardian: admin or guardian only\");\n require(newGuardian != address(0), \"GovernorBravo::_setGuardian: cannot live without a guardian\");\n address oldGuardian = guardian;\n guardian = newGuardian;\n\n emit NewGuardian(oldGuardian, newGuardian);\n }\n\n /**\n * @notice Initiate the GovernorBravo contract\n * @dev Admin only. Sets initial proposal id which initiates the contract, ensuring a continuous proposal id count\n * @param governorAlpha The address for the Governor to continue the proposal id count from\n */\n function _initiate(address governorAlpha) external {\n require(msg.sender == admin, \"GovernorBravo::_initiate: admin only\");\n require(initialProposalId == 0, \"GovernorBravo::_initiate: can only initiate once\");\n proposalCount = GovernorAlphaInterface(governorAlpha).proposalCount();\n initialProposalId = proposalCount;\n for (uint256 i; i < uint8(ProposalType.CRITICAL) + 1; ++i) {\n proposalTimelocks[i].acceptAdmin();\n }\n }\n\n /**\n * @notice Set max proposal operations\n * @dev Admin only.\n * @param proposalMaxOperations_ Max proposal operations\n */\n function _setProposalMaxOperations(uint proposalMaxOperations_) external {\n require(msg.sender == admin, \"GovernorBravo::_setProposalMaxOperations: admin only\");\n uint oldProposalMaxOperations = proposalMaxOperations;\n proposalMaxOperations = proposalMaxOperations_;\n\n emit ProposalMaxOperationsUpdated(oldProposalMaxOperations, proposalMaxOperations_);\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 */\n function _setPendingAdmin(address newPendingAdmin) external {\n // Check caller = admin\n require(msg.sender == admin, \"GovernorBravo:_setPendingAdmin: admin only\");\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\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 */\n function _acceptAdmin() external {\n // Check caller is pendingAdmin and pendingAdmin ≠ address(0)\n require(\n msg.sender == pendingAdmin && msg.sender != address(0),\n \"GovernorBravo:_acceptAdmin: pending admin only\"\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\n function add256(uint256 a, uint256 b) internal pure returns (uint) {\n uint c = a + b;\n require(c >= a, \"addition overflow\");\n return c;\n }\n\n function sub256(uint256 a, uint256 b) internal pure returns (uint) {\n require(b <= a, \"subtraction underflow\");\n return a - b;\n }\n\n function getChainIdInternal() internal pure returns (uint) {\n uint chainId;\n assembly {\n chainId := chainid()\n }\n return chainId;\n }\n}\n" + }, + "@venusprotocol/governance-contracts/contracts/Governance/GovernorBravoInterfaces.sol": { + "content": "pragma solidity ^0.5.16;\npragma experimental ABIEncoderV2;\n\n/**\n * @title GovernorBravoEvents\n * @author Venus\n * @notice Set of events emitted by the GovernorBravo contracts.\n */\ncontract GovernorBravoEvents {\n /// @notice An event emitted when a new proposal is created\n event ProposalCreated(\n uint id,\n address proposer,\n address[] targets,\n uint[] values,\n string[] signatures,\n bytes[] calldatas,\n uint startBlock,\n uint endBlock,\n string description,\n uint8 proposalType\n );\n\n /// @notice An event emitted when a vote has been cast on a proposal\n /// @param voter The address which casted a vote\n /// @param proposalId The proposal id which was voted on\n /// @param support Support value for the vote. 0=against, 1=for, 2=abstain\n /// @param votes Number of votes which were cast by the voter\n /// @param reason The reason given for the vote by the voter\n event VoteCast(address indexed voter, uint proposalId, uint8 support, uint votes, string reason);\n\n /// @notice An event emitted when a proposal has been canceled\n event ProposalCanceled(uint id);\n\n /// @notice An event emitted when a proposal has been queued in the Timelock\n event ProposalQueued(uint id, uint eta);\n\n /// @notice An event emitted when a proposal has been executed in the Timelock\n event ProposalExecuted(uint id);\n\n /// @notice An event emitted when the voting delay is set\n event VotingDelaySet(uint oldVotingDelay, uint newVotingDelay);\n\n /// @notice An event emitted when the voting period is set\n event VotingPeriodSet(uint oldVotingPeriod, uint newVotingPeriod);\n\n /// @notice Emitted when implementation is changed\n event NewImplementation(address oldImplementation, address newImplementation);\n\n /// @notice Emitted when proposal threshold is set\n event ProposalThresholdSet(uint oldProposalThreshold, uint newProposalThreshold);\n\n /// @notice Emitted when pendingAdmin is changed\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\n\n /// @notice Emitted when pendingAdmin is accepted, which means admin is updated\n event NewAdmin(address oldAdmin, address newAdmin);\n\n /// @notice Emitted when the new guardian address is set\n event NewGuardian(address oldGuardian, address newGuardian);\n\n /// @notice Emitted when the maximum number of operations in one proposal is updated\n event ProposalMaxOperationsUpdated(uint oldMaxOperations, uint newMaxOperations);\n}\n\n/**\n * @title GovernorBravoDelegatorStorage\n * @author Venus\n * @notice Storage layout of the `GovernorBravoDelegator` contract\n */\ncontract GovernorBravoDelegatorStorage {\n /// @notice Administrator for this contract\n address public admin;\n\n /// @notice Pending administrator for this contract\n address public pendingAdmin;\n\n /// @notice Active brains of Governor\n address public implementation;\n}\n\n/**\n * @title GovernorBravoDelegateStorageV1\n * @dev For future upgrades, do not change GovernorBravoDelegateStorageV1. Create a new\n * contract which implements GovernorBravoDelegateStorageV1 and following the naming convention\n * GovernorBravoDelegateStorageVX.\n */\ncontract GovernorBravoDelegateStorageV1 is GovernorBravoDelegatorStorage {\n /// @notice DEPRECATED The delay before voting on a proposal may take place, once proposed, in blocks\n uint public votingDelay;\n\n /// @notice DEPRECATED The duration of voting on a proposal, in blocks\n uint public votingPeriod;\n\n /// @notice DEPRECATED The number of votes required in order for a voter to become a proposer\n uint public proposalThreshold;\n\n /// @notice Initial proposal id set at become\n uint public initialProposalId;\n\n /// @notice The total number of proposals\n uint public proposalCount;\n\n /// @notice The address of the Venus Protocol Timelock\n TimelockInterface public timelock;\n\n /// @notice The address of the Venus governance token\n XvsVaultInterface public xvsVault;\n\n /// @notice The official record of all proposals ever proposed\n mapping(uint => Proposal) public proposals;\n\n /// @notice The latest proposal for each proposer\n mapping(address => uint) public latestProposalIds;\n\n struct Proposal {\n /// @notice Unique id for looking up a proposal\n uint id;\n /// @notice Creator of the proposal\n address proposer;\n /// @notice The timestamp that the proposal will be available for execution, set once the vote succeeds\n uint eta;\n /// @notice the ordered list of target addresses for calls to be made\n address[] targets;\n /// @notice The ordered list of values (i.e. msg.value) to be passed to the calls to be made\n uint[] values;\n /// @notice The ordered list of function signatures to be called\n string[] signatures;\n /// @notice The ordered list of calldata to be passed to each call\n bytes[] calldatas;\n /// @notice The block at which voting begins: holders must delegate their votes prior to this block\n uint startBlock;\n /// @notice The block at which voting ends: votes must be cast prior to this block\n uint endBlock;\n /// @notice Current number of votes in favor of this proposal\n uint forVotes;\n /// @notice Current number of votes in opposition to this proposal\n uint againstVotes;\n /// @notice Current number of votes for abstaining for this proposal\n uint abstainVotes;\n /// @notice Flag marking whether the proposal has been canceled\n bool canceled;\n /// @notice Flag marking whether the proposal has been executed\n bool executed;\n /// @notice Receipts of ballots for the entire set of voters\n mapping(address => Receipt) receipts;\n /// @notice The type of the proposal\n uint8 proposalType;\n }\n\n /// @notice Ballot receipt record for a voter\n struct Receipt {\n /// @notice Whether or not a vote has been cast\n bool hasVoted;\n /// @notice Whether or not the voter supports the proposal or abstains\n uint8 support;\n /// @notice The number of votes the voter had, which were cast\n uint96 votes;\n }\n\n /// @notice Possible states that a proposal may be in\n enum ProposalState {\n Pending,\n Active,\n Canceled,\n Defeated,\n Succeeded,\n Queued,\n Expired,\n Executed\n }\n\n /// @notice The maximum number of actions that can be included in a proposal\n uint public proposalMaxOperations;\n\n /// @notice A privileged role that can cancel any proposal\n address public guardian;\n}\n\n/**\n * @title GovernorBravoDelegateStorageV2\n * @dev For future upgrades, do not change GovernorBravoDelegateStorageV1. Create a new\n * contract which implements GovernorBravoDelegateStorageV2 and following the naming convention\n * GovernorBravoDelegateStorageVX.\n */\ncontract GovernorBravoDelegateStorageV2 is GovernorBravoDelegateStorageV1 {\n enum ProposalType {\n NORMAL,\n FASTTRACK,\n CRITICAL\n }\n\n struct ProposalConfig {\n /// @notice The delay before voting on a proposal may take place, once proposed, in blocks\n uint256 votingDelay;\n /// @notice The duration of voting on a proposal, in blocks\n uint256 votingPeriod;\n /// @notice The number of votes required in order for a voter to become a proposer\n uint256 proposalThreshold;\n }\n\n /// @notice mapping containing configuration for each proposal type\n mapping(uint => ProposalConfig) public proposalConfigs;\n\n /// @notice mapping containing Timelock addresses for each proposal type\n mapping(uint => TimelockInterface) public proposalTimelocks;\n}\n\n/**\n * @title TimelockInterface\n * @author Venus\n * @notice Interface implemented by the Timelock contract.\n */\ninterface TimelockInterface {\n function delay() external view returns (uint);\n\n function GRACE_PERIOD() external view returns (uint);\n\n function acceptAdmin() external;\n\n function queuedTransactions(bytes32 hash) external view returns (bool);\n\n function queueTransaction(\n address target,\n uint value,\n string calldata signature,\n bytes calldata data,\n uint eta\n ) external returns (bytes32);\n\n function cancelTransaction(\n address target,\n uint value,\n string calldata signature,\n bytes calldata data,\n uint eta\n ) external;\n\n function executeTransaction(\n address target,\n uint value,\n string calldata signature,\n bytes calldata data,\n uint eta\n ) external payable returns (bytes memory);\n}\n\ninterface XvsVaultInterface {\n function getPriorVotes(address account, uint blockNumber) external view returns (uint96);\n}\n\ninterface GovernorAlphaInterface {\n /// @notice The total number of proposals\n function proposalCount() external returns (uint);\n}\n" + }, + "@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV5.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity 0.5.16;\n\n/**\n * @title IAccessControlManagerV5\n * @author Venus\n * @notice Interface implemented by the `AccessControlManagerV5` contract.\n */\ninterface IAccessControlManagerV5 {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n\n /**\n * @notice Gives a function call permission to one single account\n * @dev this function can be called only from Role Admin or DEFAULT_ADMIN_ROLE\n * \t\tMay emit a {RoleGranted} event.\n * @param contractAddress address of contract for which call permissions will be granted\n * @param functionSig signature e.g. \"functionName(uint,bool)\"\n */\n function giveCallPermission(address contractAddress, string calldata functionSig, address accountToPermit) external;\n\n /**\n * @notice Revokes an account's permission to a particular function call\n * @dev this function can be called only from Role Admin or DEFAULT_ADMIN_ROLE\n * \t\tMay emit a {RoleRevoked} event.\n * @param contractAddress address of contract for which call permissions will be revoked\n * @param functionSig signature e.g. \"functionName(uint,bool)\"\n */\n function revokeCallPermission(\n address contractAddress,\n string calldata functionSig,\n address accountToRevoke\n ) external;\n\n /**\n * @notice Verifies if the given account can call a praticular contract's function\n * @dev Since the contract is calling itself this function, we can get contracts address with msg.sender\n * @param account address (eoa or contract) for which call permissions will be checked\n * @param functionSig signature e.g. \"functionName(uint,bool)\"\n * @return false if the user account cannot call the particular contract function\n *\n */\n function isAllowedToCall(address account, string calldata functionSig) external view returns (bool);\n\n function hasPermission(\n address account,\n address contractAddress,\n string calldata functionSig\n ) external view returns (bool);\n}\n" + }, + "@venusprotocol/solidity-utilities/contracts/TimeManagerV5.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity 0.5.16;\n\ncontract TimeManagerV5 {\n /// @dev The approximate number of seconds per year\n uint256 public constant SECONDS_PER_YEAR = 31_536_000;\n\n /// @notice Number of blocks per year or seconds per year\n uint256 public blocksOrSecondsPerYear;\n\n /// @dev Sets true when block timestamp is used\n bool public isTimeBased;\n\n /// @dev Sets true when contract is initialized\n bool private isInitialized;\n\n /// @notice Deprecated slot for _getCurrentSlot function pointer\n bytes8 private __deprecatedSlot1;\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[48] private __gap;\n\n /**\n * @dev Function to simply retrieve block number or block timestamp\n * @return Current block number or block timestamp\n */\n function getBlockNumberOrTimestamp() public view returns (uint256) {\n return isTimeBased ? _getBlockTimestamp() : _getBlockNumber();\n }\n\n /**\n * @dev Initializes the contract to use either blocks or seconds\n * @param timeBased_ A boolean indicating whether the contract is based on time or block\n * If timeBased is true than blocksPerYear_ param is ignored as blocksOrSecondsPerYear is set to SECONDS_PER_YEAR\n * @param blocksPerYear_ The number of blocks per year\n */\n function _initializeTimeManager(bool timeBased_, uint256 blocksPerYear_) internal {\n if (isInitialized) revert(\"Already initialized TimeManager\");\n\n if (!timeBased_ && blocksPerYear_ == 0) {\n revert(\"Invalid blocks per year\");\n }\n if (timeBased_ && blocksPerYear_ != 0) {\n revert(\"Invalid time based configuration\");\n }\n\n isTimeBased = timeBased_;\n blocksOrSecondsPerYear = timeBased_ ? SECONDS_PER_YEAR : blocksPerYear_;\n isInitialized = true;\n }\n\n /**\n * @dev Returns the current timestamp in seconds\n * @return The current timestamp\n */\n function _getBlockTimestamp() private view returns (uint256) {\n return block.timestamp;\n }\n\n /**\n * @dev Returns the current block number\n * @return The current block number\n */\n function _getBlockNumber() private view returns (uint256) {\n return block.number;\n }\n}\n" + }, + "contracts/Comptroller/ComptrollerInterface.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Tokens/VTokens/VToken.sol\";\nimport \"../Oracle/PriceOracle.sol\";\nimport \"../Tokens/VAI/VAIControllerInterface.sol\";\nimport { ComptrollerTypes } from \"./ComptrollerStorage.sol\";\n\ncontract ComptrollerInterface {\n /// @notice Indicator that this is a Comptroller contract (for inspection)\n bool public constant isComptroller = true;\n\n /*** Assets You Are In ***/\n\n function enterMarkets(address[] calldata vTokens) external returns (uint[] memory);\n\n function exitMarket(address vToken) external returns (uint);\n\n /*** Policy Hooks ***/\n\n function mintAllowed(address vToken, address minter, uint mintAmount) external returns (uint);\n\n function mintVerify(address vToken, address minter, uint mintAmount, uint mintTokens) external;\n\n function redeemAllowed(address vToken, address redeemer, uint redeemTokens) external returns (uint);\n\n function redeemVerify(address vToken, address redeemer, uint redeemAmount, uint redeemTokens) external;\n\n function borrowAllowed(address vToken, address borrower, uint borrowAmount) external returns (uint);\n\n function borrowVerify(address vToken, address borrower, uint borrowAmount) external;\n\n function repayBorrowAllowed(\n address vToken,\n address payer,\n address borrower,\n uint repayAmount\n ) external returns (uint);\n\n function repayBorrowVerify(\n address vToken,\n address payer,\n address borrower,\n uint repayAmount,\n uint borrowerIndex\n ) external;\n\n function liquidateBorrowAllowed(\n address vTokenBorrowed,\n address vTokenCollateral,\n address liquidator,\n address borrower,\n uint repayAmount\n ) external returns (uint);\n\n function liquidateBorrowVerify(\n address vTokenBorrowed,\n address vTokenCollateral,\n address liquidator,\n address borrower,\n uint repayAmount,\n uint seizeTokens\n ) external;\n\n function seizeAllowed(\n address vTokenCollateral,\n address vTokenBorrowed,\n address liquidator,\n address borrower,\n uint seizeTokens\n ) external returns (uint);\n\n function seizeVerify(\n address vTokenCollateral,\n address vTokenBorrowed,\n address liquidator,\n address borrower,\n uint seizeTokens\n ) external;\n\n function transferAllowed(address vToken, address src, address dst, uint transferTokens) external returns (uint);\n\n function transferVerify(address vToken, address src, address dst, uint transferTokens) external;\n\n /*** Liquidity/Liquidation Calculations ***/\n\n function liquidateCalculateSeizeTokens(\n address vTokenBorrowed,\n address vTokenCollateral,\n uint repayAmount\n ) external view returns (uint, uint);\n\n function setMintedVAIOf(address owner, uint amount) external returns (uint);\n\n function liquidateVAICalculateSeizeTokens(\n address vTokenCollateral,\n uint repayAmount\n ) external view returns (uint, uint);\n\n function getXVSAddress() public view returns (address);\n\n function markets(address) external view returns (bool, uint);\n\n function oracle() external view returns (PriceOracle);\n\n function getAccountLiquidity(address) external view returns (uint, uint, uint);\n\n function getAssetsIn(address) external view returns (VToken[] memory);\n\n function claimVenus(address) external;\n\n function venusAccrued(address) external view returns (uint);\n\n function venusSupplySpeeds(address) external view returns (uint);\n\n function venusBorrowSpeeds(address) external view returns (uint);\n\n function getAllMarkets() external view returns (VToken[] memory);\n\n function venusSupplierIndex(address, address) external view returns (uint);\n\n function venusInitialIndex() external view returns (uint224);\n\n function venusBorrowerIndex(address, address) external view returns (uint);\n\n function venusBorrowState(address) external view returns (uint224, uint32);\n\n function venusSupplyState(address) external view returns (uint224, uint32);\n\n function approvedDelegates(address borrower, address delegate) external view returns (bool);\n\n function vaiController() external view returns (VAIControllerInterface);\n\n function liquidationIncentiveMantissa() external view returns (uint);\n\n function protocolPaused() external view returns (bool);\n\n function actionPaused(address market, ComptrollerTypes.Action action) public view returns (bool);\n\n function mintedVAIs(address user) external view returns (uint);\n\n function vaiMintRate() external view returns (uint);\n}\n\ninterface IVAIVault {\n function updatePendingRewards() external;\n}\n\ninterface IComptroller {\n function liquidationIncentiveMantissa() external view returns (uint);\n\n /*** Treasury Data ***/\n function treasuryAddress() external view returns (address);\n\n function treasuryPercent() external view returns (uint);\n}\n" + }, + "contracts/Comptroller/ComptrollerLensInterface.sol": { + "content": "pragma solidity ^0.5.16;\npragma experimental ABIEncoderV2;\n\nimport \"../Tokens/VTokens/VToken.sol\";\n\ninterface ComptrollerLensInterface {\n function liquidateCalculateSeizeTokens(\n address comptroller,\n address vTokenBorrowed,\n address vTokenCollateral,\n uint actualRepayAmount\n ) external view returns (uint, uint);\n\n function liquidateVAICalculateSeizeTokens(\n address comptroller,\n address vTokenCollateral,\n uint actualRepayAmount\n ) external view returns (uint, uint);\n\n function getHypotheticalAccountLiquidity(\n address comptroller,\n address account,\n VToken vTokenModify,\n uint redeemTokens,\n uint borrowAmount\n ) external view returns (uint, uint, uint);\n}\n" + }, + "contracts/Comptroller/ComptrollerStorage.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\n\npragma solidity ^0.5.16;\n\nimport { VToken } from \"../Tokens/VTokens/VToken.sol\";\nimport { PriceOracle } from \"../Oracle/PriceOracle.sol\";\nimport { VAIControllerInterface } from \"../Tokens/VAI/VAIControllerInterface.sol\";\nimport { ComptrollerLensInterface } from \"./ComptrollerLensInterface.sol\";\nimport { IPrime } from \"../Tokens/Prime/IPrime.sol\";\n\ninterface ComptrollerTypes {\n enum Action {\n MINT,\n REDEEM,\n BORROW,\n REPAY,\n SEIZE,\n LIQUIDATE,\n TRANSFER,\n ENTER_MARKET,\n EXIT_MARKET\n }\n}\n\ncontract UnitrollerAdminStorage {\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 Unitroller\n */\n address public comptrollerImplementation;\n\n /**\n * @notice Pending brains of Unitroller\n */\n address public pendingComptrollerImplementation;\n}\n\ncontract ComptrollerV1Storage is ComptrollerTypes, UnitrollerAdminStorage {\n /**\n * @notice Oracle which gives the price of any given asset\n */\n PriceOracle public oracle;\n\n /**\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\n */\n uint256 public closeFactorMantissa;\n\n /**\n * @notice Multiplier representing the discount on collateral that a liquidator receives\n */\n uint256 public liquidationIncentiveMantissa;\n\n /**\n * @notice Max number of assets a single account can participate in (borrow or use as collateral)\n */\n uint256 public maxAssets;\n\n /**\n * @notice Per-account mapping of \"assets you are in\", capped by maxAssets\n */\n mapping(address => VToken[]) public accountAssets;\n\n struct Market {\n /// @notice Whether or not this market is listed\n bool isListed;\n /**\n * @notice Multiplier representing the most one can borrow against their collateral in this market.\n * For instance, 0.9 to allow borrowing 90% of collateral value.\n * Must be between 0 and 1, and stored as a mantissa.\n */\n uint256 collateralFactorMantissa;\n /// @notice Per-market mapping of \"accounts in this asset\"\n mapping(address => bool) accountMembership;\n /// @notice Whether or not this market receives XVS\n bool isVenus;\n }\n\n /**\n * @notice Official mapping of vTokens -> Market metadata\n * @dev Used e.g. to determine if a market is supported\n */\n mapping(address => Market) public markets;\n\n /**\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\n */\n address public pauseGuardian;\n\n /// @notice Whether minting is paused (deprecated, superseded by actionPaused)\n bool private _mintGuardianPaused;\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\n bool private _borrowGuardianPaused;\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\n bool internal transferGuardianPaused;\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\n bool internal seizeGuardianPaused;\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\n mapping(address => bool) internal mintGuardianPaused;\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\n mapping(address => bool) internal borrowGuardianPaused;\n\n struct VenusMarketState {\n /// @notice The market's last updated venusBorrowIndex or venusSupplyIndex\n uint224 index;\n /// @notice The block number the index was last updated at\n uint32 block;\n }\n\n /// @notice A list of all markets\n VToken[] public allMarkets;\n\n /// @notice The rate at which the flywheel distributes XVS, per block\n uint256 internal venusRate;\n\n /// @notice The portion of venusRate that each market currently receives\n mapping(address => uint256) internal venusSpeeds;\n\n /// @notice The Venus market supply state for each market\n mapping(address => VenusMarketState) public venusSupplyState;\n\n /// @notice The Venus market borrow state for each market\n mapping(address => VenusMarketState) public venusBorrowState;\n\n /// @notice The Venus supply index for each market for each supplier as of the last time they accrued XVS\n mapping(address => mapping(address => uint256)) public venusSupplierIndex;\n\n /// @notice The Venus borrow index for each market for each borrower as of the last time they accrued XVS\n mapping(address => mapping(address => uint256)) public venusBorrowerIndex;\n\n /// @notice The XVS accrued but not yet transferred to each user\n mapping(address => uint256) public venusAccrued;\n\n /// @notice The Address of VAIController\n VAIControllerInterface public vaiController;\n\n /// @notice The minted VAI amount to each user\n mapping(address => uint256) public mintedVAIs;\n\n /// @notice VAI Mint Rate as a percentage\n uint256 public vaiMintRate;\n\n /**\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\n */\n bool public mintVAIGuardianPaused;\n bool public repayVAIGuardianPaused;\n\n /**\n * @notice Pause/Unpause whole protocol actions\n */\n bool public protocolPaused;\n\n /// @notice The rate at which the flywheel distributes XVS to VAI Minters, per block (deprecated)\n uint256 private venusVAIRate;\n}\n\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\n /// @notice The rate at which the flywheel distributes XVS to VAI Vault, per block\n uint256 public venusVAIVaultRate;\n\n // address of VAI Vault\n address public vaiVaultAddress;\n\n // start block of release to VAI Vault\n uint256 public releaseStartBlock;\n\n // minimum release amount to VAI Vault\n uint256 public minReleaseAmount;\n}\n\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\n address public borrowCapGuardian;\n\n /// @notice Borrow caps enforced by borrowAllowed for each vToken address.\n mapping(address => uint256) public borrowCaps;\n}\n\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\n /// @notice Treasury Guardian address\n address public treasuryGuardian;\n\n /// @notice Treasury address\n address public treasuryAddress;\n\n /// @notice Fee percent of accrued interest with decimal 18\n uint256 public treasuryPercent;\n}\n\ncontract ComptrollerV5Storage is ComptrollerV4Storage {\n /// @notice The portion of XVS that each contributor receives per block (deprecated)\n mapping(address => uint256) private venusContributorSpeeds;\n\n /// @notice Last block at which a contributor's XVS rewards have been allocated (deprecated)\n mapping(address => uint256) private lastContributorBlock;\n}\n\ncontract ComptrollerV6Storage is ComptrollerV5Storage {\n address public liquidatorContract;\n}\n\ncontract ComptrollerV7Storage is ComptrollerV6Storage {\n ComptrollerLensInterface public comptrollerLens;\n}\n\ncontract ComptrollerV8Storage is ComptrollerV7Storage {\n /// @notice Supply caps enforced by mintAllowed for each vToken address. Defaults to zero which corresponds to minting notAllowed\n mapping(address => uint256) public supplyCaps;\n}\n\ncontract ComptrollerV9Storage is ComptrollerV8Storage {\n /// @notice AccessControlManager address\n address internal accessControl;\n\n /// @notice True if a certain action is paused on a certain market\n mapping(address => mapping(uint256 => bool)) internal _actionPaused;\n}\n\ncontract ComptrollerV10Storage is ComptrollerV9Storage {\n /// @notice The rate at which venus is distributed to the corresponding borrow market (per block)\n mapping(address => uint256) public venusBorrowSpeeds;\n\n /// @notice The rate at which venus is distributed to the corresponding supply market (per block)\n mapping(address => uint256) public venusSupplySpeeds;\n}\n\ncontract ComptrollerV11Storage is ComptrollerV10Storage {\n /// @notice Whether the delegate is allowed to borrow or redeem on behalf of the user\n //mapping(address user => mapping (address delegate => bool approved)) public approvedDelegates;\n mapping(address => mapping(address => bool)) public approvedDelegates;\n}\n\ncontract ComptrollerV12Storage is ComptrollerV11Storage {\n /// @notice Whether forced liquidation is enabled for all users borrowing in a certain market\n mapping(address => bool) public isForcedLiquidationEnabled;\n}\n\ncontract ComptrollerV13Storage is ComptrollerV12Storage {\n struct FacetAddressAndPosition {\n address facetAddress;\n uint96 functionSelectorPosition; // position in _facetFunctionSelectors.functionSelectors array\n }\n\n struct FacetFunctionSelectors {\n bytes4[] functionSelectors;\n uint256 facetAddressPosition; // position of facetAddress in _facetAddresses array\n }\n\n mapping(bytes4 => FacetAddressAndPosition) internal _selectorToFacetAndPosition;\n // maps facet addresses to function selectors\n mapping(address => FacetFunctionSelectors) internal _facetFunctionSelectors;\n // facet addresses\n address[] internal _facetAddresses;\n}\n\ncontract ComptrollerV14Storage is ComptrollerV13Storage {\n /// @notice Prime token address\n IPrime public prime;\n}\n\ncontract ComptrollerV15Storage is ComptrollerV14Storage {\n /// @notice Whether forced liquidation is enabled for the borrows of a user in a market\n mapping(address /* user */ => mapping(address /* market */ => bool)) public isForcedLiquidationEnabledForUser;\n}\n\ncontract ComptrollerV16Storage is ComptrollerV15Storage {\n /// @notice The XVS token contract address\n address internal xvs;\n\n /// @notice The XVS vToken contract address\n address internal xvsVToken;\n}\n" + }, + "contracts/Comptroller/Diamond/Diamond.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\n\npragma solidity 0.5.16;\npragma experimental ABIEncoderV2;\n\nimport { IDiamondCut } from \"./interfaces/IDiamondCut.sol\";\nimport { Unitroller, ComptrollerV16Storage } from \"../Unitroller.sol\";\n\n/**\n * @title Diamond\n * @author Venus\n * @notice This contract contains functions related to facets\n */\ncontract Diamond is IDiamondCut, ComptrollerV16Storage {\n /// @notice Emitted when functions are added, replaced or removed to facets\n event DiamondCut(IDiamondCut.FacetCut[] _diamondCut);\n\n struct Facet {\n address facetAddress;\n bytes4[] functionSelectors;\n }\n\n /**\n * @notice Call _acceptImplementation to accept the diamond proxy as new implementaion\n * @param unitroller Address of the unitroller\n */\n function _become(Unitroller unitroller) public {\n require(msg.sender == unitroller.admin(), \"only unitroller admin can\");\n require(unitroller._acceptImplementation() == 0, \"not authorized\");\n }\n\n /**\n * @notice To add function selectors to the facet's mapping\n * @dev Allows the contract admin to add function selectors\n * @param diamondCut_ IDiamondCut contains facets address, action and function selectors\n */\n function diamondCut(IDiamondCut.FacetCut[] memory diamondCut_) public {\n require(msg.sender == admin, \"only unitroller admin can\");\n libDiamondCut(diamondCut_);\n }\n\n /**\n * @notice Get all function selectors mapped to the facet address\n * @param facet Address of the facet\n * @return selectors Array of function selectors\n */\n function facetFunctionSelectors(address facet) external view returns (bytes4[] memory) {\n return _facetFunctionSelectors[facet].functionSelectors;\n }\n\n /**\n * @notice Get facet position in the _facetFunctionSelectors through facet address\n * @param facet Address of the facet\n * @return Position of the facet\n */\n function facetPosition(address facet) external view returns (uint256) {\n return _facetFunctionSelectors[facet].facetAddressPosition;\n }\n\n /**\n * @notice Get all facet addresses\n * @return facetAddresses Array of facet addresses\n */\n function facetAddresses() external view returns (address[] memory) {\n return _facetAddresses;\n }\n\n /**\n * @notice Get facet address and position through function selector\n * @param functionSelector function selector\n * @return FacetAddressAndPosition facet address and position\n */\n function facetAddress(\n bytes4 functionSelector\n ) external view returns (ComptrollerV16Storage.FacetAddressAndPosition memory) {\n return _selectorToFacetAndPosition[functionSelector];\n }\n\n /**\n * @notice Get all facets address and their function selector\n * @return facets_ Array of Facet\n */\n function facets() external view returns (Facet[] memory) {\n uint256 facetsLength = _facetAddresses.length;\n Facet[] memory facets_ = new Facet[](facetsLength);\n for (uint256 i; i < facetsLength; ++i) {\n address facet = _facetAddresses[i];\n facets_[i].facetAddress = facet;\n facets_[i].functionSelectors = _facetFunctionSelectors[facet].functionSelectors;\n }\n return facets_;\n }\n\n /**\n * @notice To add function selectors to the facets' mapping\n * @param diamondCut_ IDiamondCut contains facets address, action and function selectors\n */\n function libDiamondCut(IDiamondCut.FacetCut[] memory diamondCut_) internal {\n uint256 diamondCutLength = diamondCut_.length;\n for (uint256 facetIndex; facetIndex < diamondCutLength; ++facetIndex) {\n IDiamondCut.FacetCutAction action = diamondCut_[facetIndex].action;\n if (action == IDiamondCut.FacetCutAction.Add) {\n addFunctions(diamondCut_[facetIndex].facetAddress, diamondCut_[facetIndex].functionSelectors);\n } else if (action == IDiamondCut.FacetCutAction.Replace) {\n replaceFunctions(diamondCut_[facetIndex].facetAddress, diamondCut_[facetIndex].functionSelectors);\n } else if (action == IDiamondCut.FacetCutAction.Remove) {\n removeFunctions(diamondCut_[facetIndex].facetAddress, diamondCut_[facetIndex].functionSelectors);\n } else {\n revert(\"LibDiamondCut: Incorrect FacetCutAction\");\n }\n }\n emit DiamondCut(diamondCut_);\n }\n\n /**\n * @notice Add function selectors to the facet's address mapping\n * @param facetAddress Address of the facet\n * @param functionSelectors Array of function selectors need to add in the mapping\n */\n function addFunctions(address facetAddress, bytes4[] memory functionSelectors) internal {\n require(functionSelectors.length != 0, \"LibDiamondCut: No selectors in facet to cut\");\n require(facetAddress != address(0), \"LibDiamondCut: Add facet can't be address(0)\");\n uint96 selectorPosition = uint96(_facetFunctionSelectors[facetAddress].functionSelectors.length);\n // add new facet address if it does not exist\n if (selectorPosition == 0) {\n addFacet(facetAddress);\n }\n uint256 functionSelectorsLength = functionSelectors.length;\n for (uint256 selectorIndex; selectorIndex < functionSelectorsLength; ++selectorIndex) {\n bytes4 selector = functionSelectors[selectorIndex];\n address oldFacetAddress = _selectorToFacetAndPosition[selector].facetAddress;\n require(oldFacetAddress == address(0), \"LibDiamondCut: Can't add function that already exists\");\n addFunction(selector, selectorPosition, facetAddress);\n ++selectorPosition;\n }\n }\n\n /**\n * @notice Replace facet's address mapping for function selectors i.e selectors already associate to any other existing facet\n * @param facetAddress Address of the facet\n * @param functionSelectors Array of function selectors need to replace in the mapping\n */\n function replaceFunctions(address facetAddress, bytes4[] memory functionSelectors) internal {\n require(functionSelectors.length != 0, \"LibDiamondCut: No selectors in facet to cut\");\n require(facetAddress != address(0), \"LibDiamondCut: Add facet can't be address(0)\");\n uint96 selectorPosition = uint96(_facetFunctionSelectors[facetAddress].functionSelectors.length);\n // add new facet address if it does not exist\n if (selectorPosition == 0) {\n addFacet(facetAddress);\n }\n uint256 functionSelectorsLength = functionSelectors.length;\n for (uint256 selectorIndex; selectorIndex < functionSelectorsLength; ++selectorIndex) {\n bytes4 selector = functionSelectors[selectorIndex];\n address oldFacetAddress = _selectorToFacetAndPosition[selector].facetAddress;\n require(oldFacetAddress != facetAddress, \"LibDiamondCut: Can't replace function with same function\");\n removeFunction(oldFacetAddress, selector);\n addFunction(selector, selectorPosition, facetAddress);\n ++selectorPosition;\n }\n }\n\n /**\n * @notice Remove function selectors to the facet's address mapping\n * @param facetAddress Address of the facet\n * @param functionSelectors Array of function selectors need to remove in the mapping\n */\n function removeFunctions(address facetAddress, bytes4[] memory functionSelectors) internal {\n uint256 functionSelectorsLength = functionSelectors.length;\n require(functionSelectorsLength != 0, \"LibDiamondCut: No selectors in facet to cut\");\n // if function does not exist then do nothing and revert\n require(facetAddress == address(0), \"LibDiamondCut: Remove facet address must be address(0)\");\n for (uint256 selectorIndex; selectorIndex < functionSelectorsLength; ++selectorIndex) {\n bytes4 selector = functionSelectors[selectorIndex];\n address oldFacetAddress = _selectorToFacetAndPosition[selector].facetAddress;\n removeFunction(oldFacetAddress, selector);\n }\n }\n\n /**\n * @notice Add new facet to the proxy\n * @param facetAddress Address of the facet\n */\n function addFacet(address facetAddress) internal {\n enforceHasContractCode(facetAddress, \"Diamond: New facet has no code\");\n _facetFunctionSelectors[facetAddress].facetAddressPosition = _facetAddresses.length;\n _facetAddresses.push(facetAddress);\n }\n\n /**\n * @notice Add function selector to the facet's address mapping\n * @param selector funciton selector need to be added\n * @param selectorPosition funciton selector position\n * @param facetAddress Address of the facet\n */\n function addFunction(bytes4 selector, uint96 selectorPosition, address facetAddress) internal {\n _selectorToFacetAndPosition[selector].functionSelectorPosition = selectorPosition;\n _facetFunctionSelectors[facetAddress].functionSelectors.push(selector);\n _selectorToFacetAndPosition[selector].facetAddress = facetAddress;\n }\n\n /**\n * @notice Remove function selector to the facet's address mapping\n * @param facetAddress Address of the facet\n * @param selector function selectors need to remove in the mapping\n */\n function removeFunction(address facetAddress, bytes4 selector) internal {\n require(facetAddress != address(0), \"LibDiamondCut: Can't remove function that doesn't exist\");\n\n // replace selector with last selector, then delete last selector\n uint256 selectorPosition = _selectorToFacetAndPosition[selector].functionSelectorPosition;\n uint256 lastSelectorPosition = _facetFunctionSelectors[facetAddress].functionSelectors.length - 1;\n // if not the same then replace selector with lastSelector\n if (selectorPosition != lastSelectorPosition) {\n bytes4 lastSelector = _facetFunctionSelectors[facetAddress].functionSelectors[lastSelectorPosition];\n _facetFunctionSelectors[facetAddress].functionSelectors[selectorPosition] = lastSelector;\n _selectorToFacetAndPosition[lastSelector].functionSelectorPosition = uint96(selectorPosition);\n }\n // delete the last selector\n _facetFunctionSelectors[facetAddress].functionSelectors.pop();\n delete _selectorToFacetAndPosition[selector];\n\n // if no more selectors for facet address then delete the facet address\n if (lastSelectorPosition == 0) {\n // replace facet address with last facet address and delete last facet address\n uint256 lastFacetAddressPosition = _facetAddresses.length - 1;\n uint256 facetAddressPosition = _facetFunctionSelectors[facetAddress].facetAddressPosition;\n if (facetAddressPosition != lastFacetAddressPosition) {\n address lastFacetAddress = _facetAddresses[lastFacetAddressPosition];\n _facetAddresses[facetAddressPosition] = lastFacetAddress;\n _facetFunctionSelectors[lastFacetAddress].facetAddressPosition = facetAddressPosition;\n }\n _facetAddresses.pop();\n delete _facetFunctionSelectors[facetAddress];\n }\n }\n\n /**\n * @dev Ensure that the given address has contract code deployed\n * @param _contract The address to check for contract code\n * @param _errorMessage The error message to display if the contract code is not deployed\n */\n function enforceHasContractCode(address _contract, string memory _errorMessage) internal view {\n uint256 contractSize;\n assembly {\n contractSize := extcodesize(_contract)\n }\n require(contractSize != 0, _errorMessage);\n }\n\n // Find facet for function that is called and execute the\n // function if a facet is found and return any value.\n function() external payable {\n address facet = _selectorToFacetAndPosition[msg.sig].facetAddress;\n require(facet != address(0), \"Diamond: Function does not exist\");\n // Execute public function from facet using delegatecall and return any value.\n assembly {\n // copy function selector and any arguments\n calldatacopy(0, 0, calldatasize())\n // execute function call using the facet\n let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0)\n // get any return value\n returndatacopy(0, 0, returndatasize())\n // return any return value or error back to the caller\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n" + }, + "contracts/Comptroller/Diamond/DiamondConsolidated.sol": { + "content": "pragma solidity ^0.5.16;\npragma experimental ABIEncoderV2;\n\nimport \"./facets/MarketFacet.sol\";\nimport \"./facets/PolicyFacet.sol\";\nimport \"./facets/RewardFacet.sol\";\nimport \"./facets/SetterFacet.sol\";\nimport \"./Diamond.sol\";\n\n/**\n * @title DiamondConsolidated\n * @author Venus\n * @notice This contract contains the functions defined in the different facets of the Diamond, plus the getters to the public variables.\n * This contract cannot be deployed, due to its size. Its main purpose is to allow the easy generation of an ABI and the typechain to interact with the\n * Unitroller contract in a simple way\n */\ncontract DiamondConsolidated is Diamond, MarketFacet, PolicyFacet, RewardFacet, SetterFacet {}\n" + }, + "contracts/Comptroller/Diamond/facets/FacetBase.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\n\npragma solidity 0.5.16;\n\nimport { VToken, ComptrollerErrorReporter, ExponentialNoError } from \"../../../Tokens/VTokens/VToken.sol\";\nimport { IVAIVault } from \"../../../Comptroller/ComptrollerInterface.sol\";\nimport { ComptrollerV16Storage } from \"../../../Comptroller/ComptrollerStorage.sol\";\nimport { IAccessControlManagerV5 } from \"@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV5.sol\";\n\nimport { SafeBEP20, IBEP20 } from \"../../../Utils/SafeBEP20.sol\";\n\n/**\n * @title FacetBase\n * @author Venus\n * @notice This facet contract contains functions related to access and checks\n */\ncontract FacetBase is ComptrollerV16Storage, ExponentialNoError, ComptrollerErrorReporter {\n using SafeBEP20 for IBEP20;\n\n /// @notice The initial Venus index for a market\n uint224 public constant venusInitialIndex = 1e36;\n // closeFactorMantissa must be strictly greater than this value\n uint256 internal constant closeFactorMinMantissa = 0.05e18; // 0.05\n // closeFactorMantissa must not exceed this value\n uint256 internal constant closeFactorMaxMantissa = 0.9e18; // 0.9\n // No collateralFactorMantissa may exceed this value\n uint256 internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9\n\n /// @notice Emitted when an account enters a market\n event MarketEntered(VToken indexed vToken, address indexed account);\n\n /// @notice Emitted when XVS is distributed to VAI Vault\n event DistributedVAIVaultVenus(uint256 amount);\n\n /// @notice Reverts if the protocol is paused\n function checkProtocolPauseState() internal view {\n require(!protocolPaused, \"protocol is paused\");\n }\n\n /// @notice Reverts if a certain action is paused on a market\n function checkActionPauseState(address market, Action action) internal view {\n require(!actionPaused(market, action), \"action is paused\");\n }\n\n /// @notice Reverts if the caller is not admin\n function ensureAdmin() internal view {\n require(msg.sender == admin, \"only admin can\");\n }\n\n /// @notice Checks the passed address is nonzero\n function ensureNonzeroAddress(address someone) internal pure {\n require(someone != address(0), \"can't be zero address\");\n }\n\n /// @notice Reverts if the market is not listed\n function ensureListed(Market storage market) internal view {\n require(market.isListed, \"market not listed\");\n }\n\n /// @notice Reverts if the caller is neither admin nor the passed address\n function ensureAdminOr(address privilegedAddress) internal view {\n require(msg.sender == admin || msg.sender == privilegedAddress, \"access denied\");\n }\n\n /// @notice Checks the caller is allowed to call the specified fuction\n function ensureAllowed(string memory functionSig) internal view {\n require(IAccessControlManagerV5(accessControl).isAllowedToCall(msg.sender, functionSig), \"access denied\");\n }\n\n /**\n * @notice Checks if a certain action is paused on a market\n * @param action Action id\n * @param market vToken address\n */\n function actionPaused(address market, Action action) public view returns (bool) {\n return _actionPaused[market][uint256(action)];\n }\n\n /**\n * @notice Get the latest block number\n */\n function getBlockNumber() internal view returns (uint256) {\n return block.number;\n }\n\n /**\n * @notice Get the latest block number with the safe32 check\n */\n function getBlockNumberAsUint32() internal view returns (uint32) {\n return safe32(getBlockNumber(), \"block # > 32 bits\");\n }\n\n /**\n * @notice Transfer XVS to VAI Vault\n */\n function releaseToVault() internal {\n if (releaseStartBlock == 0 || getBlockNumber() < releaseStartBlock) {\n return;\n }\n\n IBEP20 xvs_ = IBEP20(xvs);\n\n uint256 xvsBalance = xvs_.balanceOf(address(this));\n if (xvsBalance == 0) {\n return;\n }\n\n uint256 actualAmount;\n uint256 deltaBlocks = sub_(getBlockNumber(), releaseStartBlock);\n // releaseAmount = venusVAIVaultRate * deltaBlocks\n uint256 releaseAmount_ = mul_(venusVAIVaultRate, deltaBlocks);\n\n if (xvsBalance >= releaseAmount_) {\n actualAmount = releaseAmount_;\n } else {\n actualAmount = xvsBalance;\n }\n\n if (actualAmount < minReleaseAmount) {\n return;\n }\n\n releaseStartBlock = getBlockNumber();\n\n xvs_.safeTransfer(vaiVaultAddress, actualAmount);\n emit DistributedVAIVaultVenus(actualAmount);\n\n IVAIVault(vaiVaultAddress).updatePendingRewards();\n }\n\n /**\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\n * @param vTokenModify The market to hypothetically redeem/borrow in\n * @param account The account to determine liquidity for\n * @param redeemTokens The number of tokens to hypothetically redeem\n * @param borrowAmount The amount of underlying to hypothetically borrow\n * @dev Note that we calculate the exchangeRateStored for each collateral vToken using stored data,\n * without calculating accumulated interest.\n * @return (possible error code,\n hypothetical account liquidity in excess of collateral requirements,\n * hypothetical account shortfall below collateral requirements)\n */\n function getHypotheticalAccountLiquidityInternal(\n address account,\n VToken vTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount\n ) internal view returns (Error, uint256, uint256) {\n (uint256 err, uint256 liquidity, uint256 shortfall) = comptrollerLens.getHypotheticalAccountLiquidity(\n address(this),\n account,\n vTokenModify,\n redeemTokens,\n borrowAmount\n );\n return (Error(err), liquidity, shortfall);\n }\n\n /**\n * @notice Add the market to the borrower's \"assets in\" for liquidity calculations\n * @param vToken The market to enter\n * @param borrower The address of the account to modify\n * @return Success indicator for whether the market was entered\n */\n function addToMarketInternal(VToken vToken, address borrower) internal returns (Error) {\n checkActionPauseState(address(vToken), Action.ENTER_MARKET);\n Market storage marketToJoin = markets[address(vToken)];\n ensureListed(marketToJoin);\n if (marketToJoin.accountMembership[borrower]) {\n // already joined\n return Error.NO_ERROR;\n }\n // survived the gauntlet, add to list\n // NOTE: we store these somewhat redundantly as a significant optimization\n // this avoids having to iterate through the list for the most common use cases\n // that is, only when we need to perform liquidity checks\n // and not whenever we want to check if an account is in a particular market\n marketToJoin.accountMembership[borrower] = true;\n accountAssets[borrower].push(vToken);\n\n emit MarketEntered(vToken, borrower);\n\n return Error.NO_ERROR;\n }\n\n /**\n * @notice Checks for the user is allowed to redeem tokens\n * @param vToken Address of the market\n * @param redeemer Address of the user\n * @param redeemTokens Amount of tokens to redeem\n * @return Success indicator for redeem is allowed or not\n */\n function redeemAllowedInternal(\n address vToken,\n address redeemer,\n uint256 redeemTokens\n ) internal view returns (uint256) {\n ensureListed(markets[vToken]);\n /* If the redeemer is not 'in' the market, then we can bypass the liquidity check */\n if (!markets[vToken].accountMembership[redeemer]) {\n return uint256(Error.NO_ERROR);\n }\n /* Otherwise, perform a hypothetical liquidity check to guard against shortfall */\n (Error err, , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n redeemer,\n VToken(vToken),\n redeemTokens,\n 0\n );\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n if (shortfall != 0) {\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\n }\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Returns the XVS address\n * @return The address of XVS token\n */\n function getXVSAddress() external view returns (address) {\n return xvs;\n }\n}\n" + }, + "contracts/Comptroller/Diamond/facets/MarketFacet.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\n\npragma solidity 0.5.16;\n\nimport { IMarketFacet } from \"../interfaces/IMarketFacet.sol\";\nimport { FacetBase } from \"./FacetBase.sol\";\nimport { VToken } from \"../../../Tokens/VTokens/VToken.sol\";\n\n/**\n * @title MarketFacet\n * @author Venus\n * @dev This facet contains all the methods related to the market's management in the pool\n * @notice This facet contract contains functions regarding markets\n */\ncontract MarketFacet is IMarketFacet, FacetBase {\n /// @notice Emitted when an admin supports a market\n event MarketListed(VToken indexed vToken);\n\n /// @notice Emitted when an account exits a market\n event MarketExited(VToken indexed vToken, address indexed account);\n\n /// @notice Emitted when the borrowing or redeeming delegate rights are updated for an account\n event DelegateUpdated(address indexed approver, address indexed delegate, bool approved);\n\n /// @notice Emitted when an admin unlists a market\n event MarketUnlisted(address indexed vToken);\n\n /// @notice Indicator that this is a Comptroller contract (for inspection)\n function isComptroller() public pure returns (bool) {\n return true;\n }\n\n /**\n * @notice Returns the assets an account has entered\n * @param account The address of the account to pull assets for\n * @return A dynamic list with the assets the account has entered\n */\n function getAssetsIn(address account) external view returns (VToken[] memory) {\n uint256 len;\n VToken[] memory _accountAssets = accountAssets[account];\n uint256 _accountAssetsLength = _accountAssets.length;\n\n VToken[] memory assetsIn = new VToken[](_accountAssetsLength);\n\n for (uint256 i; i < _accountAssetsLength; ++i) {\n Market memory market = markets[address(_accountAssets[i])];\n if (market.isListed) {\n assetsIn[len] = _accountAssets[i];\n ++len;\n }\n }\n\n assembly {\n mstore(assetsIn, len)\n }\n\n return assetsIn;\n }\n\n /**\n * @notice Return all of the markets\n * @dev The automatic getter may be used to access an individual market\n * @return The list of market addresses\n */\n function getAllMarkets() external view returns (VToken[] memory) {\n return allMarkets;\n }\n\n /**\n * @notice Calculate number of tokens of collateral asset to seize given an underlying amount\n * @dev Used in liquidation (called in vToken.liquidateBorrowFresh)\n * @param vTokenBorrowed The address of the borrowed vToken\n * @param vTokenCollateral The address of the collateral vToken\n * @param actualRepayAmount The amount of vTokenBorrowed underlying to convert into vTokenCollateral tokens\n * @return (errorCode, number of vTokenCollateral tokens to be seized in a liquidation)\n */\n function liquidateCalculateSeizeTokens(\n address vTokenBorrowed,\n address vTokenCollateral,\n uint256 actualRepayAmount\n ) external view returns (uint256, uint256) {\n (uint256 err, uint256 seizeTokens) = comptrollerLens.liquidateCalculateSeizeTokens(\n address(this),\n vTokenBorrowed,\n vTokenCollateral,\n actualRepayAmount\n );\n return (err, seizeTokens);\n }\n\n /**\n * @notice Calculate number of tokens of collateral asset to seize given an underlying amount\n * @dev Used in liquidation (called in vToken.liquidateBorrowFresh)\n * @param vTokenCollateral The address of the collateral vToken\n * @param actualRepayAmount The amount of vTokenBorrowed underlying to convert into vTokenCollateral tokens\n * @return (errorCode, number of vTokenCollateral tokens to be seized in a liquidation)\n */\n function liquidateVAICalculateSeizeTokens(\n address vTokenCollateral,\n uint256 actualRepayAmount\n ) external view returns (uint256, uint256) {\n (uint256 err, uint256 seizeTokens) = comptrollerLens.liquidateVAICalculateSeizeTokens(\n address(this),\n vTokenCollateral,\n actualRepayAmount\n );\n return (err, seizeTokens);\n }\n\n /**\n * @notice Returns whether the given account is entered in the given asset\n * @param account The address of the account to check\n * @param vToken The vToken to check\n * @return True if the account is in the asset, otherwise false\n */\n function checkMembership(address account, VToken vToken) external view returns (bool) {\n return markets[address(vToken)].accountMembership[account];\n }\n\n /**\n * @notice Add assets to be included in account liquidity calculation\n * @param vTokens The list of addresses of the vToken markets to be enabled\n * @return Success indicator for whether each corresponding market was entered\n */\n function enterMarkets(address[] calldata vTokens) external returns (uint256[] memory) {\n uint256 len = vTokens.length;\n\n uint256[] memory results = new uint256[](len);\n for (uint256 i; i < len; ++i) {\n results[i] = uint256(addToMarketInternal(VToken(vTokens[i]), msg.sender));\n }\n\n return results;\n }\n\n /**\n * @notice Unlist a market by setting isListed to false\n * @dev Checks if market actions are paused and borrowCap/supplyCap/CF are set to 0\n * @param market The address of the market (vToken) to unlist\n * @return uint256 0=success, otherwise a failure. (See enum Error for details)\n */\n function unlistMarket(address market) external returns (uint256) {\n ensureAllowed(\"unlistMarket(address)\");\n\n Market storage _market = markets[market];\n\n if (!_market.isListed) {\n return fail(Error.MARKET_NOT_LISTED, FailureInfo.UNLIST_MARKET_NOT_LISTED);\n }\n\n require(actionPaused(market, Action.BORROW), \"borrow action is not paused\");\n require(actionPaused(market, Action.MINT), \"mint action is not paused\");\n require(actionPaused(market, Action.REDEEM), \"redeem action is not paused\");\n require(actionPaused(market, Action.REPAY), \"repay action is not paused\");\n require(actionPaused(market, Action.ENTER_MARKET), \"enter market action is not paused\");\n require(actionPaused(market, Action.LIQUIDATE), \"liquidate action is not paused\");\n require(actionPaused(market, Action.SEIZE), \"seize action is not paused\");\n require(actionPaused(market, Action.TRANSFER), \"transfer action is not paused\");\n require(actionPaused(market, Action.EXIT_MARKET), \"exit market action is not paused\");\n\n require(borrowCaps[market] == 0, \"borrow cap is not 0\");\n require(supplyCaps[market] == 0, \"supply cap is not 0\");\n\n require(_market.collateralFactorMantissa == 0, \"collateral factor is not 0\");\n\n _market.isListed = false;\n emit MarketUnlisted(market);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Removes asset from sender's account liquidity calculation\n * @dev Sender must not have an outstanding borrow balance in the asset,\n * or be providing necessary collateral for an outstanding borrow\n * @param vTokenAddress The address of the asset to be removed\n * @return Whether or not the account successfully exited the market\n */\n function exitMarket(address vTokenAddress) external returns (uint256) {\n checkActionPauseState(vTokenAddress, Action.EXIT_MARKET);\n\n VToken vToken = VToken(vTokenAddress);\n /* Get sender tokensHeld and amountOwed underlying from the vToken */\n (uint256 oErr, uint256 tokensHeld, uint256 amountOwed, ) = vToken.getAccountSnapshot(msg.sender);\n require(oErr == 0, \"getAccountSnapshot failed\"); // semi-opaque error code\n\n /* Fail if the sender has a borrow balance */\n if (amountOwed != 0) {\n return fail(Error.NONZERO_BORROW_BALANCE, FailureInfo.EXIT_MARKET_BALANCE_OWED);\n }\n\n /* Fail if the sender is not permitted to redeem all of their tokens */\n uint256 allowed = redeemAllowedInternal(vTokenAddress, msg.sender, tokensHeld);\n if (allowed != 0) {\n return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed);\n }\n\n Market storage marketToExit = markets[address(vToken)];\n\n /* Return true if the sender is not already ‘in’ the market */\n if (!marketToExit.accountMembership[msg.sender]) {\n return uint256(Error.NO_ERROR);\n }\n\n /* Set vToken account membership to false */\n delete marketToExit.accountMembership[msg.sender];\n\n /* Delete vToken from the account’s list of assets */\n // In order to delete vToken, copy last item in list to location of item to be removed, reduce length by 1\n VToken[] storage userAssetList = accountAssets[msg.sender];\n uint256 len = userAssetList.length;\n uint256 i;\n for (; i < len; ++i) {\n if (userAssetList[i] == vToken) {\n userAssetList[i] = userAssetList[len - 1];\n userAssetList.length--;\n break;\n }\n }\n\n // We *must* have found the asset in the list or our redundant data structure is broken\n assert(i < len);\n\n emit MarketExited(vToken, msg.sender);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Add the market to the markets mapping and set it as listed\n * @dev Allows a privileged role to add and list markets to the Comptroller\n * @param vToken The address of the market (token) to list\n * @return uint256 0=success, otherwise a failure. (See enum Error for details)\n */\n function _supportMarket(VToken vToken) external returns (uint256) {\n ensureAllowed(\"_supportMarket(address)\");\n\n if (markets[address(vToken)].isListed) {\n return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);\n }\n\n vToken.isVToken(); // Sanity check to make sure its really a VToken\n\n // Note that isVenus is not in active use anymore\n Market storage newMarket = markets[address(vToken)];\n newMarket.isListed = true;\n newMarket.isVenus = false;\n newMarket.collateralFactorMantissa = 0;\n\n _addMarketInternal(vToken);\n _initializeMarket(address(vToken));\n\n emit MarketListed(vToken);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Grants or revokes the borrowing or redeeming delegate rights to / from an account\n * If allowed, the delegate will be able to borrow funds on behalf of the sender\n * Upon a delegated borrow, the delegate will receive the funds, and the borrower\n * will see the debt on their account\n * Upon a delegated redeem, the delegate will receive the redeemed amount and the approver\n * will see a deduction in his vToken balance\n * @param delegate The address to update the rights for\n * @param approved Whether to grant (true) or revoke (false) the borrowing or redeeming rights\n */\n function updateDelegate(address delegate, bool approved) external {\n ensureNonzeroAddress(delegate);\n require(approvedDelegates[msg.sender][delegate] != approved, \"Delegation status unchanged\");\n\n _updateDelegate(msg.sender, delegate, approved);\n }\n\n function _updateDelegate(address approver, address delegate, bool approved) internal {\n approvedDelegates[approver][delegate] = approved;\n emit DelegateUpdated(approver, delegate, approved);\n }\n\n function _addMarketInternal(VToken vToken) internal {\n uint256 allMarketsLength = allMarkets.length;\n for (uint256 i; i < allMarketsLength; ++i) {\n require(allMarkets[i] != vToken, \"already added\");\n }\n allMarkets.push(vToken);\n }\n\n function _initializeMarket(address vToken) internal {\n uint32 blockNumber = getBlockNumberAsUint32();\n\n VenusMarketState storage supplyState = venusSupplyState[vToken];\n VenusMarketState storage borrowState = venusBorrowState[vToken];\n\n /*\n * Update market state indices\n */\n if (supplyState.index == 0) {\n // Initialize supply state index with default value\n supplyState.index = venusInitialIndex;\n }\n\n if (borrowState.index == 0) {\n // Initialize borrow state index with default value\n borrowState.index = venusInitialIndex;\n }\n\n /*\n * Update market state block numbers\n */\n supplyState.block = borrowState.block = blockNumber;\n }\n}\n" + }, + "contracts/Comptroller/Diamond/facets/PolicyFacet.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\n\npragma solidity 0.5.16;\n\nimport { VToken } from \"../../../Tokens/VTokens/VToken.sol\";\nimport { IPolicyFacet } from \"../interfaces/IPolicyFacet.sol\";\n\nimport { XVSRewardsHelper } from \"./XVSRewardsHelper.sol\";\n\n/**\n * @title PolicyFacet\n * @author Venus\n * @dev This facet contains all the hooks used while transferring the assets\n * @notice This facet contract contains all the external pre-hook functions related to vToken\n */\ncontract PolicyFacet is IPolicyFacet, XVSRewardsHelper {\n /// @notice Emitted when a new borrow-side XVS speed is calculated for a market\n event VenusBorrowSpeedUpdated(VToken indexed vToken, uint256 newSpeed);\n\n /// @notice Emitted when a new supply-side XVS speed is calculated for a market\n event VenusSupplySpeedUpdated(VToken indexed vToken, uint256 newSpeed);\n\n /**\n * @notice Checks if the account should be allowed to mint tokens in the given market\n * @param vToken The market to verify the mint against\n * @param minter The account which would get the minted tokens\n * @param mintAmount The amount of underlying being supplied to the market in exchange for tokens\n * @return 0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function mintAllowed(address vToken, address minter, uint256 mintAmount) external returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n checkProtocolPauseState();\n checkActionPauseState(vToken, Action.MINT);\n ensureListed(markets[vToken]);\n\n uint256 supplyCap = supplyCaps[vToken];\n require(supplyCap != 0, \"market supply cap is 0\");\n\n uint256 vTokenSupply = VToken(vToken).totalSupply();\n Exp memory exchangeRate = Exp({ mantissa: VToken(vToken).exchangeRateStored() });\n uint256 nextTotalSupply = mul_ScalarTruncateAddUInt(exchangeRate, vTokenSupply, mintAmount);\n require(nextTotalSupply <= supplyCap, \"market supply cap reached\");\n\n // Keep the flywheel moving\n updateVenusSupplyIndex(vToken);\n distributeSupplierVenus(vToken, minter);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates mint, accrues interest and updates score in prime. Reverts on rejection. May emit logs.\n * @param vToken Asset being minted\n * @param minter The address minting the tokens\n * @param actualMintAmount The amount of the underlying asset being minted\n * @param mintTokens The number of tokens being minted\n */\n // solhint-disable-next-line no-unused-vars\n function mintVerify(address vToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external {\n if (address(prime) != address(0)) {\n prime.accrueInterestAndUpdateScore(minter, vToken);\n }\n }\n\n /**\n * @notice Checks if the account should be allowed to redeem tokens in the given market\n * @param vToken The market to verify the redeem against\n * @param redeemer The account which would redeem the tokens\n * @param redeemTokens The number of vTokens to exchange for the underlying asset in the market\n * @return 0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function redeemAllowed(address vToken, address redeemer, uint256 redeemTokens) external returns (uint256) {\n checkProtocolPauseState();\n checkActionPauseState(vToken, Action.REDEEM);\n\n uint256 allowed = redeemAllowedInternal(vToken, redeemer, redeemTokens);\n if (allowed != uint256(Error.NO_ERROR)) {\n return allowed;\n }\n\n // Keep the flywheel moving\n updateVenusSupplyIndex(vToken);\n distributeSupplierVenus(vToken, redeemer);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates redeem, accrues interest and updates score in prime. Reverts on rejection. May emit logs.\n * @param vToken Asset being redeemed\n * @param redeemer The address redeeming the tokens\n * @param redeemAmount The amount of the underlying asset being redeemed\n * @param redeemTokens The number of tokens being redeemed\n */\n function redeemVerify(address vToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external {\n require(redeemTokens != 0 || redeemAmount == 0, \"redeemTokens zero\");\n if (address(prime) != address(0)) {\n prime.accrueInterestAndUpdateScore(redeemer, vToken);\n }\n }\n\n /**\n * @notice Checks if the account should be allowed to borrow the underlying asset of the given market\n * @param vToken The market to verify the borrow against\n * @param borrower The account which would borrow the asset\n * @param borrowAmount The amount of underlying the account would borrow\n * @return 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function borrowAllowed(address vToken, address borrower, uint256 borrowAmount) external returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n checkProtocolPauseState();\n checkActionPauseState(vToken, Action.BORROW);\n ensureListed(markets[vToken]);\n\n uint256 borrowCap = borrowCaps[vToken];\n require(borrowCap != 0, \"market borrow cap is 0\");\n\n if (!markets[vToken].accountMembership[borrower]) {\n // only vTokens may call borrowAllowed if borrower not in market\n require(msg.sender == vToken, \"sender must be vToken\");\n\n // attempt to add borrower to the market\n Error err = addToMarketInternal(VToken(vToken), borrower);\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n }\n\n if (oracle.getUnderlyingPrice(VToken(vToken)) == 0) {\n return uint256(Error.PRICE_ERROR);\n }\n\n uint256 nextTotalBorrows = add_(VToken(vToken).totalBorrows(), borrowAmount);\n require(nextTotalBorrows <= borrowCap, \"market borrow cap reached\");\n\n (Error err, , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n borrower,\n VToken(vToken),\n 0,\n borrowAmount\n );\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n if (shortfall != 0) {\n return uint256(Error.INSUFFICIENT_LIQUIDITY);\n }\n\n // Keep the flywheel moving\n Exp memory borrowIndex = Exp({ mantissa: VToken(vToken).borrowIndex() });\n updateVenusBorrowIndex(vToken, borrowIndex);\n distributeBorrowerVenus(vToken, borrower, borrowIndex);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates borrow, accrues interest and updates score in prime. Reverts on rejection. May emit logs.\n * @param vToken Asset whose underlying is being borrowed\n * @param borrower The address borrowing the underlying\n * @param borrowAmount The amount of the underlying asset requested to borrow\n */\n // solhint-disable-next-line no-unused-vars\n function borrowVerify(address vToken, address borrower, uint256 borrowAmount) external {\n if (address(prime) != address(0)) {\n prime.accrueInterestAndUpdateScore(borrower, vToken);\n }\n }\n\n /**\n * @notice Checks if the account should be allowed to repay a borrow in the given market\n * @param vToken The market to verify the repay against\n * @param payer The account which would repay the asset\n * @param borrower The account which borrowed the asset\n * @param repayAmount The amount of the underlying asset the account would repay\n * @return 0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function repayBorrowAllowed(\n address vToken,\n address payer, // solhint-disable-line no-unused-vars\n address borrower,\n uint256 repayAmount // solhint-disable-line no-unused-vars\n ) external returns (uint256) {\n checkProtocolPauseState();\n checkActionPauseState(vToken, Action.REPAY);\n ensureListed(markets[vToken]);\n\n // Keep the flywheel moving\n Exp memory borrowIndex = Exp({ mantissa: VToken(vToken).borrowIndex() });\n updateVenusBorrowIndex(vToken, borrowIndex);\n distributeBorrowerVenus(vToken, borrower, borrowIndex);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates repayBorrow, accrues interest and updates score in prime. Reverts on rejection. May emit logs.\n * @param vToken Asset being repaid\n * @param payer The address repaying the borrow\n * @param borrower The address of the borrower\n * @param actualRepayAmount The amount of underlying being repaid\n */\n function repayBorrowVerify(\n address vToken,\n address payer, // solhint-disable-line no-unused-vars\n address borrower,\n uint256 actualRepayAmount, // solhint-disable-line no-unused-vars\n uint256 borrowerIndex // solhint-disable-line no-unused-vars\n ) external {\n if (address(prime) != address(0)) {\n prime.accrueInterestAndUpdateScore(borrower, vToken);\n }\n }\n\n /**\n * @notice Checks if the liquidation should be allowed to occur\n * @param vTokenBorrowed Asset which was borrowed by the borrower\n * @param vTokenCollateral Asset which was used as collateral and will be seized\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param repayAmount The amount of underlying being repaid\n */\n function liquidateBorrowAllowed(\n address vTokenBorrowed,\n address vTokenCollateral,\n address liquidator,\n address borrower,\n uint256 repayAmount\n ) external view returns (uint256) {\n checkProtocolPauseState();\n\n // if we want to pause liquidating to vTokenCollateral, we should pause seizing\n checkActionPauseState(vTokenBorrowed, Action.LIQUIDATE);\n\n if (liquidatorContract != address(0) && liquidator != liquidatorContract) {\n return uint256(Error.UNAUTHORIZED);\n }\n\n ensureListed(markets[vTokenCollateral]);\n\n uint256 borrowBalance;\n if (address(vTokenBorrowed) != address(vaiController)) {\n ensureListed(markets[vTokenBorrowed]);\n borrowBalance = VToken(vTokenBorrowed).borrowBalanceStored(borrower);\n } else {\n borrowBalance = vaiController.getVAIRepayAmount(borrower);\n }\n\n if (isForcedLiquidationEnabled[vTokenBorrowed] || isForcedLiquidationEnabledForUser[borrower][vTokenBorrowed]) {\n if (repayAmount > borrowBalance) {\n return uint(Error.TOO_MUCH_REPAY);\n }\n return uint(Error.NO_ERROR);\n }\n\n /* The borrower must have shortfall in order to be liquidatable */\n (Error err, , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(borrower, VToken(address(0)), 0, 0);\n if (err != Error.NO_ERROR) {\n return uint256(err);\n }\n if (shortfall == 0) {\n return uint256(Error.INSUFFICIENT_SHORTFALL);\n }\n\n // The liquidator may not repay more than what is allowed by the closeFactor\n //-- maxClose = multipy of closeFactorMantissa and borrowBalance\n if (repayAmount > mul_ScalarTruncate(Exp({ mantissa: closeFactorMantissa }), borrowBalance)) {\n return uint256(Error.TOO_MUCH_REPAY);\n }\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates liquidateBorrow, accrues interest and updates score in prime. Reverts on rejection. May emit logs.\n * @param vTokenBorrowed Asset which was borrowed by the borrower\n * @param vTokenCollateral Asset which was used as collateral and will be seized\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param actualRepayAmount The amount of underlying being repaid\n * @param seizeTokens The amount of collateral token that will be seized\n */\n function liquidateBorrowVerify(\n address vTokenBorrowed,\n address vTokenCollateral, // solhint-disable-line no-unused-vars\n address liquidator,\n address borrower,\n uint256 actualRepayAmount, // solhint-disable-line no-unused-vars\n uint256 seizeTokens // solhint-disable-line no-unused-vars\n ) external {\n if (address(prime) != address(0)) {\n prime.accrueInterestAndUpdateScore(borrower, vTokenBorrowed);\n prime.accrueInterestAndUpdateScore(liquidator, vTokenBorrowed);\n }\n }\n\n /**\n * @notice Checks if the seizing of assets should be allowed to occur\n * @param vTokenCollateral Asset which was used as collateral and will be seized\n * @param vTokenBorrowed Asset which was borrowed by the borrower\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param seizeTokens The number of collateral tokens to seize\n */\n function seizeAllowed(\n address vTokenCollateral,\n address vTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens // solhint-disable-line no-unused-vars\n ) external returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n checkProtocolPauseState();\n checkActionPauseState(vTokenCollateral, Action.SEIZE);\n\n Market storage market = markets[vTokenCollateral];\n\n // We've added VAIController as a borrowed token list check for seize\n ensureListed(market);\n\n if (!market.accountMembership[borrower]) {\n return uint256(Error.MARKET_NOT_COLLATERAL);\n }\n\n if (address(vTokenBorrowed) != address(vaiController)) {\n ensureListed(markets[vTokenBorrowed]);\n }\n\n if (VToken(vTokenCollateral).comptroller() != VToken(vTokenBorrowed).comptroller()) {\n return uint256(Error.COMPTROLLER_MISMATCH);\n }\n\n // Keep the flywheel moving\n updateVenusSupplyIndex(vTokenCollateral);\n distributeSupplierVenus(vTokenCollateral, borrower);\n distributeSupplierVenus(vTokenCollateral, liquidator);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates seize, accrues interest and updates score in prime. Reverts on rejection. May emit logs.\n * @param vTokenCollateral Asset which was used as collateral and will be seized\n * @param vTokenBorrowed Asset which was borrowed by the borrower\n * @param liquidator The address repaying the borrow and seizing the collateral\n * @param borrower The address of the borrower\n * @param seizeTokens The number of collateral tokens to seize\n */\n function seizeVerify(\n address vTokenCollateral,\n address vTokenBorrowed, // solhint-disable-line no-unused-vars\n address liquidator,\n address borrower,\n uint256 seizeTokens // solhint-disable-line no-unused-vars\n ) external {\n if (address(prime) != address(0)) {\n prime.accrueInterestAndUpdateScore(borrower, vTokenCollateral);\n prime.accrueInterestAndUpdateScore(liquidator, vTokenCollateral);\n }\n }\n\n /**\n * @notice Checks if the account should be allowed to transfer tokens in the given market\n * @param vToken The market to verify the transfer against\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n * @param transferTokens The number of vTokens to transfer\n * @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)\n */\n function transferAllowed(\n address vToken,\n address src,\n address dst,\n uint256 transferTokens\n ) external returns (uint256) {\n // Pausing is a very serious situation - we revert to sound the alarms\n checkProtocolPauseState();\n checkActionPauseState(vToken, Action.TRANSFER);\n\n // Currently the only consideration is whether or not\n // the src is allowed to redeem this many tokens\n uint256 allowed = redeemAllowedInternal(vToken, src, transferTokens);\n if (allowed != uint256(Error.NO_ERROR)) {\n return allowed;\n }\n\n // Keep the flywheel moving\n updateVenusSupplyIndex(vToken);\n distributeSupplierVenus(vToken, src);\n distributeSupplierVenus(vToken, dst);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Validates transfer, accrues interest and updates score in prime. Reverts on rejection. May emit logs.\n * @param vToken Asset being transferred\n * @param src The account which sources the tokens\n * @param dst The account which receives the tokens\n * @param transferTokens The number of vTokens to transfer\n */\n // solhint-disable-next-line no-unused-vars\n function transferVerify(address vToken, address src, address dst, uint256 transferTokens) external {\n if (address(prime) != address(0)) {\n prime.accrueInterestAndUpdateScore(src, vToken);\n prime.accrueInterestAndUpdateScore(dst, vToken);\n }\n }\n\n /**\n * @notice Determine the current account liquidity wrt collateral requirements\n * @return (possible error code (semi-opaque),\n account liquidity in excess of collateral requirements,\n * account shortfall below collateral requirements)\n */\n function getAccountLiquidity(address account) external view returns (uint256, uint256, uint256) {\n (Error err, uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n account,\n VToken(address(0)),\n 0,\n 0\n );\n\n return (uint256(err), liquidity, shortfall);\n }\n\n /**\n * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed\n * @param vTokenModify The market to hypothetically redeem/borrow in\n * @param account The account to determine liquidity for\n * @param redeemTokens The number of tokens to hypothetically redeem\n * @param borrowAmount The amount of underlying to hypothetically borrow\n * @return (possible error code (semi-opaque),\n hypothetical account liquidity in excess of collateral requirements,\n * hypothetical account shortfall below collateral requirements)\n */\n function getHypotheticalAccountLiquidity(\n address account,\n address vTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount\n ) external view returns (uint256, uint256, uint256) {\n (Error err, uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternal(\n account,\n VToken(vTokenModify),\n redeemTokens,\n borrowAmount\n );\n return (uint256(err), liquidity, shortfall);\n }\n\n // setter functionality\n /**\n * @notice Set XVS speed for a single market\n * @dev Allows the contract admin to set XVS speed for a market\n * @param vTokens The market whose XVS speed to update\n * @param supplySpeeds New XVS speed for supply\n * @param borrowSpeeds New XVS speed for borrow\n */\n function _setVenusSpeeds(\n VToken[] calldata vTokens,\n uint256[] calldata supplySpeeds,\n uint256[] calldata borrowSpeeds\n ) external {\n ensureAdmin();\n\n uint256 numTokens = vTokens.length;\n require(numTokens == supplySpeeds.length && numTokens == borrowSpeeds.length, \"invalid input\");\n\n for (uint256 i; i < numTokens; ++i) {\n ensureNonzeroAddress(address(vTokens[i]));\n setVenusSpeedInternal(vTokens[i], supplySpeeds[i], borrowSpeeds[i]);\n }\n }\n\n function setVenusSpeedInternal(VToken vToken, uint256 supplySpeed, uint256 borrowSpeed) internal {\n ensureListed(markets[address(vToken)]);\n\n if (venusSupplySpeeds[address(vToken)] != supplySpeed) {\n // Supply speed updated so let's update supply state to ensure that\n // 1. XVS accrued properly for the old speed, and\n // 2. XVS accrued at the new speed starts after this block.\n\n updateVenusSupplyIndex(address(vToken));\n // Update speed and emit event\n venusSupplySpeeds[address(vToken)] = supplySpeed;\n emit VenusSupplySpeedUpdated(vToken, supplySpeed);\n }\n\n if (venusBorrowSpeeds[address(vToken)] != borrowSpeed) {\n // Borrow speed updated so let's update borrow state to ensure that\n // 1. XVS accrued properly for the old speed, and\n // 2. XVS accrued at the new speed starts after this block.\n Exp memory borrowIndex = Exp({ mantissa: vToken.borrowIndex() });\n updateVenusBorrowIndex(address(vToken), borrowIndex);\n\n // Update speed and emit event\n venusBorrowSpeeds[address(vToken)] = borrowSpeed;\n emit VenusBorrowSpeedUpdated(vToken, borrowSpeed);\n }\n }\n}\n" + }, + "contracts/Comptroller/Diamond/facets/RewardFacet.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\n\npragma solidity 0.5.16;\n\nimport { VToken } from \"../../../Tokens/VTokens/VToken.sol\";\nimport { IRewardFacet } from \"../interfaces/IRewardFacet.sol\";\nimport { XVSRewardsHelper } from \"./XVSRewardsHelper.sol\";\nimport { SafeBEP20, IBEP20 } from \"../../../Utils/SafeBEP20.sol\";\nimport { VBep20Interface } from \"../../../Tokens/VTokens/VTokenInterfaces.sol\";\n\n/**\n * @title RewardFacet\n * @author Venus\n * @dev This facet contains all the methods related to the reward functionality\n * @notice This facet contract provides the external functions related to all claims and rewards of the protocol\n */\ncontract RewardFacet is IRewardFacet, XVSRewardsHelper {\n /// @notice Emitted when Venus is granted by admin\n event VenusGranted(address indexed recipient, uint256 amount);\n\n /// @notice Emitted when XVS are seized for the holder\n event VenusSeized(address indexed holder, uint256 amount);\n\n using SafeBEP20 for IBEP20;\n\n /**\n * @notice Claim all the xvs accrued by holder in all markets and VAI\n * @param holder The address to claim XVS for\n */\n function claimVenus(address holder) public {\n return claimVenus(holder, allMarkets);\n }\n\n /**\n * @notice Claim all the xvs accrued by holder in the specified markets\n * @param holder The address to claim XVS for\n * @param vTokens The list of markets to claim XVS in\n */\n function claimVenus(address holder, VToken[] memory vTokens) public {\n address[] memory holders = new address[](1);\n holders[0] = holder;\n claimVenus(holders, vTokens, true, true);\n }\n\n /**\n * @notice Claim all xvs accrued by the holders\n * @param holders The addresses to claim XVS for\n * @param vTokens The list of markets to claim XVS in\n * @param borrowers Whether or not to claim XVS earned by borrowing\n * @param suppliers Whether or not to claim XVS earned by supplying\n */\n function claimVenus(address[] memory holders, VToken[] memory vTokens, bool borrowers, bool suppliers) public {\n claimVenus(holders, vTokens, borrowers, suppliers, false);\n }\n\n /**\n * @notice Claim all the xvs accrued by holder in all markets, a shorthand for `claimVenus` with collateral set to `true`\n * @param holder The address to claim XVS for\n */\n function claimVenusAsCollateral(address holder) external {\n address[] memory holders = new address[](1);\n holders[0] = holder;\n claimVenus(holders, allMarkets, true, true, true);\n }\n\n /**\n * @notice Transfer XVS to the user with user's shortfall considered\n * @dev Note: If there is not enough XVS, we do not perform the transfer all\n * @param user The address of the user to transfer XVS to\n * @param amount The amount of XVS to (possibly) transfer\n * @param shortfall The shortfall of the user\n * @param collateral Whether or not we will use user's venus reward as collateral to pay off the debt\n * @return The amount of XVS which was NOT transferred to the user\n */\n function grantXVSInternal(\n address user,\n uint256 amount,\n uint256 shortfall,\n bool collateral\n ) internal returns (uint256) {\n // If the user is blacklisted, they can't get XVS rewards\n require(\n user != 0xEF044206Db68E40520BfA82D45419d498b4bc7Bf &&\n user != 0x7589dD3355DAE848FDbF75044A3495351655cB1A &&\n user != 0x33df7a7F6D44307E1e5F3B15975b47515e5524c0 &&\n user != 0x24e77E5b74B30b026E9996e4bc3329c881e24968,\n \"Blacklisted\"\n );\n\n IBEP20 xvs_ = IBEP20(xvs);\n\n if (amount == 0 || amount > xvs_.balanceOf(address(this))) {\n return amount;\n }\n\n if (shortfall == 0) {\n xvs_.safeTransfer(user, amount);\n return 0;\n }\n // If user's bankrupt and doesn't use pending xvs as collateral, don't grant\n // anything, otherwise, we will transfer the pending xvs as collateral to\n // vXVS token and mint vXVS for the user\n //\n // If mintBehalf failed, don't grant any xvs\n require(collateral, \"bankrupt\");\n\n address xvsVToken_ = xvsVToken;\n\n xvs_.safeApprove(xvsVToken_, 0);\n xvs_.safeApprove(xvsVToken_, amount);\n require(VBep20Interface(xvsVToken_).mintBehalf(user, amount) == uint256(Error.NO_ERROR), \"mint behalf error\");\n\n // set venusAccrued[user] to 0\n return 0;\n }\n\n /*** Venus Distribution Admin ***/\n\n /**\n * @notice Transfer XVS to the recipient\n * @dev Allows the contract admin to transfer XVS to any recipient based on the recipient's shortfall\n * Note: If there is not enough XVS, we do not perform the transfer all\n * @param recipient The address of the recipient to transfer XVS to\n * @param amount The amount of XVS to (possibly) transfer\n */\n function _grantXVS(address recipient, uint256 amount) external {\n ensureAdmin();\n uint256 amountLeft = grantXVSInternal(recipient, amount, 0, false);\n require(amountLeft == 0, \"no xvs\");\n emit VenusGranted(recipient, amount);\n }\n\n /**\n * @dev Seize XVS tokens from the specified holders and transfer to recipient\n * @notice Seize XVS rewards allocated to holders\n * @param holders Addresses of the XVS holders\n * @param recipient Address of the XVS token recipient\n * @return The total amount of XVS tokens seized and transferred to recipient\n */\n function seizeVenus(address[] calldata holders, address recipient) external returns (uint256) {\n ensureAllowed(\"seizeVenus(address[],address)\");\n\n uint256 holdersLength = holders.length;\n uint256 totalHoldings;\n\n updateAndDistributeRewardsInternal(holders, allMarkets, true, true);\n for (uint256 j; j < holdersLength; ++j) {\n address holder = holders[j];\n uint256 userHolding = venusAccrued[holder];\n\n if (userHolding != 0) {\n totalHoldings += userHolding;\n delete venusAccrued[holder];\n }\n\n emit VenusSeized(holder, userHolding);\n }\n\n if (totalHoldings != 0) {\n IBEP20(xvs).safeTransfer(recipient, totalHoldings);\n emit VenusGranted(recipient, totalHoldings);\n }\n\n return totalHoldings;\n }\n\n /**\n * @notice Claim all xvs accrued by the holders\n * @param holders The addresses to claim XVS for\n * @param vTokens The list of markets to claim XVS in\n * @param borrowers Whether or not to claim XVS earned by borrowing\n * @param suppliers Whether or not to claim XVS earned by supplying\n * @param collateral Whether or not to use XVS earned as collateral, only takes effect when the holder has a shortfall\n */\n function claimVenus(\n address[] memory holders,\n VToken[] memory vTokens,\n bool borrowers,\n bool suppliers,\n bool collateral\n ) public {\n uint256 holdersLength = holders.length;\n\n updateAndDistributeRewardsInternal(holders, vTokens, borrowers, suppliers);\n for (uint256 j; j < holdersLength; ++j) {\n address holder = holders[j];\n\n // If there is a positive shortfall, the XVS reward is accrued,\n // but won't be granted to this holder\n (, , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(holder, VToken(address(0)), 0, 0);\n\n uint256 value = venusAccrued[holder];\n delete venusAccrued[holder];\n\n uint256 returnAmount = grantXVSInternal(holder, value, shortfall, collateral);\n\n // returnAmount can only be positive if balance of xvsAddress is less than grant amount(venusAccrued[holder])\n if (returnAmount != 0) {\n venusAccrued[holder] = returnAmount;\n }\n }\n }\n\n /**\n * @notice Update and distribute tokens\n * @param holders The addresses to claim XVS for\n * @param vTokens The list of markets to claim XVS in\n * @param borrowers Whether or not to claim XVS earned by borrowing\n * @param suppliers Whether or not to claim XVS earned by supplying\n */\n function updateAndDistributeRewardsInternal(\n address[] memory holders,\n VToken[] memory vTokens,\n bool borrowers,\n bool suppliers\n ) internal {\n uint256 j;\n uint256 holdersLength = holders.length;\n uint256 vTokensLength = vTokens.length;\n\n for (uint256 i; i < vTokensLength; ++i) {\n VToken vToken = vTokens[i];\n ensureListed(markets[address(vToken)]);\n if (borrowers) {\n Exp memory borrowIndex = Exp({ mantissa: vToken.borrowIndex() });\n updateVenusBorrowIndex(address(vToken), borrowIndex);\n for (j = 0; j < holdersLength; ++j) {\n distributeBorrowerVenus(address(vToken), holders[j], borrowIndex);\n }\n }\n\n if (suppliers) {\n updateVenusSupplyIndex(address(vToken));\n for (j = 0; j < holdersLength; ++j) {\n distributeSupplierVenus(address(vToken), holders[j]);\n }\n }\n }\n }\n\n /**\n * @notice Returns the XVS vToken address\n * @return The address of XVS vToken\n */\n function getXVSVTokenAddress() external view returns (address) {\n return xvsVToken;\n }\n}\n" + }, + "contracts/Comptroller/Diamond/facets/SetterFacet.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\n\npragma solidity 0.5.16;\n\nimport { VToken } from \"../../../Tokens/VTokens/VToken.sol\";\nimport { ISetterFacet } from \"../interfaces/ISetterFacet.sol\";\nimport { PriceOracle } from \"../../../Oracle/PriceOracle.sol\";\nimport { ComptrollerLensInterface } from \"../../ComptrollerLensInterface.sol\";\nimport { VAIControllerInterface } from \"../../../Tokens/VAI/VAIControllerInterface.sol\";\nimport { FacetBase } from \"./FacetBase.sol\";\nimport { IPrime } from \"../../../Tokens/Prime/IPrime.sol\";\n\n/**\n * @title SetterFacet\n * @author Venus\n * @dev This facet contains all the setters for the states\n * @notice This facet contract contains all the configurational setter functions\n */\ncontract SetterFacet is ISetterFacet, FacetBase {\n /// @notice Emitted when close factor is changed by admin\n event NewCloseFactor(uint256 oldCloseFactorMantissa, uint256 newCloseFactorMantissa);\n\n /// @notice Emitted when a collateral factor is changed by admin\n event NewCollateralFactor(\n VToken indexed vToken,\n uint256 oldCollateralFactorMantissa,\n uint256 newCollateralFactorMantissa\n );\n\n /// @notice Emitted when liquidation incentive is changed by admin\n event NewLiquidationIncentive(uint256 oldLiquidationIncentiveMantissa, uint256 newLiquidationIncentiveMantissa);\n\n /// @notice Emitted when price oracle is changed\n event NewPriceOracle(PriceOracle oldPriceOracle, PriceOracle newPriceOracle);\n\n /// @notice Emitted when borrow cap for a vToken is changed\n event NewBorrowCap(VToken indexed vToken, uint256 newBorrowCap);\n\n /// @notice Emitted when VAIController is changed\n event NewVAIController(VAIControllerInterface oldVAIController, VAIControllerInterface newVAIController);\n\n /// @notice Emitted when VAI mint rate is changed by admin\n event NewVAIMintRate(uint256 oldVAIMintRate, uint256 newVAIMintRate);\n\n /// @notice Emitted when protocol state is changed by admin\n event ActionProtocolPaused(bool state);\n\n /// @notice Emitted when treasury guardian is changed\n event NewTreasuryGuardian(address oldTreasuryGuardian, address newTreasuryGuardian);\n\n /// @notice Emitted when treasury address is changed\n event NewTreasuryAddress(address oldTreasuryAddress, address newTreasuryAddress);\n\n /// @notice Emitted when treasury percent is changed\n event NewTreasuryPercent(uint256 oldTreasuryPercent, uint256 newTreasuryPercent);\n\n /// @notice Emitted when liquidator adress is changed\n event NewLiquidatorContract(address oldLiquidatorContract, address newLiquidatorContract);\n\n /// @notice Emitted when ComptrollerLens address is changed\n event NewComptrollerLens(address oldComptrollerLens, address newComptrollerLens);\n\n /// @notice Emitted when supply cap for a vToken is changed\n event NewSupplyCap(VToken indexed vToken, uint256 newSupplyCap);\n\n /// @notice Emitted when access control address is changed by admin\n event NewAccessControl(address oldAccessControlAddress, address newAccessControlAddress);\n\n /// @notice Emitted when pause guardian is changed\n event NewPauseGuardian(address oldPauseGuardian, address newPauseGuardian);\n\n /// @notice Emitted when an action is paused on a market\n event ActionPausedMarket(VToken indexed vToken, Action indexed action, bool pauseState);\n\n /// @notice Emitted when VAI Vault info is changed\n event NewVAIVaultInfo(address indexed vault_, uint256 releaseStartBlock_, uint256 releaseInterval_);\n\n /// @notice Emitted when Venus VAI Vault rate is changed\n event NewVenusVAIVaultRate(uint256 oldVenusVAIVaultRate, uint256 newVenusVAIVaultRate);\n\n /// @notice Emitted when prime token contract address is changed\n event NewPrimeToken(IPrime oldPrimeToken, IPrime newPrimeToken);\n\n /// @notice Emitted when forced liquidation is enabled or disabled for all users in a market\n event IsForcedLiquidationEnabledUpdated(address indexed vToken, bool enable);\n\n /// @notice Emitted when forced liquidation is enabled or disabled for a user borrowing in a market\n event IsForcedLiquidationEnabledForUserUpdated(address indexed borrower, address indexed vToken, bool enable);\n\n /// @notice Emitted when XVS token address is changed\n event NewXVSToken(address indexed oldXVS, address indexed newXVS);\n\n /// @notice Emitted when XVS vToken address is changed\n event NewXVSVToken(address indexed oldXVSVToken, address indexed newXVSVToken);\n\n /**\n * @notice Compare two addresses to ensure they are different\n * @param oldAddress The original address to compare\n * @param newAddress The new address to compare\n */\n modifier compareAddress(address oldAddress, address newAddress) {\n require(oldAddress != newAddress, \"old address is same as new address\");\n _;\n }\n\n /**\n * @notice Compare two values to ensure they are different\n * @param oldValue The original value to compare\n * @param newValue The new value to compare\n */\n modifier compareValue(uint256 oldValue, uint256 newValue) {\n require(oldValue != newValue, \"old value is same as new value\");\n _;\n }\n\n /**\n * @notice Sets a new price oracle for the comptroller\n * @dev Allows the contract admin to set a new price oracle used by the Comptroller\n * @return uint256 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPriceOracle(\n PriceOracle newOracle\n ) external compareAddress(address(oracle), address(newOracle)) returns (uint256) {\n // Check caller is admin\n ensureAdmin();\n ensureNonzeroAddress(address(newOracle));\n\n // Track the old oracle for the comptroller\n PriceOracle oldOracle = oracle;\n\n // Set comptroller's oracle to newOracle\n oracle = newOracle;\n\n // Emit NewPriceOracle(oldOracle, newOracle)\n emit NewPriceOracle(oldOracle, newOracle);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the closeFactor used when liquidating borrows\n * @dev Allows the contract admin to set the closeFactor used to liquidate borrows\n * @param newCloseFactorMantissa New close factor, scaled by 1e18\n * @return uint256 0=success, otherwise will revert\n */\n function _setCloseFactor(\n uint256 newCloseFactorMantissa\n ) external compareValue(closeFactorMantissa, newCloseFactorMantissa) returns (uint256) {\n // Check caller is admin\n ensureAdmin();\n\n Exp memory newCloseFactorExp = Exp({ mantissa: newCloseFactorMantissa });\n\n //-- Check close factor <= 0.9\n Exp memory highLimit = Exp({ mantissa: closeFactorMaxMantissa });\n //-- Check close factor >= 0.05\n Exp memory lowLimit = Exp({ mantissa: closeFactorMinMantissa });\n\n if (lessThanExp(highLimit, newCloseFactorExp) || greaterThanExp(lowLimit, newCloseFactorExp)) {\n return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);\n }\n\n uint256 oldCloseFactorMantissa = closeFactorMantissa;\n closeFactorMantissa = newCloseFactorMantissa;\n emit NewCloseFactor(oldCloseFactorMantissa, newCloseFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the address of the access control of this contract\n * @dev Allows the contract admin to set the address of access control of this contract\n * @param newAccessControlAddress New address for the access control\n * @return uint256 0=success, otherwise will revert\n */\n function _setAccessControl(\n address newAccessControlAddress\n ) external compareAddress(accessControl, newAccessControlAddress) returns (uint256) {\n // Check caller is admin\n ensureAdmin();\n ensureNonzeroAddress(newAccessControlAddress);\n\n address oldAccessControlAddress = accessControl;\n\n accessControl = newAccessControlAddress;\n emit NewAccessControl(oldAccessControlAddress, newAccessControlAddress);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets the collateralFactor for a market\n * @dev Allows a privileged role to set the collateralFactorMantissa\n * @param vToken The market to set the factor on\n * @param newCollateralFactorMantissa The new collateral factor, scaled by 1e18\n * @return uint256 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setCollateralFactor(\n VToken vToken,\n uint256 newCollateralFactorMantissa\n )\n external\n compareValue(markets[address(vToken)].collateralFactorMantissa, newCollateralFactorMantissa)\n returns (uint256)\n {\n // Check caller is allowed by access control manager\n ensureAllowed(\"_setCollateralFactor(address,uint256)\");\n ensureNonzeroAddress(address(vToken));\n\n // Verify market is listed\n Market storage market = markets[address(vToken)];\n ensureListed(market);\n\n Exp memory newCollateralFactorExp = Exp({ mantissa: newCollateralFactorMantissa });\n\n //-- Check collateral factor <= 0.9\n Exp memory highLimit = Exp({ mantissa: collateralFactorMaxMantissa });\n if (lessThanExp(highLimit, newCollateralFactorExp)) {\n return fail(Error.INVALID_COLLATERAL_FACTOR, FailureInfo.SET_COLLATERAL_FACTOR_VALIDATION);\n }\n\n // If collateral factor != 0, fail if price == 0\n if (newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(vToken) == 0) {\n return fail(Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE);\n }\n\n // Set market's collateral factor to new collateral factor, remember old value\n uint256 oldCollateralFactorMantissa = market.collateralFactorMantissa;\n market.collateralFactorMantissa = newCollateralFactorMantissa;\n\n // Emit event with asset, old collateral factor, and new collateral factor\n emit NewCollateralFactor(vToken, oldCollateralFactorMantissa, newCollateralFactorMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets liquidationIncentive\n * @dev Allows a privileged role to set the liquidationIncentiveMantissa\n * @param newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18\n * @return uint256 0=success, otherwise a failure. (See ErrorReporter for details)\n */\n function _setLiquidationIncentive(\n uint256 newLiquidationIncentiveMantissa\n ) external compareValue(liquidationIncentiveMantissa, newLiquidationIncentiveMantissa) returns (uint256) {\n ensureAllowed(\"_setLiquidationIncentive(uint256)\");\n\n require(newLiquidationIncentiveMantissa >= 1e18, \"incentive < 1e18\");\n\n // Save current value for use in log\n uint256 oldLiquidationIncentiveMantissa = liquidationIncentiveMantissa;\n // Set liquidation incentive to new incentive\n liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;\n\n // Emit event with old incentive, new incentive\n emit NewLiquidationIncentive(oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Update the address of the liquidator contract\n * @dev Allows the contract admin to update the address of liquidator contract\n * @param newLiquidatorContract_ The new address of the liquidator contract\n */\n function _setLiquidatorContract(\n address newLiquidatorContract_\n ) external compareAddress(liquidatorContract, newLiquidatorContract_) {\n // Check caller is admin\n ensureAdmin();\n ensureNonzeroAddress(newLiquidatorContract_);\n address oldLiquidatorContract = liquidatorContract;\n liquidatorContract = newLiquidatorContract_;\n emit NewLiquidatorContract(oldLiquidatorContract, newLiquidatorContract_);\n }\n\n /**\n * @notice Admin function to change the Pause Guardian\n * @dev Allows the contract admin to change the Pause Guardian\n * @param newPauseGuardian The address of the new Pause Guardian\n * @return uint256 0=success, otherwise a failure. (See enum Error for details)\n */\n function _setPauseGuardian(\n address newPauseGuardian\n ) external compareAddress(pauseGuardian, newPauseGuardian) returns (uint256) {\n ensureAdmin();\n ensureNonzeroAddress(newPauseGuardian);\n\n // Save current value for inclusion in log\n address oldPauseGuardian = pauseGuardian;\n // Store pauseGuardian with value newPauseGuardian\n pauseGuardian = newPauseGuardian;\n\n // Emit NewPauseGuardian(OldPauseGuardian, NewPauseGuardian)\n emit NewPauseGuardian(oldPauseGuardian, newPauseGuardian);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Set the given borrow caps for the given vToken market Borrowing that brings total borrows to or above borrow cap will revert\n * @dev Allows a privileged role to set the borrowing cap for a vToken market. A borrow cap of 0 corresponds to Borrow not allowed\n * @param vTokens The addresses of the markets (tokens) to change the borrow caps for\n * @param newBorrowCaps The new borrow cap values in underlying to be set. A value of 0 corresponds to Borrow not allowed\n */\n function _setMarketBorrowCaps(VToken[] calldata vTokens, uint256[] calldata newBorrowCaps) external {\n ensureAllowed(\"_setMarketBorrowCaps(address[],uint256[])\");\n\n uint256 numMarkets = vTokens.length;\n uint256 numBorrowCaps = newBorrowCaps.length;\n\n require(numMarkets != 0 && numMarkets == numBorrowCaps, \"invalid input\");\n\n for (uint256 i; i < numMarkets; ++i) {\n borrowCaps[address(vTokens[i])] = newBorrowCaps[i];\n emit NewBorrowCap(vTokens[i], newBorrowCaps[i]);\n }\n }\n\n /**\n * @notice Set the given supply caps for the given vToken market Supply that brings total Supply to or above supply cap will revert\n * @dev Allows a privileged role to set the supply cap for a vToken. A supply cap of 0 corresponds to Minting NotAllowed\n * @param vTokens The addresses of the markets (tokens) to change the supply caps for\n * @param newSupplyCaps The new supply cap values in underlying to be set. A value of 0 corresponds to Minting NotAllowed\n */\n function _setMarketSupplyCaps(VToken[] calldata vTokens, uint256[] calldata newSupplyCaps) external {\n ensureAllowed(\"_setMarketSupplyCaps(address[],uint256[])\");\n\n uint256 numMarkets = vTokens.length;\n uint256 numSupplyCaps = newSupplyCaps.length;\n\n require(numMarkets != 0 && numMarkets == numSupplyCaps, \"invalid input\");\n\n for (uint256 i; i < numMarkets; ++i) {\n supplyCaps[address(vTokens[i])] = newSupplyCaps[i];\n emit NewSupplyCap(vTokens[i], newSupplyCaps[i]);\n }\n }\n\n /**\n * @notice Set whole protocol pause/unpause state\n * @dev Allows a privileged role to pause/unpause protocol\n * @param state The new state (true=paused, false=unpaused)\n * @return bool The updated state of the protocol\n */\n function _setProtocolPaused(bool state) external returns (bool) {\n ensureAllowed(\"_setProtocolPaused(bool)\");\n\n protocolPaused = state;\n emit ActionProtocolPaused(state);\n return state;\n }\n\n /**\n * @notice Pause/unpause certain actions\n * @dev Allows a privileged role to pause/unpause the protocol action state\n * @param markets_ Markets to pause/unpause the actions on\n * @param actions_ List of action ids to pause/unpause\n * @param paused_ The new paused state (true=paused, false=unpaused)\n */\n function _setActionsPaused(address[] calldata markets_, Action[] calldata actions_, bool paused_) external {\n ensureAllowed(\"_setActionsPaused(address[],uint8[],bool)\");\n\n uint256 numMarkets = markets_.length;\n uint256 numActions = actions_.length;\n for (uint256 marketIdx; marketIdx < numMarkets; ++marketIdx) {\n for (uint256 actionIdx; actionIdx < numActions; ++actionIdx) {\n setActionPausedInternal(markets_[marketIdx], actions_[actionIdx], paused_);\n }\n }\n }\n\n /**\n * @dev Pause/unpause an action on a market\n * @param market Market to pause/unpause the action on\n * @param action Action id to pause/unpause\n * @param paused The new paused state (true=paused, false=unpaused)\n */\n function setActionPausedInternal(address market, Action action, bool paused) internal {\n ensureListed(markets[market]);\n _actionPaused[market][uint256(action)] = paused;\n emit ActionPausedMarket(VToken(market), action, paused);\n }\n\n /**\n * @notice Sets a new VAI controller\n * @dev Admin function to set a new VAI controller\n * @return uint256 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setVAIController(\n VAIControllerInterface vaiController_\n ) external compareAddress(address(vaiController), address(vaiController_)) returns (uint256) {\n // Check caller is admin\n ensureAdmin();\n ensureNonzeroAddress(address(vaiController_));\n\n VAIControllerInterface oldVaiController = vaiController;\n vaiController = vaiController_;\n emit NewVAIController(oldVaiController, vaiController_);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Set the VAI mint rate\n * @param newVAIMintRate The new VAI mint rate to be set\n * @return uint256 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setVAIMintRate(\n uint256 newVAIMintRate\n ) external compareValue(vaiMintRate, newVAIMintRate) returns (uint256) {\n // Check caller is admin\n ensureAdmin();\n uint256 oldVAIMintRate = vaiMintRate;\n vaiMintRate = newVAIMintRate;\n emit NewVAIMintRate(oldVAIMintRate, newVAIMintRate);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Set the minted VAI amount of the `owner`\n * @param owner The address of the account to set\n * @param amount The amount of VAI to set to the account\n * @return The number of minted VAI by `owner`\n */\n function setMintedVAIOf(address owner, uint256 amount) external returns (uint256) {\n checkProtocolPauseState();\n\n // Pausing is a very serious situation - we revert to sound the alarms\n require(!mintVAIGuardianPaused && !repayVAIGuardianPaused, \"VAI is paused\");\n // Check caller is vaiController\n if (msg.sender != address(vaiController)) {\n return fail(Error.REJECTION, FailureInfo.SET_MINTED_VAI_REJECTION);\n }\n mintedVAIs[owner] = amount;\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Set the treasury data.\n * @param newTreasuryGuardian The new address of the treasury guardian to be set\n * @param newTreasuryAddress The new address of the treasury to be set\n * @param newTreasuryPercent The new treasury percent to be set\n * @return uint256 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setTreasuryData(\n address newTreasuryGuardian,\n address newTreasuryAddress,\n uint256 newTreasuryPercent\n ) external returns (uint256) {\n // Check caller is admin\n ensureAdminOr(treasuryGuardian);\n\n require(newTreasuryPercent < 1e18, \"percent >= 100%\");\n ensureNonzeroAddress(newTreasuryGuardian);\n ensureNonzeroAddress(newTreasuryAddress);\n\n address oldTreasuryGuardian = treasuryGuardian;\n address oldTreasuryAddress = treasuryAddress;\n uint256 oldTreasuryPercent = treasuryPercent;\n\n treasuryGuardian = newTreasuryGuardian;\n treasuryAddress = newTreasuryAddress;\n treasuryPercent = newTreasuryPercent;\n\n emit NewTreasuryGuardian(oldTreasuryGuardian, newTreasuryGuardian);\n emit NewTreasuryAddress(oldTreasuryAddress, newTreasuryAddress);\n emit NewTreasuryPercent(oldTreasuryPercent, newTreasuryPercent);\n\n return uint256(Error.NO_ERROR);\n }\n\n /*** Venus Distribution ***/\n\n /**\n * @dev Set ComptrollerLens contract address\n * @param comptrollerLens_ The new ComptrollerLens contract address to be set\n * @return uint256 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setComptrollerLens(\n ComptrollerLensInterface comptrollerLens_\n ) external compareAddress(address(comptrollerLens), address(comptrollerLens_)) returns (uint256) {\n ensureAdmin();\n ensureNonzeroAddress(address(comptrollerLens_));\n address oldComptrollerLens = address(comptrollerLens);\n comptrollerLens = comptrollerLens_;\n emit NewComptrollerLens(oldComptrollerLens, address(comptrollerLens));\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Set the amount of XVS distributed per block to VAI Vault\n * @param venusVAIVaultRate_ The amount of XVS wei per block to distribute to VAI Vault\n */\n function _setVenusVAIVaultRate(\n uint256 venusVAIVaultRate_\n ) external compareValue(venusVAIVaultRate, venusVAIVaultRate_) {\n ensureAdmin();\n if (vaiVaultAddress != address(0)) {\n releaseToVault();\n }\n uint256 oldVenusVAIVaultRate = venusVAIVaultRate;\n venusVAIVaultRate = venusVAIVaultRate_;\n emit NewVenusVAIVaultRate(oldVenusVAIVaultRate, venusVAIVaultRate_);\n }\n\n /**\n * @notice Set the VAI Vault infos\n * @param vault_ The address of the VAI Vault\n * @param releaseStartBlock_ The start block of release to VAI Vault\n * @param minReleaseAmount_ The minimum release amount to VAI Vault\n */\n function _setVAIVaultInfo(\n address vault_,\n uint256 releaseStartBlock_,\n uint256 minReleaseAmount_\n ) external compareAddress(vaiVaultAddress, vault_) {\n ensureAdmin();\n ensureNonzeroAddress(vault_);\n if (vaiVaultAddress != address(0)) {\n releaseToVault();\n }\n\n vaiVaultAddress = vault_;\n releaseStartBlock = releaseStartBlock_;\n minReleaseAmount = minReleaseAmount_;\n emit NewVAIVaultInfo(vault_, releaseStartBlock_, minReleaseAmount_);\n }\n\n /**\n * @notice Sets the prime token contract for the comptroller\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPrimeToken(IPrime _prime) external returns (uint) {\n ensureAdmin();\n ensureNonzeroAddress(address(_prime));\n\n IPrime oldPrime = prime;\n prime = _prime;\n emit NewPrimeToken(oldPrime, _prime);\n\n return uint(Error.NO_ERROR);\n }\n\n /** @notice Enables forced liquidations for a market. If forced liquidation is enabled,\n * borrows in the market may be liquidated regardless of the account liquidity\n * @dev Allows a privileged role to set enable/disable forced liquidations\n * @param vTokenBorrowed Borrowed vToken\n * @param enable Whether to enable forced liquidations\n */\n function _setForcedLiquidation(address vTokenBorrowed, bool enable) external {\n ensureAllowed(\"_setForcedLiquidation(address,bool)\");\n if (vTokenBorrowed != address(vaiController)) {\n ensureListed(markets[vTokenBorrowed]);\n }\n isForcedLiquidationEnabled[vTokenBorrowed] = enable;\n emit IsForcedLiquidationEnabledUpdated(vTokenBorrowed, enable);\n }\n\n /**\n * @notice Enables forced liquidations for user's borrows in a certain market. If forced\n * liquidation is enabled, user's borrows in the market may be liquidated regardless of\n * the account liquidity. Forced liquidation may be enabled for a user even if it is not\n * enabled for the entire market.\n * @param borrower The address of the borrower\n * @param vTokenBorrowed Borrowed vToken\n * @param enable Whether to enable forced liquidations\n */\n function _setForcedLiquidationForUser(address borrower, address vTokenBorrowed, bool enable) external {\n ensureAllowed(\"_setForcedLiquidationForUser(address,address,bool)\");\n if (vTokenBorrowed != address(vaiController)) {\n ensureListed(markets[vTokenBorrowed]);\n }\n isForcedLiquidationEnabledForUser[borrower][vTokenBorrowed] = enable;\n emit IsForcedLiquidationEnabledForUserUpdated(borrower, vTokenBorrowed, enable);\n }\n\n /**\n * @notice Set the address of the XVS token\n * @param xvs_ The address of the XVS token\n */\n function _setXVSToken(address xvs_) external {\n ensureAdmin();\n ensureNonzeroAddress(xvs_);\n\n emit NewXVSToken(xvs, xvs_);\n xvs = xvs_;\n }\n\n /**\n * @notice Set the address of the XVS vToken\n * @param xvsVToken_ The address of the XVS vToken\n */\n function _setXVSVToken(address xvsVToken_) external {\n ensureAdmin();\n ensureNonzeroAddress(xvsVToken_);\n\n address underlying = VToken(xvsVToken_).underlying();\n require(underlying == xvs, \"invalid xvs vtoken address\");\n\n emit NewXVSVToken(xvsVToken, xvsVToken_);\n xvsVToken = xvsVToken_;\n }\n}\n" + }, + "contracts/Comptroller/Diamond/facets/XVSRewardsHelper.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\n\npragma solidity 0.5.16;\n\nimport { VToken } from \"../../../Tokens/VTokens/VToken.sol\";\nimport { FacetBase } from \"./FacetBase.sol\";\n\n/**\n * @title XVSRewardsHelper\n * @author Venus\n * @dev This contract contains internal functions used in RewardFacet and PolicyFacet\n * @notice This facet contract contains the shared functions used by the RewardFacet and PolicyFacet\n */\ncontract XVSRewardsHelper is FacetBase {\n /// @notice Emitted when XVS is distributed to a borrower\n event DistributedBorrowerVenus(\n VToken indexed vToken,\n address indexed borrower,\n uint256 venusDelta,\n uint256 venusBorrowIndex\n );\n\n /// @notice Emitted when XVS is distributed to a supplier\n event DistributedSupplierVenus(\n VToken indexed vToken,\n address indexed supplier,\n uint256 venusDelta,\n uint256 venusSupplyIndex\n );\n\n /**\n * @notice Accrue XVS to the market by updating the borrow index\n * @param vToken The market whose borrow index to update\n */\n function updateVenusBorrowIndex(address vToken, Exp memory marketBorrowIndex) internal {\n VenusMarketState storage borrowState = venusBorrowState[vToken];\n uint256 borrowSpeed = venusBorrowSpeeds[vToken];\n uint32 blockNumber = getBlockNumberAsUint32();\n uint256 deltaBlocks = sub_(blockNumber, borrowState.block);\n if (deltaBlocks != 0 && borrowSpeed != 0) {\n uint256 borrowAmount = div_(VToken(vToken).totalBorrows(), marketBorrowIndex);\n uint256 accruedVenus = mul_(deltaBlocks, borrowSpeed);\n Double memory ratio = borrowAmount != 0 ? fraction(accruedVenus, borrowAmount) : Double({ mantissa: 0 });\n borrowState.index = safe224(add_(Double({ mantissa: borrowState.index }), ratio).mantissa, \"224\");\n borrowState.block = blockNumber;\n } else if (deltaBlocks != 0) {\n borrowState.block = blockNumber;\n }\n }\n\n /**\n * @notice Accrue XVS to the market by updating the supply index\n * @param vToken The market whose supply index to update\n */\n function updateVenusSupplyIndex(address vToken) internal {\n VenusMarketState storage supplyState = venusSupplyState[vToken];\n uint256 supplySpeed = venusSupplySpeeds[vToken];\n uint32 blockNumber = getBlockNumberAsUint32();\n\n uint256 deltaBlocks = sub_(blockNumber, supplyState.block);\n if (deltaBlocks != 0 && supplySpeed != 0) {\n uint256 supplyTokens = VToken(vToken).totalSupply();\n uint256 accruedVenus = mul_(deltaBlocks, supplySpeed);\n Double memory ratio = supplyTokens != 0 ? fraction(accruedVenus, supplyTokens) : Double({ mantissa: 0 });\n supplyState.index = safe224(add_(Double({ mantissa: supplyState.index }), ratio).mantissa, \"224\");\n supplyState.block = blockNumber;\n } else if (deltaBlocks != 0) {\n supplyState.block = blockNumber;\n }\n }\n\n /**\n * @notice Calculate XVS accrued by a supplier and possibly transfer it to them\n * @param vToken The market in which the supplier is interacting\n * @param supplier The address of the supplier to distribute XVS to\n */\n function distributeSupplierVenus(address vToken, address supplier) internal {\n if (address(vaiVaultAddress) != address(0)) {\n releaseToVault();\n }\n uint256 supplyIndex = venusSupplyState[vToken].index;\n uint256 supplierIndex = venusSupplierIndex[vToken][supplier];\n // Update supplier's index to the current index since we are distributing accrued XVS\n venusSupplierIndex[vToken][supplier] = supplyIndex;\n if (supplierIndex == 0 && supplyIndex >= venusInitialIndex) {\n // Covers the case where users supplied tokens before the market's supply state index was set.\n // Rewards the user with XVS accrued from the start of when supplier rewards were first\n // set for the market.\n supplierIndex = venusInitialIndex;\n }\n // Calculate change in the cumulative sum of the XVS per vToken accrued\n Double memory deltaIndex = Double({ mantissa: sub_(supplyIndex, supplierIndex) });\n // Multiply of supplierTokens and supplierDelta\n uint256 supplierDelta = mul_(VToken(vToken).balanceOf(supplier), deltaIndex);\n // Addition of supplierAccrued and supplierDelta\n venusAccrued[supplier] = add_(venusAccrued[supplier], supplierDelta);\n emit DistributedSupplierVenus(VToken(vToken), supplier, supplierDelta, supplyIndex);\n }\n\n /**\n * @notice Calculate XVS accrued by a borrower and possibly transfer it to them\n * @dev Borrowers will not begin to accrue until after the first interaction with the protocol\n * @param vToken The market in which the borrower is interacting\n * @param borrower The address of the borrower to distribute XVS to\n */\n function distributeBorrowerVenus(address vToken, address borrower, Exp memory marketBorrowIndex) internal {\n if (address(vaiVaultAddress) != address(0)) {\n releaseToVault();\n }\n uint256 borrowIndex = venusBorrowState[vToken].index;\n uint256 borrowerIndex = venusBorrowerIndex[vToken][borrower];\n // Update borrowers's index to the current index since we are distributing accrued XVS\n venusBorrowerIndex[vToken][borrower] = borrowIndex;\n if (borrowerIndex == 0 && borrowIndex >= venusInitialIndex) {\n // Covers the case where users borrowed tokens before the market's borrow state index was set.\n // Rewards the user with XVS accrued from the start of when borrower rewards were first\n // set for the market.\n borrowerIndex = venusInitialIndex;\n }\n // Calculate change in the cumulative sum of the XVS per borrowed unit accrued\n Double memory deltaIndex = Double({ mantissa: sub_(borrowIndex, borrowerIndex) });\n uint256 borrowerDelta = mul_(div_(VToken(vToken).borrowBalanceStored(borrower), marketBorrowIndex), deltaIndex);\n venusAccrued[borrower] = add_(venusAccrued[borrower], borrowerDelta);\n emit DistributedBorrowerVenus(VToken(vToken), borrower, borrowerDelta, borrowIndex);\n }\n}\n" + }, + "contracts/Comptroller/Diamond/interfaces/IDiamondCut.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\n\npragma solidity 0.5.16;\npragma experimental ABIEncoderV2;\n\ninterface IDiamondCut {\n enum FacetCutAction {\n Add,\n Replace,\n Remove\n }\n // Add=0, Replace=1, Remove=2\n\n struct FacetCut {\n address facetAddress;\n FacetCutAction action;\n bytes4[] functionSelectors;\n }\n\n /// @notice Add/replace/remove any number of functions and optionally execute\n /// a function with delegatecall\n /// @param _diamondCut Contains the facet addresses and function selectors\n function diamondCut(FacetCut[] calldata _diamondCut) external;\n}\n" + }, + "contracts/Comptroller/Diamond/interfaces/IMarketFacet.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\n\npragma solidity 0.5.16;\n\nimport { VToken } from \"../../../Tokens/VTokens/VToken.sol\";\n\ninterface IMarketFacet {\n function isComptroller() external pure returns (bool);\n\n function liquidateCalculateSeizeTokens(\n address vTokenBorrowed,\n address vTokenCollateral,\n uint256 actualRepayAmount\n ) external view returns (uint256, uint256);\n\n function liquidateVAICalculateSeizeTokens(\n address vTokenCollateral,\n uint256 actualRepayAmount\n ) external view returns (uint256, uint256);\n\n function checkMembership(address account, VToken vToken) external view returns (bool);\n\n function enterMarkets(address[] calldata vTokens) external returns (uint256[] memory);\n\n function exitMarket(address vToken) external returns (uint256);\n\n function _supportMarket(VToken vToken) external returns (uint256);\n\n function getAssetsIn(address account) external view returns (VToken[] memory);\n\n function getAllMarkets() external view returns (VToken[] memory);\n\n function updateDelegate(address delegate, bool allowBorrows) external;\n\n function unlistMarket(address market) external returns (uint256);\n}\n" + }, + "contracts/Comptroller/Diamond/interfaces/IPolicyFacet.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\n\npragma solidity 0.5.16;\n\nimport { VToken } from \"../../../Tokens/VTokens/VToken.sol\";\n\ninterface IPolicyFacet {\n function mintAllowed(address vToken, address minter, uint256 mintAmount) external returns (uint256);\n\n function mintVerify(address vToken, address minter, uint256 mintAmount, uint256 mintTokens) external;\n\n function redeemAllowed(address vToken, address redeemer, uint256 redeemTokens) external returns (uint256);\n\n function redeemVerify(address vToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\n\n function borrowAllowed(address vToken, address borrower, uint256 borrowAmount) external returns (uint256);\n\n function borrowVerify(address vToken, address borrower, uint256 borrowAmount) external;\n\n function repayBorrowAllowed(\n address vToken,\n address payer,\n address borrower,\n uint256 repayAmount\n ) external returns (uint256);\n\n function repayBorrowVerify(\n address vToken,\n address payer,\n address borrower,\n uint256 repayAmount,\n uint256 borrowerIndex\n ) external;\n\n function liquidateBorrowAllowed(\n address vTokenBorrowed,\n address vTokenCollateral,\n address liquidator,\n address borrower,\n uint256 repayAmount\n ) external view returns (uint256);\n\n function liquidateBorrowVerify(\n address vTokenBorrowed,\n address vTokenCollateral,\n address liquidator,\n address borrower,\n uint256 repayAmount,\n uint256 seizeTokens\n ) external;\n\n function seizeAllowed(\n address vTokenCollateral,\n address vTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external returns (uint256);\n\n function seizeVerify(\n address vTokenCollateral,\n address vTokenBorrowed,\n address liquidator,\n address borrower,\n uint256 seizeTokens\n ) external;\n\n function transferAllowed(\n address vToken,\n address src,\n address dst,\n uint256 transferTokens\n ) external returns (uint256);\n\n function transferVerify(address vToken, address src, address dst, uint256 transferTokens) external;\n\n function getAccountLiquidity(address account) external view returns (uint256, uint256, uint256);\n\n function getHypotheticalAccountLiquidity(\n address account,\n address vTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount\n ) external view returns (uint256, uint256, uint256);\n\n function _setVenusSpeeds(\n VToken[] calldata vTokens,\n uint256[] calldata supplySpeeds,\n uint256[] calldata borrowSpeeds\n ) external;\n}\n" + }, + "contracts/Comptroller/Diamond/interfaces/IRewardFacet.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\n\npragma solidity 0.5.16;\n\nimport { VToken } from \"../../../Tokens/VTokens/VToken.sol\";\nimport { ComptrollerTypes } from \"../../ComptrollerStorage.sol\";\n\ninterface IRewardFacet {\n function claimVenus(address holder) external;\n\n function claimVenus(address holder, VToken[] calldata vTokens) external;\n\n function claimVenus(address[] calldata holders, VToken[] calldata vTokens, bool borrowers, bool suppliers) external;\n\n function claimVenusAsCollateral(address holder) external;\n\n function _grantXVS(address recipient, uint256 amount) external;\n\n function getXVSAddress() external view returns (address);\n\n function getXVSVTokenAddress() external view returns (address);\n\n function actionPaused(address market, ComptrollerTypes.Action action) external view returns (bool);\n\n function claimVenus(\n address[] calldata holders,\n VToken[] calldata vTokens,\n bool borrowers,\n bool suppliers,\n bool collateral\n ) external;\n function seizeVenus(address[] calldata holders, address recipient) external returns (uint256);\n}\n" + }, + "contracts/Comptroller/Diamond/interfaces/ISetterFacet.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\n\npragma solidity 0.5.16;\n\nimport { PriceOracle } from \"../../../Oracle/PriceOracle.sol\";\nimport { VToken } from \"../../../Tokens/VTokens/VToken.sol\";\nimport { ComptrollerTypes } from \"../../ComptrollerStorage.sol\";\nimport { VAIControllerInterface } from \"../../../Tokens/VAI/VAIControllerInterface.sol\";\nimport { ComptrollerLensInterface } from \"../../../Comptroller/ComptrollerLensInterface.sol\";\nimport { IPrime } from \"../../../Tokens/Prime/IPrime.sol\";\n\ninterface ISetterFacet {\n function _setPriceOracle(PriceOracle newOracle) external returns (uint256);\n\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\n\n function _setAccessControl(address newAccessControlAddress) external returns (uint256);\n\n function _setCollateralFactor(VToken vToken, uint256 newCollateralFactorMantissa) external returns (uint256);\n\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\n\n function _setLiquidatorContract(address newLiquidatorContract_) external;\n\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\n\n function _setMarketBorrowCaps(VToken[] calldata vTokens, uint256[] calldata newBorrowCaps) external;\n\n function _setMarketSupplyCaps(VToken[] calldata vTokens, uint256[] calldata newSupplyCaps) external;\n\n function _setProtocolPaused(bool state) external returns (bool);\n\n function _setActionsPaused(\n address[] calldata markets,\n ComptrollerTypes.Action[] calldata actions,\n bool paused\n ) external;\n\n function _setVAIController(VAIControllerInterface vaiController_) external returns (uint256);\n\n function _setVAIMintRate(uint256 newVAIMintRate) external returns (uint256);\n\n function setMintedVAIOf(address owner, uint256 amount) external returns (uint256);\n\n function _setTreasuryData(\n address newTreasuryGuardian,\n address newTreasuryAddress,\n uint256 newTreasuryPercent\n ) external returns (uint256);\n\n function _setComptrollerLens(ComptrollerLensInterface comptrollerLens_) external returns (uint256);\n\n function _setVenusVAIVaultRate(uint256 venusVAIVaultRate_) external;\n\n function _setVAIVaultInfo(address vault_, uint256 releaseStartBlock_, uint256 minReleaseAmount_) external;\n\n function _setForcedLiquidation(address vToken, bool enable) external;\n\n function _setPrimeToken(IPrime _prime) external returns (uint);\n\n function _setForcedLiquidationForUser(address borrower, address vTokenBorrowed, bool enable) external;\n\n function _setXVSToken(address xvs_) external;\n\n function _setXVSVToken(address xvsVToken_) external;\n}\n" + }, + "contracts/Comptroller/Unitroller.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./ComptrollerStorage.sol\";\nimport \"../Utils/ErrorReporter.sol\";\n\n/**\n * @title ComptrollerCore\n * @dev Storage for the comptroller is at this address, while execution is delegated to the `comptrollerImplementation`.\n * VTokens should reference this contract as their comptroller.\n */\ncontract Unitroller is UnitrollerAdminStorage, ComptrollerErrorReporter {\n /**\n * @notice Emitted when pendingComptrollerImplementation is changed\n */\n event NewPendingImplementation(address oldPendingImplementation, address newPendingImplementation);\n\n /**\n * @notice Emitted when pendingComptrollerImplementation is accepted, which means comptroller 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 = pendingComptrollerImplementation;\n\n pendingComptrollerImplementation = newPendingImplementation;\n\n emit NewPendingImplementation(oldPendingImplementation, pendingComptrollerImplementation);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Accepts new implementation of comptroller. 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 and pendingImplementation ≠ address(0)\n if (msg.sender != pendingComptrollerImplementation || pendingComptrollerImplementation == address(0)) {\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK);\n }\n\n // Save current values for inclusion in log\n address oldImplementation = comptrollerImplementation;\n address oldPendingImplementation = pendingComptrollerImplementation;\n\n comptrollerImplementation = pendingComptrollerImplementation;\n\n pendingComptrollerImplementation = address(0);\n\n emit NewImplementation(oldImplementation, comptrollerImplementation);\n emit NewPendingImplementation(oldPendingImplementation, pendingComptrollerImplementation);\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, ) = comptrollerImplementation.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" + }, + "contracts/Governance/VTreasury.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Utils/IBEP20.sol\";\nimport \"../Utils/SafeBEP20.sol\";\nimport \"../Utils/Ownable.sol\";\n\n/**\n * @title VTreasury\n * @author Venus\n * @notice Protocol treasury that holds tokens owned by Venus\n */\ncontract VTreasury is Ownable {\n using SafeMath for uint256;\n using SafeBEP20 for IBEP20;\n\n // WithdrawTreasuryBEP20 Event\n event WithdrawTreasuryBEP20(address tokenAddress, uint256 withdrawAmount, address withdrawAddress);\n\n // WithdrawTreasuryBNB Event\n event WithdrawTreasuryBNB(uint256 withdrawAmount, address withdrawAddress);\n\n /**\n * @notice To receive BNB\n */\n function() external payable {}\n\n /**\n * @notice Withdraw Treasury BEP20 Tokens, Only owner call it\n * @param tokenAddress The address of treasury token\n * @param withdrawAmount The withdraw amount to owner\n * @param withdrawAddress The withdraw address\n */\n function withdrawTreasuryBEP20(\n address tokenAddress,\n uint256 withdrawAmount,\n address withdrawAddress\n ) external onlyOwner {\n uint256 actualWithdrawAmount = withdrawAmount;\n // Get Treasury Token Balance\n uint256 treasuryBalance = IBEP20(tokenAddress).balanceOf(address(this));\n\n // Check Withdraw Amount\n if (withdrawAmount > treasuryBalance) {\n // Update actualWithdrawAmount\n actualWithdrawAmount = treasuryBalance;\n }\n\n // Transfer BEP20 Token to withdrawAddress\n IBEP20(tokenAddress).safeTransfer(withdrawAddress, actualWithdrawAmount);\n\n emit WithdrawTreasuryBEP20(tokenAddress, actualWithdrawAmount, withdrawAddress);\n }\n\n /**\n * @notice Withdraw Treasury BNB, Only owner call it\n * @param withdrawAmount The withdraw amount to owner\n * @param withdrawAddress The withdraw address\n */\n function withdrawTreasuryBNB(uint256 withdrawAmount, address payable withdrawAddress) external payable onlyOwner {\n uint256 actualWithdrawAmount = withdrawAmount;\n // Get Treasury BNB Balance\n uint256 bnbBalance = address(this).balance;\n\n // Check Withdraw Amount\n if (withdrawAmount > bnbBalance) {\n // Update actualWithdrawAmount\n actualWithdrawAmount = bnbBalance;\n }\n // Transfer BNB to withdrawAddress\n withdrawAddress.transfer(actualWithdrawAmount);\n\n emit WithdrawTreasuryBNB(actualWithdrawAmount, withdrawAddress);\n }\n}\n" + }, + "contracts/InterestRateModels/InterestRateModel.sol": { + "content": "pragma solidity ^0.5.16;\n\n/**\n * @title Venus's InterestRateModel Interface\n * @author Venus\n */\ncontract InterestRateModel {\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\n bool public constant isInterestRateModel = true;\n\n /**\n * @notice Calculates the current borrow interest rate per block\n * @param cash The total amount of cash the market has\n * @param borrows The total amount of borrows the market has outstanding\n * @param reserves The total amnount of reserves the market has\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\n */\n function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);\n\n /**\n * @notice Calculates the current supply interest rate per block\n * @param cash The total amount of cash the market has\n * @param borrows The total amount of borrows the market has outstanding\n * @param reserves The total amnount of reserves the market has\n * @param reserveFactorMantissa The current reserve factor the market has\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\n */\n function getSupplyRate(\n uint cash,\n uint borrows,\n uint reserves,\n uint reserveFactorMantissa\n ) external view returns (uint);\n}\n" + }, + "contracts/InterestRateModels/JumpRateModel.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Utils/SafeMath.sol\";\nimport \"./InterestRateModel.sol\";\n\n/**\n * @title Venus's JumpRateModel Contract\n * @author Venus\n */\ncontract JumpRateModel is InterestRateModel {\n using SafeMath for uint;\n\n event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock, uint jumpMultiplierPerBlock, uint kink);\n\n /**\n * @notice The approximate number of blocks per year that is assumed by the interest rate model\n */\n uint public constant blocksPerYear = (60 * 60 * 24 * 365) / 3; // (assuming 3s blocks)\n\n /**\n * @notice The multiplier of utilization rate that gives the slope of the interest rate\n */\n uint public multiplierPerBlock;\n\n /**\n * @notice The base interest rate which is the y-intercept when utilization rate is 0\n */\n uint public baseRatePerBlock;\n\n /**\n * @notice The multiplierPerBlock after hitting a specified utilization point\n */\n uint public jumpMultiplierPerBlock;\n\n /**\n * @notice The utilization point at which the jump multiplier is applied\n */\n uint public kink;\n\n /**\n * @notice Construct an interest rate model\n * @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)\n * @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)\n * @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point\n * @param kink_ The utilization point at which the jump multiplier is applied\n */\n constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) public {\n baseRatePerBlock = baseRatePerYear.div(blocksPerYear);\n multiplierPerBlock = multiplierPerYear.div(blocksPerYear);\n jumpMultiplierPerBlock = jumpMultiplierPerYear.div(blocksPerYear);\n kink = kink_;\n\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);\n }\n\n /**\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market (currently unused)\n * @return The utilization rate as a mantissa between [0, 1e18]\n */\n function utilizationRate(uint cash, uint borrows, uint reserves) public pure returns (uint) {\n // Utilization rate is 0 when there are no borrows\n if (borrows == 0) {\n return 0;\n }\n\n return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));\n }\n\n /**\n * @notice Calculates the current borrow rate per block, with the error code expected by the market\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18)\n */\n function getBorrowRate(uint cash, uint borrows, uint reserves) public view returns (uint) {\n uint util = utilizationRate(cash, borrows, reserves);\n\n if (util <= kink) {\n return util.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\n } else {\n uint normalRate = kink.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\n uint excessUtil = util.sub(kink);\n return excessUtil.mul(jumpMultiplierPerBlock).div(1e18).add(normalRate);\n }\n }\n\n /**\n * @notice Calculates the current supply rate per block\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market\n * @param reserveFactorMantissa The current reserve factor for the market\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18)\n */\n function getSupplyRate(\n uint cash,\n uint borrows,\n uint reserves,\n uint reserveFactorMantissa\n ) public view returns (uint) {\n uint oneMinusReserveFactor = uint(1e18).sub(reserveFactorMantissa);\n uint borrowRate = getBorrowRate(cash, borrows, reserves);\n uint rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);\n return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);\n }\n}\n" + }, + "contracts/InterestRateModels/WhitePaperInterestRateModel.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Utils/SafeMath.sol\";\nimport \"./InterestRateModel.sol\";\n\n/**\n * @title Venus's WhitePaperInterestRateModel Contract\n * @author Venus\n * @notice The parameterized model described in section 2.4 of the original Venus Protocol whitepaper\n */\ncontract WhitePaperInterestRateModel is InterestRateModel {\n using SafeMath for uint;\n\n event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock);\n\n /**\n * @notice The approximate number of blocks per year that is assumed by the interest rate model\n */\n uint public constant blocksPerYear = (60 * 60 * 24 * 365) / 3; // (assuming 3s blocks)\n\n /**\n * @notice The multiplier of utilization rate that gives the slope of the interest rate\n */\n uint public multiplierPerBlock;\n\n /**\n * @notice The base interest rate which is the y-intercept when utilization rate is 0\n */\n uint public baseRatePerBlock;\n\n /**\n * @notice Construct an interest rate model\n * @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)\n * @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)\n */\n constructor(uint baseRatePerYear, uint multiplierPerYear) public {\n baseRatePerBlock = baseRatePerYear.div(blocksPerYear);\n multiplierPerBlock = multiplierPerYear.div(blocksPerYear);\n\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock);\n }\n\n /**\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market (currently unused)\n * @return The utilization rate as a mantissa between [0, 1e18]\n */\n function utilizationRate(uint cash, uint borrows, uint reserves) public pure returns (uint) {\n // Utilization rate is 0 when there are no borrows\n if (borrows == 0) {\n return 0;\n }\n\n return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));\n }\n\n /**\n * @notice Calculates the current borrow rate per block, with the error code expected by the market\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18)\n */\n function getBorrowRate(uint cash, uint borrows, uint reserves) public view returns (uint) {\n uint ur = utilizationRate(cash, borrows, reserves);\n return ur.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\n }\n\n /**\n * @notice Calculates the current supply rate per block\n * @param cash The amount of cash in the market\n * @param borrows The amount of borrows in the market\n * @param reserves The amount of reserves in the market\n * @param reserveFactorMantissa The current reserve factor for the market\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18)\n */\n function getSupplyRate(\n uint cash,\n uint borrows,\n uint reserves,\n uint reserveFactorMantissa\n ) public view returns (uint) {\n uint oneMinusReserveFactor = uint(1e18).sub(reserveFactorMantissa);\n uint borrowRate = getBorrowRate(cash, borrows, reserves);\n uint rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);\n return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);\n }\n}\n" + }, + "contracts/Lens/ComptrollerLens.sol": { + "content": "pragma solidity ^0.5.16;\npragma experimental ABIEncoderV2;\n\nimport \"../Tokens/VTokens/VBep20.sol\";\nimport { VToken } from \"../Tokens/VTokens/VToken.sol\";\nimport { ExponentialNoError } from \"../Utils/ExponentialNoError.sol\";\nimport \"../Tokens/EIP20Interface.sol\";\nimport \"../Oracle/PriceOracle.sol\";\nimport \"../Utils/ErrorReporter.sol\";\nimport \"../Comptroller/ComptrollerInterface.sol\";\nimport \"../Comptroller/ComptrollerLensInterface.sol\";\nimport \"../Tokens/VAI/VAIControllerInterface.sol\";\n\n/**\n * @title ComptrollerLens Contract\n * @author Venus\n * @notice The ComptrollerLens contract has functions to get the number of tokens that\n * can be seized through liquidation, hypothetical account liquidity and shortfall of an account.\n */\ncontract ComptrollerLens is ComptrollerLensInterface, ComptrollerErrorReporter, ExponentialNoError {\n /**\n * @dev Local vars for avoiding stack-depth limits in calculating account liquidity.\n * Note that `vTokenBalance` is the number of vTokens the account owns in the market,\n * whereas `borrowBalance` is the amount of underlying that the account has borrowed.\n */\n struct AccountLiquidityLocalVars {\n uint sumCollateral;\n uint sumBorrowPlusEffects;\n uint vTokenBalance;\n uint borrowBalance;\n uint exchangeRateMantissa;\n uint oraclePriceMantissa;\n Exp collateralFactor;\n Exp exchangeRate;\n Exp oraclePrice;\n Exp tokensToDenom;\n }\n\n /**\n * @notice Computes the number of collateral tokens to be seized in a liquidation event\n * @param comptroller Address of comptroller\n * @param vTokenBorrowed Address of the borrowed vToken\n * @param vTokenCollateral Address of collateral for the borrow\n * @param actualRepayAmount Repayment amount i.e amount to be repaid of total borrowed amount\n * @return A tuple of error code, and tokens to seize\n */\n function liquidateCalculateSeizeTokens(\n address comptroller,\n address vTokenBorrowed,\n address vTokenCollateral,\n uint actualRepayAmount\n ) external view returns (uint, uint) {\n /* Read oracle prices for borrowed and collateral markets */\n uint priceBorrowedMantissa = ComptrollerInterface(comptroller).oracle().getUnderlyingPrice(\n VToken(vTokenBorrowed)\n );\n uint priceCollateralMantissa = ComptrollerInterface(comptroller).oracle().getUnderlyingPrice(\n VToken(vTokenCollateral)\n );\n if (priceBorrowedMantissa == 0 || priceCollateralMantissa == 0) {\n return (uint(Error.PRICE_ERROR), 0);\n }\n\n /*\n * Get the exchange rate and calculate the number of collateral tokens to seize:\n * seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral\n * seizeTokens = seizeAmount / exchangeRate\n * = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate)\n */\n uint exchangeRateMantissa = VToken(vTokenCollateral).exchangeRateStored(); // Note: reverts on error\n uint seizeTokens;\n Exp memory numerator;\n Exp memory denominator;\n Exp memory ratio;\n\n numerator = mul_(\n Exp({ mantissa: ComptrollerInterface(comptroller).liquidationIncentiveMantissa() }),\n Exp({ mantissa: priceBorrowedMantissa })\n );\n denominator = mul_(Exp({ mantissa: priceCollateralMantissa }), Exp({ mantissa: exchangeRateMantissa }));\n ratio = div_(numerator, denominator);\n\n seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount);\n\n return (uint(Error.NO_ERROR), seizeTokens);\n }\n\n /**\n * @notice Computes the number of VAI tokens to be seized in a liquidation event\n * @param comptroller Address of comptroller\n * @param vTokenCollateral Address of collateral for vToken\n * @param actualRepayAmount Repayment amount i.e amount to be repaid of the total borrowed amount\n * @return A tuple of error code, and tokens to seize\n */\n function liquidateVAICalculateSeizeTokens(\n address comptroller,\n address vTokenCollateral,\n uint actualRepayAmount\n ) external view returns (uint, uint) {\n /* Read oracle prices for borrowed and collateral markets */\n uint priceBorrowedMantissa = 1e18; // Note: this is VAI\n uint priceCollateralMantissa = ComptrollerInterface(comptroller).oracle().getUnderlyingPrice(\n VToken(vTokenCollateral)\n );\n if (priceCollateralMantissa == 0) {\n return (uint(Error.PRICE_ERROR), 0);\n }\n\n /*\n * Get the exchange rate and calculate the number of collateral tokens to seize:\n * seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral\n * seizeTokens = seizeAmount / exchangeRate\n * = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate)\n */\n uint exchangeRateMantissa = VToken(vTokenCollateral).exchangeRateStored(); // Note: reverts on error\n uint seizeTokens;\n Exp memory numerator;\n Exp memory denominator;\n Exp memory ratio;\n\n numerator = mul_(\n Exp({ mantissa: ComptrollerInterface(comptroller).liquidationIncentiveMantissa() }),\n Exp({ mantissa: priceBorrowedMantissa })\n );\n denominator = mul_(Exp({ mantissa: priceCollateralMantissa }), Exp({ mantissa: exchangeRateMantissa }));\n ratio = div_(numerator, denominator);\n\n seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount);\n\n return (uint(Error.NO_ERROR), seizeTokens);\n }\n\n /**\n * @notice Computes the hypothetical liquidity and shortfall of an account given a hypothetical borrow\n * A snapshot of the account is taken and the total borrow amount of the account is calculated\n * @param comptroller Address of comptroller\n * @param account Address of the borrowed vToken\n * @param vTokenModify Address of collateral for vToken\n * @param redeemTokens Number of vTokens being redeemed\n * @param borrowAmount Amount borrowed\n * @return Returns a tuple of error code, liquidity, and shortfall\n */\n function getHypotheticalAccountLiquidity(\n address comptroller,\n address account,\n VToken vTokenModify,\n uint redeemTokens,\n uint borrowAmount\n ) external view returns (uint, uint, uint) {\n AccountLiquidityLocalVars memory vars; // Holds all our calculation results\n uint oErr;\n\n // For each asset the account is in\n VToken[] memory assets = ComptrollerInterface(comptroller).getAssetsIn(account);\n uint assetsCount = assets.length;\n for (uint i = 0; i < assetsCount; ++i) {\n VToken asset = assets[i];\n\n // Read the balances and exchange rate from the vToken\n (oErr, vars.vTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = asset.getAccountSnapshot(\n account\n );\n if (oErr != 0) {\n // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades\n return (uint(Error.SNAPSHOT_ERROR), 0, 0);\n }\n (, uint collateralFactorMantissa) = ComptrollerInterface(comptroller).markets(address(asset));\n vars.collateralFactor = Exp({ mantissa: collateralFactorMantissa });\n vars.exchangeRate = Exp({ mantissa: vars.exchangeRateMantissa });\n\n // Get the normalized price of the asset\n vars.oraclePriceMantissa = ComptrollerInterface(comptroller).oracle().getUnderlyingPrice(asset);\n if (vars.oraclePriceMantissa == 0) {\n return (uint(Error.PRICE_ERROR), 0, 0);\n }\n vars.oraclePrice = Exp({ mantissa: vars.oraclePriceMantissa });\n\n // Pre-compute a conversion factor from tokens -> bnb (normalized price value)\n vars.tokensToDenom = mul_(mul_(vars.collateralFactor, vars.exchangeRate), vars.oraclePrice);\n\n // sumCollateral += tokensToDenom * vTokenBalance\n vars.sumCollateral = mul_ScalarTruncateAddUInt(vars.tokensToDenom, vars.vTokenBalance, vars.sumCollateral);\n\n // sumBorrowPlusEffects += oraclePrice * borrowBalance\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.oraclePrice,\n vars.borrowBalance,\n vars.sumBorrowPlusEffects\n );\n\n // Calculate effects of interacting with vTokenModify\n if (asset == vTokenModify) {\n // redeem effect\n // sumBorrowPlusEffects += tokensToDenom * redeemTokens\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.tokensToDenom,\n redeemTokens,\n vars.sumBorrowPlusEffects\n );\n\n // borrow effect\n // sumBorrowPlusEffects += oraclePrice * borrowAmount\n vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(\n vars.oraclePrice,\n borrowAmount,\n vars.sumBorrowPlusEffects\n );\n }\n }\n\n VAIControllerInterface vaiController = ComptrollerInterface(comptroller).vaiController();\n\n if (address(vaiController) != address(0)) {\n vars.sumBorrowPlusEffects = add_(vars.sumBorrowPlusEffects, vaiController.getVAIRepayAmount(account));\n }\n\n // These are safe, as the underflow condition is checked first\n if (vars.sumCollateral > vars.sumBorrowPlusEffects) {\n return (uint(Error.NO_ERROR), vars.sumCollateral - vars.sumBorrowPlusEffects, 0);\n } else {\n return (uint(Error.NO_ERROR), 0, vars.sumBorrowPlusEffects - vars.sumCollateral);\n }\n }\n}\n" + }, + "contracts/Lens/SnapshotLens.sol": { + "content": "pragma solidity ^0.5.16;\npragma experimental ABIEncoderV2;\n\nimport { VToken } from \"../Tokens/VTokens/VToken.sol\";\nimport { ExponentialNoError } from \"../Utils/ExponentialNoError.sol\";\nimport \"../Utils/SafeMath.sol\";\nimport \"../Comptroller/ComptrollerInterface.sol\";\nimport \"../Tokens/EIP20Interface.sol\";\nimport \"../Tokens/VTokens/VBep20.sol\";\n\ncontract SnapshotLens is ExponentialNoError {\n using SafeMath for uint256;\n\n struct AccountSnapshot {\n address account;\n string assetName;\n address vTokenAddress;\n address underlyingAssetAddress;\n uint256 supply;\n uint256 supplyInUsd;\n uint256 collateral;\n uint256 borrows;\n uint256 borrowsInUsd;\n uint256 assetPrice;\n uint256 accruedInterest;\n uint vTokenDecimals;\n uint underlyingDecimals;\n uint exchangeRate;\n bool isACollateral;\n }\n\n /** Snapshot calculation **/\n /**\n * @dev Local vars for avoiding stack-depth limits in calculating account snapshot.\n * Note that `vTokenBalance` is the number of vTokens the account owns in the market,\n * whereas `borrowBalance` is the amount of underlying that the account has borrowed.\n */\n struct AccountSnapshotLocalVars {\n uint collateral;\n uint vTokenBalance;\n uint borrowBalance;\n uint borrowsInUsd;\n uint balanceOfUnderlying;\n uint supplyInUsd;\n uint exchangeRateMantissa;\n uint oraclePriceMantissa;\n Exp collateralFactor;\n Exp exchangeRate;\n Exp oraclePrice;\n Exp tokensToDenom;\n bool isACollateral;\n }\n\n function getAccountSnapshot(\n address payable account,\n address comptrollerAddress\n ) public returns (AccountSnapshot[] memory) {\n // For each asset the account is in\n VToken[] memory assets = ComptrollerInterface(comptrollerAddress).getAllMarkets();\n AccountSnapshot[] memory accountSnapshots = new AccountSnapshot[](assets.length);\n for (uint256 i = 0; i < assets.length; ++i) {\n accountSnapshots[i] = getAccountSnapshot(account, comptrollerAddress, assets[i]);\n }\n return accountSnapshots;\n }\n\n function isACollateral(address account, address asset, address comptrollerAddress) public view returns (bool) {\n VToken[] memory assetsAsCollateral = ComptrollerInterface(comptrollerAddress).getAssetsIn(account);\n for (uint256 j = 0; j < assetsAsCollateral.length; ++j) {\n if (address(assetsAsCollateral[j]) == asset) {\n return true;\n }\n }\n\n return false;\n }\n\n function getAccountSnapshot(\n address payable account,\n address comptrollerAddress,\n VToken vToken\n ) public returns (AccountSnapshot memory) {\n AccountSnapshotLocalVars memory vars; // Holds all our calculation results\n uint oErr;\n\n // Read the balances and exchange rate from the vToken\n (oErr, vars.vTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = vToken.getAccountSnapshot(account);\n require(oErr == 0, \"Snapshot Error\");\n vars.exchangeRate = Exp({ mantissa: vars.exchangeRateMantissa });\n\n (, uint collateralFactorMantissa) = ComptrollerInterface(comptrollerAddress).markets(address(vToken));\n vars.collateralFactor = Exp({ mantissa: collateralFactorMantissa });\n\n // Get the normalized price of the asset\n vars.oraclePriceMantissa = ComptrollerInterface(comptrollerAddress).oracle().getUnderlyingPrice(vToken);\n vars.oraclePrice = Exp({ mantissa: vars.oraclePriceMantissa });\n\n // Pre-compute a conversion factor from tokens -> bnb (normalized price value)\n vars.tokensToDenom = mul_(mul_(vars.collateralFactor, vars.exchangeRate), vars.oraclePrice);\n\n //Collateral = tokensToDenom * vTokenBalance\n vars.collateral = mul_ScalarTruncate(vars.tokensToDenom, vars.vTokenBalance);\n\n vars.balanceOfUnderlying = vToken.balanceOfUnderlying(account);\n vars.supplyInUsd = mul_ScalarTruncate(vars.oraclePrice, vars.balanceOfUnderlying);\n\n vars.borrowsInUsd = mul_ScalarTruncate(vars.oraclePrice, vars.borrowBalance);\n\n address underlyingAssetAddress;\n uint underlyingDecimals;\n\n if (compareStrings(vToken.symbol(), \"vBNB\")) {\n underlyingAssetAddress = address(0);\n underlyingDecimals = 18;\n } else {\n VBep20 vBep20 = VBep20(address(vToken));\n underlyingAssetAddress = vBep20.underlying();\n underlyingDecimals = EIP20Interface(vBep20.underlying()).decimals();\n }\n\n vars.isACollateral = isACollateral(account, address(vToken), comptrollerAddress);\n\n return\n AccountSnapshot({\n account: account,\n assetName: vToken.name(),\n vTokenAddress: address(vToken),\n underlyingAssetAddress: underlyingAssetAddress,\n supply: vars.balanceOfUnderlying,\n supplyInUsd: vars.supplyInUsd,\n collateral: vars.collateral,\n borrows: vars.borrowBalance,\n borrowsInUsd: vars.borrowsInUsd,\n assetPrice: vars.oraclePriceMantissa,\n accruedInterest: vToken.borrowIndex(),\n vTokenDecimals: vToken.decimals(),\n underlyingDecimals: underlyingDecimals,\n exchangeRate: vToken.exchangeRateCurrent(),\n isACollateral: vars.isACollateral\n });\n }\n\n // utilities\n function compareStrings(string memory a, string memory b) internal pure returns (bool) {\n return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));\n }\n}\n" + }, + "contracts/Lens/VenusLens.sol": { + "content": "pragma solidity ^0.5.16;\npragma experimental ABIEncoderV2;\n\nimport \"../Tokens/VTokens/VBep20.sol\";\nimport \"../Tokens/VTokens/VToken.sol\";\nimport \"../Oracle/PriceOracle.sol\";\nimport \"../Tokens/EIP20Interface.sol\";\nimport \"../Tokens/XVS/XVS.sol\";\nimport \"../Comptroller/ComptrollerInterface.sol\";\nimport \"../Utils/SafeMath.sol\";\nimport { ComptrollerTypes } from \"../Comptroller/ComptrollerStorage.sol\";\n\ncontract VenusLens is ExponentialNoError {\n using SafeMath for uint;\n\n /// @notice Blocks Per Day\n uint public constant BLOCKS_PER_DAY = 28800;\n\n /// @notice Total actions available on VToken\n uint public constant VTOKEN_ACTIONS = 8;\n\n struct VenusMarketState {\n uint224 index;\n uint32 block;\n }\n\n struct VTokenMetadata {\n address vToken;\n uint exchangeRateCurrent;\n uint supplyRatePerBlock;\n uint borrowRatePerBlock;\n uint reserveFactorMantissa;\n uint totalBorrows;\n uint totalReserves;\n uint totalSupply;\n uint totalCash;\n bool isListed;\n uint collateralFactorMantissa;\n address underlyingAssetAddress;\n uint vTokenDecimals;\n uint underlyingDecimals;\n uint venusSupplySpeed;\n uint venusBorrowSpeed;\n uint dailySupplyXvs;\n uint dailyBorrowXvs;\n uint pausedActions;\n }\n\n struct VTokenBalances {\n address vToken;\n uint balanceOf;\n uint borrowBalanceCurrent;\n uint balanceOfUnderlying;\n uint tokenBalance;\n uint tokenAllowance;\n }\n\n struct VTokenUnderlyingPrice {\n address vToken;\n uint underlyingPrice;\n }\n\n struct AccountLimits {\n VToken[] markets;\n uint liquidity;\n uint shortfall;\n }\n\n struct XVSBalanceMetadata {\n uint balance;\n uint votes;\n address delegate;\n }\n\n struct XVSBalanceMetadataExt {\n uint balance;\n uint votes;\n address delegate;\n uint allocated;\n }\n\n struct VenusVotes {\n uint blockNumber;\n uint votes;\n }\n\n struct ClaimVenusLocalVariables {\n uint totalRewards;\n uint224 borrowIndex;\n uint32 borrowBlock;\n uint224 supplyIndex;\n uint32 supplyBlock;\n }\n\n /**\n * @dev Struct for Pending Rewards for per market\n */\n struct PendingReward {\n address vTokenAddress;\n uint256 amount;\n }\n\n /**\n * @dev Struct for Reward of a single reward token.\n */\n struct RewardSummary {\n address distributorAddress;\n address rewardTokenAddress;\n uint256 totalRewards;\n PendingReward[] pendingRewards;\n }\n\n /**\n * @notice Query the metadata of a vToken by its address\n * @param vToken The address of the vToken to fetch VTokenMetadata\n * @return VTokenMetadata struct with vToken supply and borrow information.\n */\n function vTokenMetadata(VToken vToken) public returns (VTokenMetadata memory) {\n uint exchangeRateCurrent = vToken.exchangeRateCurrent();\n address comptrollerAddress = address(vToken.comptroller());\n ComptrollerInterface comptroller = ComptrollerInterface(comptrollerAddress);\n (bool isListed, uint collateralFactorMantissa) = comptroller.markets(address(vToken));\n address underlyingAssetAddress;\n uint underlyingDecimals;\n\n if (compareStrings(vToken.symbol(), \"vBNB\")) {\n underlyingAssetAddress = address(0);\n underlyingDecimals = 18;\n } else {\n VBep20 vBep20 = VBep20(address(vToken));\n underlyingAssetAddress = vBep20.underlying();\n underlyingDecimals = EIP20Interface(vBep20.underlying()).decimals();\n }\n\n uint venusSupplySpeedPerBlock = comptroller.venusSupplySpeeds(address(vToken));\n uint venusBorrowSpeedPerBlock = comptroller.venusBorrowSpeeds(address(vToken));\n\n uint256 pausedActions;\n\n for (uint8 i; i <= VTOKEN_ACTIONS; ++i) {\n uint256 paused = comptroller.actionPaused(address(vToken), ComptrollerTypes.Action(i)) ? 1 : 0;\n pausedActions |= paused << i;\n }\n\n return\n VTokenMetadata({\n vToken: address(vToken),\n exchangeRateCurrent: exchangeRateCurrent,\n supplyRatePerBlock: vToken.supplyRatePerBlock(),\n borrowRatePerBlock: vToken.borrowRatePerBlock(),\n reserveFactorMantissa: vToken.reserveFactorMantissa(),\n totalBorrows: vToken.totalBorrows(),\n totalReserves: vToken.totalReserves(),\n totalSupply: vToken.totalSupply(),\n totalCash: vToken.getCash(),\n isListed: isListed,\n collateralFactorMantissa: collateralFactorMantissa,\n underlyingAssetAddress: underlyingAssetAddress,\n vTokenDecimals: vToken.decimals(),\n underlyingDecimals: underlyingDecimals,\n venusSupplySpeed: venusSupplySpeedPerBlock,\n venusBorrowSpeed: venusBorrowSpeedPerBlock,\n dailySupplyXvs: venusSupplySpeedPerBlock.mul(BLOCKS_PER_DAY),\n dailyBorrowXvs: venusBorrowSpeedPerBlock.mul(BLOCKS_PER_DAY),\n pausedActions: pausedActions\n });\n }\n\n /**\n * @notice Get VTokenMetadata for an array of vToken addresses\n * @param vTokens Array of vToken addresses to fetch VTokenMetadata\n * @return Array of structs with vToken supply and borrow information.\n */\n function vTokenMetadataAll(VToken[] calldata vTokens) external returns (VTokenMetadata[] memory) {\n uint vTokenCount = vTokens.length;\n VTokenMetadata[] memory res = new VTokenMetadata[](vTokenCount);\n for (uint i = 0; i < vTokenCount; i++) {\n res[i] = vTokenMetadata(vTokens[i]);\n }\n return res;\n }\n\n /**\n * @notice Get amount of XVS distributed daily to an account\n * @param account Address of account to fetch the daily XVS distribution\n * @param comptrollerAddress Address of the comptroller proxy\n * @return Amount of XVS distributed daily to an account\n */\n function getDailyXVS(address payable account, address comptrollerAddress) external returns (uint) {\n ComptrollerInterface comptrollerInstance = ComptrollerInterface(comptrollerAddress);\n VToken[] memory vTokens = comptrollerInstance.getAllMarkets();\n uint dailyXvsPerAccount = 0;\n\n for (uint i = 0; i < vTokens.length; i++) {\n VToken vToken = vTokens[i];\n if (!compareStrings(vToken.symbol(), \"vUST\") && !compareStrings(vToken.symbol(), \"vLUNA\")) {\n VTokenMetadata memory metaDataItem = vTokenMetadata(vToken);\n\n //get balanceOfUnderlying and borrowBalanceCurrent from vTokenBalance\n VTokenBalances memory vTokenBalanceInfo = vTokenBalances(vToken, account);\n\n VTokenUnderlyingPrice memory underlyingPriceResponse = vTokenUnderlyingPrice(vToken);\n uint underlyingPrice = underlyingPriceResponse.underlyingPrice;\n Exp memory underlyingPriceMantissa = Exp({ mantissa: underlyingPrice });\n\n //get dailyXvsSupplyMarket\n uint dailyXvsSupplyMarket = 0;\n uint supplyInUsd = mul_ScalarTruncate(underlyingPriceMantissa, vTokenBalanceInfo.balanceOfUnderlying);\n uint marketTotalSupply = (metaDataItem.totalSupply.mul(metaDataItem.exchangeRateCurrent)).div(1e18);\n uint marketTotalSupplyInUsd = mul_ScalarTruncate(underlyingPriceMantissa, marketTotalSupply);\n\n if (marketTotalSupplyInUsd > 0) {\n dailyXvsSupplyMarket = (metaDataItem.dailySupplyXvs.mul(supplyInUsd)).div(marketTotalSupplyInUsd);\n }\n\n //get dailyXvsBorrowMarket\n uint dailyXvsBorrowMarket = 0;\n uint borrowsInUsd = mul_ScalarTruncate(underlyingPriceMantissa, vTokenBalanceInfo.borrowBalanceCurrent);\n uint marketTotalBorrowsInUsd = mul_ScalarTruncate(underlyingPriceMantissa, metaDataItem.totalBorrows);\n\n if (marketTotalBorrowsInUsd > 0) {\n dailyXvsBorrowMarket = (metaDataItem.dailyBorrowXvs.mul(borrowsInUsd)).div(marketTotalBorrowsInUsd);\n }\n\n dailyXvsPerAccount += dailyXvsSupplyMarket + dailyXvsBorrowMarket;\n }\n }\n\n return dailyXvsPerAccount;\n }\n\n /**\n * @notice Get the current vToken balance (outstanding borrows) for an account\n * @param vToken Address of the token to check the balance of\n * @param account Account address to fetch the balance of\n * @return VTokenBalances with token balance information\n */\n function vTokenBalances(VToken vToken, address payable account) public returns (VTokenBalances memory) {\n uint balanceOf = vToken.balanceOf(account);\n uint borrowBalanceCurrent = vToken.borrowBalanceCurrent(account);\n uint balanceOfUnderlying = vToken.balanceOfUnderlying(account);\n uint tokenBalance;\n uint tokenAllowance;\n\n if (compareStrings(vToken.symbol(), \"vBNB\")) {\n tokenBalance = account.balance;\n tokenAllowance = account.balance;\n } else {\n VBep20 vBep20 = VBep20(address(vToken));\n EIP20Interface underlying = EIP20Interface(vBep20.underlying());\n tokenBalance = underlying.balanceOf(account);\n tokenAllowance = underlying.allowance(account, address(vToken));\n }\n\n return\n VTokenBalances({\n vToken: address(vToken),\n balanceOf: balanceOf,\n borrowBalanceCurrent: borrowBalanceCurrent,\n balanceOfUnderlying: balanceOfUnderlying,\n tokenBalance: tokenBalance,\n tokenAllowance: tokenAllowance\n });\n }\n\n /**\n * @notice Get the current vToken balances (outstanding borrows) for all vTokens on an account\n * @param vTokens Addresses of the tokens to check the balance of\n * @param account Account address to fetch the balance of\n * @return VTokenBalances Array with token balance information\n */\n function vTokenBalancesAll(\n VToken[] calldata vTokens,\n address payable account\n ) external returns (VTokenBalances[] memory) {\n uint vTokenCount = vTokens.length;\n VTokenBalances[] memory res = new VTokenBalances[](vTokenCount);\n for (uint i = 0; i < vTokenCount; i++) {\n res[i] = vTokenBalances(vTokens[i], account);\n }\n return res;\n }\n\n /**\n * @notice Get the price for the underlying asset of a vToken\n * @param vToken address of the vToken\n * @return response struct with underlyingPrice info of vToken\n */\n function vTokenUnderlyingPrice(VToken vToken) public view returns (VTokenUnderlyingPrice memory) {\n ComptrollerInterface comptroller = ComptrollerInterface(address(vToken.comptroller()));\n PriceOracle priceOracle = comptroller.oracle();\n\n return\n VTokenUnderlyingPrice({ vToken: address(vToken), underlyingPrice: priceOracle.getUnderlyingPrice(vToken) });\n }\n\n /**\n * @notice Query the underlyingPrice of an array of vTokens\n * @param vTokens Array of vToken addresses\n * @return array of response structs with underlying price information of vTokens\n */\n function vTokenUnderlyingPriceAll(\n VToken[] calldata vTokens\n ) external view returns (VTokenUnderlyingPrice[] memory) {\n uint vTokenCount = vTokens.length;\n VTokenUnderlyingPrice[] memory res = new VTokenUnderlyingPrice[](vTokenCount);\n for (uint i = 0; i < vTokenCount; i++) {\n res[i] = vTokenUnderlyingPrice(vTokens[i]);\n }\n return res;\n }\n\n /**\n * @notice Query the account liquidity and shortfall of an account\n * @param comptroller Address of comptroller proxy\n * @param account Address of the account to query\n * @return Struct with markets user has entered, liquidity, and shortfall of the account\n */\n function getAccountLimits(\n ComptrollerInterface comptroller,\n address account\n ) public view returns (AccountLimits memory) {\n (uint errorCode, uint liquidity, uint shortfall) = comptroller.getAccountLiquidity(account);\n require(errorCode == 0, \"account liquidity error\");\n\n return AccountLimits({ markets: comptroller.getAssetsIn(account), liquidity: liquidity, shortfall: shortfall });\n }\n\n /**\n * @notice Query the XVSBalance info of an account\n * @param xvs XVS contract address\n * @param account Account address\n * @return Struct with XVS balance and voter details\n */\n function getXVSBalanceMetadata(XVS xvs, address account) external view returns (XVSBalanceMetadata memory) {\n return\n XVSBalanceMetadata({\n balance: xvs.balanceOf(account),\n votes: uint256(xvs.getCurrentVotes(account)),\n delegate: xvs.delegates(account)\n });\n }\n\n /**\n * @notice Query the XVSBalance extended info of an account\n * @param xvs XVS contract address\n * @param comptroller Comptroller proxy contract address\n * @param account Account address\n * @return Struct with XVS balance and voter details and XVS allocation\n */\n function getXVSBalanceMetadataExt(\n XVS xvs,\n ComptrollerInterface comptroller,\n address account\n ) external returns (XVSBalanceMetadataExt memory) {\n uint balance = xvs.balanceOf(account);\n comptroller.claimVenus(account);\n uint newBalance = xvs.balanceOf(account);\n uint accrued = comptroller.venusAccrued(account);\n uint total = add_(accrued, newBalance, \"sum xvs total\");\n uint allocated = sub_(total, balance, \"sub allocated\");\n\n return\n XVSBalanceMetadataExt({\n balance: balance,\n votes: uint256(xvs.getCurrentVotes(account)),\n delegate: xvs.delegates(account),\n allocated: allocated\n });\n }\n\n /**\n * @notice Query the voting power for an account at a specific list of block numbers\n * @param xvs XVS contract address\n * @param account Address of the account\n * @param blockNumbers Array of blocks to query\n * @return Array of VenusVotes structs with block number and vote count\n */\n function getVenusVotes(\n XVS xvs,\n address account,\n uint32[] calldata blockNumbers\n ) external view returns (VenusVotes[] memory) {\n VenusVotes[] memory res = new VenusVotes[](blockNumbers.length);\n for (uint i = 0; i < blockNumbers.length; i++) {\n res[i] = VenusVotes({\n blockNumber: uint256(blockNumbers[i]),\n votes: uint256(xvs.getPriorVotes(account, blockNumbers[i]))\n });\n }\n return res;\n }\n\n /**\n * @dev Queries the current supply to calculate rewards for an account\n * @param supplyState VenusMarketState struct\n * @param vToken Address of a vToken\n * @param comptroller Address of the comptroller proxy\n */\n function updateVenusSupplyIndex(\n VenusMarketState memory supplyState,\n address vToken,\n ComptrollerInterface comptroller\n ) internal view {\n uint supplySpeed = comptroller.venusSupplySpeeds(vToken);\n uint blockNumber = block.number;\n uint deltaBlocks = sub_(blockNumber, uint(supplyState.block));\n if (deltaBlocks > 0 && supplySpeed > 0) {\n uint supplyTokens = VToken(vToken).totalSupply();\n uint venusAccrued = mul_(deltaBlocks, supplySpeed);\n Double memory ratio = supplyTokens > 0 ? fraction(venusAccrued, supplyTokens) : Double({ mantissa: 0 });\n Double memory index = add_(Double({ mantissa: supplyState.index }), ratio);\n supplyState.index = safe224(index.mantissa, \"new index overflows\");\n supplyState.block = safe32(blockNumber, \"block number overflows\");\n } else if (deltaBlocks > 0) {\n supplyState.block = safe32(blockNumber, \"block number overflows\");\n }\n }\n\n /**\n * @dev Queries the current borrow to calculate rewards for an account\n * @param borrowState VenusMarketState struct\n * @param vToken Address of a vToken\n * @param comptroller Address of the comptroller proxy\n */\n function updateVenusBorrowIndex(\n VenusMarketState memory borrowState,\n address vToken,\n Exp memory marketBorrowIndex,\n ComptrollerInterface comptroller\n ) internal view {\n uint borrowSpeed = comptroller.venusBorrowSpeeds(vToken);\n uint blockNumber = block.number;\n uint deltaBlocks = sub_(blockNumber, uint(borrowState.block));\n if (deltaBlocks > 0 && borrowSpeed > 0) {\n uint borrowAmount = div_(VToken(vToken).totalBorrows(), marketBorrowIndex);\n uint venusAccrued = mul_(deltaBlocks, borrowSpeed);\n Double memory ratio = borrowAmount > 0 ? fraction(venusAccrued, borrowAmount) : Double({ mantissa: 0 });\n Double memory index = add_(Double({ mantissa: borrowState.index }), ratio);\n borrowState.index = safe224(index.mantissa, \"new index overflows\");\n borrowState.block = safe32(blockNumber, \"block number overflows\");\n } else if (deltaBlocks > 0) {\n borrowState.block = safe32(blockNumber, \"block number overflows\");\n }\n }\n\n /**\n * @dev Calculate available rewards for an account's supply\n * @param supplyState VenusMarketState struct\n * @param vToken Address of a vToken\n * @param supplier Address of the account supplying\n * @param comptroller Address of the comptroller proxy\n * @return Undistributed earned XVS from supplies\n */\n function distributeSupplierVenus(\n VenusMarketState memory supplyState,\n address vToken,\n address supplier,\n ComptrollerInterface comptroller\n ) internal view returns (uint) {\n Double memory supplyIndex = Double({ mantissa: supplyState.index });\n Double memory supplierIndex = Double({ mantissa: comptroller.venusSupplierIndex(vToken, supplier) });\n if (supplierIndex.mantissa == 0 && supplyIndex.mantissa > 0) {\n supplierIndex.mantissa = comptroller.venusInitialIndex();\n }\n\n Double memory deltaIndex = sub_(supplyIndex, supplierIndex);\n uint supplierTokens = VToken(vToken).balanceOf(supplier);\n uint supplierDelta = mul_(supplierTokens, deltaIndex);\n return supplierDelta;\n }\n\n /**\n * @dev Calculate available rewards for an account's borrows\n * @param borrowState VenusMarketState struct\n * @param vToken Address of a vToken\n * @param borrower Address of the account borrowing\n * @param marketBorrowIndex vToken Borrow index\n * @param comptroller Address of the comptroller proxy\n * @return Undistributed earned XVS from borrows\n */\n function distributeBorrowerVenus(\n VenusMarketState memory borrowState,\n address vToken,\n address borrower,\n Exp memory marketBorrowIndex,\n ComptrollerInterface comptroller\n ) internal view returns (uint) {\n Double memory borrowIndex = Double({ mantissa: borrowState.index });\n Double memory borrowerIndex = Double({ mantissa: comptroller.venusBorrowerIndex(vToken, borrower) });\n if (borrowerIndex.mantissa > 0) {\n Double memory deltaIndex = sub_(borrowIndex, borrowerIndex);\n uint borrowerAmount = div_(VToken(vToken).borrowBalanceStored(borrower), marketBorrowIndex);\n uint borrowerDelta = mul_(borrowerAmount, deltaIndex);\n return borrowerDelta;\n }\n return 0;\n }\n\n /**\n * @notice Calculate the total XVS tokens pending and accrued by a user account\n * @param holder Account to query pending XVS\n * @param comptroller Address of the comptroller\n * @return Reward object contraining the totalRewards and pending rewards for each market\n */\n function pendingRewards(\n address holder,\n ComptrollerInterface comptroller\n ) external view returns (RewardSummary memory) {\n VToken[] memory vTokens = comptroller.getAllMarkets();\n ClaimVenusLocalVariables memory vars;\n RewardSummary memory rewardSummary;\n rewardSummary.distributorAddress = address(comptroller);\n rewardSummary.rewardTokenAddress = comptroller.getXVSAddress();\n rewardSummary.totalRewards = comptroller.venusAccrued(holder);\n rewardSummary.pendingRewards = new PendingReward[](vTokens.length);\n for (uint i; i < vTokens.length; ++i) {\n (vars.borrowIndex, vars.borrowBlock) = comptroller.venusBorrowState(address(vTokens[i]));\n VenusMarketState memory borrowState = VenusMarketState({\n index: vars.borrowIndex,\n block: vars.borrowBlock\n });\n\n (vars.supplyIndex, vars.supplyBlock) = comptroller.venusSupplyState(address(vTokens[i]));\n VenusMarketState memory supplyState = VenusMarketState({\n index: vars.supplyIndex,\n block: vars.supplyBlock\n });\n\n Exp memory borrowIndex = Exp({ mantissa: vTokens[i].borrowIndex() });\n\n PendingReward memory marketReward;\n marketReward.vTokenAddress = address(vTokens[i]);\n\n updateVenusBorrowIndex(borrowState, address(vTokens[i]), borrowIndex, comptroller);\n uint256 borrowReward = distributeBorrowerVenus(\n borrowState,\n address(vTokens[i]),\n holder,\n borrowIndex,\n comptroller\n );\n\n updateVenusSupplyIndex(supplyState, address(vTokens[i]), comptroller);\n uint256 supplyReward = distributeSupplierVenus(supplyState, address(vTokens[i]), holder, comptroller);\n\n marketReward.amount = add_(borrowReward, supplyReward);\n rewardSummary.pendingRewards[i] = marketReward;\n }\n return rewardSummary;\n }\n\n // utilities\n /**\n * @notice Compares if two strings are equal\n * @param a First string to compare\n * @param b Second string to compare\n * @return Boolean depending on if the strings are equal\n */\n function compareStrings(string memory a, string memory b) internal pure returns (bool) {\n return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));\n }\n}\n" + }, + "contracts/Oracle/PriceOracle.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Tokens/VTokens/VToken.sol\";\n\ncontract PriceOracle {\n /// @notice Indicator that this is a PriceOracle contract (for inspection)\n bool public constant isPriceOracle = true;\n\n /**\n * @notice Get the underlying price of a vToken asset\n * @param vToken The vToken to get the underlying price of\n * @return The underlying asset price mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function getUnderlyingPrice(VToken vToken) external view returns (uint);\n}\n" + }, + "contracts/test/BEP20.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Utils/SafeMath.sol\";\n\n// Mock import\nimport { GovernorBravoDelegate } from \"@venusprotocol/governance-contracts/contracts/Governance/GovernorBravoDelegate.sol\";\n\ninterface BEP20Base {\n event Approval(address indexed owner, address indexed spender, uint256 value);\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function totalSupply() external view returns (uint256);\n\n function allowance(address owner, address spender) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function balanceOf(address who) external view returns (uint256);\n}\n\ncontract BEP20 is BEP20Base {\n function transfer(address to, uint256 value) external returns (bool);\n\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\ncontract BEP20NS is BEP20Base {\n function transfer(address to, uint256 value) external;\n\n function transferFrom(address from, address to, uint256 value) external;\n}\n\n/**\n * @title Standard BEP20 token\n * @dev Implementation of the basic standard token.\n * See https://github.com/ethereum/EIPs/issues/20\n */\ncontract StandardToken is BEP20 {\n using SafeMath for uint256;\n\n string public name;\n string public symbol;\n uint8 public decimals;\n uint256 public totalSupply;\n mapping(address => mapping(address => uint256)) public allowance;\n mapping(address => uint256) public balanceOf;\n\n constructor(\n uint256 _initialAmount,\n string memory _tokenName,\n uint8 _decimalUnits,\n string memory _tokenSymbol\n ) public {\n totalSupply = _initialAmount;\n balanceOf[msg.sender] = _initialAmount;\n name = _tokenName;\n symbol = _tokenSymbol;\n decimals = _decimalUnits;\n }\n\n function transfer(address dst, uint256 amount) external returns (bool) {\n balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount, \"Insufficient balance\");\n balanceOf[dst] = balanceOf[dst].add(amount, \"Balance overflow\");\n emit Transfer(msg.sender, dst, amount);\n return true;\n }\n\n function transferFrom(address src, address dst, uint256 amount) external returns (bool) {\n allowance[src][msg.sender] = allowance[src][msg.sender].sub(amount, \"Insufficient allowance\");\n balanceOf[src] = balanceOf[src].sub(amount, \"Insufficient balance\");\n balanceOf[dst] = balanceOf[dst].add(amount, \"Balance overflow\");\n emit Transfer(src, dst, amount);\n return true;\n }\n\n function approve(address _spender, uint256 amount) external returns (bool) {\n allowance[msg.sender][_spender] = amount;\n emit Approval(msg.sender, _spender, amount);\n return true;\n }\n}\n\n/**\n * @title Non-Standard BEP20 token\n * @dev Version of BEP20 with no return values for `transfer` and `transferFrom`\n * See https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\ncontract NonStandardToken is BEP20NS {\n using SafeMath for uint256;\n\n string public name;\n uint8 public decimals;\n string public symbol;\n uint256 public totalSupply;\n mapping(address => mapping(address => uint256)) public allowance;\n mapping(address => uint256) public balanceOf;\n\n constructor(\n uint256 _initialAmount,\n string memory _tokenName,\n uint8 _decimalUnits,\n string memory _tokenSymbol\n ) public {\n totalSupply = _initialAmount;\n balanceOf[msg.sender] = _initialAmount;\n name = _tokenName;\n symbol = _tokenSymbol;\n decimals = _decimalUnits;\n }\n\n function transfer(address dst, uint256 amount) external {\n balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount, \"Insufficient balance\");\n balanceOf[dst] = balanceOf[dst].add(amount, \"Balance overflow\");\n emit Transfer(msg.sender, dst, amount);\n }\n\n function transferFrom(address src, address dst, uint256 amount) external {\n allowance[src][msg.sender] = allowance[src][msg.sender].sub(amount, \"Insufficient allowance\");\n balanceOf[src] = balanceOf[src].sub(amount, \"Insufficient balance\");\n balanceOf[dst] = balanceOf[dst].add(amount, \"Balance overflow\");\n emit Transfer(src, dst, amount);\n }\n\n function approve(address _spender, uint256 amount) external returns (bool) {\n allowance[msg.sender][_spender] = amount;\n emit Approval(msg.sender, _spender, amount);\n return true;\n }\n}\n\ncontract BEP20Harness is StandardToken {\n // To support testing, we can specify addresses for which transferFrom should fail and return false\n mapping(address => bool) public failTransferFromAddresses;\n\n // To support testing, we allow the contract to always fail `transfer`.\n mapping(address => bool) public failTransferToAddresses;\n\n constructor(\n uint256 _initialAmount,\n string memory _tokenName,\n uint8 _decimalUnits,\n string memory _tokenSymbol\n ) public StandardToken(_initialAmount, _tokenName, _decimalUnits, _tokenSymbol) {}\n\n function harnessSetFailTransferFromAddress(address src, bool _fail) public {\n failTransferFromAddresses[src] = _fail;\n }\n\n function harnessSetFailTransferToAddress(address dst, bool _fail) public {\n failTransferToAddresses[dst] = _fail;\n }\n\n function harnessSetBalance(address _account, uint _amount) public {\n balanceOf[_account] = _amount;\n }\n\n function transfer(address dst, uint256 amount) external returns (bool success) {\n // Added for testing purposes\n if (failTransferToAddresses[dst]) {\n return false;\n }\n balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount, \"Insufficient balance\");\n balanceOf[dst] = balanceOf[dst].add(amount, \"Balance overflow\");\n emit Transfer(msg.sender, dst, amount);\n return true;\n }\n\n function transferFrom(address src, address dst, uint256 amount) external returns (bool success) {\n // Added for testing purposes\n if (failTransferFromAddresses[src]) {\n return false;\n }\n allowance[src][msg.sender] = allowance[src][msg.sender].sub(amount, \"Insufficient allowance\");\n balanceOf[src] = balanceOf[src].sub(amount, \"Insufficient balance\");\n balanceOf[dst] = balanceOf[dst].add(amount, \"Balance overflow\");\n emit Transfer(src, dst, amount);\n return true;\n }\n}\n" + }, + "contracts/test/ComptrollerHarness.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./ComptrollerMock.sol\";\nimport \"../Oracle/PriceOracle.sol\";\nimport \"../Comptroller/Unitroller.sol\";\n\ncontract ComptrollerHarness is ComptrollerMock {\n address internal xvsAddress;\n address internal vXVSAddress;\n uint public blockNumber;\n\n constructor() public ComptrollerMock() {}\n\n function setVenusSupplyState(address vToken, uint224 index, uint32 blockNumber_) public {\n venusSupplyState[vToken].index = index;\n venusSupplyState[vToken].block = blockNumber_;\n }\n\n function setVenusBorrowState(address vToken, uint224 index, uint32 blockNumber_) public {\n venusBorrowState[vToken].index = index;\n venusBorrowState[vToken].block = blockNumber_;\n }\n\n function setVenusAccrued(address user, uint userAccrued) public {\n venusAccrued[user] = userAccrued;\n }\n\n function setXVSAddress(address xvsAddress_) public {\n xvsAddress = xvsAddress_;\n }\n\n function setXVSVTokenAddress(address vXVSAddress_) public {\n vXVSAddress = vXVSAddress_;\n }\n\n /**\n * @notice Set the amount of XVS distributed per block\n * @param venusRate_ The amount of XVS wei per block to distribute\n */\n function harnessSetVenusRate(uint venusRate_) public {\n venusRate = venusRate_;\n }\n\n /**\n * @notice Recalculate and update XVS speeds for all XVS markets\n */\n function harnessRefreshVenusSpeeds() public {\n VToken[] memory allMarkets_ = allMarkets;\n\n for (uint i = 0; i < allMarkets_.length; i++) {\n VToken vToken = allMarkets_[i];\n Exp memory borrowIndex = Exp({ mantissa: vToken.borrowIndex() });\n updateVenusSupplyIndex(address(vToken));\n updateVenusBorrowIndex(address(vToken), borrowIndex);\n }\n\n Exp memory totalUtility = Exp({ mantissa: 0 });\n Exp[] memory utilities = new Exp[](allMarkets_.length);\n for (uint i = 0; i < allMarkets_.length; i++) {\n VToken vToken = allMarkets_[i];\n if (venusSpeeds[address(vToken)] > 0) {\n Exp memory assetPrice = Exp({ mantissa: oracle.getUnderlyingPrice(vToken) });\n Exp memory utility = mul_(assetPrice, vToken.totalBorrows());\n utilities[i] = utility;\n totalUtility = add_(totalUtility, utility);\n }\n }\n\n for (uint i = 0; i < allMarkets_.length; i++) {\n VToken vToken = allMarkets[i];\n uint newSpeed = totalUtility.mantissa > 0 ? mul_(venusRate, div_(utilities[i], totalUtility)) : 0;\n setVenusSpeedInternal(vToken, newSpeed, newSpeed);\n }\n }\n\n function setVenusBorrowerIndex(address vToken, address borrower, uint index) public {\n venusBorrowerIndex[vToken][borrower] = index;\n }\n\n function setVenusSupplierIndex(address vToken, address supplier, uint index) public {\n venusSupplierIndex[vToken][supplier] = index;\n }\n\n function harnessDistributeAllBorrowerVenus(\n address vToken,\n address borrower,\n uint marketBorrowIndexMantissa\n ) public {\n distributeBorrowerVenus(vToken, borrower, Exp({ mantissa: marketBorrowIndexMantissa }));\n venusAccrued[borrower] = grantXVSInternal(borrower, venusAccrued[borrower], 0, false);\n }\n\n function harnessDistributeAllSupplierVenus(address vToken, address supplier) public {\n distributeSupplierVenus(vToken, supplier);\n venusAccrued[supplier] = grantXVSInternal(supplier, venusAccrued[supplier], 0, false);\n }\n\n function harnessUpdateVenusBorrowIndex(address vToken, uint marketBorrowIndexMantissa) public {\n updateVenusBorrowIndex(vToken, Exp({ mantissa: marketBorrowIndexMantissa }));\n }\n\n function harnessUpdateVenusSupplyIndex(address vToken) public {\n updateVenusSupplyIndex(vToken);\n }\n\n function harnessDistributeBorrowerVenus(address vToken, address borrower, uint marketBorrowIndexMantissa) public {\n distributeBorrowerVenus(vToken, borrower, Exp({ mantissa: marketBorrowIndexMantissa }));\n }\n\n function harnessDistributeSupplierVenus(address vToken, address supplier) public {\n distributeSupplierVenus(vToken, supplier);\n }\n\n function harnessTransferVenus(address user, uint userAccrued, uint threshold) public returns (uint) {\n if (userAccrued > 0 && userAccrued >= threshold) {\n return grantXVSInternal(user, userAccrued, 0, false);\n }\n return userAccrued;\n }\n\n function harnessAddVenusMarkets(address[] memory vTokens) public {\n for (uint i = 0; i < vTokens.length; i++) {\n // temporarily set venusSpeed to 1 (will be fixed by `harnessRefreshVenusSpeeds`)\n setVenusSpeedInternal(VToken(vTokens[i]), 1, 1);\n }\n }\n\n function harnessSetMintedVAIs(address user, uint amount) public {\n mintedVAIs[user] = amount;\n }\n\n function harnessFastForward(uint blocks) public returns (uint) {\n blockNumber += blocks;\n return blockNumber;\n }\n\n function setBlockNumber(uint number) public {\n blockNumber = number;\n }\n\n function getBlockNumber() internal view returns (uint) {\n return blockNumber;\n }\n\n function getVenusMarkets() public view returns (address[] memory) {\n uint m = allMarkets.length;\n uint n = 0;\n for (uint i = 0; i < m; i++) {\n if (venusSpeeds[address(allMarkets[i])] > 0) {\n n++;\n }\n }\n\n address[] memory venusMarkets = new address[](n);\n uint k = 0;\n for (uint i = 0; i < m; i++) {\n if (venusSpeeds[address(allMarkets[i])] > 0) {\n venusMarkets[k++] = address(allMarkets[i]);\n }\n }\n return venusMarkets;\n }\n\n function harnessSetReleaseStartBlock(uint startBlock) external {\n releaseStartBlock = startBlock;\n }\n\n function harnessAddVtoken(address vToken) external {\n markets[vToken] = Market({ isListed: true, isVenus: false, collateralFactorMantissa: 0 });\n }\n}\n\ncontract EchoTypesComptroller is UnitrollerAdminStorage {\n function stringy(string memory s) public pure returns (string memory) {\n return s;\n }\n\n function addresses(address a) public pure returns (address) {\n return a;\n }\n\n function booly(bool b) public pure returns (bool) {\n return b;\n }\n\n function listOInts(uint[] memory u) public pure returns (uint[] memory) {\n return u;\n }\n\n function reverty() public pure {\n require(false, \"gotcha sucka\");\n }\n\n function becomeBrains(address payable unitroller) public {\n Unitroller(unitroller)._acceptImplementation();\n }\n}\n" + }, + "contracts/test/ComptrollerMock.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Comptroller/Diamond/facets/MarketFacet.sol\";\nimport \"../Comptroller/Diamond/facets/PolicyFacet.sol\";\nimport \"../Comptroller/Diamond/facets/RewardFacet.sol\";\nimport \"../Comptroller/Diamond/facets/SetterFacet.sol\";\nimport \"../Comptroller/Unitroller.sol\";\n\n// This contract contains all methods of Comptroller implementation in different facets at one place for testing purpose\n// This contract does not have diamond functionality(i.e delegate call to facets methods)\ncontract ComptrollerMock is MarketFacet, PolicyFacet, RewardFacet, SetterFacet {\n constructor() public {\n admin = msg.sender;\n }\n\n function _become(Unitroller unitroller) public {\n require(msg.sender == unitroller.admin(), \"only unitroller admin can\");\n require(unitroller._acceptImplementation() == 0, \"not authorized\");\n }\n\n function _setComptrollerLens(ComptrollerLensInterface comptrollerLens_) external returns (uint) {\n ensureAdmin();\n ensureNonzeroAddress(address(comptrollerLens_));\n address oldComptrollerLens = address(comptrollerLens);\n comptrollerLens = comptrollerLens_;\n emit NewComptrollerLens(oldComptrollerLens, address(comptrollerLens));\n\n return uint(Error.NO_ERROR);\n }\n}\n" + }, + "contracts/test/ComptrollerMockR1.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Comptroller/Diamond/facets/MarketFacet.sol\";\nimport \"../Comptroller/Diamond/facets/PolicyFacet.sol\";\nimport \"../Comptroller/Diamond/facets/RewardFacet.sol\";\nimport \"../Comptroller/Diamond/facets/SetterFacet.sol\";\nimport \"../Comptroller/Unitroller.sol\";\n\n// This contract contains all methods of Comptroller implementation in different facets at one place for testing purpose\n// This contract does not have diamond functionality(i.e delegate call to facets methods)\ncontract ComptrollerMockR1 is MarketFacet, PolicyFacet, RewardFacet, SetterFacet {\n event MarketListed(address vToken);\n event NewCollateralFactor(address vToken, uint256 oldCollateralFactorMantissa, uint256 newCollateralFactorMantissa);\n event MarketEntered(address vToken, address account);\n event MarketExited(address vToken, address account);\n\n constructor() public {\n admin = msg.sender;\n }\n\n function _become(Unitroller unitroller) public {\n require(msg.sender == unitroller.admin(), \"only unitroller admin can\");\n require(unitroller._acceptImplementation() == 0, \"not authorized\");\n }\n\n function _setComptrollerLens(ComptrollerLensInterface comptrollerLens_) external returns (uint) {\n ensureAdmin();\n ensureNonzeroAddress(address(comptrollerLens_));\n address oldComptrollerLens = address(comptrollerLens);\n comptrollerLens = comptrollerLens_;\n emit NewComptrollerLens(oldComptrollerLens, address(comptrollerLens));\n\n return uint(Error.NO_ERROR);\n }\n}\n" + }, + "contracts/test/ComptrollerScenario.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./ComptrollerMock.sol\";\n\ncontract ComptrollerScenario is ComptrollerMock {\n uint public blockNumber;\n address public xvsAddress;\n address public vaiAddress;\n\n constructor() public ComptrollerMock() {}\n\n function setXVSAddress(address xvsAddress_) public {\n xvsAddress = xvsAddress_;\n }\n\n // function getXVSAddress() public view returns (address) {\n // return xvsAddress;\n // }\n\n function setVAIAddress(address vaiAddress_) public {\n vaiAddress = vaiAddress_;\n }\n\n function getVAIAddress() public view returns (address) {\n return vaiAddress;\n }\n\n function membershipLength(VToken vToken) public view returns (uint) {\n return accountAssets[address(vToken)].length;\n }\n\n function fastForward(uint blocks) public returns (uint) {\n blockNumber += blocks;\n\n return blockNumber;\n }\n\n function setBlockNumber(uint number) public {\n blockNumber = number;\n }\n\n function getBlockNumber() internal view returns (uint) {\n return blockNumber;\n }\n\n function getVenusMarkets() public view returns (address[] memory) {\n uint m = allMarkets.length;\n uint n = 0;\n for (uint i = 0; i < m; i++) {\n if (markets[address(allMarkets[i])].isVenus) {\n n++;\n }\n }\n\n address[] memory venusMarkets = new address[](n);\n uint k = 0;\n for (uint i = 0; i < m; i++) {\n if (markets[address(allMarkets[i])].isVenus) {\n venusMarkets[k++] = address(allMarkets[i]);\n }\n }\n return venusMarkets;\n }\n\n function unlist(VToken vToken) public {\n markets[address(vToken)].isListed = false;\n }\n\n /**\n * @notice Recalculate and update XVS speeds for all XVS markets\n */\n function refreshVenusSpeeds() public {\n VToken[] memory allMarkets_ = allMarkets;\n\n for (uint i = 0; i < allMarkets_.length; i++) {\n VToken vToken = allMarkets_[i];\n Exp memory borrowIndex = Exp({ mantissa: vToken.borrowIndex() });\n updateVenusSupplyIndex(address(vToken));\n updateVenusBorrowIndex(address(vToken), borrowIndex);\n }\n\n Exp memory totalUtility = Exp({ mantissa: 0 });\n Exp[] memory utilities = new Exp[](allMarkets_.length);\n for (uint i = 0; i < allMarkets_.length; i++) {\n VToken vToken = allMarkets_[i];\n if (venusSpeeds[address(vToken)] > 0) {\n Exp memory assetPrice = Exp({ mantissa: oracle.getUnderlyingPrice(vToken) });\n Exp memory utility = mul_(assetPrice, vToken.totalBorrows());\n utilities[i] = utility;\n totalUtility = add_(totalUtility, utility);\n }\n }\n\n for (uint i = 0; i < allMarkets_.length; i++) {\n VToken vToken = allMarkets[i];\n uint newSpeed = totalUtility.mantissa > 0 ? mul_(venusRate, div_(utilities[i], totalUtility)) : 0;\n setVenusSpeedInternal(vToken, newSpeed, newSpeed);\n }\n }\n}\n" + }, + "contracts/test/DiamondHarness.sol": { + "content": "pragma solidity ^0.5.16;\npragma experimental ABIEncoderV2;\n\nimport \"../Comptroller/Diamond/Diamond.sol\";\n\ncontract DiamondHarness is Diamond {\n function getFacetAddress(bytes4 sig) public view returns (address) {\n address facet = _selectorToFacetAndPosition[sig].facetAddress;\n require(facet != address(0), \"Diamond: Function does not exist\");\n return facet;\n }\n}\n" + }, + "contracts/test/EvilToken.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./FaucetToken.sol\";\n\n/**\n * @title The Venus Evil Test Token\n * @author Venus\n * @notice A simple test token that fails certain operations\n */\ncontract EvilToken is FaucetToken {\n bool public fail;\n\n constructor(\n uint256 _initialAmount,\n string memory _tokenName,\n uint8 _decimalUnits,\n string memory _tokenSymbol\n ) public FaucetToken(_initialAmount, _tokenName, _decimalUnits, _tokenSymbol) {\n fail = true;\n }\n\n function setFail(bool _fail) external {\n fail = _fail;\n }\n\n function transfer(address dst, uint256 amount) external returns (bool) {\n if (fail) {\n return false;\n }\n balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount);\n balanceOf[dst] = balanceOf[dst].add(amount);\n emit Transfer(msg.sender, dst, amount);\n return true;\n }\n\n function transferFrom(address src, address dst, uint256 amount) external returns (bool) {\n if (fail) {\n return false;\n }\n balanceOf[src] = balanceOf[src].sub(amount);\n balanceOf[dst] = balanceOf[dst].add(amount);\n allowance[src][msg.sender] = allowance[src][msg.sender].sub(amount);\n emit Transfer(src, dst, amount);\n return true;\n }\n}\n" + }, + "contracts/test/EvilXDelegator.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Tokens/VTokens/VTokenInterfaces.sol\";\n\n/**\n * @title Venus's VBep20Delegator Contract\n * @notice VTokens which wrap an EIP-20 underlying and delegate to an implementation\n * @author Venus\n */\ncontract EvilXDelegator is VTokenInterface, VBep20Interface, VDelegatorInterface {\n /**\n * @notice Construct a new money market\n * @param underlying_ The address of the underlying asset\n * @param comptroller_ The address of the Comptroller\n * @param interestRateModel_ The address of the interest rate model\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\n * @param name_ BEP-20 name of this token\n * @param symbol_ BEP-20 symbol of this token\n * @param decimals_ BEP-20 decimal precision of this token\n * @param admin_ Address of the administrator of this token\n * @param implementation_ The address of the implementation the contract delegates to\n * @param becomeImplementationData The encoded args for becomeImplementation\n */\n constructor(\n address underlying_,\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint256 initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n address payable admin_,\n address implementation_,\n bytes memory becomeImplementationData\n ) public {\n // Creator of the contract is admin during initialization\n admin = msg.sender;\n\n // First delegate gets to initialize the delegator (i.e. storage contract)\n delegateTo(\n implementation_,\n abi.encodeWithSignature(\n \"initialize(address,address,address,uint256,string,string,uint8)\",\n underlying_,\n comptroller_,\n interestRateModel_,\n initialExchangeRateMantissa_,\n name_,\n symbol_,\n decimals_\n )\n );\n\n // New implementations always get set via the settor (post-initialize)\n _setImplementation(implementation_, false, becomeImplementationData);\n\n // Set the proper admin now that initialization is done\n admin = admin_;\n }\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param allowResign Flag to indicate whether to call _resignImplementation on the old implementation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n function _setImplementation(\n address implementation_,\n bool allowResign,\n bytes memory becomeImplementationData\n ) public {\n require(msg.sender == admin, \"VBep20Delegator::_setImplementation: Caller must be admin\");\n\n if (allowResign) {\n delegateToImplementation(abi.encodeWithSignature(\"_resignImplementation()\"));\n }\n\n address oldImplementation = implementation;\n implementation = implementation_;\n\n delegateToImplementation(abi.encodeWithSignature(\"_becomeImplementation(bytes)\", becomeImplementationData));\n\n emit NewImplementation(oldImplementation, implementation);\n }\n\n /**\n * @notice Sender supplies assets into the market and receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function mint(uint256 mintAmount) external returns (uint256) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"mint(uint256)\", mintAmount));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Sender supplies assets into the market and receiver receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function mintBehalf(address receiver, uint256 mintAmount) external returns (uint256) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"mintBehalf(address,uint256)\", receiver, mintAmount)\n );\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of vTokens to redeem into underlying\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeem(uint256 redeemTokens) external returns (uint256) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"redeem(uint256)\", redeemTokens));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to redeem\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"redeemUnderlying(uint256)\", redeemAmount)\n );\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrow(uint256 borrowAmount) external returns (uint256) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"borrow(uint256)\", borrowAmount));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function repayBorrow(uint256 repayAmount) external returns (uint256) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"repayBorrow(uint256)\", repayAmount));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Sender repays a borrow belonging to borrower\n * @param borrower the account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"repayBorrowBehalf(address,uint256)\", borrower, repayAmount)\n );\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this vToken to be liquidated\n * @param vTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function liquidateBorrow(\n address borrower,\n uint256 repayAmount,\n VTokenInterface vTokenCollateral\n ) external returns (uint256) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"liquidateBorrow(address,uint256,address)\", borrower, repayAmount, vTokenCollateral)\n );\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(address dst, uint256 amount) external returns (bool) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"transfer(address,uint256)\", dst, amount));\n return abi.decode(data, (bool));\n }\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(address src, address dst, uint256 amount) external returns (bool) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", src, dst, amount)\n );\n return abi.decode(data, (bool));\n }\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved (-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(address spender, uint256 amount) external returns (bool) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"approve(address,uint256)\", spender, amount)\n );\n return abi.decode(data, (bool));\n }\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return The number of tokens allowed to be spent (-1 means infinite)\n */\n function allowance(address owner, address spender) external view returns (uint256) {\n bytes memory data = delegateToViewImplementation(\n abi.encodeWithSignature(\"allowance(address,address)\", owner, spender)\n );\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Get the token balance of the `owner`\n * @param owner The address of the account to query\n * @return The number of tokens owned by `owner`\n */\n function balanceOf(address owner) external view returns (uint256) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"balanceOf(address)\", owner));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Get the underlying balance of the `owner`\n * @dev This also accrues interest in a transaction\n * @param owner The address of the account to query\n * @return The amount of underlying owned by `owner`\n */\n function balanceOfUnderlying(address owner) external returns (uint256) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"balanceOfUnderlying(address)\", owner));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Get a snapshot of the account's balances, and the cached exchange rate\n * @dev This is used by comptroller to more efficiently perform liquidity checks.\n * @param account Address of the account to snapshot\n * @return (possible error, token balance, borrow balance, exchange rate mantissa)\n */\n function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256) {\n bytes memory data = delegateToViewImplementation(\n abi.encodeWithSignature(\"getAccountSnapshot(address)\", account)\n );\n return abi.decode(data, (uint256, uint256, uint256, uint256));\n }\n\n /**\n * @notice Returns the current per-block borrow interest rate for this vToken\n * @return The borrow interest rate per block, scaled by 1e18\n */\n function borrowRatePerBlock() external view returns (uint256) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"borrowRatePerBlock()\"));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Returns the current per-block supply interest rate for this vToken\n * @return The supply interest rate per block, scaled by 1e18\n */\n function supplyRatePerBlock() external view returns (uint256) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"supplyRatePerBlock()\"));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Returns the current total borrows plus accrued interest\n * @return The total borrows with interest\n */\n function totalBorrowsCurrent() external returns (uint256) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"totalBorrowsCurrent()\"));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex\n * @param account The address whose balance should be calculated after updating borrowIndex\n * @return The calculated balance\n */\n function borrowBalanceCurrent(address account) external returns (uint256) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"borrowBalanceCurrent(address)\", account));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Return the borrow balance of account based on stored data\n * @param account The address whose balance should be calculated\n * @return The calculated balance\n */\n function borrowBalanceStored(address account) public view returns (uint256) {\n bytes memory data = delegateToViewImplementation(\n abi.encodeWithSignature(\"borrowBalanceStored(address)\", account)\n );\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Accrue interest then return the up-to-date exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateCurrent() public returns (uint256) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"exchangeRateCurrent()\"));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Calculates the exchange rate from the underlying to the VToken\n * @dev This function does not accrue interest before calculating the exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateStored() public view returns (uint256) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"exchangeRateStored()\"));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Get cash balance of this vToken in the underlying asset\n * @return The quantity of underlying asset owned by this contract\n */\n function getCash() external view returns (uint256) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"getCash()\"));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Applies accrued interest to total borrows and reserves.\n * @dev This calculates interest accrued from the last checkpointed block\n * up to the current block and writes new checkpoint to storage.\n */\n function accrueInterest() public returns (uint256) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"accrueInterest()\"));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Will fail unless called by another vToken during the process of liquidation.\n * Its absolutely critical to use msg.sender as the borrowed vToken and not a parameter.\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of vTokens to seize\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function seize(address liquidator, address borrower, uint256 seizeTokens) external returns (uint256) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"seize(address,address,uint256)\", liquidator, borrower, seizeTokens)\n );\n return abi.decode(data, (uint256));\n }\n\n /*** Admin Functions ***/\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 payable newPendingAdmin) external returns (uint256) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"_setPendingAdmin(address)\", newPendingAdmin)\n );\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Sets a new comptroller for the market\n * @dev Admin function to set a new comptroller\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setComptroller(ComptrollerInterface newComptroller) public returns (uint256) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"_setComptroller(address)\", newComptroller)\n );\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh\n * @dev Admin function to accrue interest and set a new reserve factor\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"_setReserveFactor(uint256)\", newReserveFactorMantissa)\n );\n return abi.decode(data, (uint256));\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() external returns (uint256) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"_acceptAdmin()\"));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Accrues interest and adds reserves by transferring from admin\n * @param addAmount Amount of reserves to add\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _addReserves(uint256 addAmount) external returns (uint256) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"_addReserves(uint256)\", addAmount));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Accrues interest and reduces reserves by transferring to admin\n * @param reduceAmount Amount of reduction to reserves\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _reduceReserves(uint256 reduceAmount) external returns (uint256) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"_reduceReserves(uint256)\", reduceAmount));\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Accrues interest and updates the interest rate model using _setInterestRateModelFresh\n * @dev Admin function to accrue interest and update the interest rate model\n * @param newInterestRateModel the new interest rate model to use\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setInterestRateModel(InterestRateModel newInterestRateModel) public returns (uint256) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"_setInterestRateModel(address)\", newInterestRateModel)\n );\n return abi.decode(data, (uint256));\n }\n\n /**\n * @notice Internal method to delegate execution to another contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n * @param callee The contract to delegatecall\n * @param data The raw data to delegatecall\n * @return The returned bytes from the delegatecall\n */\n function delegateTo(address callee, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returnData) = callee.delegatecall(data);\n assembly {\n if eq(success, 0) {\n revert(add(returnData, 0x20), returndatasize)\n }\n }\n return returnData;\n }\n\n /**\n * @notice Delegates execution to the implementation contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n * @param data The raw data to delegatecall\n * @return The returned bytes from the delegatecall\n */\n function delegateToImplementation(bytes memory data) public returns (bytes memory) {\n return delegateTo(implementation, data);\n }\n\n /**\n * @notice Delegates execution to an implementation contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n * There are an additional 2 prefix uints from the wrapper returndata, which we ignore since we make an extra hop.\n * @param data The raw data to delegatecall\n * @return The returned bytes from the delegatecall\n */\n function delegateToViewImplementation(bytes memory data) public view returns (bytes memory) {\n (bool success, bytes memory returnData) = address(this).staticcall(\n abi.encodeWithSignature(\"delegateToImplementation(bytes)\", data)\n );\n assembly {\n if eq(success, 0) {\n revert(add(returnData, 0x20), returndatasize)\n }\n }\n return abi.decode(returnData, (bytes));\n }\n\n /**\n * @notice Delegates execution to an implementation contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n */\n function() external payable {\n require(msg.value == 0, \"VBep20Delegator:fallback: cannot send value to fallback\");\n\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" + }, + "contracts/test/EvilXToken.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Tokens/VTokens/VBep20Immutable.sol\";\nimport \"../Tokens/VTokens/VBep20Delegator.sol\";\nimport \"../Tokens/VTokens/VBep20Delegate.sol\";\nimport \"./ComptrollerScenario.sol\";\nimport \"../Comptroller/ComptrollerInterface.sol\";\n\ncontract VBep20Scenario is VBep20Immutable {\n constructor(\n address underlying_,\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n address payable admin_\n )\n public\n VBep20Immutable(\n underlying_,\n comptroller_,\n interestRateModel_,\n initialExchangeRateMantissa_,\n name_,\n symbol_,\n decimals_,\n admin_\n )\n {}\n\n function setTotalBorrows(uint totalBorrows_) public {\n totalBorrows = totalBorrows_;\n }\n\n function setTotalReserves(uint totalReserves_) public {\n totalReserves = totalReserves_;\n }\n\n function getBlockNumber() internal view returns (uint) {\n ComptrollerScenario comptrollerScenario = ComptrollerScenario(address(comptroller));\n return comptrollerScenario.blockNumber();\n }\n}\n\n// doTransferOut method of this token supposed to be compromised and contians malicious code which\n// can be used by attacker to compromise the protocol working.\ncontract EvilXToken is VBep20Delegate {\n event Log(string x, address y);\n event Log(string x, uint y);\n event LogLiquidity(uint liquidity);\n\n uint internal blockNumber = 100000;\n uint internal harnessExchangeRate;\n bool internal harnessExchangeRateStored;\n\n address public comptrollerAddress;\n\n mapping(address => bool) public failTransferToAddresses;\n\n function setComptrollerAddress(address _comptrollerAddress) external {\n comptrollerAddress = _comptrollerAddress;\n }\n\n function exchangeRateStoredInternal() internal view returns (MathError, uint) {\n if (harnessExchangeRateStored) {\n return (MathError.NO_ERROR, harnessExchangeRate);\n }\n return super.exchangeRateStoredInternal();\n }\n\n function doTransferOut(address payable to, uint amount) internal {\n require(failTransferToAddresses[to] == false, \"TOKEN_TRANSFER_OUT_FAILED\");\n super.doTransferOut(to, amount);\n\n // Checking the Liquidity of the user after the tranfer.\n // solhint-disable-next-line no-unused-vars\n (uint errorCode, uint liquidity, uint shortfall) = ComptrollerInterface(comptrollerAddress).getAccountLiquidity(\n msg.sender\n );\n emit LogLiquidity(liquidity);\n return;\n }\n\n function getBlockNumber() internal view returns (uint) {\n return blockNumber;\n }\n\n function getBorrowRateMaxMantissa() public pure returns (uint) {\n return borrowRateMaxMantissa;\n }\n\n function harnessSetBlockNumber(uint newBlockNumber) public {\n blockNumber = newBlockNumber;\n }\n\n function harnessFastForward(uint blocks) public {\n blockNumber += blocks;\n }\n\n function harnessSetBalance(address account, uint amount) external {\n accountTokens[account] = amount;\n }\n\n function harnessSetAccrualBlockNumber(uint _accrualblockNumber) public {\n accrualBlockNumber = _accrualblockNumber;\n }\n\n function harnessSetTotalSupply(uint totalSupply_) public {\n totalSupply = totalSupply_;\n }\n\n function harnessSetTotalBorrows(uint totalBorrows_) public {\n totalBorrows = totalBorrows_;\n }\n\n function harnessIncrementTotalBorrows(uint addtlBorrow_) public {\n totalBorrows = totalBorrows + addtlBorrow_;\n }\n\n function harnessSetTotalReserves(uint totalReserves_) public {\n totalReserves = totalReserves_;\n }\n\n function harnessExchangeRateDetails(uint totalSupply_, uint totalBorrows_, uint totalReserves_) public {\n totalSupply = totalSupply_;\n totalBorrows = totalBorrows_;\n totalReserves = totalReserves_;\n }\n\n function harnessSetExchangeRate(uint exchangeRate) public {\n harnessExchangeRate = exchangeRate;\n harnessExchangeRateStored = true;\n }\n\n function harnessSetFailTransferToAddress(address _to, bool _fail) public {\n failTransferToAddresses[_to] = _fail;\n }\n\n function harnessMintFresh(address account, uint mintAmount) public returns (uint) {\n (uint err, ) = super.mintFresh(account, mintAmount);\n return err;\n }\n\n function harnessMintBehalfFresh(address payer, address receiver, uint mintAmount) public returns (uint) {\n (uint err, ) = super.mintBehalfFresh(payer, receiver, mintAmount);\n return err;\n }\n\n function harnessRedeemFresh(\n address payable account,\n uint vTokenAmount,\n uint underlyingAmount\n ) public returns (uint) {\n return super.redeemFresh(account, account, vTokenAmount, underlyingAmount);\n }\n\n function harnessAccountBorrows(address account) public view returns (uint principal, uint interestIndex) {\n BorrowSnapshot memory snapshot = accountBorrows[account];\n return (snapshot.principal, snapshot.interestIndex);\n }\n\n function harnessSetAccountBorrows(address account, uint principal, uint interestIndex) public {\n accountBorrows[account] = BorrowSnapshot({ principal: principal, interestIndex: interestIndex });\n }\n\n function harnessSetBorrowIndex(uint borrowIndex_) public {\n borrowIndex = borrowIndex_;\n }\n\n function harnessBorrowFresh(address payable account, uint borrowAmount) public returns (uint) {\n return borrowFresh(account, account, borrowAmount);\n }\n\n function harnessRepayBorrowFresh(address payer, address account, uint repayAmount) public returns (uint) {\n (uint err, ) = repayBorrowFresh(payer, account, repayAmount);\n return err;\n }\n\n function harnessLiquidateBorrowFresh(\n address liquidator,\n address borrower,\n uint repayAmount,\n VToken vTokenCollateral\n ) public returns (uint) {\n (uint err, ) = liquidateBorrowFresh(liquidator, borrower, repayAmount, vTokenCollateral);\n return err;\n }\n\n function harnessReduceReservesFresh(uint amount) public returns (uint) {\n return _reduceReservesFresh(amount);\n }\n\n function harnessSetReserveFactorFresh(uint newReserveFactorMantissa) public returns (uint) {\n return _setReserveFactorFresh(newReserveFactorMantissa);\n }\n\n function harnessSetInterestRateModelFresh(InterestRateModel newInterestRateModel) public returns (uint) {\n return _setInterestRateModelFresh(newInterestRateModel);\n }\n\n function harnessSetInterestRateModel(address newInterestRateModelAddress) public {\n interestRateModel = InterestRateModel(newInterestRateModelAddress);\n }\n\n function harnessCallBorrowAllowed(uint amount) public returns (uint) {\n return comptroller.borrowAllowed(address(this), msg.sender, amount);\n }\n}\n" + }, + "contracts/test/Fauceteer.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Tokens/EIP20NonStandardInterface.sol\";\n\n/**\n * @title Fauceteer\n * @author Venus\n * @notice First computer program to be part of The Giving Pledge\n */\ncontract Fauceteer {\n /**\n * @notice Drips some tokens to caller\n * @dev We send 0.01% of our tokens to the caller. Over time, the amount will tend toward and eventually reach zero.\n * @param token The token to drip. Note: if we have no balance in this token, function will revert.\n */\n function drip(EIP20NonStandardInterface token) public {\n uint tokenBalance = token.balanceOf(address(this));\n require(tokenBalance > 0, \"Fauceteer is empty\");\n token.transfer(msg.sender, tokenBalance / 10000); // 0.01%\n\n bool success;\n assembly {\n switch returndatasize()\n case 0 {\n // This is a non-standard BEP-20\n success := not(0) // set success to true\n }\n case 32 {\n // This is a compliant BEP-20\n returndatacopy(0, 0, 32)\n success := mload(0) // Set `success = returndata` of external call\n }\n default {\n // This is an excessively non-compliant BEP-20, revert.\n revert(0, 0)\n }\n }\n\n require(success, \"Transfer returned false.\");\n }\n}\n" + }, + "contracts/test/FaucetToken.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./BEP20.sol\";\n\n/**\n * @title The Venus Faucet Test Token\n * @author Venus\n * @notice A simple test token that lets anyone get more of it.\n */\ncontract FaucetToken is StandardToken {\n constructor(\n uint256 _initialAmount,\n string memory _tokenName,\n uint8 _decimalUnits,\n string memory _tokenSymbol\n ) public StandardToken(_initialAmount, _tokenName, _decimalUnits, _tokenSymbol) {}\n\n function allocateTo(address _owner, uint256 value) public {\n balanceOf[_owner] += value;\n totalSupply += value;\n emit Transfer(address(this), _owner, value);\n }\n}\n\n/**\n * @title The Venus Faucet Test Token (non-standard)\n * @author Venus\n * @notice A simple test token that lets anyone get more of it.\n */\ncontract FaucetNonStandardToken is NonStandardToken {\n constructor(\n uint256 _initialAmount,\n string memory _tokenName,\n uint8 _decimalUnits,\n string memory _tokenSymbol\n ) public NonStandardToken(_initialAmount, _tokenName, _decimalUnits, _tokenSymbol) {}\n\n function allocateTo(address _owner, uint256 value) public {\n balanceOf[_owner] += value;\n totalSupply += value;\n emit Transfer(address(this), _owner, value);\n }\n}\n\n/**\n * @title The Venus Faucet Re-Entrant Test Token\n * @author Venus\n * @notice A test token that is malicious and tries to re-enter callers\n */\ncontract FaucetTokenReEntrantHarness {\n using SafeMath for uint256;\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n string public name;\n string public symbol;\n uint8 public decimals;\n uint256 internal totalSupply_;\n mapping(address => mapping(address => uint256)) internal allowance_;\n mapping(address => uint256) internal balanceOf_;\n\n bytes public reEntryCallData;\n string public reEntryFun;\n\n constructor(\n uint256 _initialAmount,\n string memory _tokenName,\n uint8 _decimalUnits,\n string memory _tokenSymbol,\n bytes memory _reEntryCallData,\n string memory _reEntryFun\n ) public {\n totalSupply_ = _initialAmount;\n balanceOf_[msg.sender] = _initialAmount;\n name = _tokenName;\n symbol = _tokenSymbol;\n decimals = _decimalUnits;\n reEntryCallData = _reEntryCallData;\n reEntryFun = _reEntryFun;\n }\n\n modifier reEnter(string memory funName) {\n string memory _reEntryFun = reEntryFun;\n if (compareStrings(_reEntryFun, funName)) {\n reEntryFun = \"\"; // Clear re-entry fun\n (bool success, bytes memory returndata) = msg.sender.call(reEntryCallData);\n assembly {\n if eq(success, 0) {\n revert(add(returndata, 0x20), returndatasize())\n }\n }\n }\n\n _;\n }\n\n function compareStrings(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b)));\n }\n\n function allocateTo(address _owner, uint256 value) public {\n balanceOf_[_owner] += value;\n totalSupply_ += value;\n emit Transfer(address(this), _owner, value);\n }\n\n function totalSupply() public reEnter(\"totalSupply\") returns (uint256) {\n return totalSupply_;\n }\n\n function allowance(address owner, address spender) public reEnter(\"allowance\") returns (uint256 remaining) {\n return allowance_[owner][spender];\n }\n\n function approve(address spender, uint256 amount) public reEnter(\"approve\") returns (bool success) {\n _approve(msg.sender, spender, amount);\n return true;\n }\n\n function balanceOf(address owner) public reEnter(\"balanceOf\") returns (uint256 balance) {\n return balanceOf_[owner];\n }\n\n function transfer(address dst, uint256 amount) public reEnter(\"transfer\") returns (bool success) {\n _transfer(msg.sender, dst, amount);\n return true;\n }\n\n function transferFrom(\n address src,\n address dst,\n uint256 amount\n ) public reEnter(\"transferFrom\") returns (bool success) {\n _transfer(src, dst, amount);\n _approve(src, msg.sender, allowance_[src][msg.sender].sub(amount));\n return true;\n }\n\n function _approve(address owner, address spender, uint256 amount) internal {\n require(spender != address(0), \"sender should be valid address\");\n require(owner != address(0), \"owner should be valid address\");\n allowance_[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n function _transfer(address src, address dst, uint256 amount) internal {\n require(dst != address(0), \"dst should be valid address\");\n balanceOf_[src] = balanceOf_[src].sub(amount);\n balanceOf_[dst] = balanceOf_[dst].add(amount);\n emit Transfer(src, dst, amount);\n }\n}\n" + }, + "contracts/test/FeeToken.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./FaucetToken.sol\";\n\n/**\n * @title Fee Token\n * @author Venus\n * @notice A simple test token that charges fees on transfer. Used to mock USDT.\n */\ncontract FeeToken is FaucetToken {\n uint public basisPointFee;\n address public owner;\n\n constructor(\n uint256 _initialAmount,\n string memory _tokenName,\n uint8 _decimalUnits,\n string memory _tokenSymbol,\n uint _basisPointFee,\n address _owner\n ) public FaucetToken(_initialAmount, _tokenName, _decimalUnits, _tokenSymbol) {\n basisPointFee = _basisPointFee;\n owner = _owner;\n }\n\n function transfer(address dst, uint amount) public returns (bool) {\n uint fee = amount.mul(basisPointFee).div(10000);\n uint net = amount.sub(fee);\n balanceOf[owner] = balanceOf[owner].add(fee);\n balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount);\n balanceOf[dst] = balanceOf[dst].add(net);\n emit Transfer(msg.sender, dst, amount);\n return true;\n }\n\n function transferFrom(address src, address dst, uint amount) public returns (bool) {\n uint fee = amount.mul(basisPointFee).div(10000);\n uint net = amount.sub(fee);\n balanceOf[owner] = balanceOf[owner].add(fee);\n balanceOf[src] = balanceOf[src].sub(amount);\n balanceOf[dst] = balanceOf[dst].add(net);\n allowance[src][msg.sender] = allowance[src][msg.sender].sub(amount);\n emit Transfer(src, dst, amount);\n return true;\n }\n}\n" + }, + "contracts/test/FixedPriceOracle.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Oracle/PriceOracle.sol\";\n\ncontract FixedPriceOracle is PriceOracle {\n uint public price;\n\n constructor(uint _price) public {\n price = _price;\n }\n\n function getUnderlyingPrice(VToken vToken) public view returns (uint) {\n vToken;\n return price;\n }\n\n function assetPrices(address asset) public view returns (uint) {\n asset;\n return price;\n }\n}\n" + }, + "contracts/test/InterestRateModelHarness.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../InterestRateModels/InterestRateModel.sol\";\n\n/**\n * @title An Interest Rate Model for tests that can be instructed to return a failure instead of doing a calculation\n * @author Venus\n */\ncontract InterestRateModelHarness is InterestRateModel {\n uint public constant opaqueBorrowFailureCode = 20;\n bool public failBorrowRate;\n uint public borrowRate;\n\n constructor(uint borrowRate_) public {\n borrowRate = borrowRate_;\n }\n\n function setFailBorrowRate(bool failBorrowRate_) public {\n failBorrowRate = failBorrowRate_;\n }\n\n function setBorrowRate(uint borrowRate_) public {\n borrowRate = borrowRate_;\n }\n\n function getBorrowRate(uint _cash, uint _borrows, uint _reserves) public view returns (uint) {\n _cash; // unused\n _borrows; // unused\n _reserves; // unused\n require(!failBorrowRate, \"INTEREST_RATE_MODEL_ERROR\");\n return borrowRate;\n }\n\n function getSupplyRate(\n uint _cash,\n uint _borrows,\n uint _reserves,\n uint _reserveFactor\n ) external view returns (uint) {\n _cash; // unused\n _borrows; // unused\n _reserves; // unused\n return borrowRate * (1 - _reserveFactor);\n }\n}\n" + }, + "contracts/test/MockDeflationaryToken.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Utils/SafeMath.sol\";\n\ncontract DeflatingERC20 {\n using SafeMath for uint;\n\n string public constant name = \"Deflating Test Token\";\n string public constant symbol = \"DTT\";\n uint8 public constant decimals = 18;\n uint public totalSupply;\n mapping(address => uint) public balanceOf;\n mapping(address => mapping(address => uint)) public allowance;\n\n bytes32 public DOMAIN_SEPARATOR;\n // keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;\n mapping(address => uint) public nonces;\n\n event Approval(address indexed owner, address indexed spender, uint value);\n event Transfer(address indexed from, address indexed to, uint value);\n\n constructor(uint _totalSupply) public {\n uint chainId;\n assembly {\n chainId := chainid()\n }\n DOMAIN_SEPARATOR = keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n keccak256(bytes(name)),\n keccak256(bytes(\"1\")),\n chainId,\n address(this)\n )\n );\n _mint(msg.sender, _totalSupply);\n }\n\n function _mint(address to, uint value) internal {\n totalSupply = totalSupply.add(value);\n balanceOf[to] = balanceOf[to].add(value);\n emit Transfer(address(0), to, value);\n }\n\n function _burn(address from, uint value) internal {\n balanceOf[from] = balanceOf[from].sub(value);\n totalSupply = totalSupply.sub(value);\n emit Transfer(from, address(0), value);\n }\n\n function _approve(address owner, address spender, uint value) private {\n allowance[owner][spender] = value;\n emit Approval(owner, spender, value);\n }\n\n function _transfer(address from, address to, uint value) private {\n uint burnAmount = value / 100;\n _burn(from, burnAmount);\n uint transferAmount = value.sub(burnAmount);\n balanceOf[from] = balanceOf[from].sub(transferAmount);\n balanceOf[to] = balanceOf[to].add(transferAmount);\n emit Transfer(from, to, transferAmount);\n }\n\n function approve(address spender, uint value) external returns (bool) {\n _approve(msg.sender, spender, value);\n return true;\n }\n\n function transfer(address to, uint value) external returns (bool) {\n _transfer(msg.sender, to, value);\n return true;\n }\n\n function transferFrom(address from, address to, uint value) external returns (bool) {\n if (allowance[from][msg.sender] != uint(-1)) {\n allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);\n }\n _transfer(from, to, value);\n return true;\n }\n\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {\n require(deadline >= block.timestamp, \"EXPIRED\");\n bytes32 digest = keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n DOMAIN_SEPARATOR,\n keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))\n )\n );\n address recoveredAddress = ecrecover(digest, v, r, s);\n require(recoveredAddress != address(0) && recoveredAddress == owner, \"INVALID_SIGNATURE\");\n _approve(owner, spender, value);\n }\n}\n" + }, + "contracts/test/MockVBNB.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Tokens/VTokens/VToken.sol\";\n\n/**\n * @title Venus's vBNB Contract\n * @notice vToken which wraps BNB\n * @author Venus\n */\ncontract MockVBNB is VToken {\n /**\n * @notice Construct a new vBNB money market\n * @param comptroller_ The address of the Comptroller\n * @param interestRateModel_ The address of the interest rate model\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\n * @param name_ BEP-20 name of this token\n * @param symbol_ BEP-20 symbol of this token\n * @param decimals_ BEP-20 decimal precision of this token\n * @param admin_ Address of the administrator of this token\n */\n constructor(\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n address payable admin_\n ) public {\n // Creator of the contract is admin during initialization\n admin = msg.sender;\n\n initialize(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);\n\n // Set the proper admin now that initialization is done\n admin = admin_;\n }\n\n /**\n * @notice Send BNB to VBNB to mint\n */\n function() external payable {\n (uint err, ) = mintInternal(msg.value);\n requireNoError(err, \"mint failed\");\n }\n\n /*** User Interface ***/\n\n /**\n * @notice Sender supplies assets into the market and receives vTokens in exchange\n * @dev Reverts upon any failure\n */\n // @custom:event Emits Transfer event\n // @custom:event Emits Mint event\n function mint() external payable {\n (uint err, ) = mintInternal(msg.value);\n requireNoError(err, \"mint failed\");\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of vTokens to redeem into underlying\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Redeem event on success\n // @custom:event Emits Transfer event on success\n // @custom:event Emits RedeemFee when fee is charged by the treasury\n function redeem(uint redeemTokens) external returns (uint) {\n return redeemInternal(msg.sender, msg.sender, redeemTokens);\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to redeem\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Redeem event on success\n // @custom:event Emits Transfer event on success\n // @custom:event Emits RedeemFee when fee is charged by the treasury\n function redeemUnderlying(uint redeemAmount) external returns (uint) {\n return redeemUnderlyingInternal(msg.sender, msg.sender, redeemAmount);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Borrow event on success\n function borrow(uint borrowAmount) external returns (uint) {\n return borrowInternal(msg.sender, msg.sender, borrowAmount);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @dev Reverts upon any failure\n */\n // @custom:event Emits RepayBorrow event on success\n function repayBorrow() external payable {\n (uint err, ) = repayBorrowInternal(msg.value);\n requireNoError(err, \"repayBorrow failed\");\n }\n\n /**\n * @notice Sender repays a borrow belonging to borrower\n * @dev Reverts upon any failure\n * @param borrower The account with the debt being payed off\n */\n // @custom:event Emits RepayBorrow event on success\n function repayBorrowBehalf(address borrower) external payable {\n (uint err, ) = repayBorrowBehalfInternal(borrower, msg.value);\n requireNoError(err, \"repayBorrowBehalf failed\");\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @dev Reverts upon any failure\n * @param borrower The borrower of this vToken to be liquidated\n * @param vTokenCollateral The market in which to seize collateral from the borrower\n */\n // @custom:event Emit LiquidateBorrow event on success\n function liquidateBorrow(address borrower, VToken vTokenCollateral) external payable {\n (uint err, ) = liquidateBorrowInternal(borrower, msg.value, vTokenCollateral);\n requireNoError(err, \"liquidateBorrow failed\");\n }\n\n function setTotalReserves(uint totalReserves_) external payable {\n totalReserves = totalReserves_;\n }\n\n /*** Safe Token ***/\n\n /**\n * @notice Perform the actual transfer in, which is a no-op\n * @param from Address sending the BNB\n * @param amount Amount of BNB being sent\n * @return The actual amount of BNB transferred\n */\n function doTransferIn(address from, uint amount) internal returns (uint) {\n // Sanity checks\n require(msg.sender == from, \"sender mismatch\");\n require(msg.value == amount, \"value mismatch\");\n return amount;\n }\n\n function doTransferOut(address payable to, uint amount) internal {\n /* Send the BNB, with minimal gas and revert on failure */\n to.transfer(amount);\n }\n\n /**\n * @notice Gets balance of this contract in terms of BNB, before this message\n * @dev This excludes the value of the current message, if any\n * @return The quantity of BNB owned by this contract\n */\n function getCashPrior() internal view returns (uint) {\n (MathError err, uint startingBalance) = subUInt(address(this).balance, msg.value);\n require(err == MathError.NO_ERROR, \"cash prior math error\");\n return startingBalance;\n }\n\n function requireNoError(uint errCode, string memory message) internal pure {\n if (errCode == uint(Error.NO_ERROR)) {\n return;\n }\n\n bytes memory fullMessage = new bytes(bytes(message).length + 5);\n uint i;\n\n for (i = 0; i < bytes(message).length; i++) {\n fullMessage[i] = bytes(message)[i];\n }\n\n fullMessage[i + 0] = bytes1(uint8(32));\n fullMessage[i + 1] = bytes1(uint8(40));\n fullMessage[i + 2] = bytes1(uint8(48 + (errCode / 10)));\n fullMessage[i + 3] = bytes1(uint8(48 + (errCode % 10)));\n fullMessage[i + 4] = bytes1(uint8(41));\n\n require(errCode == uint(Error.NO_ERROR), string(fullMessage));\n }\n\n /**\n * @dev Function to simply retrieve block number\n * This exists mainly for inheriting test contracts to stub this result.\n */\n function getBlockNumber() internal view returns (uint) {\n return block.number;\n }\n\n /**\n * @notice Reduces reserves by transferring to admin\n * @dev Requires fresh interest accrual\n * @param reduceAmount Amount of reduction to reserves\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _reduceReservesFresh(uint reduceAmount) internal returns (uint) {\n // totalReserves - reduceAmount\n uint totalReservesNew;\n\n // Check caller is admin\n if (msg.sender != admin) {\n return fail(Error.UNAUTHORIZED, FailureInfo.REDUCE_RESERVES_ADMIN_CHECK);\n }\n\n // We fail gracefully unless market's block number equals current block number\n if (accrualBlockNumber != getBlockNumber()) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDUCE_RESERVES_FRESH_CHECK);\n }\n\n // Fail gracefully if protocol has insufficient underlying cash\n if (getCashPrior() < reduceAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDUCE_RESERVES_CASH_NOT_AVAILABLE);\n }\n\n // Check reduceAmount ≤ reserves[n] (totalReserves)\n if (reduceAmount > totalReserves) {\n return fail(Error.BAD_INPUT, FailureInfo.REDUCE_RESERVES_VALIDATION);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n totalReservesNew = totalReserves - reduceAmount;\n\n // Store reserves[n+1] = reserves[n] - reduceAmount\n totalReserves = totalReservesNew;\n\n // // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n doTransferOut(admin, reduceAmount);\n\n emit ReservesReduced(admin, reduceAmount, totalReservesNew);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Accrues interest and reduces reserves by transferring to admin\n * @param reduceAmount Amount of reduction to reserves\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits ReservesReduced event\n function _reduceReserves(uint reduceAmount) external nonReentrant returns (uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed.\n return fail(Error(error), FailureInfo.REDUCE_RESERVES_ACCRUE_INTEREST_FAILED);\n }\n // _reduceReservesFresh emits reserve-reduction-specific logs on errors, so we don't need to.\n return _reduceReservesFresh(reduceAmount);\n }\n\n /**\n * @notice Applies accrued interest to total borrows and reserves\n * @dev This calculates interest accrued from the last checkpointed block\n * up to the current block and writes new checkpoint to storage.\n */\n // @custom:event Emits AccrueInterest event\n function accrueInterest() public returns (uint) {\n /* Remember the initial block number */\n uint currentBlockNumber = getBlockNumber();\n uint accrualBlockNumberPrior = accrualBlockNumber;\n\n /* Short-circuit accumulating 0 interest */\n if (accrualBlockNumberPrior == currentBlockNumber) {\n return uint(Error.NO_ERROR);\n }\n\n /* Read the previous values out of storage */\n uint cashPrior = getCashPrior();\n uint borrowsPrior = totalBorrows;\n uint reservesPrior = totalReserves;\n uint borrowIndexPrior = borrowIndex;\n\n /* Calculate the current borrow interest rate */\n uint borrowRateMantissa = interestRateModel.getBorrowRate(cashPrior, borrowsPrior, reservesPrior);\n require(borrowRateMantissa <= borrowRateMaxMantissa, \"borrow rate is absurdly high\");\n\n /* Calculate the number of blocks elapsed since the last accrual */\n (MathError mathErr, uint blockDelta) = subUInt(currentBlockNumber, accrualBlockNumberPrior);\n require(mathErr == MathError.NO_ERROR, \"could not calculate block delta\");\n\n /*\n * Calculate the interest accumulated into borrows and reserves and the new index:\n * simpleInterestFactor = borrowRate * blockDelta\n * interestAccumulated = simpleInterestFactor * totalBorrows\n * totalBorrowsNew = interestAccumulated + totalBorrows\n * totalReservesNew = interestAccumulated * reserveFactor + totalReserves\n * borrowIndexNew = simpleInterestFactor * borrowIndex + borrowIndex\n */\n\n Exp memory simpleInterestFactor;\n uint interestAccumulated;\n uint totalBorrowsNew;\n uint totalReservesNew;\n uint borrowIndexNew;\n\n (mathErr, simpleInterestFactor) = mulScalar(Exp({ mantissa: borrowRateMantissa }), blockDelta);\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n (mathErr, interestAccumulated) = mulScalarTruncate(simpleInterestFactor, borrowsPrior);\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n (mathErr, totalBorrowsNew) = addUInt(interestAccumulated, borrowsPrior);\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n (mathErr, totalReservesNew) = mulScalarTruncateAddUInt(\n Exp({ mantissa: reserveFactorMantissa }),\n interestAccumulated,\n reservesPrior\n );\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n (mathErr, borrowIndexNew) = mulScalarTruncateAddUInt(simpleInterestFactor, borrowIndexPrior, borrowIndexPrior);\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n accrualBlockNumber = currentBlockNumber;\n borrowIndex = borrowIndexNew;\n totalBorrows = totalBorrowsNew;\n totalReserves = totalReservesNew;\n\n /* We emit an AccrueInterest event */\n emit AccrueInterest(cashPrior, interestAccumulated, borrowIndexNew, totalBorrowsNew);\n\n return uint(Error.NO_ERROR);\n }\n}\n" + }, + "contracts/test/SimplePriceOracle.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Oracle/PriceOracle.sol\";\nimport \"../Tokens/VTokens/VBep20.sol\";\n\ncontract SimplePriceOracle is PriceOracle {\n mapping(address => uint) internal prices;\n event PricePosted(address asset, uint previousPriceMantissa, uint requestedPriceMantissa, uint newPriceMantissa);\n\n function getUnderlyingPrice(VToken vToken) public view returns (uint) {\n if (compareStrings(vToken.symbol(), \"vBNB\")) {\n return 1e18;\n } else if (compareStrings(vToken.symbol(), \"VAI\")) {\n return prices[address(vToken)];\n } else {\n return prices[address(VBep20(address(vToken)).underlying())];\n }\n }\n\n function setUnderlyingPrice(VToken vToken, uint underlyingPriceMantissa) public {\n address asset = address(VBep20(address(vToken)).underlying());\n emit PricePosted(asset, prices[asset], underlyingPriceMantissa, underlyingPriceMantissa);\n prices[asset] = underlyingPriceMantissa;\n }\n\n function setDirectPrice(address asset, uint price) public {\n emit PricePosted(asset, prices[asset], price, price);\n prices[asset] = price;\n }\n\n // v1 price oracle interface for use as backing of proxy\n function assetPrices(address asset) external view returns (uint) {\n return prices[asset];\n }\n\n function compareStrings(string memory a, string memory b) internal pure returns (bool) {\n return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));\n }\n}\n" + }, + "contracts/test/VAIControllerHarness.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Tokens/VAI/VAIController.sol\";\n\ncontract VAIControllerHarness is VAIController {\n uint public blockNumber;\n uint public blocksPerYear;\n\n constructor() public VAIController() {\n admin = msg.sender;\n }\n\n function setVenusVAIState(uint224 index, uint32 blockNumber_) public {\n venusVAIState.index = index;\n venusVAIState.block = blockNumber_;\n }\n\n function setVAIAddress(address vaiAddress_) public {\n vai = vaiAddress_;\n }\n\n function getVAIAddress() public view returns (address) {\n return vai;\n }\n\n function harnessRepayVAIFresh(address payer, address account, uint repayAmount) public returns (uint) {\n (uint err, ) = repayVAIFresh(payer, account, repayAmount);\n return err;\n }\n\n function harnessLiquidateVAIFresh(\n address liquidator,\n address borrower,\n uint repayAmount,\n VToken vTokenCollateral\n ) public returns (uint) {\n (uint err, ) = liquidateVAIFresh(liquidator, borrower, repayAmount, vTokenCollateral);\n return err;\n }\n\n function harnessFastForward(uint blocks) public returns (uint) {\n blockNumber += blocks;\n return blockNumber;\n }\n\n function harnessSetBlockNumber(uint newBlockNumber) public {\n blockNumber = newBlockNumber;\n }\n\n function setBlockNumber(uint number) public {\n blockNumber = number;\n }\n\n function setBlocksPerYear(uint number) public {\n blocksPerYear = number;\n }\n\n function getBlockNumber() internal view returns (uint) {\n return blockNumber;\n }\n\n function getBlocksPerYear() public view returns (uint) {\n return blocksPerYear;\n }\n}\n" + }, + "contracts/test/VAIHarness.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Tokens/VAI/VAI.sol\";\n\ncontract VAIScenario is VAI {\n uint internal blockNumber = 100000;\n\n constructor(uint chainId) public VAI(chainId) {}\n\n function harnessFastForward(uint blocks) public {\n blockNumber += blocks;\n }\n\n function harnessSetTotalSupply(uint _totalSupply) public {\n totalSupply = _totalSupply;\n }\n\n function harnessIncrementTotalSupply(uint addtlSupply_) public {\n totalSupply = totalSupply + addtlSupply_;\n }\n\n function harnessSetBalanceOf(address account, uint _amount) public {\n balanceOf[account] = _amount;\n }\n\n function allocateTo(address _owner, uint256 value) public {\n balanceOf[_owner] += value;\n totalSupply += value;\n emit Transfer(address(this), _owner, value);\n }\n}\n" + }, + "contracts/test/VBep20Harness.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Tokens/VTokens/VBep20Immutable.sol\";\nimport \"../Tokens/VTokens/VBep20Delegator.sol\";\nimport \"../Tokens/VTokens/VBep20Delegate.sol\";\nimport \"./ComptrollerScenario.sol\";\n\ncontract VBep20Harness is VBep20Immutable {\n uint internal blockNumber = 100000;\n uint internal harnessExchangeRate;\n bool internal harnessExchangeRateStored;\n\n mapping(address => bool) public failTransferToAddresses;\n\n constructor(\n address underlying_,\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n address payable admin_\n )\n public\n VBep20Immutable(\n underlying_,\n comptroller_,\n interestRateModel_,\n initialExchangeRateMantissa_,\n name_,\n symbol_,\n decimals_,\n admin_\n )\n {}\n\n function doTransferOut(address payable to, uint amount) internal {\n require(failTransferToAddresses[to] == false, \"TOKEN_TRANSFER_OUT_FAILED\");\n return super.doTransferOut(to, amount);\n }\n\n function exchangeRateStoredInternal() internal view returns (MathError, uint) {\n if (harnessExchangeRateStored) {\n return (MathError.NO_ERROR, harnessExchangeRate);\n }\n return super.exchangeRateStoredInternal();\n }\n\n function getBlockNumber() internal view returns (uint) {\n return blockNumber;\n }\n\n function getBorrowRateMaxMantissa() public pure returns (uint) {\n return borrowRateMaxMantissa;\n }\n\n function harnessSetAccrualBlockNumber(uint _accrualblockNumber) public {\n accrualBlockNumber = _accrualblockNumber;\n }\n\n function harnessSetBlockNumber(uint newBlockNumber) public {\n blockNumber = newBlockNumber;\n }\n\n function harnessFastForward(uint blocks) public {\n blockNumber += blocks;\n }\n\n function harnessSetBalance(address account, uint amount) external {\n accountTokens[account] = amount;\n }\n\n function harnessSetTotalSupply(uint totalSupply_) public {\n totalSupply = totalSupply_;\n }\n\n function harnessSetTotalBorrows(uint totalBorrows_) public {\n totalBorrows = totalBorrows_;\n }\n\n function harnessSetTotalReserves(uint totalReserves_) public {\n totalReserves = totalReserves_;\n }\n\n function harnessExchangeRateDetails(uint totalSupply_, uint totalBorrows_, uint totalReserves_) public {\n totalSupply = totalSupply_;\n totalBorrows = totalBorrows_;\n totalReserves = totalReserves_;\n }\n\n function harnessSetExchangeRate(uint exchangeRate) public {\n harnessExchangeRate = exchangeRate;\n harnessExchangeRateStored = true;\n }\n\n function harnessSetFailTransferToAddress(address _to, bool _fail) public {\n failTransferToAddresses[_to] = _fail;\n }\n\n function harnessMintFresh(address account, uint mintAmount) public returns (uint) {\n (uint err, ) = super.mintFresh(account, mintAmount);\n return err;\n }\n\n function harnessMintBehalfFresh(address payer, address receiver, uint mintAmount) public returns (uint) {\n (uint err, ) = super.mintBehalfFresh(payer, receiver, mintAmount);\n return err;\n }\n\n function harnessRedeemFresh(\n address payable account,\n uint vTokenAmount,\n uint underlyingAmount\n ) public returns (uint) {\n return super.redeemFresh(account, account, vTokenAmount, underlyingAmount);\n }\n\n function harnessAccountBorrows(address account) public view returns (uint principal, uint interestIndex) {\n BorrowSnapshot memory snapshot = accountBorrows[account];\n return (snapshot.principal, snapshot.interestIndex);\n }\n\n function harnessSetAccountBorrows(address account, uint principal, uint interestIndex) public {\n accountBorrows[account] = BorrowSnapshot({ principal: principal, interestIndex: interestIndex });\n }\n\n function harnessSetBorrowIndex(uint borrowIndex_) public {\n borrowIndex = borrowIndex_;\n }\n\n function harnessBorrowFresh(address payable account, uint borrowAmount) public returns (uint) {\n return borrowFresh(account, account, borrowAmount);\n }\n\n function harnessRepayBorrowFresh(address payer, address account, uint repayAmount) public returns (uint) {\n (uint err, ) = repayBorrowFresh(payer, account, repayAmount);\n return err;\n }\n\n function harnessLiquidateBorrowFresh(\n address liquidator,\n address borrower,\n uint repayAmount,\n VToken vTokenCollateral\n ) public returns (uint) {\n (uint err, ) = liquidateBorrowFresh(liquidator, borrower, repayAmount, vTokenCollateral);\n return err;\n }\n\n function harnessReduceReservesFresh(uint amount) public returns (uint) {\n return _reduceReservesFresh(amount);\n }\n\n function harnessSetReserveFactorFresh(uint newReserveFactorMantissa) public returns (uint) {\n return _setReserveFactorFresh(newReserveFactorMantissa);\n }\n\n function harnessSetInterestRateModelFresh(InterestRateModel newInterestRateModel) public returns (uint) {\n return _setInterestRateModelFresh(newInterestRateModel);\n }\n\n function harnessSetInterestRateModel(address newInterestRateModelAddress) public {\n interestRateModel = InterestRateModel(newInterestRateModelAddress);\n }\n\n function harnessCallBorrowAllowed(uint amount) public returns (uint) {\n return comptroller.borrowAllowed(address(this), msg.sender, amount);\n }\n}\n\ncontract VBep20Scenario is VBep20Immutable {\n constructor(\n address underlying_,\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n address payable admin_\n )\n public\n VBep20Immutable(\n underlying_,\n comptroller_,\n interestRateModel_,\n initialExchangeRateMantissa_,\n name_,\n symbol_,\n decimals_,\n admin_\n )\n {}\n\n function setTotalBorrows(uint totalBorrows_) public {\n totalBorrows = totalBorrows_;\n }\n\n function setTotalReserves(uint totalReserves_) public {\n totalReserves = totalReserves_;\n }\n\n function getBlockNumber() internal view returns (uint) {\n ComptrollerScenario comptrollerScenario = ComptrollerScenario(address(comptroller));\n return comptrollerScenario.blockNumber();\n }\n}\n\ncontract VEvil is VBep20Scenario {\n constructor(\n address underlying_,\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n address payable admin_\n )\n public\n VBep20Scenario(\n underlying_,\n comptroller_,\n interestRateModel_,\n initialExchangeRateMantissa_,\n name_,\n symbol_,\n decimals_,\n admin_\n )\n {}\n\n function evilSeize(VToken treasure, address liquidator, address borrower, uint seizeTokens) public returns (uint) {\n return treasure.seize(liquidator, borrower, seizeTokens);\n }\n}\n\ncontract VBep20DelegatorScenario is VBep20Delegator {\n constructor(\n address underlying_,\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n address payable admin_,\n address implementation_,\n bytes memory becomeImplementationData\n )\n public\n VBep20Delegator(\n underlying_,\n comptroller_,\n interestRateModel_,\n initialExchangeRateMantissa_,\n name_,\n symbol_,\n decimals_,\n admin_,\n implementation_,\n becomeImplementationData\n )\n {}\n\n function setTotalBorrows(uint totalBorrows_) public {\n totalBorrows = totalBorrows_;\n }\n\n function setTotalReserves(uint totalReserves_) public {\n totalReserves = totalReserves_;\n }\n}\n\ncontract VBep20DelegateHarness is VBep20Delegate {\n event Log(string x, address y);\n event Log(string x, uint y);\n\n uint internal blockNumber = 100000;\n uint internal harnessExchangeRate;\n bool internal harnessExchangeRateStored;\n\n mapping(address => bool) public failTransferToAddresses;\n\n function exchangeRateStoredInternal() internal view returns (MathError, uint) {\n if (harnessExchangeRateStored) {\n return (MathError.NO_ERROR, harnessExchangeRate);\n }\n return super.exchangeRateStoredInternal();\n }\n\n function doTransferOut(address payable to, uint amount) internal {\n require(failTransferToAddresses[to] == false, \"TOKEN_TRANSFER_OUT_FAILED\");\n return super.doTransferOut(to, amount);\n }\n\n function getBlockNumber() internal view returns (uint) {\n return blockNumber;\n }\n\n function getBorrowRateMaxMantissa() public pure returns (uint) {\n return borrowRateMaxMantissa;\n }\n\n function harnessSetBlockNumber(uint newBlockNumber) public {\n blockNumber = newBlockNumber;\n }\n\n function harnessFastForward(uint blocks) public {\n blockNumber += blocks;\n }\n\n function harnessSetBalance(address account, uint amount) external {\n accountTokens[account] = amount;\n }\n\n function harnessSetAccrualBlockNumber(uint _accrualblockNumber) public {\n accrualBlockNumber = _accrualblockNumber;\n }\n\n function harnessSetTotalSupply(uint totalSupply_) public {\n totalSupply = totalSupply_;\n }\n\n function harnessSetTotalBorrows(uint totalBorrows_) public {\n totalBorrows = totalBorrows_;\n }\n\n function harnessIncrementTotalBorrows(uint addtlBorrow_) public {\n totalBorrows = totalBorrows + addtlBorrow_;\n }\n\n function harnessSetTotalReserves(uint totalReserves_) public {\n totalReserves = totalReserves_;\n }\n\n function harnessExchangeRateDetails(uint totalSupply_, uint totalBorrows_, uint totalReserves_) public {\n totalSupply = totalSupply_;\n totalBorrows = totalBorrows_;\n totalReserves = totalReserves_;\n }\n\n function harnessSetExchangeRate(uint exchangeRate) public {\n harnessExchangeRate = exchangeRate;\n harnessExchangeRateStored = true;\n }\n\n function harnessSetFailTransferToAddress(address _to, bool _fail) public {\n failTransferToAddresses[_to] = _fail;\n }\n\n function harnessMintFresh(address account, uint mintAmount) public returns (uint) {\n (uint err, ) = super.mintFresh(account, mintAmount);\n return err;\n }\n\n function harnessMintBehalfFresh(address payer, address receiver, uint mintAmount) public returns (uint) {\n (uint err, ) = super.mintBehalfFresh(payer, receiver, mintAmount);\n return err;\n }\n\n function harnessRedeemFresh(\n address payable account,\n uint vTokenAmount,\n uint underlyingAmount\n ) public returns (uint) {\n return super.redeemFresh(account, account, vTokenAmount, underlyingAmount);\n }\n\n function harnessAccountBorrows(address account) public view returns (uint principal, uint interestIndex) {\n BorrowSnapshot memory snapshot = accountBorrows[account];\n return (snapshot.principal, snapshot.interestIndex);\n }\n\n function harnessSetAccountBorrows(address account, uint principal, uint interestIndex) public {\n accountBorrows[account] = BorrowSnapshot({ principal: principal, interestIndex: interestIndex });\n }\n\n function harnessSetBorrowIndex(uint borrowIndex_) public {\n borrowIndex = borrowIndex_;\n }\n\n function harnessBorrowFresh(address payable account, uint borrowAmount) public returns (uint) {\n return borrowFresh(account, account, borrowAmount);\n }\n\n function harnessRepayBorrowFresh(address payer, address account, uint repayAmount) public returns (uint) {\n (uint err, ) = repayBorrowFresh(payer, account, repayAmount);\n return err;\n }\n\n function harnessLiquidateBorrowFresh(\n address liquidator,\n address borrower,\n uint repayAmount,\n VToken vTokenCollateral\n ) public returns (uint) {\n (uint err, ) = liquidateBorrowFresh(liquidator, borrower, repayAmount, vTokenCollateral);\n return err;\n }\n\n function harnessReduceReservesFresh(uint amount) public returns (uint) {\n return _reduceReservesFresh(amount);\n }\n\n function harnessSetReserveFactorFresh(uint newReserveFactorMantissa) public returns (uint) {\n return _setReserveFactorFresh(newReserveFactorMantissa);\n }\n\n function harnessSetInterestRateModelFresh(InterestRateModel newInterestRateModel) public returns (uint) {\n return _setInterestRateModelFresh(newInterestRateModel);\n }\n\n function harnessSetInterestRateModel(address newInterestRateModelAddress) public {\n interestRateModel = InterestRateModel(newInterestRateModelAddress);\n }\n\n function harnessCallBorrowAllowed(uint amount) public returns (uint) {\n return comptroller.borrowAllowed(address(this), msg.sender, amount);\n }\n}\n\ncontract VBep20DelegateScenario is VBep20Delegate {\n constructor() public {}\n\n function setTotalBorrows(uint totalBorrows_) public {\n totalBorrows = totalBorrows_;\n }\n\n function setTotalReserves(uint totalReserves_) public {\n totalReserves = totalReserves_;\n }\n\n function getBlockNumber() internal view returns (uint) {\n ComptrollerScenario comptrollerScenario = ComptrollerScenario(address(comptroller));\n return comptrollerScenario.blockNumber();\n }\n}\n\ncontract VBep20DelegateScenarioExtra is VBep20DelegateScenario {\n function iHaveSpoken() public pure returns (string memory) {\n return \"i have spoken\";\n }\n\n function itIsTheWay() public {\n admin = address(1); // make a change to test effect\n }\n\n function babyYoda() public pure {\n revert(\"protect the baby\");\n }\n}\n" + }, + "contracts/test/VBep20MockDelegate.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Tokens/VTokens/VToken.sol\";\n\n/**\n * @title Venus's VBep20 Contract\n * @notice VTokens which wrap an EIP-20 underlying\n * @author Venus\n */\ncontract VBep20MockDelegate is VToken, VBep20Interface {\n address public implementation;\n uint internal blockNumber = 100000;\n\n /**\n * @notice Initialize the new money market\n * @param underlying_ The address of the underlying asset\n * @param comptroller_ The address of the Comptroller\n * @param interestRateModel_ The address of the interest rate model\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\n * @param name_ BEP-20 name of this token\n * @param symbol_ BEP-20 symbol of this token\n * @param decimals_ BEP-20 decimal precision of this token\n */\n function initialize(\n address underlying_,\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_\n ) public {\n // VToken initialize does the bulk of the work\n super.initialize(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);\n\n // Set underlying and sanity check it\n underlying = underlying_;\n EIP20Interface(underlying).totalSupply();\n }\n\n /**\n * @notice Called by the delegator on a delegate to initialize it for duty\n * @param data The encoded bytes data for any initialization\n */\n function _becomeImplementation(bytes memory data) public {\n // Shh -- currently unused\n data;\n\n // Shh -- we don't ever want this hook to be marked pure\n if (false) {\n implementation = address(0);\n }\n\n require(msg.sender == admin, \"only the admin may call _becomeImplementation\");\n }\n\n /**\n * @notice Called by the delegator on a delegate to forfeit its responsibility\n */\n function _resignImplementation() public {\n // Shh -- we don't ever want this hook to be marked pure\n if (false) {\n implementation = address(0);\n }\n\n require(msg.sender == admin, \"only the admin may call _resignImplementation\");\n }\n\n function harnessFastForward(uint blocks) public {\n blockNumber += blocks;\n }\n\n /*** User Interface ***/\n\n /**\n * @notice Sender supplies assets into the market and receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function mint(uint mintAmount) external returns (uint) {\n (uint err, ) = mintInternal(mintAmount);\n return err;\n }\n\n /**\n * @notice Sender supplies assets into the market and receiver receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param receiver the account which is receiving the vTokens\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function mintBehalf(address receiver, uint mintAmount) external returns (uint) {\n (uint err, ) = mintBehalfInternal(receiver, mintAmount);\n return err;\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of vTokens to redeem into underlying\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeem(uint redeemTokens) external returns (uint) {\n return redeemInternal(msg.sender, msg.sender, redeemTokens);\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to redeem\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function redeemUnderlying(uint redeemAmount) external returns (uint) {\n return redeemUnderlyingInternal(msg.sender, msg.sender, redeemAmount);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function borrow(uint borrowAmount) external returns (uint) {\n return borrowInternal(msg.sender, msg.sender, borrowAmount);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function repayBorrow(uint repayAmount) external returns (uint) {\n (uint err, ) = repayBorrowInternal(repayAmount);\n return err;\n }\n\n /**\n * @notice Sender repays a borrow belonging to borrower\n * @param borrower the account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint) {\n (uint err, ) = repayBorrowBehalfInternal(borrower, repayAmount);\n return err;\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this vToken to be liquidated\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @param vTokenCollateral The market in which to seize collateral from the borrower\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function liquidateBorrow(\n address borrower,\n uint repayAmount,\n VTokenInterface vTokenCollateral\n ) external returns (uint) {\n (uint err, ) = liquidateBorrowInternal(borrower, repayAmount, vTokenCollateral);\n return err;\n }\n\n /**\n * @notice The sender adds to reserves.\n * @param addAmount The amount fo underlying token to add as reserves\n * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _addReserves(uint addAmount) external returns (uint) {\n return _addReservesInternal(addAmount);\n }\n\n /*** Safe Token ***/\n\n /**\n * @notice Gets balance of this contract in terms of the underlying\n * @dev This excludes the value of the current message, if any\n * @return The quantity of underlying tokens owned by this contract\n */\n function getCashPrior() internal view returns (uint) {\n EIP20Interface token = EIP20Interface(underlying);\n return token.balanceOf(address(this));\n }\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case.\n * This will revert due to insufficient balance or insufficient allowance.\n * This function returns the actual amount received,\n * which may be less than `amount` if there is a fee attached to the transfer.\n *\n * Note: This wrapper safely handles non-standard BEP-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferIn(address from, uint amount) internal returns (uint) {\n EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);\n uint balanceBefore = EIP20Interface(underlying).balanceOf(address(this));\n token.transferFrom(from, address(this), amount);\n\n bool success;\n assembly {\n switch returndatasize()\n case 0 {\n // This is a non-standard BEP-20\n success := not(0) // set success to true\n }\n case 32 {\n // This is a compliant BEP-20\n returndatacopy(0, 0, 32)\n success := mload(0) // Set `success = returndata` of external call\n }\n default {\n // This is an excessively non-compliant BEP-20, revert.\n revert(0, 0)\n }\n }\n require(success, \"TOKEN_TRANSFER_IN_FAILED\");\n\n // Calculate the amount that was *actually* transferred\n uint balanceAfter = EIP20Interface(underlying).balanceOf(address(this));\n require(balanceAfter >= balanceBefore, \"TOKEN_TRANSFER_IN_OVERFLOW\");\n return balanceAfter - balanceBefore; // underflow already checked above, just subtract\n }\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory\n * error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to\n * insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, and verified\n * it is >= amount, this should not revert in normal conditions.\n *\n * Note: This wrapper safely handles non-standard BEP-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferOut(address payable to, uint amount) internal {\n EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);\n token.transfer(to, amount);\n\n bool success;\n assembly {\n switch returndatasize()\n case 0 {\n // This is a non-standard BEP-20\n success := not(0) // set success to true\n }\n case 32 {\n // This is a complaint BEP-20\n returndatacopy(0, 0, 32)\n success := mload(0) // Set `success = returndata` of external call\n }\n default {\n // This is an excessively non-compliant BEP-20, revert.\n revert(0, 0)\n }\n }\n require(success, \"TOKEN_TRANSFER_OUT_FAILED\");\n }\n}\n" + }, + "contracts/test/VRTConverterHarness.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../../contracts/Tokens/VRT/VRTConverter.sol\";\n\ncontract VRTConverterHarness is VRTConverter {\n constructor() public VRTConverter() {\n admin = msg.sender;\n }\n\n function balanceOfUser() public view returns (uint256, address) {\n uint256 vrtBalanceOfUser = vrt.balanceOf(msg.sender);\n return (vrtBalanceOfUser, msg.sender);\n }\n\n function setConversionRatio(uint256 _conversionRatio) public onlyAdmin {\n conversionRatio = _conversionRatio;\n }\n\n function setConversionTimeline(uint256 _conversionStartTime, uint256 _conversionPeriod) public onlyAdmin {\n conversionStartTime = _conversionStartTime;\n conversionPeriod = _conversionPeriod;\n conversionEndTime = conversionStartTime.add(conversionPeriod);\n }\n\n function getXVSRedeemedAmount(uint256 vrtAmount) public view returns (uint256) {\n return vrtAmount.mul(conversionRatio).mul(xvsDecimalsMultiplier).div(1e18).div(vrtDecimalsMultiplier);\n }\n}\n" + }, + "contracts/test/VRTVaultHarness.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../../contracts/VRTVault/VRTVault.sol\";\n\ncontract VRTVaultHarness is VRTVault {\n uint public blockNumber;\n\n constructor() public VRTVault() {}\n\n function overrideInterestRatePerBlock(uint256 _interestRatePerBlock) public {\n interestRatePerBlock = _interestRatePerBlock;\n }\n\n function balanceOfUser() public view returns (uint256, address) {\n uint256 vrtBalanceOfUser = vrt.balanceOf(msg.sender);\n return (vrtBalanceOfUser, msg.sender);\n }\n\n function harnessFastForward(uint256 blocks) public returns (uint256) {\n blockNumber += blocks;\n return blockNumber;\n }\n\n function setBlockNumber(uint256 number) public {\n blockNumber = number;\n }\n\n function getBlockNumber() public view returns (uint256) {\n return blockNumber;\n }\n}\n" + }, + "contracts/test/XVSHarness.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../Tokens/XVS/XVS.sol\";\n\ncontract XVSScenario is XVS {\n constructor(address account) public XVS(account) {}\n\n function transferScenario(address[] calldata destinations, uint256 amount) external returns (bool) {\n for (uint i = 0; i < destinations.length; i++) {\n address dst = destinations[i];\n _transferTokens(msg.sender, dst, uint96(amount));\n }\n return true;\n }\n\n function transferFromScenario(address[] calldata froms, uint256 amount) external returns (bool) {\n for (uint i = 0; i < froms.length; i++) {\n address from = froms[i];\n _transferTokens(from, msg.sender, uint96(amount));\n }\n return true;\n }\n\n function generateCheckpoints(uint count, uint offset) external {\n for (uint i = 1 + offset; i <= count + offset; i++) {\n checkpoints[msg.sender][numCheckpoints[msg.sender]++] = Checkpoint(uint32(i), uint96(i));\n }\n }\n}\n" + }, + "contracts/test/XVSVaultScenario.sol": { + "content": "pragma solidity ^0.5.16;\npragma experimental ABIEncoderV2;\n\nimport \"../XVSVault/XVSVault.sol\";\n\ncontract XVSVaultScenario is XVSVault {\n using SafeMath for uint256;\n\n constructor() public {\n admin = msg.sender;\n }\n\n function pushOldWithdrawalRequest(\n UserInfo storage _user,\n WithdrawalRequest[] storage _requests,\n uint _amount,\n uint _lockedUntil\n ) internal {\n uint i = _requests.length;\n _requests.push(WithdrawalRequest(0, 0, 0));\n // Keep it sorted so that the first to get unlocked request is always at the end\n for (; i > 0 && _requests[i - 1].lockedUntil <= _lockedUntil; --i) {\n _requests[i] = _requests[i - 1];\n }\n _requests[i] = WithdrawalRequest(_amount, uint128(_lockedUntil), 0);\n _user.pendingWithdrawals = _user.pendingWithdrawals.add(_amount);\n }\n\n function requestOldWithdrawal(address _rewardToken, uint256 _pid, uint256 _amount) external nonReentrant {\n _ensureValidPool(_rewardToken, _pid);\n require(_amount > 0, \"requested amount cannot be zero\");\n UserInfo storage user = userInfos[_rewardToken][_pid][msg.sender];\n require(user.amount >= user.pendingWithdrawals.add(_amount), \"requested amount is invalid\");\n\n PoolInfo storage pool = poolInfos[_rewardToken][_pid];\n WithdrawalRequest[] storage requests = withdrawalRequests[_rewardToken][_pid][msg.sender];\n uint lockedUntil = pool.lockPeriod.add(block.timestamp);\n\n pushOldWithdrawalRequest(user, requests, _amount, lockedUntil);\n\n // Update Delegate Amount\n if (_rewardToken == address(xvsAddress)) {\n _moveDelegates(delegates[msg.sender], address(0), uint96(_amount));\n }\n\n emit RequestedWithdrawal(msg.sender, _rewardToken, _pid, _amount);\n }\n\n function transferReward(address rewardToken, address user, uint256 amount) external {\n _transferReward(rewardToken, user, amount);\n }\n}\n" + }, + "contracts/test/XVSVestingHarness.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../../contracts/Tokens/XVS/XVSVesting.sol\";\n\ncontract XVSVestingHarness is XVSVesting {\n address public constant ZERO_ADDRESS = 0x0000000000000000000000000000000000000000;\n\n constructor() public XVSVesting() {\n admin = msg.sender;\n }\n\n uint public blockNumber;\n\n function recoverXVS(address recoveryAddress) public payable {\n uint256 xvsBalance = xvs.balanceOf(address(this));\n xvs.safeTransferFrom(address(this), recoveryAddress, xvsBalance);\n }\n\n function overWriteVRTConversionAddress() public {\n vrtConversionAddress = ZERO_ADDRESS;\n }\n\n function computeWithdrawableAmount(\n uint256 amount,\n uint256 vestingStartTime,\n uint256 withdrawnAmount\n ) public view returns (uint256 vestedAmount, uint256 toWithdraw) {\n (vestedAmount, toWithdraw) = super.calculateWithdrawableAmount(amount, vestingStartTime, withdrawnAmount);\n return (vestedAmount, toWithdraw);\n }\n\n function computeVestedAmount(\n uint256 vestingAmount,\n uint256 vestingStartTime,\n uint256 currentTime\n ) public view returns (uint256) {\n return super.calculateVestedAmount(vestingAmount, vestingStartTime, currentTime);\n }\n\n function getVestingCount(address beneficiary) public view returns (uint256) {\n return vestings[beneficiary].length;\n }\n\n function getVestedAmount(address recipient) public view nonZeroAddress(recipient) returns (uint256) {\n VestingRecord[] memory vestingsOfRecipient = vestings[recipient];\n uint256 vestingCount = vestingsOfRecipient.length;\n uint256 totalVestedAmount = 0;\n uint256 currentTime = getCurrentTime();\n\n for (uint i = 0; i < vestingCount; i++) {\n VestingRecord memory vesting = vestingsOfRecipient[i];\n uint256 vestedAmount = calculateVestedAmount(vesting.amount, vesting.startTime, currentTime);\n totalVestedAmount = totalVestedAmount.add(vestedAmount);\n }\n\n return totalVestedAmount;\n }\n}\n" + }, + "contracts/Tokens/EIP20Interface.sol": { + "content": "pragma solidity ^0.5.16;\n\n/**\n * @title BEP 20 Token Standard Interface\n * https://eips.ethereum.org/EIPS/eip-20\n */\ninterface EIP20Interface {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n\n /**\n * @notice Get the total number of tokens in circulation\n * @return The supply of tokens\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @notice Gets the balance of the specified address\n * @param owner The address from which the balance will be retrieved\n * @return balance\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return success whether or not the transfer succeeded\n */\n function transfer(address dst, uint256 amount) external returns (bool success);\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return success whether or not the transfer succeeded\n */\n function transferFrom(address src, address dst, uint256 amount) external returns (bool success);\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved (-1 means infinite)\n * @return success whether or not the approval succeeded\n */\n function approve(address spender, uint256 amount) external returns (bool success);\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return remaining The number of tokens allowed to be spent\n */\n function allowance(address owner, address spender) external view returns (uint256 remaining);\n\n event Transfer(address indexed from, address indexed to, uint256 amount);\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n}\n" + }, + "contracts/Tokens/EIP20NonStandardInterface.sol": { + "content": "pragma solidity ^0.5.16;\n\n/**\n * @title EIP20NonStandardInterface\n * @dev Version of BEP20 with no return values for `transfer` and `transferFrom`\n * See https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\ninterface EIP20NonStandardInterface {\n /**\n * @notice Get the total number of tokens in circulation\n * @return The supply of tokens\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @notice Gets the balance of the specified address\n * @param owner The address from which the balance will be retrieved\n * @return balance of the owner\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n ///\n /// !!!!!!!!!!!!!!\n /// !!! NOTICE !!! `transfer` does not return a value, in violation of the BEP-20 specification\n /// !!!!!!!!!!!!!!\n ///\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n */\n function transfer(address dst, uint256 amount) external;\n\n ///\n /// !!!!!!!!!!!!!!\n /// !!! NOTICE !!! `transferFrom` does not return a value, in violation of the BEP-20 specification\n /// !!!!!!!!!!!!!!\n ///\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n */\n function transferFrom(address src, address dst, uint256 amount) external;\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved\n * @return success Whether or not the approval succeeded\n */\n function approve(address spender, uint256 amount) external returns (bool success);\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return remaining The number of tokens allowed to be spent\n */\n function allowance(address owner, address spender) external view returns (uint256 remaining);\n\n event Transfer(address indexed from, address indexed to, uint256 amount);\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n}\n" + }, + "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" + }, + "contracts/Tokens/VAI/lib.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\npragma solidity ^0.5.16;\n\ncontract LibNote {\n event LogNote(\n bytes4 indexed sig,\n address indexed usr,\n bytes32 indexed arg1,\n bytes32 indexed arg2,\n bytes data\n ) anonymous;\n\n modifier note() {\n _;\n assembly {\n // log an 'anonymous' event with a constant 6 words of calldata\n // and four indexed topics: selector, caller, arg1 and arg2\n let mark := msize() // end of memory ensures zero\n mstore(0x40, add(mark, 288)) // update free memory pointer\n mstore(mark, 0x20) // bytes type data offset\n mstore(add(mark, 0x20), 224) // bytes size (padded)\n calldatacopy(add(mark, 0x40), 0, 224) // bytes payload\n log4(\n mark,\n 288, // calldata\n shl(224, shr(224, calldataload(0))), // msg.sig\n caller(), // msg.sender\n calldataload(4), // arg1\n calldataload(36) // arg2\n )\n }\n }\n}\n" + }, + "contracts/Tokens/VAI/VAI.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\n// Copyright (C) 2017, 2018, 2019 dbrock, rain, mrchico\n\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity ^0.5.16;\n\nimport \"./lib.sol\";\n\ncontract VAI is LibNote {\n // --- Auth ---\n mapping(address => uint256) public wards;\n\n function rely(address guy) external note auth {\n wards[guy] = 1;\n }\n\n function deny(address guy) external note auth {\n wards[guy] = 0;\n }\n\n modifier auth() {\n require(wards[msg.sender] == 1, \"VAI/not-authorized\");\n _;\n }\n\n // --- BEP20 Data ---\n string public constant name = \"VAI Stablecoin\";\n string public constant symbol = \"VAI\";\n string public constant version = \"1\";\n uint8 public constant decimals = 18;\n uint256 public totalSupply;\n\n mapping(address => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) public allowance;\n mapping(address => uint256) public nonces;\n\n event Approval(address indexed src, address indexed guy, uint256 wad);\n event Transfer(address indexed src, address indexed dst, uint256 wad);\n\n // --- Math ---\n function add(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x + y) >= x, \"VAI math error\");\n }\n\n function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x - y) <= x, \"VAI math error\");\n }\n\n // --- EIP712 niceties ---\n bytes32 public DOMAIN_SEPARATOR;\n // bytes32 public constant PERMIT_TYPEHASH = keccak256(\"Permit(address holder,address spender,uint256 nonce,uint256 expiry,bool allowed)\");\n bytes32 public constant PERMIT_TYPEHASH = 0xea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb;\n\n constructor(uint256 chainId_) public {\n wards[msg.sender] = 1;\n DOMAIN_SEPARATOR = keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n keccak256(bytes(name)),\n keccak256(bytes(version)),\n chainId_,\n address(this)\n )\n );\n }\n\n // --- Token ---\n function transfer(address dst, uint256 wad) external returns (bool) {\n return transferFrom(msg.sender, dst, wad);\n }\n\n function transferFrom(address src, address dst, uint256 wad) public returns (bool) {\n require(balanceOf[src] >= wad, \"VAI/insufficient-balance\");\n if (src != msg.sender && allowance[src][msg.sender] != uint256(-1)) {\n require(allowance[src][msg.sender] >= wad, \"VAI/insufficient-allowance\");\n allowance[src][msg.sender] = sub(allowance[src][msg.sender], wad);\n }\n balanceOf[src] = sub(balanceOf[src], wad);\n balanceOf[dst] = add(balanceOf[dst], wad);\n emit Transfer(src, dst, wad);\n return true;\n }\n\n function mint(address usr, uint256 wad) external auth {\n balanceOf[usr] = add(balanceOf[usr], wad);\n totalSupply = add(totalSupply, wad);\n emit Transfer(address(0), usr, wad);\n }\n\n function burn(address usr, uint256 wad) external {\n require(balanceOf[usr] >= wad, \"VAI/insufficient-balance\");\n if (usr != msg.sender && allowance[usr][msg.sender] != uint256(-1)) {\n require(allowance[usr][msg.sender] >= wad, \"VAI/insufficient-allowance\");\n allowance[usr][msg.sender] = sub(allowance[usr][msg.sender], wad);\n }\n balanceOf[usr] = sub(balanceOf[usr], wad);\n totalSupply = sub(totalSupply, wad);\n emit Transfer(usr, address(0), wad);\n }\n\n function approve(address usr, uint256 wad) external returns (bool) {\n allowance[msg.sender][usr] = wad;\n emit Approval(msg.sender, usr, wad);\n return true;\n }\n\n // --- Alias ---\n function push(address usr, uint256 wad) external {\n transferFrom(msg.sender, usr, wad);\n }\n\n function pull(address usr, uint256 wad) external {\n transferFrom(usr, msg.sender, wad);\n }\n\n function move(address src, address dst, uint256 wad) external {\n transferFrom(src, dst, wad);\n }\n\n // --- Approve by signature ---\n function permit(\n address holder,\n address spender,\n uint256 nonce,\n uint256 expiry,\n bool allowed,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external {\n bytes32 digest = keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n DOMAIN_SEPARATOR,\n keccak256(abi.encode(PERMIT_TYPEHASH, holder, spender, nonce, expiry, allowed))\n )\n );\n\n require(holder != address(0), \"VAI/invalid-address-0\");\n require(holder == ecrecover(digest, v, r, s), \"VAI/invalid-permit\");\n require(expiry == 0 || now <= expiry, \"VAI/permit-expired\");\n require(nonce == nonces[holder]++, \"VAI/invalid-nonce\");\n uint256 wad = allowed ? uint256(-1) : 0;\n allowance[holder][spender] = wad;\n emit Approval(holder, spender, wad);\n }\n}\n" + }, + "contracts/Tokens/VAI/VAIController.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity ^0.5.16;\n\nimport { PriceOracle } from \"../../Oracle/PriceOracle.sol\";\nimport { VAIControllerErrorReporter } from \"../../Utils/ErrorReporter.sol\";\nimport { Exponential } from \"../../Utils/Exponential.sol\";\nimport { ComptrollerInterface } from \"../../Comptroller/ComptrollerInterface.sol\";\nimport { IAccessControlManagerV5 } from \"@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV5.sol\";\nimport { VToken, EIP20Interface } from \"../VTokens/VToken.sol\";\nimport { VAIUnitroller, VAIControllerStorageG4 } from \"./VAIUnitroller.sol\";\nimport { VAIControllerInterface } from \"./VAIControllerInterface.sol\";\nimport { VAI } from \"./VAI.sol\";\nimport { IPrime } from \"../Prime/IPrime.sol\";\nimport { VTokenInterface } from \"../VTokens/VTokenInterfaces.sol\";\n\n/**\n * @title VAI Comptroller\n * @author Venus\n * @notice This is the implementation contract for the VAIUnitroller proxy\n */\ncontract VAIController is VAIControllerInterface, VAIControllerStorageG4, VAIControllerErrorReporter, Exponential {\n /// @notice Initial index used in interest computations\n uint256 public constant INITIAL_VAI_MINT_INDEX = 1e18;\n\n /// @notice Emitted when Comptroller is changed\n event NewComptroller(ComptrollerInterface oldComptroller, ComptrollerInterface newComptroller);\n\n /// @notice Emitted when mint for prime holder is changed\n event MintOnlyForPrimeHolder(bool previousMintEnabledOnlyForPrimeHolder, bool newMintEnabledOnlyForPrimeHolder);\n\n /// @notice Emitted when Prime is changed\n event NewPrime(address oldPrime, address newPrime);\n\n /// @notice Event emitted when VAI is minted\n event MintVAI(address minter, uint256 mintVAIAmount);\n\n /// @notice Event emitted when VAI is repaid\n event RepayVAI(address payer, address borrower, uint256 repayVAIAmount);\n\n /// @notice Event emitted when a borrow is liquidated\n event LiquidateVAI(\n address liquidator,\n address borrower,\n uint256 repayAmount,\n address vTokenCollateral,\n uint256 seizeTokens\n );\n\n /// @notice Emitted when treasury guardian is changed\n event NewTreasuryGuardian(address oldTreasuryGuardian, address newTreasuryGuardian);\n\n /// @notice Emitted when treasury address is changed\n event NewTreasuryAddress(address oldTreasuryAddress, address newTreasuryAddress);\n\n /// @notice Emitted when treasury percent is changed\n event NewTreasuryPercent(uint256 oldTreasuryPercent, uint256 newTreasuryPercent);\n\n /// @notice Event emitted when VAIs are minted and fee are transferred\n event MintFee(address minter, uint256 feeAmount);\n\n /// @notice Emiitted when VAI base rate is changed\n event NewVAIBaseRate(uint256 oldBaseRateMantissa, uint256 newBaseRateMantissa);\n\n /// @notice Emiitted when VAI float rate is changed\n event NewVAIFloatRate(uint256 oldFloatRateMantissa, uint256 newFlatRateMantissa);\n\n /// @notice Emiitted when VAI receiver address is changed\n event NewVAIReceiver(address oldReceiver, address newReceiver);\n\n /// @notice Emiitted when VAI mint cap is changed\n event NewVAIMintCap(uint256 oldMintCap, uint256 newMintCap);\n\n /// @notice Emitted when access control address is changed by admin\n event NewAccessControl(address oldAccessControlAddress, address newAccessControlAddress);\n\n /// @notice Emitted when VAI token address is changed by admin\n event NewVaiToken(address oldVaiToken, address newVaiToken);\n\n function initialize() external onlyAdmin {\n require(vaiMintIndex == 0, \"already initialized\");\n\n vaiMintIndex = INITIAL_VAI_MINT_INDEX;\n accrualBlockNumber = getBlockNumber();\n mintCap = uint256(-1);\n\n // The counter starts true to prevent changing it from zero to non-zero (i.e. smaller cost/refund)\n _notEntered = true;\n }\n\n function _become(VAIUnitroller unitroller) external {\n require(msg.sender == unitroller.admin(), \"only unitroller admin can change brains\");\n require(unitroller._acceptImplementation() == 0, \"change not authorized\");\n }\n\n /**\n * @notice The mintVAI function mints and transfers VAI from the protocol to the user, and adds a borrow balance.\n * The amount minted must be less than the user's Account Liquidity and the mint vai limit.\n * @dev If the Comptroller address is not set, minting is a no-op and the function returns the success code.\n * @param mintVAIAmount The amount of the VAI to be minted.\n * @return 0 on success, otherwise an error code\n */\n // solhint-disable-next-line code-complexity\n function mintVAI(uint256 mintVAIAmount) external nonReentrant returns (uint256) {\n if (address(comptroller) == address(0)) {\n return uint256(Error.NO_ERROR);\n }\n\n _ensureNonzeroAmount(mintVAIAmount);\n _ensureNotPaused();\n accrueVAIInterest();\n\n uint256 err;\n address minter = msg.sender;\n address _vai = vai;\n uint256 vaiTotalSupply = EIP20Interface(_vai).totalSupply();\n\n uint256 vaiNewTotalSupply = add_(vaiTotalSupply, mintVAIAmount);\n require(vaiNewTotalSupply <= mintCap, \"mint cap reached\");\n\n uint256 accountMintableVAI;\n (err, accountMintableVAI) = getMintableVAI(minter);\n require(err == uint256(Error.NO_ERROR), \"could not compute mintable amount\");\n\n // check that user have sufficient mintableVAI balance\n require(mintVAIAmount <= accountMintableVAI, \"minting more than allowed\");\n\n // Calculate the minted balance based on interest index\n uint256 totalMintedVAI = comptroller.mintedVAIs(minter);\n\n if (totalMintedVAI > 0) {\n uint256 repayAmount = getVAIRepayAmount(minter);\n uint256 remainedAmount = sub_(repayAmount, totalMintedVAI);\n pastVAIInterest[minter] = add_(pastVAIInterest[minter], remainedAmount);\n totalMintedVAI = repayAmount;\n }\n\n uint256 accountMintVAINew = add_(totalMintedVAI, mintVAIAmount);\n err = comptroller.setMintedVAIOf(minter, accountMintVAINew);\n require(err == uint256(Error.NO_ERROR), \"comptroller rejection\");\n\n uint256 remainedAmount;\n if (treasuryPercent != 0) {\n uint256 feeAmount = div_(mul_(mintVAIAmount, treasuryPercent), 1e18);\n remainedAmount = sub_(mintVAIAmount, feeAmount);\n VAI(_vai).mint(treasuryAddress, feeAmount);\n\n emit MintFee(minter, feeAmount);\n } else {\n remainedAmount = mintVAIAmount;\n }\n\n VAI(_vai).mint(minter, remainedAmount);\n vaiMinterInterestIndex[minter] = vaiMintIndex;\n\n emit MintVAI(minter, remainedAmount);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice The repay function transfers VAI interest into the protocol and burns the rest,\n * reducing the borrower's borrow balance. Before repaying VAI, users must first approve\n * VAIController to access their VAI balance.\n * @dev If the Comptroller address is not set, repayment is a no-op and the function returns the success code.\n * @param amount The amount of VAI to be repaid.\n * @return Error code (0=success, otherwise a failure, see ErrorReporter.sol)\n * @return Actual repayment amount\n */\n function repayVAI(uint256 amount) external nonReentrant returns (uint256, uint256) {\n return _repayVAI(msg.sender, amount);\n }\n\n /**\n * @notice The repay on behalf function transfers VAI interest into the protocol and burns the rest,\n * reducing the borrower's borrow balance. Borrowed VAIs are repaid by another user (possibly the borrower).\n * Before repaying VAI, the payer must first approve VAIController to access their VAI balance.\n * @dev If the Comptroller address is not set, repayment is a no-op and the function returns the success code.\n * @param borrower The account to repay the debt for.\n * @param amount The amount of VAI to be repaid.\n * @return Error code (0=success, otherwise a failure, see ErrorReporter.sol)\n * @return Actual repayment amount\n */\n function repayVAIBehalf(address borrower, uint256 amount) external nonReentrant returns (uint256, uint256) {\n _ensureNonzeroAddress(borrower);\n return _repayVAI(borrower, amount);\n }\n\n /**\n * @dev Checks the parameters and the protocol state, accrues interest, and invokes repayVAIFresh.\n * @dev If the Comptroller address is not set, repayment is a no-op and the function returns the success code.\n * @param borrower The account to repay the debt for.\n * @param amount The amount of VAI to be repaid.\n * @return Error code (0=success, otherwise a failure, see ErrorReporter.sol)\n * @return Actual repayment amount\n */\n function _repayVAI(address borrower, uint256 amount) internal returns (uint256, uint256) {\n if (address(comptroller) == address(0)) {\n return (0, 0);\n }\n _ensureNonzeroAmount(amount);\n _ensureNotPaused();\n\n accrueVAIInterest();\n return repayVAIFresh(msg.sender, borrower, amount);\n }\n\n /**\n * @dev Repay VAI, expecting interest to be accrued\n * @dev Borrowed VAIs are repaid by another user (possibly the borrower).\n * @param payer the account paying off the VAI\n * @param borrower the account with the debt being payed off\n * @param repayAmount the amount of VAI being repaid\n * @return Error code (0=success, otherwise a failure, see ErrorReporter.sol)\n * @return Actual repayment amount\n */\n function repayVAIFresh(address payer, address borrower, uint256 repayAmount) internal returns (uint256, uint256) {\n (uint256 burn, uint256 partOfCurrentInterest, uint256 partOfPastInterest) = getVAICalculateRepayAmount(\n borrower,\n repayAmount\n );\n\n VAI _vai = VAI(vai);\n _vai.burn(payer, burn);\n bool success = _vai.transferFrom(payer, receiver, partOfCurrentInterest);\n require(success == true, \"failed to transfer VAI fee\");\n\n uint256 vaiBalanceBorrower = comptroller.mintedVAIs(borrower);\n\n uint256 accountVAINew = sub_(sub_(vaiBalanceBorrower, burn), partOfPastInterest);\n pastVAIInterest[borrower] = sub_(pastVAIInterest[borrower], partOfPastInterest);\n\n uint256 error = comptroller.setMintedVAIOf(borrower, accountVAINew);\n // We have to revert upon error since side-effects already happened at this point\n require(error == uint256(Error.NO_ERROR), \"comptroller rejection\");\n\n uint256 repaidAmount = add_(burn, partOfCurrentInterest);\n emit RepayVAI(payer, borrower, repaidAmount);\n\n return (uint256(Error.NO_ERROR), repaidAmount);\n }\n\n /**\n * @notice The sender liquidates the vai minters collateral. The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of vai to be liquidated\n * @param vTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return Error code (0=success, otherwise a failure, see ErrorReporter.sol)\n * @return Actual repayment amount\n */\n function liquidateVAI(\n address borrower,\n uint256 repayAmount,\n VTokenInterface vTokenCollateral\n ) external nonReentrant returns (uint256, uint256) {\n _ensureNotPaused();\n\n uint256 error = vTokenCollateral.accrueInterest();\n if (error != uint256(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted liquidation failed\n return (fail(Error(error), FailureInfo.VAI_LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED), 0);\n }\n\n // liquidateVAIFresh emits borrow-specific logs on errors, so we don't need to\n return liquidateVAIFresh(msg.sender, borrower, repayAmount, vTokenCollateral);\n }\n\n /**\n * @notice The liquidator liquidates the borrowers collateral by repay borrowers VAI.\n * The collateral seized is transferred to the liquidator.\n * @dev If the Comptroller address is not set, liquidation is a no-op and the function returns the success code.\n * @param liquidator The address repaying the VAI and seizing collateral\n * @param borrower The borrower of this VAI to be liquidated\n * @param vTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the VAI to repay\n * @return Error code (0=success, otherwise a failure, see ErrorReporter.sol)\n * @return Actual repayment amount\n */\n function liquidateVAIFresh(\n address liquidator,\n address borrower,\n uint256 repayAmount,\n VTokenInterface vTokenCollateral\n ) internal returns (uint256, uint256) {\n if (address(comptroller) != address(0)) {\n accrueVAIInterest();\n\n /* Fail if liquidate not allowed */\n uint256 allowed = comptroller.liquidateBorrowAllowed(\n address(this),\n address(vTokenCollateral),\n liquidator,\n borrower,\n repayAmount\n );\n if (allowed != 0) {\n return (failOpaque(Error.REJECTION, FailureInfo.VAI_LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify vTokenCollateral market's block number equals current block number */\n //if (vTokenCollateral.accrualBlockNumber() != accrualBlockNumber) {\n if (vTokenCollateral.accrualBlockNumber() != getBlockNumber()) {\n return (fail(Error.REJECTION, FailureInfo.VAI_LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return (fail(Error.REJECTION, FailureInfo.VAI_LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0);\n }\n\n /* Fail if repayAmount = 0 */\n if (repayAmount == 0) {\n return (fail(Error.REJECTION, FailureInfo.VAI_LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0);\n }\n\n /* Fail if repayAmount = -1 */\n if (repayAmount == uint256(-1)) {\n return (fail(Error.REJECTION, FailureInfo.VAI_LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0);\n }\n\n /* Fail if repayVAI fails */\n (uint256 repayBorrowError, uint256 actualRepayAmount) = repayVAIFresh(liquidator, borrower, repayAmount);\n if (repayBorrowError != uint256(Error.NO_ERROR)) {\n return (fail(Error(repayBorrowError), FailureInfo.VAI_LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We calculate the number of collateral tokens that will be seized */\n (uint256 amountSeizeError, uint256 seizeTokens) = comptroller.liquidateVAICalculateSeizeTokens(\n address(vTokenCollateral),\n actualRepayAmount\n );\n require(\n amountSeizeError == uint256(Error.NO_ERROR),\n \"VAI_LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED\"\n );\n\n /* Revert if borrower collateral token balance < seizeTokens */\n require(vTokenCollateral.balanceOf(borrower) >= seizeTokens, \"VAI_LIQUIDATE_SEIZE_TOO_MUCH\");\n\n uint256 seizeError;\n seizeError = vTokenCollateral.seize(liquidator, borrower, seizeTokens);\n\n /* Revert if seize tokens fails (since we cannot be sure of side effects) */\n require(seizeError == uint256(Error.NO_ERROR), \"token seizure failed\");\n\n /* We emit a LiquidateBorrow event */\n emit LiquidateVAI(liquidator, borrower, actualRepayAmount, address(vTokenCollateral), seizeTokens);\n\n /* We call the defense hook */\n comptroller.liquidateBorrowVerify(\n address(this),\n address(vTokenCollateral),\n liquidator,\n borrower,\n actualRepayAmount,\n seizeTokens\n );\n\n return (uint256(Error.NO_ERROR), actualRepayAmount);\n }\n }\n\n /*** Admin Functions ***/\n\n /**\n * @notice Sets a new comptroller\n * @dev Admin function to set a new comptroller\n * @return uint256 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setComptroller(ComptrollerInterface comptroller_) external returns (uint256) {\n // Check caller is admin\n if (msg.sender != admin) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_COMPTROLLER_OWNER_CHECK);\n }\n\n ComptrollerInterface oldComptroller = comptroller;\n comptroller = comptroller_;\n emit NewComptroller(oldComptroller, comptroller_);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Set the prime token contract address\n * @param prime_ The new address of the prime token contract\n */\n function setPrimeToken(address prime_) external onlyAdmin {\n emit NewPrime(prime, prime_);\n prime = prime_;\n }\n\n /**\n * @notice Set the VAI token contract address\n * @param vai_ The new address of the VAI token contract\n */\n function setVAIToken(address vai_) external onlyAdmin {\n emit NewVaiToken(vai, vai_);\n vai = vai_;\n }\n\n /**\n * @notice Toggle mint only for prime holder\n * @return uint256 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function toggleOnlyPrimeHolderMint() external returns (uint256) {\n _ensureAllowed(\"toggleOnlyPrimeHolderMint()\");\n\n if (!mintEnabledOnlyForPrimeHolder && prime == address(0)) {\n return uint256(Error.REJECTION);\n }\n\n emit MintOnlyForPrimeHolder(mintEnabledOnlyForPrimeHolder, !mintEnabledOnlyForPrimeHolder);\n mintEnabledOnlyForPrimeHolder = !mintEnabledOnlyForPrimeHolder;\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @dev Local vars for avoiding stack-depth limits in calculating account total supply balance.\n * Note that `vTokenBalance` is the number of vTokens the account owns in the market,\n * whereas `borrowBalance` is the amount of underlying that the account has borrowed.\n */\n struct AccountAmountLocalVars {\n uint256 oErr;\n MathError mErr;\n uint256 sumSupply;\n uint256 marketSupply;\n uint256 sumBorrowPlusEffects;\n uint256 vTokenBalance;\n uint256 borrowBalance;\n uint256 exchangeRateMantissa;\n uint256 oraclePriceMantissa;\n Exp exchangeRate;\n Exp oraclePrice;\n Exp tokensToDenom;\n }\n\n /**\n * @notice Function that returns the amount of VAI a user can mint based on their account liquidy and the VAI mint rate\n * If mintEnabledOnlyForPrimeHolder is true, only Prime holders are able to mint VAI\n * @param minter The account to check mintable VAI\n * @return Error code (0=success, otherwise a failure, see ErrorReporter.sol for details)\n * @return Mintable amount (with 18 decimals)\n */\n // solhint-disable-next-line code-complexity\n function getMintableVAI(address minter) public view returns (uint256, uint256) {\n if (mintEnabledOnlyForPrimeHolder && !IPrime(prime).isUserPrimeHolder(minter)) {\n return (uint256(Error.REJECTION), 0);\n }\n\n PriceOracle oracle = comptroller.oracle();\n VToken[] memory enteredMarkets = comptroller.getAssetsIn(minter);\n\n AccountAmountLocalVars memory vars; // Holds all our calculation results\n\n uint256 accountMintableVAI;\n uint256 i;\n\n /**\n * We use this formula to calculate mintable VAI amount.\n * totalSupplyAmount * VAIMintRate - (totalBorrowAmount + mintedVAIOf)\n */\n uint256 marketsCount = enteredMarkets.length;\n for (i = 0; i < marketsCount; i++) {\n (vars.oErr, vars.vTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = enteredMarkets[i]\n .getAccountSnapshot(minter);\n if (vars.oErr != 0) {\n // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades\n return (uint256(Error.SNAPSHOT_ERROR), 0);\n }\n vars.exchangeRate = Exp({ mantissa: vars.exchangeRateMantissa });\n\n // Get the normalized price of the asset\n vars.oraclePriceMantissa = oracle.getUnderlyingPrice(enteredMarkets[i]);\n if (vars.oraclePriceMantissa == 0) {\n return (uint256(Error.PRICE_ERROR), 0);\n }\n vars.oraclePrice = Exp({ mantissa: vars.oraclePriceMantissa });\n\n (vars.mErr, vars.tokensToDenom) = mulExp(vars.exchangeRate, vars.oraclePrice);\n if (vars.mErr != MathError.NO_ERROR) {\n return (uint256(Error.MATH_ERROR), 0);\n }\n\n // marketSupply = tokensToDenom * vTokenBalance\n (vars.mErr, vars.marketSupply) = mulScalarTruncate(vars.tokensToDenom, vars.vTokenBalance);\n if (vars.mErr != MathError.NO_ERROR) {\n return (uint256(Error.MATH_ERROR), 0);\n }\n\n (, uint256 collateralFactorMantissa) = comptroller.markets(address(enteredMarkets[i]));\n (vars.mErr, vars.marketSupply) = mulUInt(vars.marketSupply, collateralFactorMantissa);\n if (vars.mErr != MathError.NO_ERROR) {\n return (uint256(Error.MATH_ERROR), 0);\n }\n\n (vars.mErr, vars.marketSupply) = divUInt(vars.marketSupply, 1e18);\n if (vars.mErr != MathError.NO_ERROR) {\n return (uint256(Error.MATH_ERROR), 0);\n }\n\n (vars.mErr, vars.sumSupply) = addUInt(vars.sumSupply, vars.marketSupply);\n if (vars.mErr != MathError.NO_ERROR) {\n return (uint256(Error.MATH_ERROR), 0);\n }\n\n // sumBorrowPlusEffects += oraclePrice * borrowBalance\n (vars.mErr, vars.sumBorrowPlusEffects) = mulScalarTruncateAddUInt(\n vars.oraclePrice,\n vars.borrowBalance,\n vars.sumBorrowPlusEffects\n );\n if (vars.mErr != MathError.NO_ERROR) {\n return (uint256(Error.MATH_ERROR), 0);\n }\n }\n\n uint256 totalMintedVAI = comptroller.mintedVAIs(minter);\n uint256 repayAmount = 0;\n\n if (totalMintedVAI > 0) {\n repayAmount = getVAIRepayAmount(minter);\n }\n\n (vars.mErr, vars.sumBorrowPlusEffects) = addUInt(vars.sumBorrowPlusEffects, repayAmount);\n if (vars.mErr != MathError.NO_ERROR) {\n return (uint256(Error.MATH_ERROR), 0);\n }\n\n (vars.mErr, accountMintableVAI) = mulUInt(vars.sumSupply, comptroller.vaiMintRate());\n require(vars.mErr == MathError.NO_ERROR, \"VAI_MINT_AMOUNT_CALCULATION_FAILED\");\n\n (vars.mErr, accountMintableVAI) = divUInt(accountMintableVAI, 10000);\n require(vars.mErr == MathError.NO_ERROR, \"VAI_MINT_AMOUNT_CALCULATION_FAILED\");\n\n (vars.mErr, accountMintableVAI) = subUInt(accountMintableVAI, vars.sumBorrowPlusEffects);\n if (vars.mErr != MathError.NO_ERROR) {\n return (uint256(Error.REJECTION), 0);\n }\n\n return (uint256(Error.NO_ERROR), accountMintableVAI);\n }\n\n /**\n * @notice Update treasury data\n * @param newTreasuryGuardian New Treasury Guardian address\n * @param newTreasuryAddress New Treasury Address\n * @param newTreasuryPercent New fee percentage for minting VAI that is sent to the treasury\n */\n function _setTreasuryData(\n address newTreasuryGuardian,\n address newTreasuryAddress,\n uint256 newTreasuryPercent\n ) external returns (uint256) {\n // Check caller is admin\n if (!(msg.sender == admin || msg.sender == treasuryGuardian)) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_TREASURY_OWNER_CHECK);\n }\n\n require(newTreasuryPercent < 1e18, \"treasury percent cap overflow\");\n\n address oldTreasuryGuardian = treasuryGuardian;\n address oldTreasuryAddress = treasuryAddress;\n uint256 oldTreasuryPercent = treasuryPercent;\n\n treasuryGuardian = newTreasuryGuardian;\n treasuryAddress = newTreasuryAddress;\n treasuryPercent = newTreasuryPercent;\n\n emit NewTreasuryGuardian(oldTreasuryGuardian, newTreasuryGuardian);\n emit NewTreasuryAddress(oldTreasuryAddress, newTreasuryAddress);\n emit NewTreasuryPercent(oldTreasuryPercent, newTreasuryPercent);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Gets yearly VAI interest rate based on the VAI price\n * @return uint256 Yearly VAI interest rate\n */\n function getVAIRepayRate() public view returns (uint256) {\n PriceOracle oracle = comptroller.oracle();\n MathError mErr;\n\n if (baseRateMantissa > 0) {\n if (floatRateMantissa > 0) {\n uint256 oraclePrice = oracle.getUnderlyingPrice(VToken(getVAIAddress()));\n if (1e18 > oraclePrice) {\n uint256 delta;\n uint256 rate;\n\n (mErr, delta) = subUInt(1e18, oraclePrice);\n require(mErr == MathError.NO_ERROR, \"VAI_REPAY_RATE_CALCULATION_FAILED\");\n\n (mErr, delta) = mulUInt(delta, floatRateMantissa);\n require(mErr == MathError.NO_ERROR, \"VAI_REPAY_RATE_CALCULATION_FAILED\");\n\n (mErr, delta) = divUInt(delta, 1e18);\n require(mErr == MathError.NO_ERROR, \"VAI_REPAY_RATE_CALCULATION_FAILED\");\n\n (mErr, rate) = addUInt(delta, baseRateMantissa);\n require(mErr == MathError.NO_ERROR, \"VAI_REPAY_RATE_CALCULATION_FAILED\");\n\n return rate;\n } else {\n return baseRateMantissa;\n }\n } else {\n return baseRateMantissa;\n }\n } else {\n return 0;\n }\n }\n\n /**\n * @notice Get interest rate per block\n * @return uint256 Interest rate per bock\n */\n function getVAIRepayRatePerBlock() public view returns (uint256) {\n uint256 yearlyRate = getVAIRepayRate();\n\n MathError mErr;\n uint256 rate;\n\n (mErr, rate) = divUInt(yearlyRate, getBlocksPerYear());\n require(mErr == MathError.NO_ERROR, \"VAI_REPAY_RATE_CALCULATION_FAILED\");\n\n return rate;\n }\n\n /**\n * @notice Get the last updated interest index for a VAI Minter\n * @param minter Address of VAI minter\n * @return uint256 Returns the interest rate index for a minter\n */\n function getVAIMinterInterestIndex(address minter) public view returns (uint256) {\n uint256 storedIndex = vaiMinterInterestIndex[minter];\n // If the user minted VAI before the stability fee was introduced, accrue\n // starting from stability fee launch\n if (storedIndex == 0) {\n return INITIAL_VAI_MINT_INDEX;\n }\n return storedIndex;\n }\n\n /**\n * @notice Get the current total VAI a user needs to repay\n * @param account The address of the VAI borrower\n * @return (uint256) The total amount of VAI the user needs to repay\n */\n function getVAIRepayAmount(address account) public view returns (uint256) {\n MathError mErr;\n uint256 delta;\n\n uint256 amount = comptroller.mintedVAIs(account);\n uint256 interest = pastVAIInterest[account];\n uint256 totalMintedVAI;\n uint256 newInterest;\n\n (mErr, totalMintedVAI) = subUInt(amount, interest);\n require(mErr == MathError.NO_ERROR, \"VAI_TOTAL_REPAY_AMOUNT_CALCULATION_FAILED\");\n\n (mErr, delta) = subUInt(vaiMintIndex, getVAIMinterInterestIndex(account));\n require(mErr == MathError.NO_ERROR, \"VAI_TOTAL_REPAY_AMOUNT_CALCULATION_FAILED\");\n\n (mErr, newInterest) = mulUInt(delta, totalMintedVAI);\n require(mErr == MathError.NO_ERROR, \"VAI_TOTAL_REPAY_AMOUNT_CALCULATION_FAILED\");\n\n (mErr, newInterest) = divUInt(newInterest, 1e18);\n require(mErr == MathError.NO_ERROR, \"VAI_TOTAL_REPAY_AMOUNT_CALCULATION_FAILED\");\n\n (mErr, amount) = addUInt(amount, newInterest);\n require(mErr == MathError.NO_ERROR, \"VAI_TOTAL_REPAY_AMOUNT_CALCULATION_FAILED\");\n\n return amount;\n }\n\n /**\n * @notice Calculate how much VAI the user needs to repay\n * @param borrower The address of the VAI borrower\n * @param repayAmount The amount of VAI being returned\n * @return Amount of VAI to be burned\n * @return Amount of VAI the user needs to pay in current interest\n * @return Amount of VAI the user needs to pay in past interest\n */\n function getVAICalculateRepayAmount(\n address borrower,\n uint256 repayAmount\n ) public view returns (uint256, uint256, uint256) {\n MathError mErr;\n uint256 totalRepayAmount = getVAIRepayAmount(borrower);\n uint256 currentInterest;\n\n (mErr, currentInterest) = subUInt(totalRepayAmount, comptroller.mintedVAIs(borrower));\n require(mErr == MathError.NO_ERROR, \"VAI_BURN_AMOUNT_CALCULATION_FAILED\");\n\n (mErr, currentInterest) = addUInt(pastVAIInterest[borrower], currentInterest);\n require(mErr == MathError.NO_ERROR, \"VAI_BURN_AMOUNT_CALCULATION_FAILED\");\n\n uint256 burn;\n uint256 partOfCurrentInterest = currentInterest;\n uint256 partOfPastInterest = pastVAIInterest[borrower];\n\n if (repayAmount >= totalRepayAmount) {\n (mErr, burn) = subUInt(totalRepayAmount, currentInterest);\n require(mErr == MathError.NO_ERROR, \"VAI_BURN_AMOUNT_CALCULATION_FAILED\");\n } else {\n uint256 delta;\n\n (mErr, delta) = mulUInt(repayAmount, 1e18);\n require(mErr == MathError.NO_ERROR, \"VAI_PART_CALCULATION_FAILED\");\n\n (mErr, delta) = divUInt(delta, totalRepayAmount);\n require(mErr == MathError.NO_ERROR, \"VAI_PART_CALCULATION_FAILED\");\n\n uint256 totalMintedAmount;\n (mErr, totalMintedAmount) = subUInt(totalRepayAmount, currentInterest);\n require(mErr == MathError.NO_ERROR, \"VAI_MINTED_AMOUNT_CALCULATION_FAILED\");\n\n (mErr, burn) = mulUInt(totalMintedAmount, delta);\n require(mErr == MathError.NO_ERROR, \"VAI_BURN_AMOUNT_CALCULATION_FAILED\");\n\n (mErr, burn) = divUInt(burn, 1e18);\n require(mErr == MathError.NO_ERROR, \"VAI_BURN_AMOUNT_CALCULATION_FAILED\");\n\n (mErr, partOfCurrentInterest) = mulUInt(currentInterest, delta);\n require(mErr == MathError.NO_ERROR, \"VAI_CURRENT_INTEREST_AMOUNT_CALCULATION_FAILED\");\n\n (mErr, partOfCurrentInterest) = divUInt(partOfCurrentInterest, 1e18);\n require(mErr == MathError.NO_ERROR, \"VAI_CURRENT_INTEREST_AMOUNT_CALCULATION_FAILED\");\n\n (mErr, partOfPastInterest) = mulUInt(pastVAIInterest[borrower], delta);\n require(mErr == MathError.NO_ERROR, \"VAI_PAST_INTEREST_CALCULATION_FAILED\");\n\n (mErr, partOfPastInterest) = divUInt(partOfPastInterest, 1e18);\n require(mErr == MathError.NO_ERROR, \"VAI_PAST_INTEREST_CALCULATION_FAILED\");\n }\n\n return (burn, partOfCurrentInterest, partOfPastInterest);\n }\n\n /**\n * @notice Accrue interest on outstanding minted VAI\n */\n function accrueVAIInterest() public {\n MathError mErr;\n uint256 delta;\n\n (mErr, delta) = mulUInt(getVAIRepayRatePerBlock(), getBlockNumber() - accrualBlockNumber);\n require(mErr == MathError.NO_ERROR, \"VAI_INTEREST_ACCRUE_FAILED\");\n\n (mErr, delta) = addUInt(delta, vaiMintIndex);\n require(mErr == MathError.NO_ERROR, \"VAI_INTEREST_ACCRUE_FAILED\");\n\n vaiMintIndex = delta;\n accrualBlockNumber = getBlockNumber();\n }\n\n /**\n * @notice Sets the address of the access control of this contract\n * @dev Admin function to set the access control address\n * @param newAccessControlAddress New address for the access control\n */\n function setAccessControl(address newAccessControlAddress) external onlyAdmin {\n _ensureNonzeroAddress(newAccessControlAddress);\n\n address oldAccessControlAddress = accessControl;\n accessControl = newAccessControlAddress;\n emit NewAccessControl(oldAccessControlAddress, accessControl);\n }\n\n /**\n * @notice Set VAI borrow base rate\n * @param newBaseRateMantissa the base rate multiplied by 10**18\n */\n function setBaseRate(uint256 newBaseRateMantissa) external {\n _ensureAllowed(\"setBaseRate(uint256)\");\n\n uint256 old = baseRateMantissa;\n baseRateMantissa = newBaseRateMantissa;\n emit NewVAIBaseRate(old, baseRateMantissa);\n }\n\n /**\n * @notice Set VAI borrow float rate\n * @param newFloatRateMantissa the VAI float rate multiplied by 10**18\n */\n function setFloatRate(uint256 newFloatRateMantissa) external {\n _ensureAllowed(\"setFloatRate(uint256)\");\n\n uint256 old = floatRateMantissa;\n floatRateMantissa = newFloatRateMantissa;\n emit NewVAIFloatRate(old, floatRateMantissa);\n }\n\n /**\n * @notice Set VAI stability fee receiver address\n * @param newReceiver the address of the VAI fee receiver\n */\n function setReceiver(address newReceiver) external onlyAdmin {\n _ensureNonzeroAddress(newReceiver);\n\n address old = receiver;\n receiver = newReceiver;\n emit NewVAIReceiver(old, newReceiver);\n }\n\n /**\n * @notice Set VAI mint cap\n * @param _mintCap the amount of VAI that can be minted\n */\n function setMintCap(uint256 _mintCap) external {\n _ensureAllowed(\"setMintCap(uint256)\");\n\n uint256 old = mintCap;\n mintCap = _mintCap;\n emit NewVAIMintCap(old, _mintCap);\n }\n\n function getBlockNumber() internal view returns (uint256) {\n return block.number;\n }\n\n function getBlocksPerYear() public view returns (uint256) {\n return 10512000; //(24 * 60 * 60 * 365) / 3;\n }\n\n /**\n * @notice Return the address of the VAI token\n * @return The address of VAI\n */\n function getVAIAddress() public view returns (address) {\n return vai;\n }\n\n modifier onlyAdmin() {\n require(msg.sender == admin, \"only admin can\");\n _;\n }\n\n /*** Reentrancy Guard ***/\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant() {\n require(_notEntered, \"re-entered\");\n _notEntered = false;\n _;\n _notEntered = true; // get a gas-refund post-Istanbul\n }\n\n function _ensureAllowed(string memory functionSig) private view {\n require(IAccessControlManagerV5(accessControl).isAllowedToCall(msg.sender, functionSig), \"access denied\");\n }\n\n /// @dev Reverts if the protocol is paused\n function _ensureNotPaused() private view {\n require(!comptroller.protocolPaused(), \"protocol is paused\");\n }\n\n /// @dev Reverts if the passed address is zero\n function _ensureNonzeroAddress(address someone) private pure {\n require(someone != address(0), \"can't be zero address\");\n }\n\n /// @dev Reverts if the passed amount is zero\n function _ensureNonzeroAmount(uint256 amount) private pure {\n require(amount > 0, \"amount can't be zero\");\n }\n}\n" + }, + "contracts/Tokens/VAI/VAIControllerInterface.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport { VTokenInterface } from \"../VTokens/VTokenInterfaces.sol\";\n\ncontract VAIControllerInterface {\n function mintVAI(uint256 mintVAIAmount) external returns (uint256);\n\n function repayVAI(uint256 amount) external returns (uint256, uint256);\n\n function repayVAIBehalf(address borrower, uint256 amount) external returns (uint256, uint256);\n\n function liquidateVAI(\n address borrower,\n uint256 repayAmount,\n VTokenInterface vTokenCollateral\n ) external returns (uint256, uint256);\n\n function getMintableVAI(address minter) external view returns (uint256, uint256);\n\n function getVAIAddress() external view returns (address);\n\n function getVAIRepayAmount(address account) external view returns (uint256);\n}\n" + }, + "contracts/Tokens/VAI/VAIControllerStorage.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport { ComptrollerInterface } from \"../../Comptroller/ComptrollerInterface.sol\";\n\ncontract VAIUnitrollerAdminStorage {\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 Unitroller\n */\n address public vaiControllerImplementation;\n\n /**\n * @notice Pending brains of Unitroller\n */\n address public pendingVAIControllerImplementation;\n}\n\ncontract VAIControllerStorageG1 is VAIUnitrollerAdminStorage {\n ComptrollerInterface public comptroller;\n\n struct VenusVAIState {\n /// @notice The last updated venusVAIMintIndex\n uint224 index;\n /// @notice The block number the index was last updated at\n uint32 block;\n }\n\n /// @notice The Venus VAI state\n VenusVAIState public venusVAIState;\n\n /// @notice The Venus VAI state initialized\n bool public isVenusVAIInitialized;\n\n /// @notice The Venus VAI minter index as of the last time they accrued XVS\n mapping(address => uint256) public venusVAIMinterIndex;\n}\n\ncontract VAIControllerStorageG2 is VAIControllerStorageG1 {\n /// @notice Treasury Guardian address\n address public treasuryGuardian;\n\n /// @notice Treasury address\n address public treasuryAddress;\n\n /// @notice Fee percent of accrued interest with decimal 18\n uint256 public treasuryPercent;\n\n /// @notice Guard variable for re-entrancy checks\n bool internal _notEntered;\n\n /// @notice The base rate for stability fee\n uint256 public baseRateMantissa;\n\n /// @notice The float rate for stability fee\n uint256 public floatRateMantissa;\n\n /// @notice The address for VAI interest receiver\n address public receiver;\n\n /// @notice Accumulator of the total earned interest rate since the opening of the market. For example: 0.6 (60%)\n uint256 public vaiMintIndex;\n\n /// @notice Block number that interest was last accrued at\n uint256 internal accrualBlockNumber;\n\n /// @notice Global vaiMintIndex as of the most recent balance-changing action for user\n mapping(address => uint256) internal vaiMinterInterestIndex;\n\n /// @notice Tracks the amount of mintedVAI of a user that represents the accrued interest\n mapping(address => uint256) public pastVAIInterest;\n\n /// @notice VAI mint cap\n uint256 public mintCap;\n\n /// @notice Access control manager address\n address public accessControl;\n}\n\ncontract VAIControllerStorageG3 is VAIControllerStorageG2 {\n /// @notice The address of the prime contract. It can be a ZERO address\n address public prime;\n\n /// @notice Tracks if minting is enabled only for prime token holders. Only used if prime is set\n bool public mintEnabledOnlyForPrimeHolder;\n}\n\ncontract VAIControllerStorageG4 is VAIControllerStorageG3 {\n /// @notice The address of the VAI token\n address internal vai;\n}\n" + }, + "contracts/Tokens/VAI/VAIUnitroller.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../../Utils/ErrorReporter.sol\";\nimport \"./VAIControllerStorage.sol\";\n\n/**\n * @title VAI Unitroller\n * @author Venus\n * @notice This is the proxy contract for the VAIComptroller\n */\ncontract VAIUnitroller is VAIUnitrollerAdminStorage, VAIControllerErrorReporter {\n /**\n * @notice Emitted when pendingVAIControllerImplementation is changed\n */\n event NewPendingImplementation(address oldPendingImplementation, address newPendingImplementation);\n\n /**\n * @notice Emitted when pendingVAIControllerImplementation is accepted, which means comptroller 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 (uint256) {\n if (msg.sender != admin) {\n return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_IMPLEMENTATION_OWNER_CHECK);\n }\n\n address oldPendingImplementation = pendingVAIControllerImplementation;\n\n pendingVAIControllerImplementation = newPendingImplementation;\n\n emit NewPendingImplementation(oldPendingImplementation, pendingVAIControllerImplementation);\n\n return uint256(Error.NO_ERROR);\n }\n\n /**\n * @notice Accepts new implementation of comptroller. msg.sender must be pendingImplementation\n * @dev Admin function for new implementation to accept it's role as implementation\n * @return uint256 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _acceptImplementation() public returns (uint256) {\n // Check caller is pendingImplementation\n if (msg.sender != pendingVAIControllerImplementation) {\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK);\n }\n\n // Save current values for inclusion in log\n address oldImplementation = vaiControllerImplementation;\n address oldPendingImplementation = pendingVAIControllerImplementation;\n\n vaiControllerImplementation = pendingVAIControllerImplementation;\n\n pendingVAIControllerImplementation = address(0);\n\n emit NewImplementation(oldImplementation, vaiControllerImplementation);\n emit NewPendingImplementation(oldPendingImplementation, pendingVAIControllerImplementation);\n\n return uint256(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 uint256 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPendingAdmin(address newPendingAdmin) public returns (uint256) {\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 uint256(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 uint256 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _acceptAdmin() public returns (uint256) {\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 uint256(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, ) = vaiControllerImplementation.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" + }, + "contracts/Tokens/VRT/VRT.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../../Utils/Tokenlock.sol\";\n\ncontract VRT is Tokenlock {\n /// @notice BEP-20 token name for this token\n string public constant name = \"Venus Reward Token\";\n\n /// @notice BEP-20 token symbol for this token\n string public constant symbol = \"VRT\";\n\n /// @notice BEP-20 token decimals for this token\n uint8 public constant decimals = 18;\n\n /// @notice Total number of tokens in circulation\n uint public constant totalSupply = 30000000000e18; // 30 billion VRT\n\n /// @notice Allowance amounts on behalf of others\n mapping(address => mapping(address => uint96)) internal allowances;\n\n /// @notice Official record of token balances for each account\n mapping(address => uint96) internal balances;\n\n /// @notice A record of each accounts delegate\n mapping(address => address) public delegates;\n\n /// @notice A checkpoint for marking number of votes from a given block\n struct Checkpoint {\n uint32 fromBlock;\n uint96 votes;\n }\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 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 /// @notice A record of states for signing / validating signatures\n mapping(address => uint) public nonces;\n\n /// @notice An event thats emitted when an account changes its delegate\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /// @notice An event thats emitted when a delegate account's vote balance changes\n event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);\n\n /// @notice The standard BEP-20 transfer event\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n /// @notice The standard BEP-20 approval event\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n /**\n * @notice Construct a new VRT token\n * @param account The initial account to grant all the tokens\n */\n constructor(address account) public {\n balances[account] = uint96(totalSupply);\n emit Transfer(address(0), account, totalSupply);\n }\n\n /**\n * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`\n * @param account The address of the account holding the funds\n * @param spender The address of the account spending the funds\n * @return The number of tokens approved\n */\n function allowance(address account, address spender) external view returns (uint) {\n return allowances[account][spender];\n }\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * @param spender The address of the account which may transfer tokens\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(address spender, uint rawAmount) external validLock returns (bool) {\n uint96 amount;\n if (rawAmount == uint(-1)) {\n amount = uint96(-1);\n } else {\n amount = safe96(rawAmount, \"VRT::approve: amount exceeds 96 bits\");\n }\n\n allowances[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /**\n * @notice Get the number of tokens held by the `account`\n * @param account The address of the account to get the balance of\n * @return The number of tokens held\n */\n function balanceOf(address account) external view returns (uint) {\n return balances[account];\n }\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(address dst, uint rawAmount) external validLock returns (bool) {\n uint96 amount = safe96(rawAmount, \"VRT::transfer: amount exceeds 96 bits\");\n _transferTokens(msg.sender, dst, amount);\n return true;\n }\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(address src, address dst, uint rawAmount) external validLock returns (bool) {\n address spender = msg.sender;\n uint96 spenderAllowance = allowances[src][spender];\n uint96 amount = safe96(rawAmount, \"VRT::approve: amount exceeds 96 bits\");\n\n if (spender != src && spenderAllowance != uint96(-1)) {\n uint96 newAllowance = sub96(\n spenderAllowance,\n amount,\n \"VRT::transferFrom: transfer amount exceeds spender allowance\"\n );\n allowances[src][spender] = newAllowance;\n\n emit Approval(src, spender, newAllowance);\n }\n\n _transferTokens(src, dst, amount);\n return true;\n }\n\n /**\n * @notice Delegate votes from `msg.sender` to `delegatee`\n * @param delegatee The address to delegate votes to\n */\n function delegate(address delegatee) public validLock {\n return _delegate(msg.sender, delegatee);\n }\n\n /**\n * @notice Delegates votes from signatory to `delegatee`\n * @param delegatee The address to delegate votes to\n * @param nonce The contract state required to match the signature\n * @param expiry The time at which to expire the signature\n * @param v The recovery byte of the signature\n * @param r Half of the ECDSA signature pair\n * @param s Half of the ECDSA signature pair\n */\n function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public validLock {\n bytes32 domainSeparator = keccak256(\n abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this))\n );\n bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));\n bytes32 digest = keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n address signatory = ecrecover(digest, v, r, s);\n require(signatory != address(0), \"VRT::delegateBySig: invalid signature\");\n require(nonce == nonces[signatory]++, \"VRT::delegateBySig: invalid nonce\");\n require(now <= expiry, \"VRT::delegateBySig: signature expired\");\n return _delegate(signatory, delegatee);\n }\n\n /**\n * @notice Gets the current votes balance for `account`\n * @param account The address to get votes balance\n * @return The number of current votes for `account`\n */\n function getCurrentVotes(address account) external view returns (uint96) {\n uint32 nCheckpoints = numCheckpoints[account];\n return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;\n }\n\n /**\n * @notice Determine the prior number of votes for an account as of a block number\n * @dev Block number must be a finalized block or else this function will revert to prevent misinformation.\n * @param account The address of the account to check\n * @param blockNumber The block number to get the vote balance at\n * @return The number of votes the account had as of the given block\n */\n function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {\n require(blockNumber < block.number, \"VRT::getPriorVotes: not yet determined\");\n\n uint32 nCheckpoints = numCheckpoints[account];\n if (nCheckpoints == 0) {\n return 0;\n }\n\n // First check most recent balance\n if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {\n return checkpoints[account][nCheckpoints - 1].votes;\n }\n\n // Next check implicit zero balance\n if (checkpoints[account][0].fromBlock > blockNumber) {\n return 0;\n }\n\n uint32 lower = 0;\n uint32 upper = nCheckpoints - 1;\n while (upper > lower) {\n uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\n Checkpoint memory cp = checkpoints[account][center];\n if (cp.fromBlock == blockNumber) {\n return cp.votes;\n } else if (cp.fromBlock < blockNumber) {\n lower = center;\n } else {\n upper = center - 1;\n }\n }\n return checkpoints[account][lower].votes;\n }\n\n function _delegate(address delegator, address delegatee) internal {\n address currentDelegate = delegates[delegator];\n uint96 delegatorBalance = balances[delegator];\n delegates[delegator] = delegatee;\n\n emit DelegateChanged(delegator, currentDelegate, delegatee);\n\n _moveDelegates(currentDelegate, delegatee, delegatorBalance);\n }\n\n function _transferTokens(address src, address dst, uint96 amount) internal {\n require(src != address(0), \"VRT::_transferTokens: cannot transfer from the zero address\");\n require(dst != address(0), \"VRT::_transferTokens: cannot transfer to the zero address\");\n\n balances[src] = sub96(balances[src], amount, \"VRT::_transferTokens: transfer amount exceeds balance\");\n balances[dst] = add96(balances[dst], amount, \"VRT::_transferTokens: transfer amount overflows\");\n emit Transfer(src, dst, amount);\n\n _moveDelegates(delegates[src], delegates[dst], amount);\n }\n\n function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {\n if (srcRep != dstRep && amount > 0) {\n if (srcRep != address(0)) {\n uint32 srcRepNum = numCheckpoints[srcRep];\n uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;\n uint96 srcRepNew = sub96(srcRepOld, amount, \"VRT::_moveVotes: vote amount underflows\");\n _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);\n }\n\n if (dstRep != address(0)) {\n uint32 dstRepNum = numCheckpoints[dstRep];\n uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;\n uint96 dstRepNew = add96(dstRepOld, amount, \"VRT::_moveVotes: vote amount overflows\");\n _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);\n }\n }\n }\n\n function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {\n uint32 blockNumber = safe32(block.number, \"VRT::_writeCheckpoint: block number exceeds 32 bits\");\n\n if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {\n checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;\n } else {\n checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);\n numCheckpoints[delegatee] = nCheckpoints + 1;\n }\n\n emit DelegateVotesChanged(delegatee, oldVotes, newVotes);\n }\n\n function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {\n require(n < 2 ** 32, errorMessage);\n return uint32(n);\n }\n\n function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {\n require(n < 2 ** 96, errorMessage);\n return uint96(n);\n }\n\n function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {\n uint96 c = a + b;\n require(c >= a, errorMessage);\n return c;\n }\n\n function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n function getChainId() internal pure returns (uint) {\n uint256 chainId;\n assembly {\n chainId := chainid()\n }\n return chainId;\n }\n}\n" + }, + "contracts/Tokens/VRT/VRTConverter.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../../Utils/IBEP20.sol\";\nimport \"../../Utils/SafeBEP20.sol\";\nimport \"../XVS/IXVSVesting.sol\";\nimport \"./VRTConverterStorage.sol\";\nimport \"./VRTConverterProxy.sol\";\n\n/**\n * @title Venus's VRTConversion Contract\n * @author Venus\n */\ncontract VRTConverter is VRTConverterStorage {\n using SafeMath for uint256;\n using SafeBEP20 for IBEP20;\n\n address public constant DEAD_ADDRESS = 0x000000000000000000000000000000000000dEaD;\n\n /// @notice decimal precision for VRT\n uint256 public constant vrtDecimalsMultiplier = 1e18;\n\n /// @notice decimal precision for XVS\n uint256 public constant xvsDecimalsMultiplier = 1e18;\n\n /// @notice Emitted when an admin set conversion info\n event ConversionInfoSet(\n uint256 conversionRatio,\n uint256 conversionStartTime,\n uint256 conversionPeriod,\n uint256 conversionEndTime\n );\n\n /// @notice Emitted when token conversion is done\n event TokenConverted(\n address reedeemer,\n address vrtAddress,\n uint256 vrtAmount,\n address xvsAddress,\n uint256 xvsAmount\n );\n\n /// @notice Emitted when an admin withdraw converted token\n event TokenWithdraw(address token, address to, uint256 amount);\n\n /// @notice Emitted when XVSVestingAddress is set\n event XVSVestingSet(address xvsVestingAddress);\n\n constructor() public {}\n\n function initialize(\n address _vrtAddress,\n address _xvsAddress,\n uint256 _conversionRatio,\n uint256 _conversionStartTime,\n uint256 _conversionPeriod\n ) public {\n require(msg.sender == admin, \"only admin may initialize the VRTConverter\");\n require(initialized == false, \"VRTConverter is already initialized\");\n\n require(_vrtAddress != address(0), \"vrtAddress cannot be Zero\");\n vrt = IBEP20(_vrtAddress);\n\n require(_xvsAddress != address(0), \"xvsAddress cannot be Zero\");\n xvs = IBEP20(_xvsAddress);\n\n require(_conversionRatio > 0, \"conversionRatio cannot be Zero\");\n conversionRatio = _conversionRatio;\n\n require(_conversionStartTime >= block.timestamp, \"conversionStartTime must be time in the future\");\n require(_conversionPeriod > 0, \"_conversionPeriod is invalid\");\n\n conversionStartTime = _conversionStartTime;\n conversionPeriod = _conversionPeriod;\n conversionEndTime = conversionStartTime.add(conversionPeriod);\n emit ConversionInfoSet(conversionRatio, conversionStartTime, conversionPeriod, conversionEndTime);\n\n totalVrtConverted = 0;\n _notEntered = true;\n initialized = true;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant() {\n require(_notEntered, \"re-entered\");\n _notEntered = false;\n _;\n _notEntered = true; // get a gas-refund post-Istanbul\n }\n\n /**\n * @notice sets XVSVestingProxy Address\n * @dev Note: If XVSVestingProxy is not set, then Conversion is not allowed\n * @param _xvsVestingAddress The XVSVestingProxy Address\n */\n function setXVSVesting(address _xvsVestingAddress) public {\n require(msg.sender == admin, \"only admin may initialize the Vault\");\n require(_xvsVestingAddress != address(0), \"xvsVestingAddress cannot be Zero\");\n xvsVesting = IXVSVesting(_xvsVestingAddress);\n emit XVSVestingSet(_xvsVestingAddress);\n }\n\n modifier isInitialized() {\n require(initialized == true, \"VRTConverter is not initialized\");\n _;\n }\n\n function isConversionActive() public view returns (bool) {\n uint256 currentTime = block.timestamp;\n if (currentTime >= conversionStartTime && currentTime <= conversionEndTime) {\n return true;\n }\n return false;\n }\n\n modifier checkForActiveConversionPeriod() {\n uint256 currentTime = block.timestamp;\n require(currentTime >= conversionStartTime, \"Conversion did not start yet\");\n require(currentTime <= conversionEndTime, \"Conversion Period Ended\");\n _;\n }\n\n modifier onlyAdmin() {\n require(msg.sender == admin, \"only admin can\");\n _;\n }\n\n modifier nonZeroAddress(address _address) {\n require(_address != address(0), \"Address cannot be Zero\");\n _;\n }\n\n /**\n * @notice Transfer VRT and redeem XVS\n * @dev Note: If there is not enough XVS, we do not perform the conversion.\n * @param vrtAmount The amount of VRT\n */\n function convert(uint256 vrtAmount) external isInitialized checkForActiveConversionPeriod nonReentrant {\n require(\n address(xvsVesting) != address(0) && address(xvsVesting) != DEAD_ADDRESS,\n \"XVS-Vesting Address is not set\"\n );\n require(vrtAmount > 0, \"VRT amount must be non-zero\");\n totalVrtConverted = totalVrtConverted.add(vrtAmount);\n\n uint256 redeemAmount = vrtAmount.mul(conversionRatio).mul(xvsDecimalsMultiplier).div(1e18).div(\n vrtDecimalsMultiplier\n );\n\n emit TokenConverted(msg.sender, address(vrt), vrtAmount, address(xvs), redeemAmount);\n vrt.safeTransferFrom(msg.sender, DEAD_ADDRESS, vrtAmount);\n xvsVesting.deposit(msg.sender, redeemAmount);\n }\n\n /*** Admin Functions ***/\n function _become(VRTConverterProxy vrtConverterProxy) public {\n require(msg.sender == vrtConverterProxy.admin(), \"only proxy admin can change brains\");\n vrtConverterProxy._acceptImplementation();\n }\n}\n" + }, + "contracts/Tokens/VRT/VRTConverterProxy.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./VRTConverterStorage.sol\";\n\ncontract VRTConverterProxy is VRTConverterAdminStorage {\n /**\n * @notice Emitted when pendingImplementation is changed\n */\n event NewPendingImplementation(address oldPendingImplementation, address newPendingImplementation);\n\n /**\n * @notice Emitted when pendingImplementation is accepted, which means VRTConverter 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(\n address implementation_,\n address _vrtAddress,\n address _xvsAddress,\n uint256 _conversionRatio,\n uint256 _conversionStartTime,\n uint256 _conversionPeriod\n ) public nonZeroAddress(implementation_) nonZeroAddress(_vrtAddress) nonZeroAddress(_xvsAddress) {\n // Creator of the contract is admin during initialization\n admin = msg.sender;\n\n // New implementations always get set via the settor (post-initialize)\n _setImplementation(implementation_);\n\n // First delegate gets to initialize the delegator (i.e. storage contract)\n delegateTo(\n implementation_,\n abi.encodeWithSignature(\n \"initialize(address,address,uint256,uint256,uint256)\",\n _vrtAddress,\n _xvsAddress,\n _conversionRatio,\n _conversionStartTime,\n _conversionPeriod\n )\n );\n }\n\n modifier nonZeroAddress(address _address) {\n require(_address != address(0), \"Address cannot be Zero\");\n _;\n }\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n */\n function _setImplementation(address implementation_) public {\n require(msg.sender == admin, \"VRTConverterProxy::_setImplementation: admin only\");\n require(implementation_ != address(0), \"VRTConverterProxy::_setImplementation: invalid implementation address\");\n\n address oldImplementation = implementation;\n implementation = implementation_;\n\n emit NewImplementation(oldImplementation, implementation);\n }\n\n /**\n * @notice Internal method to delegate execution to another contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n * @param callee The contract to delegatecall\n * @param data The raw data to delegatecall\n * @return The returned bytes from the delegatecall\n */\n function delegateTo(address callee, bytes memory data) internal nonZeroAddress(callee) returns (bytes memory) {\n (bool success, bytes memory returnData) = callee.delegatecall(data);\n assembly {\n if eq(success, 0) {\n revert(add(returnData, 0x20), returndatasize)\n }\n }\n return returnData;\n }\n\n /*** Admin Functions ***/\n function _setPendingImplementation(\n address newPendingImplementation\n ) public nonZeroAddress(newPendingImplementation) {\n require(msg.sender == admin, \"Only admin can set Pending Implementation\");\n\n address oldPendingImplementation = pendingImplementation;\n\n pendingImplementation = newPendingImplementation;\n\n emit NewPendingImplementation(oldPendingImplementation, pendingImplementation);\n }\n\n /**\n * @notice Accepts new implementation of VRTConverter. msg.sender must be pendingImplementation\n * @dev Admin function for new implementation to accept it's role as implementation\n * @dev return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _acceptImplementation() public {\n // Check caller is pendingImplementation\n require(\n msg.sender == pendingImplementation,\n \"only address marked as pendingImplementation can accept Implementation\"\n );\n\n // Save current values for inclusion in log\n address oldImplementation = implementation;\n address oldPendingImplementation = pendingImplementation;\n\n implementation = pendingImplementation;\n\n pendingImplementation = address(0);\n\n emit NewImplementation(oldImplementation, implementation);\n emit NewPendingImplementation(oldPendingImplementation, pendingImplementation);\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 * @dev return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _setPendingAdmin(address newPendingAdmin) public nonZeroAddress(newPendingAdmin) {\n // Check caller = admin\n require(msg.sender == admin, \"only admin can set pending admin\");\n require(newPendingAdmin != pendingAdmin, \"New pendingAdmin can not be same as the previous one\");\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\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 * @dev return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _acceptAdmin() public {\n // Check caller is pendingAdmin\n require(msg.sender == pendingAdmin, \"only address marked as pendingAdmin can accept as Admin\");\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\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" + }, + "contracts/Tokens/VRT/VRTConverterStorage.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../../Utils/SafeMath.sol\";\nimport \"../../Utils/IBEP20.sol\";\nimport \"../XVS/IXVSVesting.sol\";\n\ncontract VRTConverterAdminStorage {\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 VRTConverter\n */\n address public implementation;\n\n /**\n * @notice Pending brains of VRTConverter\n */\n address public pendingImplementation;\n}\n\ncontract VRTConverterStorage is VRTConverterAdminStorage {\n /// @notice Guard variable for re-entrancy checks\n bool public _notEntered;\n\n /// @notice indicator to check if the contract is initialized\n bool public initialized;\n\n /// @notice The VRT TOKEN!\n IBEP20 public vrt;\n\n /// @notice The XVS TOKEN!\n IBEP20 public xvs;\n\n /// @notice XVSVesting Contract reference\n IXVSVesting public xvsVesting;\n\n /// @notice Conversion ratio from VRT to XVS with decimal 18\n uint256 public conversionRatio;\n\n /// @notice total VRT converted to XVS\n uint256 public totalVrtConverted;\n\n /// @notice Conversion Start time in EpochSeconds\n uint256 public conversionStartTime;\n\n /// @notice ConversionPeriod in Seconds\n uint256 public conversionPeriod;\n\n /// @notice Conversion End time in EpochSeconds\n uint256 public conversionEndTime;\n}\n" + }, + "contracts/Tokens/VTokens/legacy/VBep20DelegateR1.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../VTokenInterfaces.sol\";\nimport { VBep20R1 } from \"./VBep20R1.sol\";\nimport { VDelegateInterface } from \"./VTokenInterfaceR1.sol\";\n\n/**\n * @title Venus's VBep20Delegate Contract\n * @notice VTokens which wrap an EIP-20 underlying and are delegated to\n * @author Venus\n */\ncontract VBep20DelegateR1 is VBep20R1, VDelegateInterface {\n /**\n * @notice Construct an empty delegate\n */\n constructor() public {}\n\n /**\n * @notice Called by the delegator on a delegate to initialize it for duty\n * @param data The encoded bytes data for any initialization\n */\n function _becomeImplementation(bytes memory data) public {\n // Shh -- currently unused\n data;\n\n // Shh -- we don't ever want this hook to be marked pure\n if (false) {\n implementation = address(0);\n }\n\n require(msg.sender == admin, \"only the admin may call _becomeImplementation\");\n }\n\n /**\n * @notice Called by the delegator on a delegate to forfeit its responsibility\n */\n function _resignImplementation() public {\n // Shh -- we don't ever want this hook to be marked pure\n if (false) {\n implementation = address(0);\n }\n\n require(msg.sender == admin, \"only the admin may call _resignImplementation\");\n }\n}\n" + }, + "contracts/Tokens/VTokens/legacy/VBep20DelegatorR1.sol": { + "content": "pragma solidity ^0.5.16;\nimport \"../VTokenInterfaces.sol\";\nimport \"./VTokenInterfaceR1.sol\";\n\n/**\n * @title Venus's VBep20Delegator Contract\n * @notice vTokens which wrap an EIP-20 underlying and delegate to an implementation\n * @author Venus\n */\ncontract VBep20DelegatorR1 is VTokenInterfaceR1, VBep20Interface, VDelegatorInterface {\n /**\n * @notice Construct a new money market\n * @param underlying_ The address of the underlying asset\n * @param comptroller_ The address of the comptroller\n * @param interestRateModel_ The address of the interest rate model\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\n * @param name_ BEP-20 name of this token\n * @param symbol_ BEP-20 symbol of this token\n * @param decimals_ BEP-20 decimal precision of this token\n * @param admin_ Address of the administrator of this token\n * @param implementation_ The address of the implementation the contract delegates to\n * @param becomeImplementationData The encoded args for becomeImplementation\n */\n constructor(\n address underlying_,\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n address payable admin_,\n address implementation_,\n bytes memory becomeImplementationData\n ) public {\n // Creator of the contract is admin during initialization\n admin = msg.sender;\n\n // First delegate gets to initialize the delegator (i.e. storage contract)\n delegateTo(\n implementation_,\n abi.encodeWithSignature(\n \"initialize(address,address,address,uint256,string,string,uint8)\",\n underlying_,\n comptroller_,\n interestRateModel_,\n initialExchangeRateMantissa_,\n name_,\n symbol_,\n decimals_\n )\n );\n\n // New implementations always get set via the settor (post-initialize)\n _setImplementation(implementation_, false, becomeImplementationData);\n\n // Set the proper admin now that initialization is done\n admin = admin_;\n }\n\n /**\n * @notice Delegates execution to an implementation contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n */\n function() external payable {\n require(msg.value == 0, \"VBep20Delegator:fallback: cannot send value to fallback\");\n\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 /**\n * @notice Sender supplies assets into the market and receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function mint(uint mintAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"mint(uint256)\", mintAmount));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Sender supplies assets into the market and receiver receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function mintBehalf(address receiver, uint mintAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"mintBehalf(address,uint256)\", receiver, mintAmount)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of vTokens to redeem into underlying asset\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function redeem(uint redeemTokens) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"redeem(uint256)\", redeemTokens));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to redeem\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function redeemUnderlying(uint redeemAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"redeemUnderlying(uint256)\", redeemAmount)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function borrow(uint borrowAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"borrow(uint256)\", borrowAmount));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function repayBorrow(uint repayAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"repayBorrow(uint256)\", repayAmount));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Sender repays a borrow belonging to another borrower\n * @param borrower The account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"repayBorrowBehalf(address,uint256)\", borrower, repayAmount)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this vToken to be liquidated\n * @param vTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function liquidateBorrow(\n address borrower,\n uint repayAmount,\n VTokenInterface vTokenCollateral\n ) external returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"liquidateBorrow(address,uint256,address)\", borrower, repayAmount, vTokenCollateral)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(address dst, uint amount) external returns (bool) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"transfer(address,uint256)\", dst, amount));\n return abi.decode(data, (bool));\n }\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(address src, address dst, uint256 amount) external returns (bool) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", src, dst, amount)\n );\n return abi.decode(data, (bool));\n }\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved (-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(address spender, uint256 amount) external returns (bool) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"approve(address,uint256)\", spender, amount)\n );\n return abi.decode(data, (bool));\n }\n\n /**\n * @notice Get the underlying balance of the `owner`\n * @dev This also accrues interest in a transaction\n * @param owner The address of the account to query\n * @return The amount of underlying owned by `owner`\n */\n function balanceOfUnderlying(address owner) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"balanceOfUnderlying(address)\", owner));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Returns the current total borrows plus accrued interest\n * @return The total borrows with interest\n */\n function totalBorrowsCurrent() external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"totalBorrowsCurrent()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex\n * @param account The address whose balance should be calculated after updating borrowIndex\n * @return The calculated balance\n */\n function borrowBalanceCurrent(address account) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"borrowBalanceCurrent(address)\", account));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Will fail unless called by another vToken during the process of liquidation.\n * It's absolutely critical to use msg.sender as the borrowed vToken and not a parameter.\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of vTokens to seize\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function seize(address liquidator, address borrower, uint seizeTokens) external returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"seize(address,address,uint256)\", liquidator, borrower, seizeTokens)\n );\n return abi.decode(data, (uint));\n }\n\n /*** Admin Functions ***/\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _setPendingAdmin(address payable newPendingAdmin) external returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"_setPendingAdmin(address)\", newPendingAdmin)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh\n * @dev Admin function to accrue interest and set a new reserve factor\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _setReserveFactor(uint newReserveFactorMantissa) external returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"_setReserveFactor(uint256)\", newReserveFactorMantissa)\n );\n return abi.decode(data, (uint));\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _acceptAdmin() external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"_acceptAdmin()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Accrues interest and adds reserves by transferring from admin\n * @param addAmount Amount of reserves to add\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _addReserves(uint addAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"_addReserves(uint256)\", addAmount));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Accrues interest and reduces reserves by transferring to admin\n * @param reduceAmount Amount of reduction to reserves\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _reduceReserves(uint reduceAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"_reduceReserves(uint256)\", reduceAmount));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Get cash balance of this vToken in the underlying asset\n * @return The quantity of underlying asset owned by this contract\n */\n function getCash() external view returns (uint) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"getCash()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return The number of tokens allowed to be spent (-1 means infinite)\n */\n function allowance(address owner, address spender) external view returns (uint) {\n bytes memory data = delegateToViewImplementation(\n abi.encodeWithSignature(\"allowance(address,address)\", owner, spender)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Get the token balance of the `owner`\n * @param owner The address of the account to query\n * @return The number of tokens owned by `owner`\n */\n function balanceOf(address owner) external view returns (uint) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"balanceOf(address)\", owner));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Get a snapshot of the account's balances and the cached exchange rate\n * @dev This is used by comptroller to more efficiently perform liquidity checks.\n * @param account Address of the account to snapshot\n * @return (possible error, token balance, borrow balance, exchange rate mantissa)\n */\n function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) {\n bytes memory data = delegateToViewImplementation(\n abi.encodeWithSignature(\"getAccountSnapshot(address)\", account)\n );\n return abi.decode(data, (uint, uint, uint, uint));\n }\n\n /**\n * @notice Returns the current per-block borrow interest rate for this vToken\n * @return The borrow interest rate per block, scaled by 1e18\n */\n function borrowRatePerBlock() external view returns (uint) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"borrowRatePerBlock()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Returns the current per-block supply interest rate for this vToken\n * @return The supply interest rate per block, scaled by 1e18\n */\n function supplyRatePerBlock() external view returns (uint) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"supplyRatePerBlock()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param allowResign Flag to indicate whether to call _resignImplementation on the old implementation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n // @custom:access Only callable by admin\n function _setImplementation(\n address implementation_,\n bool allowResign,\n bytes memory becomeImplementationData\n ) public {\n require(msg.sender == admin, \"VBep20Delegator::_setImplementation: Caller must be admin\");\n\n if (allowResign) {\n delegateToImplementation(abi.encodeWithSignature(\"_resignImplementation()\"));\n }\n\n address oldImplementation = implementation;\n implementation = implementation_;\n\n delegateToImplementation(abi.encodeWithSignature(\"_becomeImplementation(bytes)\", becomeImplementationData));\n\n emit NewImplementation(oldImplementation, implementation);\n }\n\n /**\n * @notice Accrue interest then return the up-to-date exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateCurrent() public returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"exchangeRateCurrent()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Applies accrued interest to total borrows and reserves.\n * @dev This calculates interest accrued from the last checkpointed block\n * up to the current block and writes new checkpoint to storage.\n */\n function accrueInterest() public returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"accrueInterest()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Sets a new comptroller for the market\n * @dev Admin function to set a new comptroller\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"_setComptroller(address)\", newComptroller)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Accrues interest and updates the interest rate model using `_setInterestRateModelFresh`\n * @dev Admin function to accrue interest and update the interest rate model\n * @param newInterestRateModel The new interest rate model to use\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _setInterestRateModel(InterestRateModel newInterestRateModel) public returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"_setInterestRateModel(address)\", newInterestRateModel)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Delegates execution to the implementation contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n * @param data The raw data to delegatecall\n * @return The returned bytes from the delegatecall\n */\n function delegateToImplementation(bytes memory data) public returns (bytes memory) {\n return delegateTo(implementation, data);\n }\n\n /**\n * @notice Delegates execution to an implementation contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n * There are an additional 2 prefix uints from the wrapper returndata, which we ignore since we make an extra hop.\n * @param data The raw data to delegatecall\n * @return The returned bytes from the delegatecall\n */\n function delegateToViewImplementation(bytes memory data) public view returns (bytes memory) {\n (bool success, bytes memory returnData) = address(this).staticcall(\n abi.encodeWithSignature(\"delegateToImplementation(bytes)\", data)\n );\n assembly {\n if eq(success, 0) {\n revert(add(returnData, 0x20), returndatasize)\n }\n }\n return abi.decode(returnData, (bytes));\n }\n\n /**\n * @notice Return the borrow balance of account based on stored data\n * @param account The address whose balance should be calculated\n * @return The calculated balance\n */\n function borrowBalanceStored(address account) public view returns (uint) {\n bytes memory data = delegateToViewImplementation(\n abi.encodeWithSignature(\"borrowBalanceStored(address)\", account)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Calculates the exchange rate from the underlying to the VToken\n * @dev This function does not accrue interest before calculating the exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateStored() public view returns (uint) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"exchangeRateStored()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Internal method to delegate execution to another contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n * @param callee The contract to delegatecall\n * @param data The raw data to delegatecall\n * @return The returned bytes from the delegatecall\n */\n function delegateTo(address callee, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returnData) = callee.delegatecall(data);\n assembly {\n if eq(success, 0) {\n revert(add(returnData, 0x20), returndatasize)\n }\n }\n return returnData;\n }\n}\n" + }, + "contracts/Tokens/VTokens/legacy/VBep20R1.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport { VTokenR1, VBep20Interface, ComptrollerInterface, InterestRateModel, VTokenInterface } from \"./VTokenR1.sol\";\nimport { EIP20Interface } from \"../../EIP20Interface.sol\";\nimport { EIP20NonStandardInterface } from \"../../EIP20NonStandardInterface.sol\";\n\n/**\n * @title Venus's VBep20 Contract\n * @notice vTokens which wrap an EIP-20 underlying\n * @author Venus\n */\ncontract VBep20R1 is VTokenR1, VBep20Interface {\n /*** User Interface ***/\n\n /**\n * @notice Sender supplies assets into the market and receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Transfer event\n // @custom:event Emits Mint event\n function mint(uint mintAmount) external returns (uint) {\n (uint err, ) = mintInternal(mintAmount);\n return err;\n }\n\n /**\n * @notice Sender supplies assets into the market and receiver receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param receiver The account which is receiving the vTokens\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Transfer event\n // @custom:event Emits MintBehalf event\n function mintBehalf(address receiver, uint mintAmount) external returns (uint) {\n (uint err, ) = mintBehalfInternal(receiver, mintAmount);\n return err;\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of vTokens to redeem into underlying\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Redeem event on success\n // @custom:event Emits Transfer event on success\n // @custom:event Emits RedeemFee when fee is charged by the treasury\n function redeem(uint redeemTokens) external returns (uint) {\n return redeemInternal(msg.sender, msg.sender, redeemTokens);\n }\n\n /**\n * @notice Sender redeems assets on behalf of some other address. This function is only available\n * for senders, explicitly marked as delegates of the supplier using `comptroller.updateDelegate`\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemer The user on behalf of whom to redeem\n * @param redeemTokens The number of vTokens to redeem into underlying\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Redeem event on success\n // @custom:event Emits Transfer event on success\n // @custom:event Emits RedeemFee when fee is charged by the treasury\n function redeemBehalf(address redeemer, uint redeemTokens) external returns (uint) {\n require(comptroller.approvedDelegates(redeemer, msg.sender), \"not an approved delegate\");\n\n return redeemInternal(redeemer, msg.sender, redeemTokens);\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to redeem\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Redeem event on success\n // @custom:event Emits Transfer event on success\n // @custom:event Emits RedeemFee when fee is charged by the treasury\n function redeemUnderlying(uint redeemAmount) external returns (uint) {\n return redeemUnderlyingInternal(msg.sender, msg.sender, redeemAmount);\n }\n\n /**\n * @notice Sender redeems underlying assets on behalf of some other address. This function is only available\n * for senders, explicitly marked as delegates of the supplier using `comptroller.updateDelegate`\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemer, on behalf of whom to redeem\n * @param redeemAmount The amount of underlying to receive from redeeming vTokens\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Redeem event on success\n // @custom:event Emits Transfer event on success\n // @custom:event Emits RedeemFee when fee is charged by the treasury\n function redeemUnderlyingBehalf(address redeemer, uint redeemAmount) external returns (uint) {\n require(comptroller.approvedDelegates(redeemer, msg.sender), \"not an approved delegate\");\n\n return redeemUnderlyingInternal(redeemer, msg.sender, redeemAmount);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Borrow event on success\n function borrow(uint borrowAmount) external returns (uint) {\n return borrowInternal(msg.sender, msg.sender, borrowAmount);\n }\n\n /**\n * @notice Sender borrows assets on behalf of some other address. This function is only available\n * for senders, explicitly marked as delegates of the borrower using `comptroller.updateDelegate`\n * @param borrower The borrower, on behalf of whom to borrow.\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Borrow event on success\n function borrowBehalf(address borrower, uint borrowAmount) external returns (uint) {\n require(comptroller.approvedDelegates(borrower, msg.sender), \"not an approved delegate\");\n return borrowInternal(borrower, msg.sender, borrowAmount);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits RepayBorrow event on success\n function repayBorrow(uint repayAmount) external returns (uint) {\n (uint err, ) = repayBorrowInternal(repayAmount);\n return err;\n }\n\n /**\n * @notice Sender repays a borrow belonging to another borrowing account\n * @param borrower The account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits RepayBorrow event on success\n function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint) {\n (uint err, ) = repayBorrowBehalfInternal(borrower, repayAmount);\n return err;\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this vToken to be liquidated\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @param vTokenCollateral The market in which to seize collateral from the borrower\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emit LiquidateBorrow event on success\n function liquidateBorrow(\n address borrower,\n uint repayAmount,\n VTokenInterface vTokenCollateral\n ) external returns (uint) {\n (uint err, ) = liquidateBorrowInternal(borrower, repayAmount, vTokenCollateral);\n return err;\n }\n\n /**\n * @notice The sender adds to reserves.\n * @param addAmount The amount of underlying tokens to add as reserves\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits ReservesAdded event\n function _addReserves(uint addAmount) external returns (uint) {\n return _addReservesInternal(addAmount);\n }\n\n /**\n * @notice Initialize the new money market\n * @param underlying_ The address of the underlying asset\n * @param comptroller_ The address of the Comptroller\n * @param interestRateModel_ The address of the interest rate model\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\n * @param name_ BEP-20 name of this token\n * @param symbol_ BEP-20 symbol of this token\n * @param decimals_ BEP-20 decimal precision of this token\n */\n function initialize(\n address underlying_,\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_\n ) public {\n // VToken initialize does the bulk of the work\n super.initialize(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);\n\n // Set underlying and sanity check it\n underlying = underlying_;\n EIP20Interface(underlying).totalSupply();\n }\n\n /*** Safe Token ***/\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case.\n * This will revert due to insufficient balance or insufficient allowance.\n * This function returns the actual amount received,\n * which may be less than `amount` if there is a fee attached to the transfer.\n *\n * Note: This wrapper safely handles non-standard BEP-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferIn(address from, uint amount) internal returns (uint) {\n uint balanceBefore = EIP20Interface(underlying).balanceOf(address(this));\n EIP20NonStandardInterface(underlying).transferFrom(from, address(this), amount);\n\n bool success;\n assembly {\n switch returndatasize()\n case 0 {\n // This is a non-standard BEP-20\n success := not(0) // set success to true\n }\n case 32 {\n // This is a compliant BEP-20\n returndatacopy(0, 0, 32)\n success := mload(0) // Set `success = returndata` of external call\n }\n default {\n // This is an excessively non-compliant BEP-20, revert.\n revert(0, 0)\n }\n }\n require(success, \"TOKEN_TRANSFER_IN_FAILED\");\n\n // Calculate the amount that was *actually* transferred\n uint balanceAfter = EIP20Interface(underlying).balanceOf(address(this));\n require(balanceAfter >= balanceBefore, \"TOKEN_TRANSFER_IN_OVERFLOW\");\n return balanceAfter - balanceBefore; // underflow already checked above, just subtract\n }\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory\n * error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to\n * insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, and verified\n * it is >= amount, this should not revert in normal conditions.\n *\n * Note: This wrapper safely handles non-standard BEP-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferOut(address payable to, uint amount) internal {\n EIP20NonStandardInterface(underlying).transfer(to, amount);\n\n bool success;\n assembly {\n switch returndatasize()\n case 0 {\n // This is a non-standard BEP-20\n success := not(0) // set success to true\n }\n case 32 {\n // This is a compliant BEP-20\n returndatacopy(0, 0, 32)\n success := mload(0) // Set `success = returndata` of external call\n }\n default {\n // This is an excessively non-compliant BEP-20, revert.\n revert(0, 0)\n }\n }\n require(success, \"TOKEN_TRANSFER_OUT_FAILED\");\n }\n\n /**\n * @notice Gets balance of this contract in terms of the underlying\n * @dev This excludes the value of the current message, if any\n * @return The quantity of underlying tokens owned by this contract\n */\n function getCashPrior() internal view returns (uint) {\n return EIP20Interface(underlying).balanceOf(address(this));\n }\n}\n" + }, + "contracts/Tokens/VTokens/legacy/VTokenInterfaceR1.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../../../Comptroller/ComptrollerInterface.sol\";\nimport \"../../../InterestRateModels/InterestRateModel.sol\";\nimport \"../VTokenInterfaces.sol\";\n\ncontract VTokenInterfaceR1 is VTokenStorage {\n /**\n * @notice Indicator that this is a vToken contract (for inspection)\n */\n bool public constant isVToken = true;\n\n /*** Market Events ***/\n\n /**\n * @notice Event emitted when interest is accrued\n */\n event AccrueInterest(uint cashPrior, uint interestAccumulated, uint borrowIndex, uint totalBorrows);\n\n /**\n * @notice Event emitted when tokens are minted\n */\n event Mint(address minter, uint mintAmount, uint mintTokens);\n\n /**\n * @notice Event emitted when tokens are minted behalf by payer to receiver\n */\n event MintBehalf(address payer, address receiver, uint mintAmount, uint mintTokens);\n\n /**\n * @notice Event emitted when tokens are redeemed\n */\n event Redeem(address redeemer, uint redeemAmount, uint redeemTokens);\n\n /**\n * @notice Event emitted when tokens are redeemed and fee is transferred\n */\n event RedeemFee(address redeemer, uint feeAmount, uint redeemTokens);\n\n /**\n * @notice Event emitted when underlying is borrowed\n */\n event Borrow(address borrower, uint borrowAmount, uint accountBorrows, uint totalBorrows);\n\n /**\n * @notice Event emitted when a borrow is repaid\n */\n event RepayBorrow(address payer, address borrower, uint repayAmount, uint accountBorrows, uint totalBorrows);\n\n /**\n * @notice Event emitted when a borrow is liquidated\n */\n event LiquidateBorrow(\n address liquidator,\n address borrower,\n uint repayAmount,\n address vTokenCollateral,\n uint seizeTokens\n );\n\n /*** Admin Events ***/\n\n /**\n * @notice Event emitted when pendingAdmin is changed\n */\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\n\n /**\n * @notice Event emitted when pendingAdmin is accepted, which means admin has been updated\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n /**\n * @notice Event emitted when comptroller is changed\n */\n event NewComptroller(ComptrollerInterface oldComptroller, ComptrollerInterface newComptroller);\n\n /**\n * @notice Event emitted when interestRateModel is changed\n */\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\n\n /**\n * @notice Event emitted when the reserve factor is changed\n */\n event NewReserveFactor(uint oldReserveFactorMantissa, uint newReserveFactorMantissa);\n\n /**\n * @notice Event emitted when the reserves are added\n */\n event ReservesAdded(address benefactor, uint addAmount, uint newTotalReserves);\n\n /**\n * @notice Event emitted when the reserves are reduced\n */\n event ReservesReduced(address protocolShareReserve, uint reduceAmount, uint newTotalReserves);\n\n /**\n * @notice EIP20 Transfer event\n */\n event Transfer(address indexed from, address indexed to, uint amount);\n\n /**\n * @notice EIP20 Approval event\n */\n event Approval(address indexed owner, address indexed spender, uint amount);\n\n /**\n * @notice Event emitted when block delta for reduce reserves get updated\n */\n event NewReduceReservesBlockDelta(uint256 oldReduceReservesBlockDelta, uint256 newReduceReservesBlockDelta);\n\n /**\n * @notice Event emitted when address of ProtocolShareReserve contract get updated\n */\n event NewProtocolShareReserve(address indexed oldProtocolShareReserve, address indexed newProtocolShareReserve);\n\n /**\n * @notice Failure event\n */\n event Failure(uint error, uint info, uint detail);\n\n /// @notice Emitted when access control address is changed by admin\n event NewAccessControlManager(address oldAccessControlAddress, address newAccessControlAddress);\n\n /*** User Interface ***/\n\n function transfer(address dst, uint amount) external returns (bool);\n\n function transferFrom(address src, address dst, uint amount) external returns (bool);\n\n function approve(address spender, uint amount) external returns (bool);\n\n function balanceOfUnderlying(address owner) external returns (uint);\n\n function totalBorrowsCurrent() external returns (uint);\n\n function borrowBalanceCurrent(address account) external returns (uint);\n\n function seize(address liquidator, address borrower, uint seizeTokens) external returns (uint);\n\n /*** Admin Function ***/\n function _setPendingAdmin(address payable newPendingAdmin) external returns (uint);\n\n /*** Admin Function ***/\n function _acceptAdmin() external returns (uint);\n\n /*** Admin Function ***/\n function _setReserveFactor(uint newReserveFactorMantissa) external returns (uint);\n\n /*** Admin Function ***/\n function _reduceReserves(uint reduceAmount) external returns (uint);\n\n function balanceOf(address owner) external view returns (uint);\n\n function allowance(address owner, address spender) external view returns (uint);\n\n function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint);\n\n function borrowRatePerBlock() external view returns (uint);\n\n function supplyRatePerBlock() external view returns (uint);\n\n function getCash() external view returns (uint);\n\n function exchangeRateCurrent() public returns (uint);\n\n function accrueInterest() public returns (uint);\n\n /*** Admin Function ***/\n function _setComptroller(ComptrollerInterface newComptroller) public returns (uint);\n\n /*** Admin Function ***/\n function _setInterestRateModel(InterestRateModel newInterestRateModel) public returns (uint);\n\n function borrowBalanceStored(address account) public view returns (uint);\n\n function exchangeRateStored() public view returns (uint);\n}\n" + }, + "contracts/Tokens/VTokens/legacy/VTokenR1.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../../../Comptroller/ComptrollerInterface.sol\";\nimport \"../../../Utils/ErrorReporter.sol\";\nimport \"../../../Utils/Exponential.sol\";\nimport \"../../../Tokens/EIP20Interface.sol\";\nimport \"../../../Tokens/EIP20NonStandardInterface.sol\";\nimport \"../../../InterestRateModels/InterestRateModel.sol\";\nimport \"../VTokenInterfaces.sol\";\nimport { VTokenInterfaceR1 } from \"./VTokenInterfaceR1.sol\";\nimport { IAccessControlManagerV5 } from \"@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV5.sol\";\n\n/**\n * @title Venus's vToken Contract\n * @notice Abstract base for vTokens\n * @author Venus\n */\ncontract VTokenR1 is VTokenInterfaceR1, Exponential, TokenErrorReporter {\n struct MintLocalVars {\n MathError mathErr;\n uint exchangeRateMantissa;\n uint mintTokens;\n uint totalSupplyNew;\n uint accountTokensNew;\n uint actualMintAmount;\n }\n\n struct RedeemLocalVars {\n MathError mathErr;\n uint exchangeRateMantissa;\n uint redeemTokens;\n uint redeemAmount;\n uint totalSupplyNew;\n uint accountTokensNew;\n }\n\n struct BorrowLocalVars {\n MathError mathErr;\n uint accountBorrows;\n uint accountBorrowsNew;\n uint totalBorrowsNew;\n }\n\n struct RepayBorrowLocalVars {\n Error err;\n MathError mathErr;\n uint repayAmount;\n uint borrowerIndex;\n uint accountBorrows;\n uint accountBorrowsNew;\n uint totalBorrowsNew;\n uint actualRepayAmount;\n }\n\n /*** Reentrancy Guard ***/\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant() {\n require(_notEntered, \"re-entered\");\n _notEntered = false;\n _;\n _notEntered = true; // get a gas-refund post-Istanbul\n }\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n // @custom:event Emits Transfer event\n function transfer(address dst, uint256 amount) external nonReentrant returns (bool) {\n return transferTokens(msg.sender, msg.sender, dst, amount) == uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n // @custom:event Emits Transfer event\n function transferFrom(address src, address dst, uint256 amount) external nonReentrant returns (bool) {\n return transferTokens(msg.sender, src, dst, amount) == uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved (-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n // @custom:event Emits Approval event on successful approve\n function approve(address spender, uint256 amount) external returns (bool) {\n transferAllowances[msg.sender][spender] = amount;\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /**\n * @notice Get the underlying balance of the `owner`\n * @dev This also accrues interest in a transaction\n * @param owner The address of the account to query\n * @return The amount of underlying owned by `owner`\n */\n function balanceOfUnderlying(address owner) external returns (uint) {\n Exp memory exchangeRate = Exp({ mantissa: exchangeRateCurrent() });\n (MathError mErr, uint balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]);\n ensureNoMathError(mErr);\n return balance;\n }\n\n /**\n * @notice Returns the current total borrows plus accrued interest\n * @return The total borrows with interest\n */\n function totalBorrowsCurrent() external nonReentrant returns (uint) {\n require(accrueInterest() == uint(Error.NO_ERROR), \"accrue interest failed\");\n return totalBorrows;\n }\n\n /**\n * @notice Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex\n * @param account The address whose balance should be calculated after updating borrowIndex\n * @return The calculated balance\n */\n function borrowBalanceCurrent(address account) external nonReentrant returns (uint) {\n require(accrueInterest() == uint(Error.NO_ERROR), \"accrue interest failed\");\n return borrowBalanceStored(account);\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Will fail unless called by another vToken during the process of liquidation.\n * Its absolutely critical to use msg.sender as the borrowed vToken and not a parameter.\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of vTokens to seize\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Transfer event\n function seize(address liquidator, address borrower, uint seizeTokens) external nonReentrant returns (uint) {\n return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits NewPendingAdmin event with old and new admin addresses\n function _setPendingAdmin(address payable newPendingAdmin) external returns (uint) {\n // Check caller = admin\n ensureAdmin(msg.sender);\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits NewAdmin event on successful acceptance\n // @custom:event Emits NewPendingAdmin event with null new pending admin\n function _acceptAdmin() external 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 * @notice accrues interest and sets a new reserve factor for the protocol using `_setReserveFactorFresh`\n * @dev Governor function to accrue interest and set a new reserve factor\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits NewReserveFactor event\n function _setReserveFactor(uint newReserveFactorMantissa_) external nonReentrant returns (uint) {\n ensureAllowed(\"_setReserveFactor(uint256)\");\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reserve factor change failed.\n return fail(Error(error), FailureInfo.SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED);\n }\n // _setReserveFactorFresh emits reserve-factor-specific logs on errors, so we don't need to.\n return _setReserveFactorFresh(newReserveFactorMantissa_);\n }\n\n /**\n * @notice Sets the address of the access control manager of this contract\n * @dev Admin function to set the access control address\n * @param newAccessControlManagerAddress New address for the access control\n * @return uint 0=success, otherwise will revert\n */\n function setAccessControlManager(address newAccessControlManagerAddress) external returns (uint) {\n // Check caller is admin\n ensureAdmin(msg.sender);\n\n ensureNonZeroAddress(newAccessControlManagerAddress);\n\n emit NewAccessControlManager(accessControlManager, newAccessControlManagerAddress);\n accessControlManager = newAccessControlManagerAddress;\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Accrues interest and reduces reserves by transferring to protocol share reserve\n * @param reduceAmount_ Amount of reduction to reserves\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits ReservesReduced event\n function _reduceReserves(uint reduceAmount_) external nonReentrant returns (uint) {\n ensureAllowed(\"_reduceReserves(uint256)\");\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed.\n return fail(Error(error), FailureInfo.REDUCE_RESERVES_ACCRUE_INTEREST_FAILED);\n }\n\n // If reserves were reduced in accrueInterest\n if (reduceReservesBlockNumber == block.number) return (uint(Error.NO_ERROR));\n // _reduceReservesFresh emits reserve-reduction-specific logs on errors, so we don't need to.\n return _reduceReservesFresh(reduceAmount_);\n }\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return The number of tokens allowed to be spent (-1 means infinite)\n */\n function allowance(address owner, address spender) external view returns (uint256) {\n return transferAllowances[owner][spender];\n }\n\n /**\n * @notice Get the token balance of the `owner`\n * @param owner The address of the account to query\n * @return The number of tokens owned by `owner`\n */\n function balanceOf(address owner) external view returns (uint256) {\n return accountTokens[owner];\n }\n\n /**\n * @notice Get a snapshot of the account's balances, and the cached exchange rate\n * @dev This is used by comptroller to more efficiently perform liquidity checks.\n * @param account Address of the account to snapshot\n * @return (possible error, token balance, borrow balance, exchange rate mantissa)\n */\n function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) {\n uint vTokenBalance = accountTokens[account];\n uint borrowBalance;\n uint exchangeRateMantissa;\n\n MathError mErr;\n\n (mErr, borrowBalance) = borrowBalanceStoredInternal(account);\n if (mErr != MathError.NO_ERROR) {\n return (uint(Error.MATH_ERROR), 0, 0, 0);\n }\n\n (mErr, exchangeRateMantissa) = exchangeRateStoredInternal();\n if (mErr != MathError.NO_ERROR) {\n return (uint(Error.MATH_ERROR), 0, 0, 0);\n }\n\n return (uint(Error.NO_ERROR), vTokenBalance, borrowBalance, exchangeRateMantissa);\n }\n\n /**\n * @notice Returns the current per-block supply interest rate for this vToken\n * @return The supply interest rate per block, scaled by 1e18\n */\n function supplyRatePerBlock() external view returns (uint) {\n return interestRateModel.getSupplyRate(getCashPrior(), totalBorrows, totalReserves, reserveFactorMantissa);\n }\n\n /**\n * @notice Returns the current per-block borrow interest rate for this vToken\n * @return The borrow interest rate per block, scaled by 1e18\n */\n function borrowRatePerBlock() external view returns (uint) {\n return interestRateModel.getBorrowRate(getCashPrior(), totalBorrows, totalReserves);\n }\n\n /**\n * @notice Get cash balance of this vToken in the underlying asset\n * @return The quantity of underlying asset owned by this contract\n */\n function getCash() external view returns (uint) {\n return getCashPrior();\n }\n\n /**\n * @notice Governance function to set new threshold of block difference after which funds will be sent to the protocol share reserve\n * @param newReduceReservesBlockDelta_ block difference value\n */\n function setReduceReservesBlockDelta(uint256 newReduceReservesBlockDelta_) external {\n require(newReduceReservesBlockDelta_ > 0, \"Invalid Input\");\n ensureAllowed(\"setReduceReservesBlockDelta(uint256)\");\n emit NewReduceReservesBlockDelta(reduceReservesBlockDelta, newReduceReservesBlockDelta_);\n reduceReservesBlockDelta = newReduceReservesBlockDelta_;\n }\n\n /**\n * @notice Sets protocol share reserve contract address\n * @param protcolShareReserve_ The address of protocol share reserve contract\n */\n function setProtocolShareReserve(address payable protcolShareReserve_) external {\n // Check caller is admin\n ensureAdmin(msg.sender);\n ensureNonZeroAddress(protcolShareReserve_);\n emit NewProtocolShareReserve(protocolShareReserve, protcolShareReserve_);\n protocolShareReserve = protcolShareReserve_;\n }\n\n /**\n * @notice Initialize the money market\n * @param comptroller_ The address of the Comptroller\n * @param interestRateModel_ The address of the interest rate model\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\n * @param name_ EIP-20 name of this token\n * @param symbol_ EIP-20 symbol of this token\n * @param decimals_ EIP-20 decimal precision of this token\n */\n function initialize(\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_\n ) public {\n ensureAdmin(msg.sender);\n require(accrualBlockNumber == 0 && borrowIndex == 0, \"market may only be initialized once\");\n\n // Set initial exchange rate\n initialExchangeRateMantissa = initialExchangeRateMantissa_;\n require(initialExchangeRateMantissa > 0, \"initial exchange rate must be greater than zero.\");\n\n // Set the comptroller\n uint err = _setComptroller(comptroller_);\n require(err == uint(Error.NO_ERROR), \"setting comptroller failed\");\n\n // Initialize block number and borrow index (block number mocks depend on comptroller being set)\n accrualBlockNumber = block.number;\n borrowIndex = mantissaOne;\n\n // Set the interest rate model (depends on block number / borrow index)\n err = _setInterestRateModelFresh(interestRateModel_);\n require(err == uint(Error.NO_ERROR), \"setting interest rate model failed\");\n\n name = name_;\n symbol = symbol_;\n decimals = decimals_;\n\n // The counter starts true to prevent changing it from zero to non-zero (i.e. smaller cost/refund)\n _notEntered = true;\n }\n\n /**\n * @notice Accrue interest then return the up-to-date exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateCurrent() public nonReentrant returns (uint) {\n require(accrueInterest() == uint(Error.NO_ERROR), \"accrue interest failed\");\n return exchangeRateStored();\n }\n\n /**\n * @notice Applies accrued interest to total borrows and reserves\n * @dev This calculates interest accrued from the last checkpointed block\n * up to the current block and writes new checkpoint to storage and\n * reduce spread reserves to protocol share reserve\n * if currentBlock - reduceReservesBlockNumber >= blockDelta\n */\n // @custom:event Emits AccrueInterest event\n function accrueInterest() public returns (uint) {\n /* Remember the initial block number */\n uint currentBlockNumber = block.number;\n uint accrualBlockNumberPrior = accrualBlockNumber;\n\n /* Short-circuit accumulating 0 interest */\n if (accrualBlockNumberPrior == currentBlockNumber) {\n return uint(Error.NO_ERROR);\n }\n\n /* Read the previous values out of storage */\n uint cashPrior = getCashPrior();\n uint borrowsPrior = totalBorrows;\n uint reservesPrior = totalReserves;\n uint borrowIndexPrior = borrowIndex;\n\n /* Calculate the current borrow interest rate */\n uint borrowRateMantissa = interestRateModel.getBorrowRate(cashPrior, borrowsPrior, reservesPrior);\n require(borrowRateMantissa <= borrowRateMaxMantissa, \"borrow rate is absurdly high\");\n\n /* Calculate the number of blocks elapsed since the last accrual */\n (MathError mathErr, uint blockDelta) = subUInt(currentBlockNumber, accrualBlockNumberPrior);\n ensureNoMathError(mathErr);\n\n /*\n * Calculate the interest accumulated into borrows and reserves and the new index:\n * simpleInterestFactor = borrowRate * blockDelta\n * interestAccumulated = simpleInterestFactor * totalBorrows\n * totalBorrowsNew = interestAccumulated + totalBorrows\n * totalReservesNew = interestAccumulated * reserveFactor + totalReserves\n * borrowIndexNew = simpleInterestFactor * borrowIndex + borrowIndex\n */\n\n Exp memory simpleInterestFactor;\n uint interestAccumulated;\n uint totalBorrowsNew;\n uint totalReservesNew;\n uint borrowIndexNew;\n\n (mathErr, simpleInterestFactor) = mulScalar(Exp({ mantissa: borrowRateMantissa }), blockDelta);\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n (mathErr, interestAccumulated) = mulScalarTruncate(simpleInterestFactor, borrowsPrior);\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n (mathErr, totalBorrowsNew) = addUInt(interestAccumulated, borrowsPrior);\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n (mathErr, totalReservesNew) = mulScalarTruncateAddUInt(\n Exp({ mantissa: reserveFactorMantissa }),\n interestAccumulated,\n reservesPrior\n );\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n (mathErr, borrowIndexNew) = mulScalarTruncateAddUInt(simpleInterestFactor, borrowIndexPrior, borrowIndexPrior);\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n accrualBlockNumber = currentBlockNumber;\n borrowIndex = borrowIndexNew;\n totalBorrows = totalBorrowsNew;\n totalReserves = totalReservesNew;\n\n (mathErr, blockDelta) = subUInt(currentBlockNumber, reduceReservesBlockNumber);\n ensureNoMathError(mathErr);\n if (blockDelta >= reduceReservesBlockDelta) {\n reduceReservesBlockNumber = currentBlockNumber;\n if (cashPrior < totalReservesNew) {\n _reduceReservesFresh(cashPrior);\n } else {\n _reduceReservesFresh(totalReservesNew);\n }\n }\n\n /* We emit an AccrueInterest event */\n emit AccrueInterest(cashPrior, interestAccumulated, borrowIndexNew, totalBorrowsNew);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets a new comptroller for the market\n * @dev Admin function to set a new comptroller\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits NewComptroller event\n function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) {\n // Check caller is admin\n ensureAdmin(msg.sender);\n\n ComptrollerInterface oldComptroller = comptroller;\n // Ensure invoke comptroller.isComptroller() returns true\n require(newComptroller.isComptroller(), \"marker method returned false\");\n\n // Set market's comptroller to newComptroller\n comptroller = newComptroller;\n\n // Emit NewComptroller(oldComptroller, newComptroller)\n emit NewComptroller(oldComptroller, newComptroller);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Accrues interest and updates the interest rate model using _setInterestRateModelFresh\n * @dev Governance function to accrue interest and update the interest rate model\n * @param newInterestRateModel_ The new interest rate model to use\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _setInterestRateModel(InterestRateModel newInterestRateModel_) public returns (uint) {\n ensureAllowed(\"_setInterestRateModel(address)\");\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted change of interest rate model failed\n return fail(Error(error), FailureInfo.SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED);\n }\n // _setInterestRateModelFresh emits interest-rate-model-update-specific logs on errors, so we don't need to.\n return _setInterestRateModelFresh(newInterestRateModel_);\n }\n\n /**\n * @notice Calculates the exchange rate from the underlying to the VToken\n * @dev This function does not accrue interest before calculating the exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateStored() public view returns (uint) {\n (MathError err, uint result) = exchangeRateStoredInternal();\n ensureNoMathError(err);\n return result;\n }\n\n /**\n * @notice Return the borrow balance of account based on stored data\n * @param account The address whose balance should be calculated\n * @return The calculated balance\n */\n function borrowBalanceStored(address account) public view returns (uint) {\n (MathError err, uint result) = borrowBalanceStoredInternal(account);\n ensureNoMathError(err);\n return result;\n }\n\n /**\n * @notice Transfers `tokens` tokens from `src` to `dst` by `spender`\n * @dev Called by both `transfer` and `transferFrom` internally\n * @param spender The address of the account performing the transfer\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param tokens The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferTokens(address spender, address src, address dst, uint tokens) internal returns (uint) {\n /* Fail if transfer not allowed */\n uint allowed = comptroller.transferAllowed(address(this), src, dst, tokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.TRANSFER_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Do not allow self-transfers */\n if (src == dst) {\n return fail(Error.BAD_INPUT, FailureInfo.TRANSFER_NOT_ALLOWED);\n }\n\n /* Get the allowance, infinite for the account owner */\n uint startingAllowance = 0;\n if (spender == src) {\n startingAllowance = uint(-1);\n } else {\n startingAllowance = transferAllowances[src][spender];\n }\n\n /* Do the calculations, checking for {under,over}flow */\n MathError mathErr;\n uint allowanceNew;\n uint srvTokensNew;\n uint dstTokensNew;\n\n (mathErr, allowanceNew) = subUInt(startingAllowance, tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ALLOWED);\n }\n\n (mathErr, srvTokensNew) = subUInt(accountTokens[src], tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ENOUGH);\n }\n\n (mathErr, dstTokensNew) = addUInt(accountTokens[dst], tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_TOO_MUCH);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n accountTokens[src] = srvTokensNew;\n accountTokens[dst] = dstTokensNew;\n\n /* Eat some of the allowance (if necessary) */\n if (startingAllowance != uint(-1)) {\n transferAllowances[src][spender] = allowanceNew;\n }\n\n /* We emit a Transfer event */\n emit Transfer(src, dst, tokens);\n\n comptroller.transferVerify(address(this), src, dst, tokens);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Sender supplies assets into the market and receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintInternal(uint mintAmount) internal nonReentrant returns (uint, uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted mint failed\n return (fail(Error(error), FailureInfo.MINT_ACCRUE_INTEREST_FAILED), 0);\n }\n // mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to\n return mintFresh(msg.sender, mintAmount);\n }\n\n /**\n * @notice User supplies assets into the market and receives vTokens in exchange\n * @dev Assumes interest has already been accrued up to the current block\n * @param minter The address of the account which is supplying the assets\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintFresh(address minter, uint mintAmount) internal returns (uint, uint) {\n /* Fail if mint not allowed */\n uint allowed = comptroller.mintAllowed(address(this), minter, mintAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\n }\n\n MintLocalVars memory vars;\n\n (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();\n if (vars.mathErr != MathError.NO_ERROR) {\n return (failOpaque(Error.MATH_ERROR, FailureInfo.MINT_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr)), 0);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call `doTransferIn` for the minter and the mintAmount.\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\n * side-effects occurred. The function returns the amount actually transferred,\n * in case of a fee. On success, the vToken holds an additional `actualMintAmount`\n * of cash.\n */\n vars.actualMintAmount = doTransferIn(minter, mintAmount);\n\n /*\n * We get the current exchange rate and calculate the number of vTokens to be minted:\n * mintTokens = actualMintAmount / exchangeRate\n */\n\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\n vars.actualMintAmount,\n Exp({ mantissa: vars.exchangeRateMantissa })\n );\n ensureNoMathError(vars.mathErr);\n\n /*\n * We calculate the new total supply of vTokens and minter token balance, checking for overflow:\n * totalSupplyNew = totalSupply + mintTokens\n * accountTokensNew = accountTokens[minter] + mintTokens\n */\n (vars.mathErr, vars.totalSupplyNew) = addUInt(totalSupply, vars.mintTokens);\n ensureNoMathError(vars.mathErr);\n (vars.mathErr, vars.accountTokensNew) = addUInt(accountTokens[minter], vars.mintTokens);\n ensureNoMathError(vars.mathErr);\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[minter] = vars.accountTokensNew;\n\n /* We emit a Mint event, and a Transfer event */\n emit Mint(minter, vars.actualMintAmount, vars.mintTokens);\n emit Transfer(address(this), minter, vars.mintTokens);\n\n /* We call the defense and prime accrue interest hook */\n comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);\n\n return (uint(Error.NO_ERROR), vars.actualMintAmount);\n }\n\n /**\n * @notice Sender supplies assets into the market and receiver receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param receiver The address of the account which is receiving the vTokens\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintBehalfInternal(address receiver, uint mintAmount) internal nonReentrant returns (uint, uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted mintBehalf failed\n return (fail(Error(error), FailureInfo.MINT_ACCRUE_INTEREST_FAILED), 0);\n }\n // mintBelahfFresh emits the actual Mint event if successful and logs on errors, so we don't need to\n return mintBehalfFresh(msg.sender, receiver, mintAmount);\n }\n\n /**\n * @notice Payer supplies assets into the market and receiver receives vTokens in exchange\n * @dev Assumes interest has already been accrued up to the current block\n * @param payer The address of the account which is paying the underlying token\n * @param receiver The address of the account which is receiving vToken\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintBehalfFresh(address payer, address receiver, uint mintAmount) internal returns (uint, uint) {\n ensureNonZeroAddress(receiver);\n /* Fail if mint not allowed */\n uint allowed = comptroller.mintAllowed(address(this), receiver, mintAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\n }\n\n MintLocalVars memory vars;\n\n (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();\n if (vars.mathErr != MathError.NO_ERROR) {\n return (failOpaque(Error.MATH_ERROR, FailureInfo.MINT_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr)), 0);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call `doTransferIn` for the payer and the mintAmount.\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\n * side-effects occurred. The function returns the amount actually transferred,\n * in case of a fee. On success, the vToken holds an additional `actualMintAmount`\n * of cash.\n */\n vars.actualMintAmount = doTransferIn(payer, mintAmount);\n\n /*\n * We get the current exchange rate and calculate the number of vTokens to be minted:\n * mintTokens = actualMintAmount / exchangeRate\n */\n\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\n vars.actualMintAmount,\n Exp({ mantissa: vars.exchangeRateMantissa })\n );\n ensureNoMathError(vars.mathErr);\n\n /*\n * We calculate the new total supply of vTokens and receiver token balance, checking for overflow:\n * totalSupplyNew = totalSupply + mintTokens\n * accountTokensNew = accountTokens[receiver] + mintTokens\n */\n (vars.mathErr, vars.totalSupplyNew) = addUInt(totalSupply, vars.mintTokens);\n ensureNoMathError(vars.mathErr);\n\n (vars.mathErr, vars.accountTokensNew) = addUInt(accountTokens[receiver], vars.mintTokens);\n ensureNoMathError(vars.mathErr);\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[receiver] = vars.accountTokensNew;\n\n /* We emit a MintBehalf event, and a Transfer event */\n emit MintBehalf(payer, receiver, vars.actualMintAmount, vars.mintTokens);\n emit Transfer(address(this), receiver, vars.mintTokens);\n\n /* We call the defense and prime accrue interest hook */\n comptroller.mintVerify(address(this), receiver, vars.actualMintAmount, vars.mintTokens);\n\n return (uint(Error.NO_ERROR), vars.actualMintAmount);\n }\n\n /**\n * @notice Redeemer redeems vTokens in exchange for the underlying assets, transferred to the receiver. Redeemer and receiver can be the same\n * address, or different addresses if the receiver was previously approved by the redeemer as a valid delegate (see MarketFacet.updateDelegate)\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemer The address of the account which is redeeming the tokens\n * @param receiver The receiver of the tokens\n * @param redeemTokens The number of vTokens to redeem into underlying\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function redeemInternal(\n address redeemer,\n address payable receiver,\n uint redeemTokens\n ) internal nonReentrant returns (uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed\n return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);\n }\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\n return redeemFresh(redeemer, receiver, redeemTokens, 0);\n }\n\n /**\n * @notice Sender redeems underlying assets on behalf of some other address. This function is only available\n * for senders, explicitly marked as delegates of the supplier using `comptroller.updateDelegate`\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemer The address of the account which is redeeming the tokens\n * @param receiver The receiver of the tokens, if called by a delegate\n * @param redeemAmount The amount of underlying to receive from redeeming vTokens\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function redeemUnderlyingInternal(\n address redeemer,\n address payable receiver,\n uint redeemAmount\n ) internal nonReentrant returns (uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed\n return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);\n }\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\n return redeemFresh(redeemer, receiver, 0, redeemAmount);\n }\n\n /**\n * @notice Redeemer redeems vTokens in exchange for the underlying assets, transferred to the receiver. Redeemer and receiver can be the same\n * address, or different addresses if the receiver was previously approved by the redeemer as a valid delegate (see MarketFacet.updateDelegate)\n * @dev Assumes interest has already been accrued up to the current block\n * @param redeemer The address of the account which is redeeming the tokens\n * @param receiver The receiver of the tokens\n * @param redeemTokensIn The number of vTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)\n * @param redeemAmountIn The number of underlying tokens to receive from redeeming vTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // solhint-disable-next-line code-complexity\n function redeemFresh(\n address redeemer,\n address payable receiver,\n uint redeemTokensIn,\n uint redeemAmountIn\n ) internal returns (uint) {\n require(redeemTokensIn == 0 || redeemAmountIn == 0, \"one of redeemTokensIn or redeemAmountIn must be zero\");\n\n RedeemLocalVars memory vars;\n\n /* exchangeRate = invoke Exchange Rate Stored() */\n (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();\n ensureNoMathError(vars.mathErr);\n\n /* If redeemTokensIn > 0: */\n if (redeemTokensIn > 0) {\n /*\n * We calculate the exchange rate and the amount of underlying to be redeemed:\n * redeemTokens = redeemTokensIn\n * redeemAmount = redeemTokensIn x exchangeRateCurrent\n */\n vars.redeemTokens = redeemTokensIn;\n\n (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(\n Exp({ mantissa: vars.exchangeRateMantissa }),\n redeemTokensIn\n );\n ensureNoMathError(vars.mathErr);\n } else {\n /*\n * We get the current exchange rate and calculate the amount to be redeemed:\n * redeemTokens = redeemAmountIn / exchangeRate\n * redeemAmount = redeemAmountIn\n */\n\n (vars.mathErr, vars.redeemTokens) = divScalarByExpTruncate(\n redeemAmountIn,\n Exp({ mantissa: vars.exchangeRateMantissa })\n );\n ensureNoMathError(vars.mathErr);\n\n vars.redeemAmount = redeemAmountIn;\n }\n\n /* Fail if redeem not allowed */\n uint allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);\n if (allowed != 0) {\n revert(\"math error\");\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n revert(\"math error\");\n }\n\n /*\n * We calculate the new total supply and redeemer balance, checking for underflow:\n * totalSupplyNew = totalSupply - redeemTokens\n * accountTokensNew = accountTokens[redeemer] - redeemTokens\n */\n (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);\n ensureNoMathError(vars.mathErr);\n\n (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);\n ensureNoMathError(vars.mathErr);\n\n /* Fail gracefully if protocol has insufficient cash */\n if (getCashPrior() < vars.redeemAmount) {\n revert(\"math error\");\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[redeemer] = vars.accountTokensNew;\n\n /*\n * We invoke doTransferOut for the receiver and the redeemAmount.\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\n * On success, the vToken has redeemAmount less of cash.\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n */\n\n uint feeAmount;\n uint remainedAmount;\n if (IComptroller(address(comptroller)).treasuryPercent() != 0) {\n (vars.mathErr, feeAmount) = mulUInt(\n vars.redeemAmount,\n IComptroller(address(comptroller)).treasuryPercent()\n );\n ensureNoMathError(vars.mathErr);\n\n (vars.mathErr, feeAmount) = divUInt(feeAmount, 1e18);\n ensureNoMathError(vars.mathErr);\n\n (vars.mathErr, remainedAmount) = subUInt(vars.redeemAmount, feeAmount);\n ensureNoMathError(vars.mathErr);\n\n doTransferOut(address(uint160(IComptroller(address(comptroller)).treasuryAddress())), feeAmount);\n\n emit RedeemFee(redeemer, feeAmount, vars.redeemTokens);\n } else {\n remainedAmount = vars.redeemAmount;\n }\n\n doTransferOut(receiver, remainedAmount);\n\n /* We emit a Transfer event, and a Redeem event */\n emit Transfer(redeemer, address(this), vars.redeemTokens);\n emit Redeem(redeemer, remainedAmount, vars.redeemTokens);\n\n /* We call the defense and prime accrue interest hook */\n comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Receiver gets the borrow on behalf of the borrower address\n * @param borrower The borrower, on behalf of whom to borrow\n * @param receiver The account that would receive the funds (can be the same as the borrower)\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function borrowInternal(\n address borrower,\n address payable receiver,\n uint borrowAmount\n ) internal nonReentrant returns (uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed\n return fail(Error(error), FailureInfo.BORROW_ACCRUE_INTEREST_FAILED);\n }\n // borrowFresh emits borrow-specific logs on errors, so we don't need to\n return borrowFresh(borrower, receiver, borrowAmount);\n }\n\n /**\n * @notice Receiver gets the borrow on behalf of the borrower address\n * @dev Before calling this function, ensure that the interest has been accrued\n * @param borrower The borrower, on behalf of whom to borrow\n * @param receiver The account that would receive the funds (can be the same as the borrower)\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint Returns 0 on success, otherwise revert (see ErrorReporter.sol for details).\n */\n function borrowFresh(address borrower, address payable receiver, uint borrowAmount) internal returns (uint) {\n /* Revert if borrow not allowed */\n uint allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);\n if (allowed != 0) {\n revert(\"math error\");\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n revert(\"math error\");\n }\n\n /* Revert if protocol has insufficient underlying cash */\n if (getCashPrior() < borrowAmount) {\n revert(\"math error\");\n }\n\n BorrowLocalVars memory vars;\n\n /*\n * We calculate the new borrower and total borrow balances, failing on overflow:\n * accountBorrowsNew = accountBorrows + borrowAmount\n * totalBorrowsNew = totalBorrows + borrowAmount\n */\n (vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower);\n ensureNoMathError(vars.mathErr);\n\n (vars.mathErr, vars.accountBorrowsNew) = addUInt(vars.accountBorrows, borrowAmount);\n ensureNoMathError(vars.mathErr);\n\n (vars.mathErr, vars.totalBorrowsNew) = addUInt(totalBorrows, borrowAmount);\n ensureNoMathError(vars.mathErr);\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\n accountBorrows[borrower].interestIndex = borrowIndex;\n totalBorrows = vars.totalBorrowsNew;\n\n /*\n * We invoke doTransferOut for the receiver and the borrowAmount.\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\n * On success, the vToken borrowAmount less of cash.\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n */\n doTransferOut(receiver, borrowAmount);\n\n /* We emit a Borrow event */\n emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\n\n /* We call the defense and prime accrue interest hook */\n comptroller.borrowVerify(address(this), borrower, borrowAmount);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowInternal(uint repayAmount) internal nonReentrant returns (uint, uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed\n return (fail(Error(error), FailureInfo.REPAY_BORROW_ACCRUE_INTEREST_FAILED), 0);\n }\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\n return repayBorrowFresh(msg.sender, msg.sender, repayAmount);\n }\n\n /**\n * @notice Sender repays a borrow belonging to another borrowing account\n * @param borrower The account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowBehalfInternal(address borrower, uint repayAmount) internal nonReentrant returns (uint, uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed\n return (fail(Error(error), FailureInfo.REPAY_BEHALF_ACCRUE_INTEREST_FAILED), 0);\n }\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\n return repayBorrowFresh(msg.sender, borrower, repayAmount);\n }\n\n /**\n * @notice Borrows are repaid by another user (possibly the borrower).\n * @param payer The account paying off the borrow\n * @param borrower The account with the debt being payed off\n * @param repayAmount The amount of undelrying tokens being returned\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowFresh(address payer, address borrower, uint repayAmount) internal returns (uint, uint) {\n /* Fail if repayBorrow not allowed */\n uint allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount);\n if (allowed != 0) {\n return (\n failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_BORROW_COMPTROLLER_REJECTION, allowed),\n 0\n );\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0);\n }\n\n RepayBorrowLocalVars memory vars;\n\n /* We remember the original borrowerIndex for verification purposes */\n vars.borrowerIndex = accountBorrows[borrower].interestIndex;\n\n /* We fetch the amount the borrower owes, with accumulated interest */\n (vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower);\n if (vars.mathErr != MathError.NO_ERROR) {\n return (\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\n uint(vars.mathErr)\n ),\n 0\n );\n }\n\n /* If repayAmount == -1, repayAmount = accountBorrows */\n if (repayAmount == uint(-1)) {\n vars.repayAmount = vars.accountBorrows;\n } else {\n vars.repayAmount = repayAmount;\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call doTransferIn for the payer and the repayAmount\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\n * On success, the vToken holds an additional repayAmount of cash.\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\n * it returns the amount actually transferred, in case of a fee.\n */\n vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount);\n\n /*\n * We calculate the new borrower and total borrow balances, failing on underflow:\n * accountBorrowsNew = accountBorrows - actualRepayAmount\n * totalBorrowsNew = totalBorrows - actualRepayAmount\n */\n (vars.mathErr, vars.accountBorrowsNew) = subUInt(vars.accountBorrows, vars.actualRepayAmount);\n ensureNoMathError(vars.mathErr);\n\n (vars.mathErr, vars.totalBorrowsNew) = subUInt(totalBorrows, vars.actualRepayAmount);\n ensureNoMathError(vars.mathErr);\n\n /* We write the previously calculated values into storage */\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\n accountBorrows[borrower].interestIndex = borrowIndex;\n totalBorrows = vars.totalBorrowsNew;\n\n /* We emit a RepayBorrow event */\n emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\n\n /* We call the defense and prime accrue interest hook */\n comptroller.repayBorrowVerify(address(this), payer, borrower, vars.actualRepayAmount, vars.borrowerIndex);\n\n return (uint(Error.NO_ERROR), vars.actualRepayAmount);\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this vToken to be liquidated\n * @param vTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function liquidateBorrowInternal(\n address borrower,\n uint repayAmount,\n VTokenInterface vTokenCollateral\n ) internal nonReentrant returns (uint, uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted liquidation failed\n return (fail(Error(error), FailureInfo.LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED), 0);\n }\n\n error = vTokenCollateral.accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted liquidation failed\n return (fail(Error(error), FailureInfo.LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED), 0);\n }\n\n // liquidateBorrowFresh emits borrow-specific logs on errors, so we don't need to\n return liquidateBorrowFresh(msg.sender, borrower, repayAmount, vTokenCollateral);\n }\n\n /**\n * @notice The liquidator liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this vToken to be liquidated\n * @param liquidator The address repaying the borrow and seizing collateral\n * @param vTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n // solhint-disable-next-line code-complexity\n function liquidateBorrowFresh(\n address liquidator,\n address borrower,\n uint repayAmount,\n VTokenInterface vTokenCollateral\n ) internal returns (uint, uint) {\n /* Fail if liquidate not allowed */\n uint allowed = comptroller.liquidateBorrowAllowed(\n address(this),\n address(vTokenCollateral),\n liquidator,\n borrower,\n repayAmount\n );\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0);\n }\n\n /* Verify vTokenCollateral market's block number equals current block number */\n if (vTokenCollateral.accrualBlockNumber() != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0);\n }\n\n /* Fail if repayAmount = 0 */\n if (repayAmount == 0) {\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0);\n }\n\n /* Fail if repayAmount = -1 */\n if (repayAmount == uint(-1)) {\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0);\n }\n\n /* Fail if repayBorrow fails */\n (uint repayBorrowError, uint actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount);\n if (repayBorrowError != uint(Error.NO_ERROR)) {\n return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We calculate the number of collateral tokens that will be seized */\n (uint amountSeizeError, uint seizeTokens) = comptroller.liquidateCalculateSeizeTokens(\n address(this),\n address(vTokenCollateral),\n actualRepayAmount\n );\n require(amountSeizeError == uint(Error.NO_ERROR), \"LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED\");\n\n /* Revert if borrower collateral token balance < seizeTokens */\n require(vTokenCollateral.balanceOf(borrower) >= seizeTokens, \"LIQUIDATE_SEIZE_TOO_MUCH\");\n\n // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call\n uint seizeError;\n if (address(vTokenCollateral) == address(this)) {\n seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens);\n } else {\n seizeError = vTokenCollateral.seize(liquidator, borrower, seizeTokens);\n }\n\n /* Revert if seize tokens fails (since we cannot be sure of side effects) */\n require(seizeError == uint(Error.NO_ERROR), \"token seizure failed\");\n\n /* We emit a LiquidateBorrow event */\n emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, address(vTokenCollateral), seizeTokens);\n\n /* We call the defense and prime accrue interest hook */\n comptroller.liquidateBorrowVerify(\n address(this),\n address(vTokenCollateral),\n liquidator,\n borrower,\n actualRepayAmount,\n seizeTokens\n );\n\n return (uint(Error.NO_ERROR), actualRepayAmount);\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another vToken.\n * Its absolutely critical to use msg.sender as the seizer vToken and not a parameter.\n * @param seizerToken The contract seizing the collateral (i.e. borrowed vToken)\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of vTokens to seize\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function seizeInternal(\n address seizerToken,\n address liquidator,\n address borrower,\n uint seizeTokens\n ) internal returns (uint) {\n /* Fail if seize not allowed */\n uint allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER);\n }\n\n MathError mathErr;\n uint borrowerTokensNew;\n uint liquidatorTokensNew;\n\n /*\n * We calculate the new borrower and liquidator token balances, failing on underflow/overflow:\n * borrowerTokensNew = accountTokens[borrower] - seizeTokens\n * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens\n */\n (mathErr, borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);\n if (mathErr != MathError.NO_ERROR) {\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint(mathErr));\n }\n\n (mathErr, liquidatorTokensNew) = addUInt(accountTokens[liquidator], seizeTokens);\n if (mathErr != MathError.NO_ERROR) {\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint(mathErr));\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n accountTokens[borrower] = borrowerTokensNew;\n accountTokens[liquidator] = liquidatorTokensNew;\n\n /* Emit a Transfer event */\n emit Transfer(borrower, liquidator, seizeTokens);\n\n /* We call the defense and prime accrue interest hook */\n comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets a new reserve factor for the protocol (requires fresh interest accrual)\n * @dev Governance function to set a new reserve factor\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _setReserveFactorFresh(uint newReserveFactorMantissa) internal returns (uint) {\n // Verify market's block number equals current block number\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_RESERVE_FACTOR_FRESH_CHECK);\n }\n\n // Check newReserveFactor ≤ maxReserveFactor\n if (newReserveFactorMantissa > reserveFactorMaxMantissa) {\n return fail(Error.BAD_INPUT, FailureInfo.SET_RESERVE_FACTOR_BOUNDS_CHECK);\n }\n\n uint oldReserveFactorMantissa = reserveFactorMantissa;\n reserveFactorMantissa = newReserveFactorMantissa;\n\n emit NewReserveFactor(oldReserveFactorMantissa, newReserveFactorMantissa);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Accrues interest and adds reserves by transferring from `msg.sender`\n * @param addAmount Amount of addition to reserves\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _addReservesInternal(uint addAmount) internal nonReentrant returns (uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed.\n return fail(Error(error), FailureInfo.ADD_RESERVES_ACCRUE_INTEREST_FAILED);\n }\n\n // _addReservesFresh emits reserve-addition-specific logs on errors, so we don't need to.\n (error, ) = _addReservesFresh(addAmount);\n return error;\n }\n\n /**\n * @notice Add reserves by transferring from caller\n * @dev Requires fresh interest accrual\n * @param addAmount Amount of addition to reserves\n * @return (uint, uint) An error code (0=success, otherwise a failure (see ErrorReporter.sol for details)) and the actual amount added, net token fees\n */\n function _addReservesFresh(uint addAmount) internal returns (uint, uint) {\n // totalReserves + actualAddAmount\n uint totalReservesNew;\n uint actualAddAmount;\n\n // We fail gracefully unless market's block number equals current block number\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.ADD_RESERVES_FRESH_CHECK), actualAddAmount);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call doTransferIn for the caller and the addAmount\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\n * On success, the vToken holds an additional addAmount of cash.\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\n * it returns the amount actually transferred, in case of a fee.\n */\n\n actualAddAmount = doTransferIn(msg.sender, addAmount);\n\n totalReservesNew = totalReserves + actualAddAmount;\n\n /* Revert on overflow */\n require(totalReservesNew >= totalReserves, \"add reserves unexpected overflow\");\n\n // Store reserves[n+1] = reserves[n] + actualAddAmount\n totalReserves = totalReservesNew;\n\n /* Emit NewReserves(admin, actualAddAmount, reserves[n+1]) */\n emit ReservesAdded(msg.sender, actualAddAmount, totalReservesNew);\n\n /* Return (NO_ERROR, actualAddAmount) */\n return (uint(Error.NO_ERROR), actualAddAmount);\n }\n\n /**\n * @notice Reduces reserves by transferring to protocol share reserve contract\n * @dev Requires fresh interest accrual\n * @param reduceAmount Amount of reduction to reserves\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _reduceReservesFresh(uint reduceAmount) internal returns (uint) {\n if (reduceAmount == 0) {\n return uint(Error.NO_ERROR);\n }\n\n // We fail gracefully unless market's block number equals current block number\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDUCE_RESERVES_FRESH_CHECK);\n }\n\n // Fail gracefully if protocol has insufficient underlying cash\n if (getCashPrior() < reduceAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDUCE_RESERVES_CASH_NOT_AVAILABLE);\n }\n\n // Check reduceAmount ≤ reserves[n] (totalReserves)\n if (reduceAmount > totalReserves) {\n return fail(Error.BAD_INPUT, FailureInfo.REDUCE_RESERVES_VALIDATION);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n // totalReserves - reduceAmount\n uint totalReservesNew = totalReserves - reduceAmount;\n\n // Store reserves[n+1] = reserves[n] - reduceAmount\n totalReserves = totalReservesNew;\n\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n doTransferOut(protocolShareReserve, reduceAmount);\n\n IProtocolShareReserveV5(protocolShareReserve).updateAssetsState(\n address(comptroller),\n underlying,\n IProtocolShareReserveV5.IncomeType.SPREAD\n );\n\n emit ReservesReduced(protocolShareReserve, reduceAmount, totalReservesNew);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice updates the interest rate model (requires fresh interest accrual)\n * @dev Governance function to update the interest rate model\n * @param newInterestRateModel the new interest rate model to use\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _setInterestRateModelFresh(InterestRateModel newInterestRateModel) internal returns (uint) {\n // Used to store old model for use in the event that is emitted on success\n InterestRateModel oldInterestRateModel;\n // We fail gracefully unless market's block number equals current block number\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_INTEREST_RATE_MODEL_FRESH_CHECK);\n }\n\n // Track the market's current interest rate model\n oldInterestRateModel = interestRateModel;\n\n // Ensure invoke newInterestRateModel.isInterestRateModel() returns true\n require(newInterestRateModel.isInterestRateModel(), \"marker method returned false\");\n\n // Set the interest rate model to newInterestRateModel\n interestRateModel = newInterestRateModel;\n\n // Emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel)\n emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel);\n\n return uint(Error.NO_ERROR);\n }\n\n /*** Safe Token ***/\n\n /**\n * @dev Performs a transfer in, reverting upon failure. Returns the amount actually transferred to the protocol, in case of a fee.\n * This may revert due to insufficient balance or insufficient allowance.\n */\n function doTransferIn(address from, uint amount) internal returns (uint);\n\n /**\n * @dev Performs a transfer out, ideally returning an explanatory error code upon failure rather than reverting.\n * If caller has not called checked protocol's balance, may revert due to insufficient cash held in the contract.\n * If caller has checked protocol's balance, and verified it is >= amount, this should not revert in normal conditions.\n */\n function doTransferOut(address payable to, uint amount) internal;\n\n /**\n * @notice Return the borrow balance of account based on stored data\n * @param account The address whose balance should be calculated\n * @return Tuple of error code and the calculated balance or 0 if error code is non-zero\n */\n function borrowBalanceStoredInternal(address account) internal view returns (MathError, uint) {\n /* Note: we do not assert that the market is up to date */\n MathError mathErr;\n uint principalTimesIndex;\n uint result;\n\n /* Get borrowBalance and borrowIndex */\n BorrowSnapshot storage borrowSnapshot = accountBorrows[account];\n\n /* If borrowBalance = 0 then borrowIndex is likely also 0.\n * Rather than failing the calculation with a division by 0, we immediately return 0 in this case.\n */\n if (borrowSnapshot.principal == 0) {\n return (MathError.NO_ERROR, 0);\n }\n\n /* Calculate new borrow balance using the interest index:\n * recentBorrowBalance = borrower.borrowBalance * market.borrowIndex / borrower.borrowIndex\n */\n (mathErr, principalTimesIndex) = mulUInt(borrowSnapshot.principal, borrowIndex);\n if (mathErr != MathError.NO_ERROR) {\n return (mathErr, 0);\n }\n\n (mathErr, result) = divUInt(principalTimesIndex, borrowSnapshot.interestIndex);\n if (mathErr != MathError.NO_ERROR) {\n return (mathErr, 0);\n }\n\n return (MathError.NO_ERROR, result);\n }\n\n /**\n * @notice Calculates the exchange rate from the underlying to the vToken\n * @dev This function does not accrue interest before calculating the exchange rate\n * @return Tuple of error code and calculated exchange rate scaled by 1e18\n */\n function exchangeRateStoredInternal() internal view returns (MathError, uint) {\n uint _totalSupply = totalSupply;\n if (_totalSupply == 0) {\n /*\n * If there are no tokens minted:\n * exchangeRate = initialExchangeRate\n */\n return (MathError.NO_ERROR, initialExchangeRateMantissa);\n } else {\n /*\n * Otherwise:\n * exchangeRate = (totalCash + totalBorrows - totalReserves) / totalSupply\n */\n uint totalCash = getCashPrior();\n uint cashPlusBorrowsMinusReserves;\n Exp memory exchangeRate;\n MathError mathErr;\n\n (mathErr, cashPlusBorrowsMinusReserves) = addThenSubUInt(totalCash, totalBorrows, totalReserves);\n if (mathErr != MathError.NO_ERROR) {\n return (mathErr, 0);\n }\n\n (mathErr, exchangeRate) = getExp(cashPlusBorrowsMinusReserves, _totalSupply);\n if (mathErr != MathError.NO_ERROR) {\n return (mathErr, 0);\n }\n\n return (MathError.NO_ERROR, exchangeRate.mantissa);\n }\n }\n\n function ensureAllowed(string memory functionSig) private view {\n require(\n IAccessControlManagerV5(accessControlManager).isAllowedToCall(msg.sender, functionSig),\n \"access denied\"\n );\n }\n\n function ensureAdmin(address caller_) private view {\n require(caller_ == admin, \"Unauthorized\");\n }\n\n function ensureNoMathError(MathError mErr) private pure {\n require(mErr == MathError.NO_ERROR, \"math error\");\n }\n\n function ensureNonZeroAddress(address address_) private pure {\n require(address_ != address(0), \"zero address\");\n }\n\n /*** Safe Token ***/\n\n /**\n * @notice Gets balance of this contract in terms of the underlying\n * @dev This excludes the value of the current message, if any\n * @return The quantity of underlying owned by this contract\n */\n function getCashPrior() internal view returns (uint);\n}\n" + }, + "contracts/Tokens/VTokens/VBep20.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport { VToken, VBep20Interface, ComptrollerInterface, InterestRateModel, VTokenInterface } from \"./VToken.sol\";\nimport { EIP20Interface } from \"../EIP20Interface.sol\";\nimport { EIP20NonStandardInterface } from \"../EIP20NonStandardInterface.sol\";\n\n/**\n * @title Venus's VBep20 Contract\n * @notice vTokens which wrap an EIP-20 underlying\n * @author Venus\n */\ncontract VBep20 is VToken, VBep20Interface {\n /*** User Interface ***/\n\n /**\n * @notice Sender supplies assets into the market and receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Transfer event\n // @custom:event Emits Mint event\n function mint(uint mintAmount) external returns (uint) {\n (uint err, ) = mintInternal(mintAmount);\n return err;\n }\n\n /**\n * @notice Sender supplies assets into the market and receiver receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param receiver The account which is receiving the vTokens\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Transfer event\n // @custom:event Emits MintBehalf event\n function mintBehalf(address receiver, uint mintAmount) external returns (uint) {\n (uint err, ) = mintBehalfInternal(receiver, mintAmount);\n return err;\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of vTokens to redeem into underlying\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Redeem event on success\n // @custom:event Emits Transfer event on success\n // @custom:event Emits RedeemFee when fee is charged by the treasury\n function redeem(uint redeemTokens) external returns (uint) {\n return redeemInternal(msg.sender, msg.sender, redeemTokens);\n }\n\n /**\n * @notice Sender redeems assets on behalf of some other address. This function is only available\n * for senders, explicitly marked as delegates of the supplier using `comptroller.updateDelegate`\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemer The user on behalf of whom to redeem\n * @param redeemTokens The number of vTokens to redeem into underlying\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Redeem event on success\n // @custom:event Emits Transfer event on success\n // @custom:event Emits RedeemFee when fee is charged by the treasury\n function redeemBehalf(address redeemer, uint redeemTokens) external returns (uint) {\n require(comptroller.approvedDelegates(redeemer, msg.sender), \"not an approved delegate\");\n\n return redeemInternal(redeemer, msg.sender, redeemTokens);\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to redeem\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Redeem event on success\n // @custom:event Emits Transfer event on success\n // @custom:event Emits RedeemFee when fee is charged by the treasury\n function redeemUnderlying(uint redeemAmount) external returns (uint) {\n return redeemUnderlyingInternal(msg.sender, msg.sender, redeemAmount);\n }\n\n /**\n * @notice Sender redeems underlying assets on behalf of some other address. This function is only available\n * for senders, explicitly marked as delegates of the supplier using `comptroller.updateDelegate`\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemer, on behalf of whom to redeem\n * @param redeemAmount The amount of underlying to receive from redeeming vTokens\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Redeem event on success\n // @custom:event Emits Transfer event on success\n // @custom:event Emits RedeemFee when fee is charged by the treasury\n function redeemUnderlyingBehalf(address redeemer, uint redeemAmount) external returns (uint) {\n require(comptroller.approvedDelegates(redeemer, msg.sender), \"not an approved delegate\");\n\n return redeemUnderlyingInternal(redeemer, msg.sender, redeemAmount);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Borrow event on success\n function borrow(uint borrowAmount) external returns (uint) {\n return borrowInternal(msg.sender, msg.sender, borrowAmount);\n }\n\n /**\n * @notice Sender borrows assets on behalf of some other address. This function is only available\n * for senders, explicitly marked as delegates of the borrower using `comptroller.updateDelegate`\n * @param borrower The borrower, on behalf of whom to borrow.\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Borrow event on success\n function borrowBehalf(address borrower, uint borrowAmount) external returns (uint) {\n require(comptroller.approvedDelegates(borrower, msg.sender), \"not an approved delegate\");\n return borrowInternal(borrower, msg.sender, borrowAmount);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits RepayBorrow event on success\n function repayBorrow(uint repayAmount) external returns (uint) {\n (uint err, ) = repayBorrowInternal(repayAmount);\n return err;\n }\n\n /**\n * @notice Sender repays a borrow belonging to another borrowing account\n * @param borrower The account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits RepayBorrow event on success\n function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint) {\n (uint err, ) = repayBorrowBehalfInternal(borrower, repayAmount);\n return err;\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this vToken to be liquidated\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @param vTokenCollateral The market in which to seize collateral from the borrower\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emit LiquidateBorrow event on success\n function liquidateBorrow(\n address borrower,\n uint repayAmount,\n VTokenInterface vTokenCollateral\n ) external returns (uint) {\n (uint err, ) = liquidateBorrowInternal(borrower, repayAmount, vTokenCollateral);\n return err;\n }\n\n /**\n * @notice The sender adds to reserves.\n * @param addAmount The amount of underlying tokens to add as reserves\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits ReservesAdded event\n function _addReserves(uint addAmount) external returns (uint) {\n return _addReservesInternal(addAmount);\n }\n\n /**\n * @notice Initialize the new money market\n * @param underlying_ The address of the underlying asset\n * @param comptroller_ The address of the Comptroller\n * @param interestRateModel_ The address of the interest rate model\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\n * @param name_ BEP-20 name of this token\n * @param symbol_ BEP-20 symbol of this token\n * @param decimals_ BEP-20 decimal precision of this token\n */\n function initialize(\n address underlying_,\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_\n ) public {\n // VToken initialize does the bulk of the work\n super.initialize(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);\n\n // Set underlying and sanity check it\n underlying = underlying_;\n EIP20Interface(underlying).totalSupply();\n }\n\n /*** Safe Token ***/\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case.\n * This will revert due to insufficient balance or insufficient allowance.\n * This function returns the actual amount received,\n * which may be less than `amount` if there is a fee attached to the transfer.\n *\n * Note: This wrapper safely handles non-standard BEP-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferIn(address from, uint amount) internal returns (uint) {\n uint balanceBefore = EIP20Interface(underlying).balanceOf(address(this));\n EIP20NonStandardInterface(underlying).transferFrom(from, address(this), amount);\n\n bool success;\n assembly {\n switch returndatasize()\n case 0 {\n // This is a non-standard BEP-20\n success := not(0) // set success to true\n }\n case 32 {\n // This is a compliant BEP-20\n returndatacopy(0, 0, 32)\n success := mload(0) // Set `success = returndata` of external call\n }\n default {\n // This is an excessively non-compliant BEP-20, revert.\n revert(0, 0)\n }\n }\n require(success, \"TOKEN_TRANSFER_IN_FAILED\");\n\n // Calculate the amount that was *actually* transferred\n uint balanceAfter = EIP20Interface(underlying).balanceOf(address(this));\n require(balanceAfter >= balanceBefore, \"TOKEN_TRANSFER_IN_OVERFLOW\");\n return balanceAfter - balanceBefore; // underflow already checked above, just subtract\n }\n\n /**\n * @dev Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory\n * error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to\n * insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, and verified\n * it is >= amount, this should not revert in normal conditions.\n *\n * Note: This wrapper safely handles non-standard BEP-20 tokens that do not return a value.\n * See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n */\n function doTransferOut(address payable to, uint amount) internal {\n EIP20NonStandardInterface(underlying).transfer(to, amount);\n\n bool success;\n assembly {\n switch returndatasize()\n case 0 {\n // This is a non-standard BEP-20\n success := not(0) // set success to true\n }\n case 32 {\n // This is a compliant BEP-20\n returndatacopy(0, 0, 32)\n success := mload(0) // Set `success = returndata` of external call\n }\n default {\n // This is an excessively non-compliant BEP-20, revert.\n revert(0, 0)\n }\n }\n require(success, \"TOKEN_TRANSFER_OUT_FAILED\");\n }\n\n /**\n * @notice Gets balance of this contract in terms of the underlying\n * @dev This excludes the value of the current message, if any\n * @return The quantity of underlying tokens owned by this contract\n */\n function getCashPrior() internal view returns (uint) {\n return EIP20Interface(underlying).balanceOf(address(this));\n }\n}\n" + }, + "contracts/Tokens/VTokens/VBep20Delegate.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport { VBep20 } from \"./VBep20.sol\";\nimport { VDelegateInterface } from \"./VTokenInterfaces.sol\";\n\n/**\n * @title Venus's VBep20Delegate Contract\n * @notice VTokens which wrap an EIP-20 underlying and are delegated to\n * @author Venus\n */\ncontract VBep20Delegate is VBep20, VDelegateInterface {\n /**\n * @notice Construct an empty delegate\n */\n constructor() public {}\n\n /**\n * @notice Called by the delegator on a delegate to initialize it for duty\n * @param data The encoded bytes data for any initialization\n */\n function _becomeImplementation(bytes memory data) public {\n // Shh -- currently unused\n data;\n\n // Shh -- we don't ever want this hook to be marked pure\n if (false) {\n implementation = address(0);\n }\n\n require(msg.sender == admin, \"only the admin may call _becomeImplementation\");\n }\n\n /**\n * @notice Called by the delegator on a delegate to forfeit its responsibility\n */\n function _resignImplementation() public {\n // Shh -- we don't ever want this hook to be marked pure\n if (false) {\n implementation = address(0);\n }\n\n require(msg.sender == admin, \"only the admin may call _resignImplementation\");\n }\n}\n" + }, + "contracts/Tokens/VTokens/VBep20Delegator.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./VTokenInterfaces.sol\";\n\n/**\n * @title Venus's VBep20Delegator Contract\n * @notice vTokens which wrap an EIP-20 underlying and delegate to an implementation\n * @author Venus\n */\ncontract VBep20Delegator is VTokenInterface, VBep20Interface, VDelegatorInterface {\n /**\n * @notice Construct a new money market\n * @param underlying_ The address of the underlying asset\n * @param comptroller_ The address of the comptroller\n * @param interestRateModel_ The address of the interest rate model\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\n * @param name_ BEP-20 name of this token\n * @param symbol_ BEP-20 symbol of this token\n * @param decimals_ BEP-20 decimal precision of this token\n * @param admin_ Address of the administrator of this token\n * @param implementation_ The address of the implementation the contract delegates to\n * @param becomeImplementationData The encoded args for becomeImplementation\n */\n constructor(\n address underlying_,\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n address payable admin_,\n address implementation_,\n bytes memory becomeImplementationData\n ) public {\n // Creator of the contract is admin during initialization\n admin = msg.sender;\n\n // First delegate gets to initialize the delegator (i.e. storage contract)\n delegateTo(\n implementation_,\n abi.encodeWithSignature(\n \"initialize(address,address,address,uint256,string,string,uint8)\",\n underlying_,\n comptroller_,\n interestRateModel_,\n initialExchangeRateMantissa_,\n name_,\n symbol_,\n decimals_\n )\n );\n\n // New implementations always get set via the settor (post-initialize)\n _setImplementation(implementation_, false, becomeImplementationData);\n\n // Set the proper admin now that initialization is done\n admin = admin_;\n }\n\n /**\n * @notice Delegates execution to an implementation contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n */\n function() external payable {\n require(msg.value == 0, \"VBep20Delegator:fallback: cannot send value to fallback\");\n\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 /**\n * @notice Sender supplies assets into the market and receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function mint(uint mintAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"mint(uint256)\", mintAmount));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Sender supplies assets into the market and receiver receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function mintBehalf(address receiver, uint mintAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"mintBehalf(address,uint256)\", receiver, mintAmount)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of vTokens to redeem into underlying asset\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function redeem(uint redeemTokens) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"redeem(uint256)\", redeemTokens));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to redeem\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function redeemUnderlying(uint redeemAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"redeemUnderlying(uint256)\", redeemAmount)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function borrow(uint borrowAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"borrow(uint256)\", borrowAmount));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function repayBorrow(uint repayAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"repayBorrow(uint256)\", repayAmount));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Sender repays a borrow belonging to another borrower\n * @param borrower The account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"repayBorrowBehalf(address,uint256)\", borrower, repayAmount)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this vToken to be liquidated\n * @param vTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function liquidateBorrow(\n address borrower,\n uint repayAmount,\n VTokenInterface vTokenCollateral\n ) external returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"liquidateBorrow(address,uint256,address)\", borrower, repayAmount, vTokenCollateral)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(address dst, uint amount) external returns (bool) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"transfer(address,uint256)\", dst, amount));\n return abi.decode(data, (bool));\n }\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(address src, address dst, uint256 amount) external returns (bool) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", src, dst, amount)\n );\n return abi.decode(data, (bool));\n }\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved (-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(address spender, uint256 amount) external returns (bool) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"approve(address,uint256)\", spender, amount)\n );\n return abi.decode(data, (bool));\n }\n\n /**\n * @notice Get the underlying balance of the `owner`\n * @dev This also accrues interest in a transaction\n * @param owner The address of the account to query\n * @return The amount of underlying owned by `owner`\n */\n function balanceOfUnderlying(address owner) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"balanceOfUnderlying(address)\", owner));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Returns the current total borrows plus accrued interest\n * @return The total borrows with interest\n */\n function totalBorrowsCurrent() external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"totalBorrowsCurrent()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex\n * @param account The address whose balance should be calculated after updating borrowIndex\n * @return The calculated balance\n */\n function borrowBalanceCurrent(address account) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"borrowBalanceCurrent(address)\", account));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Will fail unless called by another vToken during the process of liquidation.\n * It's absolutely critical to use msg.sender as the borrowed vToken and not a parameter.\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of vTokens to seize\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function seize(address liquidator, address borrower, uint seizeTokens) external returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"seize(address,address,uint256)\", liquidator, borrower, seizeTokens)\n );\n return abi.decode(data, (uint));\n }\n\n /*** Admin Functions ***/\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _setPendingAdmin(address payable newPendingAdmin) external returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"_setPendingAdmin(address)\", newPendingAdmin)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh\n * @dev Admin function to accrue interest and set a new reserve factor\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _setReserveFactor(uint newReserveFactorMantissa) external returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"_setReserveFactor(uint256)\", newReserveFactorMantissa)\n );\n return abi.decode(data, (uint));\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _acceptAdmin() external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"_acceptAdmin()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Accrues interest and adds reserves by transferring from admin\n * @param addAmount Amount of reserves to add\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _addReserves(uint addAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"_addReserves(uint256)\", addAmount));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Accrues interest and reduces reserves by transferring to admin\n * @param reduceAmount Amount of reduction to reserves\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _reduceReserves(uint reduceAmount) external returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"_reduceReserves(uint256)\", reduceAmount));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Get cash balance of this vToken in the underlying asset\n * @return The quantity of underlying asset owned by this contract\n */\n function getCash() external view returns (uint) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"getCash()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return The number of tokens allowed to be spent (-1 means infinite)\n */\n function allowance(address owner, address spender) external view returns (uint) {\n bytes memory data = delegateToViewImplementation(\n abi.encodeWithSignature(\"allowance(address,address)\", owner, spender)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Get the token balance of the `owner`\n * @param owner The address of the account to query\n * @return The number of tokens owned by `owner`\n */\n function balanceOf(address owner) external view returns (uint) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"balanceOf(address)\", owner));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Get a snapshot of the account's balances and the cached exchange rate\n * @dev This is used by comptroller to more efficiently perform liquidity checks.\n * @param account Address of the account to snapshot\n * @return (possible error, token balance, borrow balance, exchange rate mantissa)\n */\n function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) {\n bytes memory data = delegateToViewImplementation(\n abi.encodeWithSignature(\"getAccountSnapshot(address)\", account)\n );\n return abi.decode(data, (uint, uint, uint, uint));\n }\n\n /**\n * @notice Returns the current per-block borrow interest rate for this vToken\n * @return The borrow interest rate per block, scaled by 1e18\n */\n function borrowRatePerBlock() external view returns (uint) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"borrowRatePerBlock()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Returns the current per-block supply interest rate for this vToken\n * @return The supply interest rate per block, scaled by 1e18\n */\n function supplyRatePerBlock() external view returns (uint) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"supplyRatePerBlock()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param allowResign Flag to indicate whether to call _resignImplementation on the old implementation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n // @custom:access Only callable by admin\n function _setImplementation(\n address implementation_,\n bool allowResign,\n bytes memory becomeImplementationData\n ) public {\n require(msg.sender == admin, \"VBep20Delegator::_setImplementation: Caller must be admin\");\n\n if (allowResign) {\n delegateToImplementation(abi.encodeWithSignature(\"_resignImplementation()\"));\n }\n\n address oldImplementation = implementation;\n implementation = implementation_;\n\n delegateToImplementation(abi.encodeWithSignature(\"_becomeImplementation(bytes)\", becomeImplementationData));\n\n emit NewImplementation(oldImplementation, implementation);\n }\n\n /**\n * @notice Accrue interest then return the up-to-date exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateCurrent() public returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"exchangeRateCurrent()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Applies accrued interest to total borrows and reserves.\n * @dev This calculates interest accrued from the last checkpointed block\n * up to the current block and writes new checkpoint to storage.\n */\n function accrueInterest() public returns (uint) {\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\"accrueInterest()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Sets a new comptroller for the market\n * @dev Admin function to set a new comptroller\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"_setComptroller(address)\", newComptroller)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Accrues interest and updates the interest rate model using `_setInterestRateModelFresh`\n * @dev Admin function to accrue interest and update the interest rate model\n * @param newInterestRateModel The new interest rate model to use\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _setInterestRateModel(InterestRateModel newInterestRateModel) public returns (uint) {\n bytes memory data = delegateToImplementation(\n abi.encodeWithSignature(\"_setInterestRateModel(address)\", newInterestRateModel)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Delegates execution to the implementation contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n * @param data The raw data to delegatecall\n * @return The returned bytes from the delegatecall\n */\n function delegateToImplementation(bytes memory data) public returns (bytes memory) {\n return delegateTo(implementation, data);\n }\n\n /**\n * @notice Delegates execution to an implementation contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n * There are an additional 2 prefix uints from the wrapper returndata, which we ignore since we make an extra hop.\n * @param data The raw data to delegatecall\n * @return The returned bytes from the delegatecall\n */\n function delegateToViewImplementation(bytes memory data) public view returns (bytes memory) {\n (bool success, bytes memory returnData) = address(this).staticcall(\n abi.encodeWithSignature(\"delegateToImplementation(bytes)\", data)\n );\n assembly {\n if eq(success, 0) {\n revert(add(returnData, 0x20), returndatasize)\n }\n }\n return abi.decode(returnData, (bytes));\n }\n\n /**\n * @notice Return the borrow balance of account based on stored data\n * @param account The address whose balance should be calculated\n * @return The calculated balance\n */\n function borrowBalanceStored(address account) public view returns (uint) {\n bytes memory data = delegateToViewImplementation(\n abi.encodeWithSignature(\"borrowBalanceStored(address)\", account)\n );\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Calculates the exchange rate from the underlying to the VToken\n * @dev This function does not accrue interest before calculating the exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateStored() public view returns (uint) {\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\"exchangeRateStored()\"));\n return abi.decode(data, (uint));\n }\n\n /**\n * @notice Internal method to delegate execution to another contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n * @param callee The contract to delegatecall\n * @param data The raw data to delegatecall\n * @return The returned bytes from the delegatecall\n */\n function delegateTo(address callee, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returnData) = callee.delegatecall(data);\n assembly {\n if eq(success, 0) {\n revert(add(returnData, 0x20), returndatasize)\n }\n }\n return returnData;\n }\n}\n" + }, + "contracts/Tokens/VTokens/VBep20Immutable.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./VBep20.sol\";\n\n/**\n * @title Venus's VBep20Immutable Contract\n * @notice VTokens which wrap an EIP-20 underlying and are immutable\n * @author Venus\n */\ncontract VBep20Immutable is VBep20 {\n /**\n * @notice Construct a new money market\n * @param underlying_ The address of the underlying asset\n * @param comptroller_ The address of the comptroller\n * @param interestRateModel_ The address of the interest rate model\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\n * @param name_ BEP-20 name of this token\n * @param symbol_ BEP-20 symbol of this token\n * @param decimals_ BEP-20 decimal precision of this token\n * @param admin_ Address of the administrator of this token\n */\n constructor(\n address underlying_,\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n address payable admin_\n ) public {\n // Creator of the contract is admin during initialization\n admin = msg.sender;\n\n // Initialize the market\n initialize(\n underlying_,\n comptroller_,\n interestRateModel_,\n initialExchangeRateMantissa_,\n name_,\n symbol_,\n decimals_\n );\n\n // Set the proper admin now that initialization is done\n admin = admin_;\n }\n}\n" + }, + "contracts/Tokens/VTokens/VBNB.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./VToken.sol\";\n\n/**\n * @title Venus's vBNB Contract\n * @notice vToken which wraps BNB\n * @author Venus\n */\ncontract VBNB is VToken {\n /**\n * @notice Construct a new vBNB money market\n * @param comptroller_ The address of the Comptroller\n * @param interestRateModel_ The address of the interest rate model\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\n * @param name_ BEP-20 name of this token\n * @param symbol_ BEP-20 symbol of this token\n * @param decimals_ BEP-20 decimal precision of this token\n * @param admin_ Address of the administrator of this token\n */\n constructor(\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n address payable admin_\n ) public {\n // Creator of the contract is admin during initialization\n admin = msg.sender;\n\n initialize(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);\n\n // Set the proper admin now that initialization is done\n admin = admin_;\n }\n\n /**\n * @notice Send BNB to VBNB to mint\n */\n function() external payable {\n (uint err, ) = mintInternal(msg.value);\n requireNoError(err, \"mint failed\");\n }\n\n /*** User Interface ***/\n\n /**\n * @notice Sender supplies assets into the market and receives vTokens in exchange\n * @dev Reverts upon any failure\n */\n // @custom:event Emits Transfer event\n // @custom:event Emits Mint event\n function mint() external payable {\n (uint err, ) = mintInternal(msg.value);\n requireNoError(err, \"mint failed\");\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for the underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemTokens The number of vTokens to redeem into underlying\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Redeem event on success\n // @custom:event Emits Transfer event on success\n // @custom:event Emits RedeemFee when fee is charged by the treasury\n function redeem(uint redeemTokens) external returns (uint) {\n return redeemInternal(msg.sender, msg.sender, redeemTokens);\n }\n\n /**\n * @notice Sender redeems vTokens in exchange for a specified amount of underlying asset\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemAmount The amount of underlying to redeem\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Redeem event on success\n // @custom:event Emits Transfer event on success\n // @custom:event Emits RedeemFee when fee is charged by the treasury\n function redeemUnderlying(uint redeemAmount) external returns (uint) {\n return redeemUnderlyingInternal(msg.sender, msg.sender, redeemAmount);\n }\n\n /**\n * @notice Sender borrows assets from the protocol to their own address\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Borrow event on success\n function borrow(uint borrowAmount) external returns (uint) {\n return borrowInternal(msg.sender, msg.sender, borrowAmount);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @dev Reverts upon any failure\n */\n // @custom:event Emits RepayBorrow event on success\n function repayBorrow() external payable {\n (uint err, ) = repayBorrowInternal(msg.value);\n requireNoError(err, \"repayBorrow failed\");\n }\n\n /**\n * @notice Sender repays a borrow belonging to borrower\n * @dev Reverts upon any failure\n * @param borrower The account with the debt being payed off\n */\n // @custom:event Emits RepayBorrow event on success\n function repayBorrowBehalf(address borrower) external payable {\n (uint err, ) = repayBorrowBehalfInternal(borrower, msg.value);\n requireNoError(err, \"repayBorrowBehalf failed\");\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @dev Reverts upon any failure\n * @param borrower The borrower of this vToken to be liquidated\n * @param vTokenCollateral The market in which to seize collateral from the borrower\n */\n // @custom:event Emit LiquidateBorrow event on success\n function liquidateBorrow(address borrower, VToken vTokenCollateral) external payable {\n (uint err, ) = liquidateBorrowInternal(borrower, msg.value, vTokenCollateral);\n requireNoError(err, \"liquidateBorrow failed\");\n }\n\n /*** Safe Token ***/\n\n /**\n * @notice Perform the actual transfer in, which is a no-op\n * @param from Address sending the BNB\n * @param amount Amount of BNB being sent\n * @return The actual amount of BNB transferred\n */\n function doTransferIn(address from, uint amount) internal returns (uint) {\n // Sanity checks\n require(msg.sender == from, \"sender mismatch\");\n require(msg.value == amount, \"value mismatch\");\n return amount;\n }\n\n function doTransferOut(address payable to, uint amount) internal {\n /* Send the BNB, with minimal gas and revert on failure */\n to.transfer(amount);\n }\n\n /**\n * @notice Gets balance of this contract in terms of BNB, before this message\n * @dev This excludes the value of the current message, if any\n * @return The quantity of BNB owned by this contract\n */\n function getCashPrior() internal view returns (uint) {\n (MathError err, uint startingBalance) = subUInt(address(this).balance, msg.value);\n require(err == MathError.NO_ERROR, \"cash prior math error\");\n return startingBalance;\n }\n\n function requireNoError(uint errCode, string memory message) internal pure {\n if (errCode == uint(Error.NO_ERROR)) {\n return;\n }\n\n bytes memory fullMessage = new bytes(bytes(message).length + 5);\n uint i;\n\n for (i = 0; i < bytes(message).length; i++) {\n fullMessage[i] = bytes(message)[i];\n }\n\n fullMessage[i + 0] = bytes1(uint8(32));\n fullMessage[i + 1] = bytes1(uint8(40));\n fullMessage[i + 2] = bytes1(uint8(48 + (errCode / 10)));\n fullMessage[i + 3] = bytes1(uint8(48 + (errCode % 10)));\n fullMessage[i + 4] = bytes1(uint8(41));\n\n require(errCode == uint(Error.NO_ERROR), string(fullMessage));\n }\n}\n" + }, + "contracts/Tokens/VTokens/VToken.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../../Comptroller/ComptrollerInterface.sol\";\nimport \"../../Utils/ErrorReporter.sol\";\nimport \"../../Utils/Exponential.sol\";\nimport \"../../Tokens/EIP20Interface.sol\";\nimport \"../../Tokens/EIP20NonStandardInterface.sol\";\nimport \"../../InterestRateModels/InterestRateModel.sol\";\nimport \"./VTokenInterfaces.sol\";\nimport { IAccessControlManagerV5 } from \"@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV5.sol\";\n\n/**\n * @title Venus's vToken Contract\n * @notice Abstract base for vTokens\n * @author Venus\n */\ncontract VToken is VTokenInterface, Exponential, TokenErrorReporter {\n struct MintLocalVars {\n MathError mathErr;\n uint exchangeRateMantissa;\n uint mintTokens;\n uint totalSupplyNew;\n uint accountTokensNew;\n uint actualMintAmount;\n }\n\n struct RedeemLocalVars {\n MathError mathErr;\n uint exchangeRateMantissa;\n uint redeemTokens;\n uint redeemAmount;\n uint totalSupplyNew;\n uint accountTokensNew;\n }\n\n struct BorrowLocalVars {\n MathError mathErr;\n uint accountBorrows;\n uint accountBorrowsNew;\n uint totalBorrowsNew;\n }\n\n struct RepayBorrowLocalVars {\n Error err;\n MathError mathErr;\n uint repayAmount;\n uint borrowerIndex;\n uint accountBorrows;\n uint accountBorrowsNew;\n uint totalBorrowsNew;\n uint actualRepayAmount;\n }\n\n /*** Reentrancy Guard ***/\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant() {\n require(_notEntered, \"re-entered\");\n _notEntered = false;\n _;\n _notEntered = true; // get a gas-refund post-Istanbul\n }\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n // @custom:event Emits Transfer event\n function transfer(address dst, uint256 amount) external nonReentrant returns (bool) {\n return transferTokens(msg.sender, msg.sender, dst, amount) == uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param amount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n // @custom:event Emits Transfer event\n function transferFrom(address src, address dst, uint256 amount) external nonReentrant returns (bool) {\n return transferTokens(msg.sender, src, dst, amount) == uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n * @param spender The address of the account which may transfer tokens\n * @param amount The number of tokens that are approved (-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n // @custom:event Emits Approval event on successful approve\n function approve(address spender, uint256 amount) external returns (bool) {\n transferAllowances[msg.sender][spender] = amount;\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /**\n * @notice Get the underlying balance of the `owner`\n * @dev This also accrues interest in a transaction\n * @param owner The address of the account to query\n * @return The amount of underlying owned by `owner`\n */\n function balanceOfUnderlying(address owner) external returns (uint) {\n Exp memory exchangeRate = Exp({ mantissa: exchangeRateCurrent() });\n (MathError mErr, uint balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]);\n ensureNoMathError(mErr);\n return balance;\n }\n\n /**\n * @notice Returns the current total borrows plus accrued interest\n * @return The total borrows with interest\n */\n function totalBorrowsCurrent() external nonReentrant returns (uint) {\n require(accrueInterest() == uint(Error.NO_ERROR), \"accrue interest failed\");\n return totalBorrows;\n }\n\n /**\n * @notice Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex\n * @param account The address whose balance should be calculated after updating borrowIndex\n * @return The calculated balance\n */\n function borrowBalanceCurrent(address account) external nonReentrant returns (uint) {\n require(accrueInterest() == uint(Error.NO_ERROR), \"accrue interest failed\");\n return borrowBalanceStored(account);\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Will fail unless called by another vToken during the process of liquidation.\n * Its absolutely critical to use msg.sender as the borrowed vToken and not a parameter.\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of vTokens to seize\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits Transfer event\n function seize(address liquidator, address borrower, uint seizeTokens) external nonReentrant returns (uint) {\n return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits NewPendingAdmin event with old and new admin addresses\n function _setPendingAdmin(address payable newPendingAdmin) external returns (uint) {\n // Check caller = admin\n ensureAdmin(msg.sender);\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits NewAdmin event on successful acceptance\n // @custom:event Emits NewPendingAdmin event with null new pending admin\n function _acceptAdmin() external 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 * @notice accrues interest and sets a new reserve factor for the protocol using `_setReserveFactorFresh`\n * @dev Governor function to accrue interest and set a new reserve factor\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits NewReserveFactor event\n function _setReserveFactor(uint newReserveFactorMantissa_) external nonReentrant returns (uint) {\n ensureAllowed(\"_setReserveFactor(uint256)\");\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reserve factor change failed.\n return fail(Error(error), FailureInfo.SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED);\n }\n // _setReserveFactorFresh emits reserve-factor-specific logs on errors, so we don't need to.\n return _setReserveFactorFresh(newReserveFactorMantissa_);\n }\n\n /**\n * @notice Sets the address of the access control manager of this contract\n * @dev Admin function to set the access control address\n * @param newAccessControlManagerAddress New address for the access control\n * @return uint 0=success, otherwise will revert\n */\n function setAccessControlManager(address newAccessControlManagerAddress) external returns (uint) {\n // Check caller is admin\n ensureAdmin(msg.sender);\n\n ensureNonZeroAddress(newAccessControlManagerAddress);\n\n emit NewAccessControlManager(accessControlManager, newAccessControlManagerAddress);\n accessControlManager = newAccessControlManagerAddress;\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Accrues interest and reduces reserves by transferring to protocol share reserve\n * @param reduceAmount_ Amount of reduction to reserves\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits ReservesReduced event\n function _reduceReserves(uint reduceAmount_) external nonReentrant returns (uint) {\n ensureAllowed(\"_reduceReserves(uint256)\");\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed.\n return fail(Error(error), FailureInfo.REDUCE_RESERVES_ACCRUE_INTEREST_FAILED);\n }\n\n // If reserves were reduced in accrueInterest\n if (reduceReservesBlockNumber == block.number) return (uint(Error.NO_ERROR));\n // _reduceReservesFresh emits reserve-reduction-specific logs on errors, so we don't need to.\n return _reduceReservesFresh(reduceAmount_);\n }\n\n /**\n * @notice Get the current allowance from `owner` for `spender`\n * @param owner The address of the account which owns the tokens to be spent\n * @param spender The address of the account which may transfer tokens\n * @return The number of tokens allowed to be spent (-1 means infinite)\n */\n function allowance(address owner, address spender) external view returns (uint256) {\n return transferAllowances[owner][spender];\n }\n\n /**\n * @notice Get the token balance of the `owner`\n * @param owner The address of the account to query\n * @return The number of tokens owned by `owner`\n */\n function balanceOf(address owner) external view returns (uint256) {\n return accountTokens[owner];\n }\n\n /**\n * @notice Get a snapshot of the account's balances, and the cached exchange rate\n * @dev This is used by comptroller to more efficiently perform liquidity checks.\n * @param account Address of the account to snapshot\n * @return (possible error, token balance, borrow balance, exchange rate mantissa)\n */\n function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) {\n uint vTokenBalance = accountTokens[account];\n uint borrowBalance;\n uint exchangeRateMantissa;\n\n MathError mErr;\n\n (mErr, borrowBalance) = borrowBalanceStoredInternal(account);\n if (mErr != MathError.NO_ERROR) {\n return (uint(Error.MATH_ERROR), 0, 0, 0);\n }\n\n (mErr, exchangeRateMantissa) = exchangeRateStoredInternal();\n if (mErr != MathError.NO_ERROR) {\n return (uint(Error.MATH_ERROR), 0, 0, 0);\n }\n\n return (uint(Error.NO_ERROR), vTokenBalance, borrowBalance, exchangeRateMantissa);\n }\n\n /**\n * @notice Returns the current per-block supply interest rate for this vToken\n * @return The supply interest rate per block, scaled by 1e18\n */\n function supplyRatePerBlock() external view returns (uint) {\n return interestRateModel.getSupplyRate(getCashPrior(), totalBorrows, totalReserves, reserveFactorMantissa);\n }\n\n /**\n * @notice Returns the current per-block borrow interest rate for this vToken\n * @return The borrow interest rate per block, scaled by 1e18\n */\n function borrowRatePerBlock() external view returns (uint) {\n return interestRateModel.getBorrowRate(getCashPrior(), totalBorrows, totalReserves);\n }\n\n /**\n * @notice Get cash balance of this vToken in the underlying asset\n * @return The quantity of underlying asset owned by this contract\n */\n function getCash() external view returns (uint) {\n return getCashPrior();\n }\n\n /**\n * @notice Governance function to set new threshold of block difference after which funds will be sent to the protocol share reserve\n * @param newReduceReservesBlockDelta_ block difference value\n */\n function setReduceReservesBlockDelta(uint256 newReduceReservesBlockDelta_) external {\n require(newReduceReservesBlockDelta_ > 0, \"Invalid Input\");\n ensureAllowed(\"setReduceReservesBlockDelta(uint256)\");\n emit NewReduceReservesBlockDelta(reduceReservesBlockDelta, newReduceReservesBlockDelta_);\n reduceReservesBlockDelta = newReduceReservesBlockDelta_;\n }\n\n /**\n * @notice Sets protocol share reserve contract address\n * @param protcolShareReserve_ The address of protocol share reserve contract\n */\n function setProtocolShareReserve(address payable protcolShareReserve_) external {\n // Check caller is admin\n ensureAdmin(msg.sender);\n ensureNonZeroAddress(protcolShareReserve_);\n emit NewProtocolShareReserve(protocolShareReserve, protcolShareReserve_);\n protocolShareReserve = protcolShareReserve_;\n }\n\n /**\n * @notice Initialize the money market\n * @param comptroller_ The address of the Comptroller\n * @param interestRateModel_ The address of the interest rate model\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\n * @param name_ EIP-20 name of this token\n * @param symbol_ EIP-20 symbol of this token\n * @param decimals_ EIP-20 decimal precision of this token\n */\n function initialize(\n ComptrollerInterface comptroller_,\n InterestRateModel interestRateModel_,\n uint initialExchangeRateMantissa_,\n string memory name_,\n string memory symbol_,\n uint8 decimals_\n ) public {\n ensureAdmin(msg.sender);\n require(accrualBlockNumber == 0 && borrowIndex == 0, \"market may only be initialized once\");\n\n // Set initial exchange rate\n initialExchangeRateMantissa = initialExchangeRateMantissa_;\n require(initialExchangeRateMantissa > 0, \"initial exchange rate must be greater than zero.\");\n\n // Set the comptroller\n uint err = _setComptroller(comptroller_);\n require(err == uint(Error.NO_ERROR), \"setting comptroller failed\");\n\n // Initialize block number and borrow index (block number mocks depend on comptroller being set)\n accrualBlockNumber = block.number;\n borrowIndex = mantissaOne;\n\n // Set the interest rate model (depends on block number / borrow index)\n err = _setInterestRateModelFresh(interestRateModel_);\n require(err == uint(Error.NO_ERROR), \"setting interest rate model failed\");\n\n name = name_;\n symbol = symbol_;\n decimals = decimals_;\n\n // The counter starts true to prevent changing it from zero to non-zero (i.e. smaller cost/refund)\n _notEntered = true;\n }\n\n /**\n * @notice Accrue interest then return the up-to-date exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateCurrent() public nonReentrant returns (uint) {\n require(accrueInterest() == uint(Error.NO_ERROR), \"accrue interest failed\");\n return exchangeRateStored();\n }\n\n /**\n * @notice Applies accrued interest to total borrows and reserves\n * @dev This calculates interest accrued from the last checkpointed block\n * up to the current block and writes new checkpoint to storage and\n * reduce spread reserves to protocol share reserve\n * if currentBlock - reduceReservesBlockNumber >= blockDelta\n */\n // @custom:event Emits AccrueInterest event\n function accrueInterest() public returns (uint) {\n /* Remember the initial block number */\n uint currentBlockNumber = block.number;\n uint accrualBlockNumberPrior = accrualBlockNumber;\n\n /* Short-circuit accumulating 0 interest */\n if (accrualBlockNumberPrior == currentBlockNumber) {\n return uint(Error.NO_ERROR);\n }\n\n /* Read the previous values out of storage */\n uint cashPrior = getCashPrior();\n uint borrowsPrior = totalBorrows;\n uint reservesPrior = totalReserves;\n uint borrowIndexPrior = borrowIndex;\n\n /* Calculate the current borrow interest rate */\n uint borrowRateMantissa = interestRateModel.getBorrowRate(cashPrior, borrowsPrior, reservesPrior);\n require(borrowRateMantissa <= borrowRateMaxMantissa, \"borrow rate is absurdly high\");\n\n /* Calculate the number of blocks elapsed since the last accrual */\n (MathError mathErr, uint blockDelta) = subUInt(currentBlockNumber, accrualBlockNumberPrior);\n ensureNoMathError(mathErr);\n\n /*\n * Calculate the interest accumulated into borrows and reserves and the new index:\n * simpleInterestFactor = borrowRate * blockDelta\n * interestAccumulated = simpleInterestFactor * totalBorrows\n * totalBorrowsNew = interestAccumulated + totalBorrows\n * totalReservesNew = interestAccumulated * reserveFactor + totalReserves\n * borrowIndexNew = simpleInterestFactor * borrowIndex + borrowIndex\n */\n\n Exp memory simpleInterestFactor;\n uint interestAccumulated;\n uint totalBorrowsNew;\n uint totalReservesNew;\n uint borrowIndexNew;\n\n (mathErr, simpleInterestFactor) = mulScalar(Exp({ mantissa: borrowRateMantissa }), blockDelta);\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n (mathErr, interestAccumulated) = mulScalarTruncate(simpleInterestFactor, borrowsPrior);\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n (mathErr, totalBorrowsNew) = addUInt(interestAccumulated, borrowsPrior);\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n (mathErr, totalReservesNew) = mulScalarTruncateAddUInt(\n Exp({ mantissa: reserveFactorMantissa }),\n interestAccumulated,\n reservesPrior\n );\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n (mathErr, borrowIndexNew) = mulScalarTruncateAddUInt(simpleInterestFactor, borrowIndexPrior, borrowIndexPrior);\n if (mathErr != MathError.NO_ERROR) {\n return\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\n uint(mathErr)\n );\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n accrualBlockNumber = currentBlockNumber;\n borrowIndex = borrowIndexNew;\n totalBorrows = totalBorrowsNew;\n totalReserves = totalReservesNew;\n\n (mathErr, blockDelta) = subUInt(currentBlockNumber, reduceReservesBlockNumber);\n ensureNoMathError(mathErr);\n if (blockDelta >= reduceReservesBlockDelta) {\n reduceReservesBlockNumber = currentBlockNumber;\n if (cashPrior < totalReservesNew) {\n _reduceReservesFresh(cashPrior);\n } else {\n _reduceReservesFresh(totalReservesNew);\n }\n }\n\n /* We emit an AccrueInterest event */\n emit AccrueInterest(cashPrior, interestAccumulated, borrowIndexNew, totalBorrowsNew);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets a new comptroller for the market\n * @dev Admin function to set a new comptroller\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // @custom:event Emits NewComptroller event\n function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) {\n // Check caller is admin\n ensureAdmin(msg.sender);\n\n ComptrollerInterface oldComptroller = comptroller;\n // Ensure invoke comptroller.isComptroller() returns true\n require(newComptroller.isComptroller(), \"marker method returned false\");\n\n // Set market's comptroller to newComptroller\n comptroller = newComptroller;\n\n // Emit NewComptroller(oldComptroller, newComptroller)\n emit NewComptroller(oldComptroller, newComptroller);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Accrues interest and updates the interest rate model using _setInterestRateModelFresh\n * @dev Governance function to accrue interest and update the interest rate model\n * @param newInterestRateModel_ The new interest rate model to use\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _setInterestRateModel(InterestRateModel newInterestRateModel_) public returns (uint) {\n ensureAllowed(\"_setInterestRateModel(address)\");\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted change of interest rate model failed\n return fail(Error(error), FailureInfo.SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED);\n }\n // _setInterestRateModelFresh emits interest-rate-model-update-specific logs on errors, so we don't need to.\n return _setInterestRateModelFresh(newInterestRateModel_);\n }\n\n /**\n * @notice Calculates the exchange rate from the underlying to the VToken\n * @dev This function does not accrue interest before calculating the exchange rate\n * @return Calculated exchange rate scaled by 1e18\n */\n function exchangeRateStored() public view returns (uint) {\n (MathError err, uint result) = exchangeRateStoredInternal();\n ensureNoMathError(err);\n return result;\n }\n\n /**\n * @notice Return the borrow balance of account based on stored data\n * @param account The address whose balance should be calculated\n * @return The calculated balance\n */\n function borrowBalanceStored(address account) public view returns (uint) {\n (MathError err, uint result) = borrowBalanceStoredInternal(account);\n ensureNoMathError(err);\n return result;\n }\n\n /**\n * @notice Transfers `tokens` tokens from `src` to `dst` by `spender`\n * @dev Called by both `transfer` and `transferFrom` internally\n * @param spender The address of the account performing the transfer\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param tokens The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferTokens(address spender, address src, address dst, uint tokens) internal returns (uint) {\n /* Fail if transfer not allowed */\n uint allowed = comptroller.transferAllowed(address(this), src, dst, tokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.TRANSFER_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Do not allow self-transfers */\n if (src == dst) {\n return fail(Error.BAD_INPUT, FailureInfo.TRANSFER_NOT_ALLOWED);\n }\n\n /* Get the allowance, infinite for the account owner */\n uint startingAllowance = 0;\n if (spender == src) {\n startingAllowance = uint(-1);\n } else {\n startingAllowance = transferAllowances[src][spender];\n }\n\n /* Do the calculations, checking for {under,over}flow */\n MathError mathErr;\n uint allowanceNew;\n uint srvTokensNew;\n uint dstTokensNew;\n\n (mathErr, allowanceNew) = subUInt(startingAllowance, tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ALLOWED);\n }\n\n (mathErr, srvTokensNew) = subUInt(accountTokens[src], tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ENOUGH);\n }\n\n (mathErr, dstTokensNew) = addUInt(accountTokens[dst], tokens);\n if (mathErr != MathError.NO_ERROR) {\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_TOO_MUCH);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n accountTokens[src] = srvTokensNew;\n accountTokens[dst] = dstTokensNew;\n\n /* Eat some of the allowance (if necessary) */\n if (startingAllowance != uint(-1)) {\n transferAllowances[src][spender] = allowanceNew;\n }\n\n /* We emit a Transfer event */\n emit Transfer(src, dst, tokens);\n\n comptroller.transferVerify(address(this), src, dst, tokens);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Sender supplies assets into the market and receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintInternal(uint mintAmount) internal nonReentrant returns (uint, uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted mint failed\n return (fail(Error(error), FailureInfo.MINT_ACCRUE_INTEREST_FAILED), 0);\n }\n // mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to\n return mintFresh(msg.sender, mintAmount);\n }\n\n /**\n * @notice User supplies assets into the market and receives vTokens in exchange\n * @dev Assumes interest has already been accrued up to the current block\n * @param minter The address of the account which is supplying the assets\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintFresh(address minter, uint mintAmount) internal returns (uint, uint) {\n /* Fail if mint not allowed */\n uint allowed = comptroller.mintAllowed(address(this), minter, mintAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\n }\n\n MintLocalVars memory vars;\n\n (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();\n if (vars.mathErr != MathError.NO_ERROR) {\n return (failOpaque(Error.MATH_ERROR, FailureInfo.MINT_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr)), 0);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call `doTransferIn` for the minter and the mintAmount.\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\n * side-effects occurred. The function returns the amount actually transferred,\n * in case of a fee. On success, the vToken holds an additional `actualMintAmount`\n * of cash.\n */\n vars.actualMintAmount = doTransferIn(minter, mintAmount);\n\n /*\n * We get the current exchange rate and calculate the number of vTokens to be minted:\n * mintTokens = actualMintAmount / exchangeRate\n */\n\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\n vars.actualMintAmount,\n Exp({ mantissa: vars.exchangeRateMantissa })\n );\n ensureNoMathError(vars.mathErr);\n\n /*\n * We calculate the new total supply of vTokens and minter token balance, checking for overflow:\n * totalSupplyNew = totalSupply + mintTokens\n * accountTokensNew = accountTokens[minter] + mintTokens\n */\n (vars.mathErr, vars.totalSupplyNew) = addUInt(totalSupply, vars.mintTokens);\n ensureNoMathError(vars.mathErr);\n (vars.mathErr, vars.accountTokensNew) = addUInt(accountTokens[minter], vars.mintTokens);\n ensureNoMathError(vars.mathErr);\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[minter] = vars.accountTokensNew;\n\n /* We emit a Mint event, and a Transfer event */\n emit Mint(minter, vars.actualMintAmount, vars.mintTokens, vars.accountTokensNew);\n emit Transfer(address(this), minter, vars.mintTokens);\n\n /* We call the defense and prime accrue interest hook */\n comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);\n\n return (uint(Error.NO_ERROR), vars.actualMintAmount);\n }\n\n /**\n * @notice Sender supplies assets into the market and receiver receives vTokens in exchange\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param receiver The address of the account which is receiving the vTokens\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintBehalfInternal(address receiver, uint mintAmount) internal nonReentrant returns (uint, uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted mintBehalf failed\n return (fail(Error(error), FailureInfo.MINT_ACCRUE_INTEREST_FAILED), 0);\n }\n // mintBelahfFresh emits the actual Mint event if successful and logs on errors, so we don't need to\n return mintBehalfFresh(msg.sender, receiver, mintAmount);\n }\n\n /**\n * @notice Payer supplies assets into the market and receiver receives vTokens in exchange\n * @dev Assumes interest has already been accrued up to the current block\n * @param payer The address of the account which is paying the underlying token\n * @param receiver The address of the account which is receiving vToken\n * @param mintAmount The amount of the underlying asset to supply\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\n */\n function mintBehalfFresh(address payer, address receiver, uint mintAmount) internal returns (uint, uint) {\n ensureNonZeroAddress(receiver);\n /* Fail if mint not allowed */\n uint allowed = comptroller.mintAllowed(address(this), receiver, mintAmount);\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\n }\n\n MintLocalVars memory vars;\n\n (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();\n if (vars.mathErr != MathError.NO_ERROR) {\n return (failOpaque(Error.MATH_ERROR, FailureInfo.MINT_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr)), 0);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call `doTransferIn` for the payer and the mintAmount.\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\n * side-effects occurred. The function returns the amount actually transferred,\n * in case of a fee. On success, the vToken holds an additional `actualMintAmount`\n * of cash.\n */\n vars.actualMintAmount = doTransferIn(payer, mintAmount);\n\n /*\n * We get the current exchange rate and calculate the number of vTokens to be minted:\n * mintTokens = actualMintAmount / exchangeRate\n */\n\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\n vars.actualMintAmount,\n Exp({ mantissa: vars.exchangeRateMantissa })\n );\n ensureNoMathError(vars.mathErr);\n\n /*\n * We calculate the new total supply of vTokens and receiver token balance, checking for overflow:\n * totalSupplyNew = totalSupply + mintTokens\n * accountTokensNew = accountTokens[receiver] + mintTokens\n */\n (vars.mathErr, vars.totalSupplyNew) = addUInt(totalSupply, vars.mintTokens);\n ensureNoMathError(vars.mathErr);\n\n (vars.mathErr, vars.accountTokensNew) = addUInt(accountTokens[receiver], vars.mintTokens);\n ensureNoMathError(vars.mathErr);\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[receiver] = vars.accountTokensNew;\n\n /* We emit a MintBehalf event, and a Transfer event */\n emit MintBehalf(payer, receiver, vars.actualMintAmount, vars.mintTokens, vars.accountTokensNew);\n emit Transfer(address(this), receiver, vars.mintTokens);\n\n /* We call the defense and prime accrue interest hook */\n comptroller.mintVerify(address(this), receiver, vars.actualMintAmount, vars.mintTokens);\n\n return (uint(Error.NO_ERROR), vars.actualMintAmount);\n }\n\n /**\n * @notice Redeemer redeems vTokens in exchange for the underlying assets, transferred to the receiver. Redeemer and receiver can be the same\n * address, or different addresses if the receiver was previously approved by the redeemer as a valid delegate (see MarketFacet.updateDelegate)\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemer The address of the account which is redeeming the tokens\n * @param receiver The receiver of the tokens\n * @param redeemTokens The number of vTokens to redeem into underlying\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function redeemInternal(\n address redeemer,\n address payable receiver,\n uint redeemTokens\n ) internal nonReentrant returns (uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed\n return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);\n }\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\n return redeemFresh(redeemer, receiver, redeemTokens, 0);\n }\n\n /**\n * @notice Sender redeems underlying assets on behalf of some other address. This function is only available\n * for senders, explicitly marked as delegates of the supplier using `comptroller.updateDelegate`\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\n * @param redeemer The address of the account which is redeeming the tokens\n * @param receiver The receiver of the tokens, if called by a delegate\n * @param redeemAmount The amount of underlying to receive from redeeming vTokens\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function redeemUnderlyingInternal(\n address redeemer,\n address payable receiver,\n uint redeemAmount\n ) internal nonReentrant returns (uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed\n return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);\n }\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\n return redeemFresh(redeemer, receiver, 0, redeemAmount);\n }\n\n /**\n * @notice Redeemer redeems vTokens in exchange for the underlying assets, transferred to the receiver. Redeemer and receiver can be the same\n * address, or different addresses if the receiver was previously approved by the redeemer as a valid delegate (see MarketFacet.updateDelegate)\n * @dev Assumes interest has already been accrued up to the current block\n * @param redeemer The address of the account which is redeeming the tokens\n * @param receiver The receiver of the tokens\n * @param redeemTokensIn The number of vTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)\n * @param redeemAmountIn The number of underlying tokens to receive from redeeming vTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n // solhint-disable-next-line code-complexity\n function redeemFresh(\n address redeemer,\n address payable receiver,\n uint redeemTokensIn,\n uint redeemAmountIn\n ) internal returns (uint) {\n require(redeemTokensIn == 0 || redeemAmountIn == 0, \"one of redeemTokensIn or redeemAmountIn must be zero\");\n\n RedeemLocalVars memory vars;\n\n /* exchangeRate = invoke Exchange Rate Stored() */\n (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();\n ensureNoMathError(vars.mathErr);\n\n /* If redeemTokensIn > 0: */\n if (redeemTokensIn > 0) {\n /*\n * We calculate the exchange rate and the amount of underlying to be redeemed:\n * redeemTokens = redeemTokensIn\n * redeemAmount = redeemTokensIn x exchangeRateCurrent\n */\n vars.redeemTokens = redeemTokensIn;\n\n (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(\n Exp({ mantissa: vars.exchangeRateMantissa }),\n redeemTokensIn\n );\n ensureNoMathError(vars.mathErr);\n } else {\n /*\n * We get the current exchange rate and calculate the amount to be redeemed:\n * redeemTokens = redeemAmountIn / exchangeRate\n * redeemAmount = redeemAmountIn\n */\n\n (vars.mathErr, vars.redeemTokens) = divScalarByExpTruncate(\n redeemAmountIn,\n Exp({ mantissa: vars.exchangeRateMantissa })\n );\n ensureNoMathError(vars.mathErr);\n\n vars.redeemAmount = redeemAmountIn;\n }\n\n /* Fail if redeem not allowed */\n uint allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);\n if (allowed != 0) {\n revert(\"math error\");\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n revert(\"math error\");\n }\n\n /*\n * We calculate the new total supply and redeemer balance, checking for underflow:\n * totalSupplyNew = totalSupply - redeemTokens\n * accountTokensNew = accountTokens[redeemer] - redeemTokens\n */\n (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);\n ensureNoMathError(vars.mathErr);\n\n (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);\n ensureNoMathError(vars.mathErr);\n\n /* Fail gracefully if protocol has insufficient cash */\n if (getCashPrior() < vars.redeemAmount) {\n revert(\"math error\");\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write previously calculated values into storage */\n totalSupply = vars.totalSupplyNew;\n accountTokens[redeemer] = vars.accountTokensNew;\n\n /*\n * We invoke doTransferOut for the receiver and the redeemAmount.\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\n * On success, the vToken has redeemAmount less of cash.\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n */\n\n uint feeAmount;\n uint remainedAmount;\n if (IComptroller(address(comptroller)).treasuryPercent() != 0) {\n (vars.mathErr, feeAmount) = mulUInt(\n vars.redeemAmount,\n IComptroller(address(comptroller)).treasuryPercent()\n );\n ensureNoMathError(vars.mathErr);\n\n (vars.mathErr, feeAmount) = divUInt(feeAmount, 1e18);\n ensureNoMathError(vars.mathErr);\n\n (vars.mathErr, remainedAmount) = subUInt(vars.redeemAmount, feeAmount);\n ensureNoMathError(vars.mathErr);\n\n doTransferOut(address(uint160(IComptroller(address(comptroller)).treasuryAddress())), feeAmount);\n\n emit RedeemFee(redeemer, feeAmount, vars.redeemTokens);\n } else {\n remainedAmount = vars.redeemAmount;\n }\n\n doTransferOut(receiver, remainedAmount);\n\n /* We emit a Transfer event, and a Redeem event */\n emit Transfer(redeemer, address(this), vars.redeemTokens);\n emit Redeem(redeemer, remainedAmount, vars.redeemTokens, vars.accountTokensNew);\n\n /* We call the defense and prime accrue interest hook */\n comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Receiver gets the borrow on behalf of the borrower address\n * @param borrower The borrower, on behalf of whom to borrow\n * @param receiver The account that would receive the funds (can be the same as the borrower)\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function borrowInternal(\n address borrower,\n address payable receiver,\n uint borrowAmount\n ) internal nonReentrant returns (uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed\n return fail(Error(error), FailureInfo.BORROW_ACCRUE_INTEREST_FAILED);\n }\n // borrowFresh emits borrow-specific logs on errors, so we don't need to\n return borrowFresh(borrower, receiver, borrowAmount);\n }\n\n /**\n * @notice Receiver gets the borrow on behalf of the borrower address\n * @dev Before calling this function, ensure that the interest has been accrued\n * @param borrower The borrower, on behalf of whom to borrow\n * @param receiver The account that would receive the funds (can be the same as the borrower)\n * @param borrowAmount The amount of the underlying asset to borrow\n * @return uint Returns 0 on success, otherwise revert (see ErrorReporter.sol for details).\n */\n function borrowFresh(address borrower, address payable receiver, uint borrowAmount) internal returns (uint) {\n /* Revert if borrow not allowed */\n uint allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);\n if (allowed != 0) {\n revert(\"math error\");\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n revert(\"math error\");\n }\n\n /* Revert if protocol has insufficient underlying cash */\n if (getCashPrior() < borrowAmount) {\n revert(\"math error\");\n }\n\n BorrowLocalVars memory vars;\n\n /*\n * We calculate the new borrower and total borrow balances, failing on overflow:\n * accountBorrowsNew = accountBorrows + borrowAmount\n * totalBorrowsNew = totalBorrows + borrowAmount\n */\n (vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower);\n ensureNoMathError(vars.mathErr);\n\n (vars.mathErr, vars.accountBorrowsNew) = addUInt(vars.accountBorrows, borrowAmount);\n ensureNoMathError(vars.mathErr);\n\n (vars.mathErr, vars.totalBorrowsNew) = addUInt(totalBorrows, borrowAmount);\n ensureNoMathError(vars.mathErr);\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\n accountBorrows[borrower].interestIndex = borrowIndex;\n totalBorrows = vars.totalBorrowsNew;\n\n /*\n * We invoke doTransferOut for the receiver and the borrowAmount.\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\n * On success, the vToken borrowAmount less of cash.\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n */\n doTransferOut(receiver, borrowAmount);\n\n /* We emit a Borrow event */\n emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\n\n /* We call the defense and prime accrue interest hook */\n comptroller.borrowVerify(address(this), borrower, borrowAmount);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Sender repays their own borrow\n * @param repayAmount The amount to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowInternal(uint repayAmount) internal nonReentrant returns (uint, uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed\n return (fail(Error(error), FailureInfo.REPAY_BORROW_ACCRUE_INTEREST_FAILED), 0);\n }\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\n return repayBorrowFresh(msg.sender, msg.sender, repayAmount);\n }\n\n /**\n * @notice Sender repays a borrow belonging to another borrowing account\n * @param borrower The account with the debt being payed off\n * @param repayAmount The amount to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowBehalfInternal(address borrower, uint repayAmount) internal nonReentrant returns (uint, uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed\n return (fail(Error(error), FailureInfo.REPAY_BEHALF_ACCRUE_INTEREST_FAILED), 0);\n }\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\n return repayBorrowFresh(msg.sender, borrower, repayAmount);\n }\n\n /**\n * @notice Borrows are repaid by another user (possibly the borrower).\n * @param payer The account paying off the borrow\n * @param borrower The account with the debt being payed off\n * @param repayAmount The amount of undelrying tokens being returned\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function repayBorrowFresh(address payer, address borrower, uint repayAmount) internal returns (uint, uint) {\n /* Fail if repayBorrow not allowed */\n uint allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount);\n if (allowed != 0) {\n return (\n failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_BORROW_COMPTROLLER_REJECTION, allowed),\n 0\n );\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0);\n }\n\n RepayBorrowLocalVars memory vars;\n\n /* We remember the original borrowerIndex for verification purposes */\n vars.borrowerIndex = accountBorrows[borrower].interestIndex;\n\n /* We fetch the amount the borrower owes, with accumulated interest */\n (vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower);\n if (vars.mathErr != MathError.NO_ERROR) {\n return (\n failOpaque(\n Error.MATH_ERROR,\n FailureInfo.REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\n uint(vars.mathErr)\n ),\n 0\n );\n }\n\n /* If repayAmount == -1, repayAmount = accountBorrows */\n if (repayAmount == uint(-1)) {\n vars.repayAmount = vars.accountBorrows;\n } else {\n vars.repayAmount = repayAmount;\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call doTransferIn for the payer and the repayAmount\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\n * On success, the vToken holds an additional repayAmount of cash.\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\n * it returns the amount actually transferred, in case of a fee.\n */\n vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount);\n\n /*\n * We calculate the new borrower and total borrow balances, failing on underflow:\n * accountBorrowsNew = accountBorrows - actualRepayAmount\n * totalBorrowsNew = totalBorrows - actualRepayAmount\n */\n (vars.mathErr, vars.accountBorrowsNew) = subUInt(vars.accountBorrows, vars.actualRepayAmount);\n ensureNoMathError(vars.mathErr);\n\n (vars.mathErr, vars.totalBorrowsNew) = subUInt(totalBorrows, vars.actualRepayAmount);\n ensureNoMathError(vars.mathErr);\n\n /* We write the previously calculated values into storage */\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\n accountBorrows[borrower].interestIndex = borrowIndex;\n totalBorrows = vars.totalBorrowsNew;\n\n /* We emit a RepayBorrow event */\n emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\n\n /* We call the defense and prime accrue interest hook */\n comptroller.repayBorrowVerify(address(this), payer, borrower, vars.actualRepayAmount, vars.borrowerIndex);\n\n return (uint(Error.NO_ERROR), vars.actualRepayAmount);\n }\n\n /**\n * @notice The sender liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this vToken to be liquidated\n * @param vTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n function liquidateBorrowInternal(\n address borrower,\n uint repayAmount,\n VTokenInterface vTokenCollateral\n ) internal nonReentrant returns (uint, uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted liquidation failed\n return (fail(Error(error), FailureInfo.LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED), 0);\n }\n\n error = vTokenCollateral.accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted liquidation failed\n return (fail(Error(error), FailureInfo.LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED), 0);\n }\n\n // liquidateBorrowFresh emits borrow-specific logs on errors, so we don't need to\n return liquidateBorrowFresh(msg.sender, borrower, repayAmount, vTokenCollateral);\n }\n\n /**\n * @notice The liquidator liquidates the borrowers collateral.\n * The collateral seized is transferred to the liquidator.\n * @param borrower The borrower of this vToken to be liquidated\n * @param liquidator The address repaying the borrow and seizing collateral\n * @param vTokenCollateral The market in which to seize collateral from the borrower\n * @param repayAmount The amount of the underlying borrowed asset to repay\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\n */\n // solhint-disable-next-line code-complexity\n function liquidateBorrowFresh(\n address liquidator,\n address borrower,\n uint repayAmount,\n VTokenInterface vTokenCollateral\n ) internal returns (uint, uint) {\n /* Fail if liquidate not allowed */\n uint allowed = comptroller.liquidateBorrowAllowed(\n address(this),\n address(vTokenCollateral),\n liquidator,\n borrower,\n repayAmount\n );\n if (allowed != 0) {\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0);\n }\n\n /* Verify market's block number equals current block number */\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0);\n }\n\n /* Verify vTokenCollateral market's block number equals current block number */\n if (vTokenCollateral.accrualBlockNumber() != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0);\n }\n\n /* Fail if repayAmount = 0 */\n if (repayAmount == 0) {\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0);\n }\n\n /* Fail if repayAmount = -1 */\n if (repayAmount == uint(-1)) {\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0);\n }\n\n /* Fail if repayBorrow fails */\n (uint repayBorrowError, uint actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount);\n if (repayBorrowError != uint(Error.NO_ERROR)) {\n return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We calculate the number of collateral tokens that will be seized */\n (uint amountSeizeError, uint seizeTokens) = comptroller.liquidateCalculateSeizeTokens(\n address(this),\n address(vTokenCollateral),\n actualRepayAmount\n );\n require(amountSeizeError == uint(Error.NO_ERROR), \"LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED\");\n\n /* Revert if borrower collateral token balance < seizeTokens */\n require(vTokenCollateral.balanceOf(borrower) >= seizeTokens, \"LIQUIDATE_SEIZE_TOO_MUCH\");\n\n // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call\n uint seizeError;\n if (address(vTokenCollateral) == address(this)) {\n seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens);\n } else {\n seizeError = vTokenCollateral.seize(liquidator, borrower, seizeTokens);\n }\n\n /* Revert if seize tokens fails (since we cannot be sure of side effects) */\n require(seizeError == uint(Error.NO_ERROR), \"token seizure failed\");\n\n /* We emit a LiquidateBorrow event */\n emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, address(vTokenCollateral), seizeTokens);\n\n /* We call the defense and prime accrue interest hook */\n comptroller.liquidateBorrowVerify(\n address(this),\n address(vTokenCollateral),\n liquidator,\n borrower,\n actualRepayAmount,\n seizeTokens\n );\n\n return (uint(Error.NO_ERROR), actualRepayAmount);\n }\n\n /**\n * @notice Transfers collateral tokens (this market) to the liquidator.\n * @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another vToken.\n * Its absolutely critical to use msg.sender as the seizer vToken and not a parameter.\n * @param seizerToken The contract seizing the collateral (i.e. borrowed vToken)\n * @param liquidator The account receiving seized collateral\n * @param borrower The account having collateral seized\n * @param seizeTokens The number of vTokens to seize\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function seizeInternal(\n address seizerToken,\n address liquidator,\n address borrower,\n uint seizeTokens\n ) internal returns (uint) {\n /* Fail if seize not allowed */\n uint allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);\n if (allowed != 0) {\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed);\n }\n\n /* Fail if borrower = liquidator */\n if (borrower == liquidator) {\n return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER);\n }\n\n MathError mathErr;\n uint borrowerTokensNew;\n uint liquidatorTokensNew;\n\n /*\n * We calculate the new borrower and liquidator token balances, failing on underflow/overflow:\n * borrowerTokensNew = accountTokens[borrower] - seizeTokens\n * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens\n */\n (mathErr, borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);\n if (mathErr != MathError.NO_ERROR) {\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint(mathErr));\n }\n\n (mathErr, liquidatorTokensNew) = addUInt(accountTokens[liquidator], seizeTokens);\n if (mathErr != MathError.NO_ERROR) {\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint(mathErr));\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /* We write the previously calculated values into storage */\n accountTokens[borrower] = borrowerTokensNew;\n accountTokens[liquidator] = liquidatorTokensNew;\n\n /* Emit a Transfer event */\n emit Transfer(borrower, liquidator, seizeTokens);\n\n /* We call the defense and prime accrue interest hook */\n comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Sets a new reserve factor for the protocol (requires fresh interest accrual)\n * @dev Governance function to set a new reserve factor\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _setReserveFactorFresh(uint newReserveFactorMantissa) internal returns (uint) {\n // Verify market's block number equals current block number\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_RESERVE_FACTOR_FRESH_CHECK);\n }\n\n // Check newReserveFactor ≤ maxReserveFactor\n if (newReserveFactorMantissa > reserveFactorMaxMantissa) {\n return fail(Error.BAD_INPUT, FailureInfo.SET_RESERVE_FACTOR_BOUNDS_CHECK);\n }\n\n uint oldReserveFactorMantissa = reserveFactorMantissa;\n reserveFactorMantissa = newReserveFactorMantissa;\n\n emit NewReserveFactor(oldReserveFactorMantissa, newReserveFactorMantissa);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Accrues interest and adds reserves by transferring from `msg.sender`\n * @param addAmount Amount of addition to reserves\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _addReservesInternal(uint addAmount) internal nonReentrant returns (uint) {\n uint error = accrueInterest();\n if (error != uint(Error.NO_ERROR)) {\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed.\n return fail(Error(error), FailureInfo.ADD_RESERVES_ACCRUE_INTEREST_FAILED);\n }\n\n // _addReservesFresh emits reserve-addition-specific logs on errors, so we don't need to.\n (error, ) = _addReservesFresh(addAmount);\n return error;\n }\n\n /**\n * @notice Add reserves by transferring from caller\n * @dev Requires fresh interest accrual\n * @param addAmount Amount of addition to reserves\n * @return (uint, uint) An error code (0=success, otherwise a failure (see ErrorReporter.sol for details)) and the actual amount added, net token fees\n */\n function _addReservesFresh(uint addAmount) internal returns (uint, uint) {\n // totalReserves + actualAddAmount\n uint totalReservesNew;\n uint actualAddAmount;\n\n // We fail gracefully unless market's block number equals current block number\n if (accrualBlockNumber != block.number) {\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.ADD_RESERVES_FRESH_CHECK), actualAddAmount);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n /*\n * We call doTransferIn for the caller and the addAmount\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\n * On success, the vToken holds an additional addAmount of cash.\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\n * it returns the amount actually transferred, in case of a fee.\n */\n\n actualAddAmount = doTransferIn(msg.sender, addAmount);\n\n totalReservesNew = totalReserves + actualAddAmount;\n\n /* Revert on overflow */\n require(totalReservesNew >= totalReserves, \"add reserves unexpected overflow\");\n\n // Store reserves[n+1] = reserves[n] + actualAddAmount\n totalReserves = totalReservesNew;\n\n /* Emit NewReserves(admin, actualAddAmount, reserves[n+1]) */\n emit ReservesAdded(msg.sender, actualAddAmount, totalReservesNew);\n\n /* Return (NO_ERROR, actualAddAmount) */\n return (uint(Error.NO_ERROR), actualAddAmount);\n }\n\n /**\n * @notice Reduces reserves by transferring to protocol share reserve contract\n * @dev Requires fresh interest accrual\n * @param reduceAmount Amount of reduction to reserves\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _reduceReservesFresh(uint reduceAmount) internal returns (uint) {\n if (reduceAmount == 0) {\n return uint(Error.NO_ERROR);\n }\n\n // We fail gracefully unless market's block number equals current block number\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDUCE_RESERVES_FRESH_CHECK);\n }\n\n // Fail gracefully if protocol has insufficient underlying cash\n if (getCashPrior() < reduceAmount) {\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDUCE_RESERVES_CASH_NOT_AVAILABLE);\n }\n\n // Check reduceAmount ≤ reserves[n] (totalReserves)\n if (reduceAmount > totalReserves) {\n return fail(Error.BAD_INPUT, FailureInfo.REDUCE_RESERVES_VALIDATION);\n }\n\n /////////////////////////\n // EFFECTS & INTERACTIONS\n // (No safe failures beyond this point)\n\n // totalReserves - reduceAmount\n uint totalReservesNew = totalReserves - reduceAmount;\n\n // Store reserves[n+1] = reserves[n] - reduceAmount\n totalReserves = totalReservesNew;\n\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\n doTransferOut(protocolShareReserve, reduceAmount);\n\n IProtocolShareReserveV5(protocolShareReserve).updateAssetsState(\n address(comptroller),\n underlying,\n IProtocolShareReserveV5.IncomeType.SPREAD\n );\n\n emit ReservesReduced(protocolShareReserve, reduceAmount, totalReservesNew);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice updates the interest rate model (requires fresh interest accrual)\n * @dev Governance function to update the interest rate model\n * @param newInterestRateModel the new interest rate model to use\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\n */\n function _setInterestRateModelFresh(InterestRateModel newInterestRateModel) internal returns (uint) {\n // Used to store old model for use in the event that is emitted on success\n InterestRateModel oldInterestRateModel;\n // We fail gracefully unless market's block number equals current block number\n if (accrualBlockNumber != block.number) {\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_INTEREST_RATE_MODEL_FRESH_CHECK);\n }\n\n // Track the market's current interest rate model\n oldInterestRateModel = interestRateModel;\n\n // Ensure invoke newInterestRateModel.isInterestRateModel() returns true\n require(newInterestRateModel.isInterestRateModel(), \"marker method returned false\");\n\n // Set the interest rate model to newInterestRateModel\n interestRateModel = newInterestRateModel;\n\n // Emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel)\n emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel);\n\n return uint(Error.NO_ERROR);\n }\n\n /*** Safe Token ***/\n\n /**\n * @dev Performs a transfer in, reverting upon failure. Returns the amount actually transferred to the protocol, in case of a fee.\n * This may revert due to insufficient balance or insufficient allowance.\n */\n function doTransferIn(address from, uint amount) internal returns (uint);\n\n /**\n * @dev Performs a transfer out, ideally returning an explanatory error code upon failure rather than reverting.\n * If caller has not called checked protocol's balance, may revert due to insufficient cash held in the contract.\n * If caller has checked protocol's balance, and verified it is >= amount, this should not revert in normal conditions.\n */\n function doTransferOut(address payable to, uint amount) internal;\n\n /**\n * @notice Return the borrow balance of account based on stored data\n * @param account The address whose balance should be calculated\n * @return Tuple of error code and the calculated balance or 0 if error code is non-zero\n */\n function borrowBalanceStoredInternal(address account) internal view returns (MathError, uint) {\n /* Note: we do not assert that the market is up to date */\n MathError mathErr;\n uint principalTimesIndex;\n uint result;\n\n /* Get borrowBalance and borrowIndex */\n BorrowSnapshot storage borrowSnapshot = accountBorrows[account];\n\n /* If borrowBalance = 0 then borrowIndex is likely also 0.\n * Rather than failing the calculation with a division by 0, we immediately return 0 in this case.\n */\n if (borrowSnapshot.principal == 0) {\n return (MathError.NO_ERROR, 0);\n }\n\n /* Calculate new borrow balance using the interest index:\n * recentBorrowBalance = borrower.borrowBalance * market.borrowIndex / borrower.borrowIndex\n */\n (mathErr, principalTimesIndex) = mulUInt(borrowSnapshot.principal, borrowIndex);\n if (mathErr != MathError.NO_ERROR) {\n return (mathErr, 0);\n }\n\n (mathErr, result) = divUInt(principalTimesIndex, borrowSnapshot.interestIndex);\n if (mathErr != MathError.NO_ERROR) {\n return (mathErr, 0);\n }\n\n return (MathError.NO_ERROR, result);\n }\n\n /**\n * @notice Calculates the exchange rate from the underlying to the vToken\n * @dev This function does not accrue interest before calculating the exchange rate\n * @return Tuple of error code and calculated exchange rate scaled by 1e18\n */\n function exchangeRateStoredInternal() internal view returns (MathError, uint) {\n uint _totalSupply = totalSupply;\n if (_totalSupply == 0) {\n /*\n * If there are no tokens minted:\n * exchangeRate = initialExchangeRate\n */\n return (MathError.NO_ERROR, initialExchangeRateMantissa);\n } else {\n /*\n * Otherwise:\n * exchangeRate = (totalCash + totalBorrows - totalReserves) / totalSupply\n */\n uint totalCash = getCashPrior();\n uint cashPlusBorrowsMinusReserves;\n Exp memory exchangeRate;\n MathError mathErr;\n\n (mathErr, cashPlusBorrowsMinusReserves) = addThenSubUInt(totalCash, totalBorrows, totalReserves);\n if (mathErr != MathError.NO_ERROR) {\n return (mathErr, 0);\n }\n\n (mathErr, exchangeRate) = getExp(cashPlusBorrowsMinusReserves, _totalSupply);\n if (mathErr != MathError.NO_ERROR) {\n return (mathErr, 0);\n }\n\n return (MathError.NO_ERROR, exchangeRate.mantissa);\n }\n }\n\n function ensureAllowed(string memory functionSig) private view {\n require(\n IAccessControlManagerV5(accessControlManager).isAllowedToCall(msg.sender, functionSig),\n \"access denied\"\n );\n }\n\n function ensureAdmin(address caller_) private view {\n require(caller_ == admin, \"Unauthorized\");\n }\n\n function ensureNoMathError(MathError mErr) private pure {\n require(mErr == MathError.NO_ERROR, \"math error\");\n }\n\n function ensureNonZeroAddress(address address_) private pure {\n require(address_ != address(0), \"zero address\");\n }\n\n /*** Safe Token ***/\n\n /**\n * @notice Gets balance of this contract in terms of the underlying\n * @dev This excludes the value of the current message, if any\n * @return The quantity of underlying owned by this contract\n */\n function getCashPrior() internal view returns (uint);\n}\n" + }, + "contracts/Tokens/VTokens/VTokenInterfaces.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../../Comptroller/ComptrollerInterface.sol\";\nimport \"../../InterestRateModels/InterestRateModel.sol\";\n\ninterface IProtocolShareReserveV5 {\n enum IncomeType {\n SPREAD,\n LIQUIDATION\n }\n\n function updateAssetsState(address comptroller, address asset, IncomeType kind) external;\n}\n\ncontract VTokenStorageBase {\n /**\n * @notice Container for borrow balance information\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\n */\n struct BorrowSnapshot {\n uint principal;\n uint interestIndex;\n }\n\n /**\n * @dev Guard variable for re-entrancy checks\n */\n bool internal _notEntered;\n\n /**\n * @notice EIP-20 token name for this token\n */\n string public name;\n\n /**\n * @notice EIP-20 token symbol for this token\n */\n string public symbol;\n\n /**\n * @notice EIP-20 token decimals for this token\n */\n uint8 public decimals;\n\n /**\n * @notice Maximum borrow rate that can ever be applied (.0005% / block)\n */\n\n uint internal constant borrowRateMaxMantissa = 0.0005e16;\n\n /**\n * @notice Maximum fraction of interest that can be set aside for reserves\n */\n uint internal constant reserveFactorMaxMantissa = 1e18;\n\n /**\n * @notice Administrator for this contract\n */\n address payable public admin;\n\n /**\n * @notice Pending administrator for this contract\n */\n address payable public pendingAdmin;\n\n /**\n * @notice Contract which oversees inter-vToken operations\n */\n ComptrollerInterface public comptroller;\n\n /**\n * @notice Model which tells what the current interest rate should be\n */\n InterestRateModel public interestRateModel;\n\n /**\n * @notice Initial exchange rate used when minting the first VTokens (used when totalSupply = 0)\n */\n uint internal initialExchangeRateMantissa;\n\n /**\n * @notice Fraction of interest currently set aside for reserves\n */\n uint public reserveFactorMantissa;\n\n /**\n * @notice Block number that interest was last accrued at\n */\n uint public accrualBlockNumber;\n\n /**\n * @notice Accumulator of the total earned interest rate since the opening of the market\n */\n uint public borrowIndex;\n\n /**\n * @notice Total amount of outstanding borrows of the underlying in this market\n */\n uint public totalBorrows;\n\n /**\n * @notice Total amount of reserves of the underlying held in this market\n */\n uint public totalReserves;\n\n /**\n * @notice Total number of tokens in circulation\n */\n uint public totalSupply;\n\n /**\n * @notice Official record of token balances for each account\n */\n mapping(address => uint) internal accountTokens;\n\n /**\n * @notice Approved token transfer amounts on behalf of others\n */\n mapping(address => mapping(address => uint)) internal transferAllowances;\n\n /**\n * @notice Mapping of account addresses to outstanding borrow balances\n */\n mapping(address => BorrowSnapshot) internal accountBorrows;\n\n /**\n * @notice Underlying asset for this VToken\n */\n address public underlying;\n\n /**\n * @notice Implementation address for this contract\n */\n address public implementation;\n\n /**\n * @notice delta block after which reserves will be reduced\n */\n uint public reduceReservesBlockDelta;\n\n /**\n * @notice last block number at which reserves were reduced\n */\n uint public reduceReservesBlockNumber;\n\n /**\n * @notice address of protocol share reserve contract\n */\n address payable public protocolShareReserve;\n\n /**\n * @notice address of accessControlManager\n */\n\n address public accessControlManager;\n}\n\ncontract VTokenStorage is VTokenStorageBase {\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n\ncontract VTokenInterface is VTokenStorage {\n /**\n * @notice Indicator that this is a vToken contract (for inspection)\n */\n bool public constant isVToken = true;\n\n /*** Market Events ***/\n\n /**\n * @notice Event emitted when interest is accrued\n */\n event AccrueInterest(uint cashPrior, uint interestAccumulated, uint borrowIndex, uint totalBorrows);\n\n /**\n * @notice Event emitted when tokens are minted\n */\n event Mint(address minter, uint mintAmount, uint mintTokens, uint256 totalSupply);\n\n /**\n * @notice Event emitted when tokens are minted behalf by payer to receiver\n */\n event MintBehalf(address payer, address receiver, uint mintAmount, uint mintTokens, uint256 totalSupply);\n\n /**\n * @notice Event emitted when tokens are redeemed\n */\n event Redeem(address redeemer, uint redeemAmount, uint redeemTokens, uint256 totalSupply);\n\n /**\n * @notice Event emitted when tokens are redeemed and fee is transferred\n */\n event RedeemFee(address redeemer, uint feeAmount, uint redeemTokens);\n\n /**\n * @notice Event emitted when underlying is borrowed\n */\n event Borrow(address borrower, uint borrowAmount, uint accountBorrows, uint totalBorrows);\n\n /**\n * @notice Event emitted when a borrow is repaid\n */\n event RepayBorrow(address payer, address borrower, uint repayAmount, uint accountBorrows, uint totalBorrows);\n\n /**\n * @notice Event emitted when a borrow is liquidated\n */\n event LiquidateBorrow(\n address liquidator,\n address borrower,\n uint repayAmount,\n address vTokenCollateral,\n uint seizeTokens\n );\n\n /*** Admin Events ***/\n\n /**\n * @notice Event emitted when pendingAdmin is changed\n */\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\n\n /**\n * @notice Event emitted when pendingAdmin is accepted, which means admin has been updated\n */\n event NewAdmin(address oldAdmin, address newAdmin);\n\n /**\n * @notice Event emitted when comptroller is changed\n */\n event NewComptroller(ComptrollerInterface oldComptroller, ComptrollerInterface newComptroller);\n\n /**\n * @notice Event emitted when interestRateModel is changed\n */\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\n\n /**\n * @notice Event emitted when the reserve factor is changed\n */\n event NewReserveFactor(uint oldReserveFactorMantissa, uint newReserveFactorMantissa);\n\n /**\n * @notice Event emitted when the reserves are added\n */\n event ReservesAdded(address benefactor, uint addAmount, uint newTotalReserves);\n\n /**\n * @notice Event emitted when the reserves are reduced\n */\n event ReservesReduced(address protocolShareReserve, uint reduceAmount, uint newTotalReserves);\n\n /**\n * @notice EIP20 Transfer event\n */\n event Transfer(address indexed from, address indexed to, uint amount);\n\n /**\n * @notice EIP20 Approval event\n */\n event Approval(address indexed owner, address indexed spender, uint amount);\n\n /**\n * @notice Event emitted when block delta for reduce reserves get updated\n */\n event NewReduceReservesBlockDelta(uint256 oldReduceReservesBlockDelta, uint256 newReduceReservesBlockDelta);\n\n /**\n * @notice Event emitted when address of ProtocolShareReserve contract get updated\n */\n event NewProtocolShareReserve(address indexed oldProtocolShareReserve, address indexed newProtocolShareReserve);\n\n /**\n * @notice Failure event\n */\n event Failure(uint error, uint info, uint detail);\n\n /// @notice Emitted when access control address is changed by admin\n event NewAccessControlManager(address oldAccessControlAddress, address newAccessControlAddress);\n\n /*** User Interface ***/\n\n function transfer(address dst, uint amount) external returns (bool);\n\n function transferFrom(address src, address dst, uint amount) external returns (bool);\n\n function approve(address spender, uint amount) external returns (bool);\n\n function balanceOfUnderlying(address owner) external returns (uint);\n\n function totalBorrowsCurrent() external returns (uint);\n\n function borrowBalanceCurrent(address account) external returns (uint);\n\n function seize(address liquidator, address borrower, uint seizeTokens) external returns (uint);\n\n /*** Admin Function ***/\n function _setPendingAdmin(address payable newPendingAdmin) external returns (uint);\n\n /*** Admin Function ***/\n function _acceptAdmin() external returns (uint);\n\n /*** Admin Function ***/\n function _setReserveFactor(uint newReserveFactorMantissa) external returns (uint);\n\n /*** Admin Function ***/\n function _reduceReserves(uint reduceAmount) external returns (uint);\n\n function balanceOf(address owner) external view returns (uint);\n\n function allowance(address owner, address spender) external view returns (uint);\n\n function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint);\n\n function borrowRatePerBlock() external view returns (uint);\n\n function supplyRatePerBlock() external view returns (uint);\n\n function getCash() external view returns (uint);\n\n function exchangeRateCurrent() public returns (uint);\n\n function accrueInterest() public returns (uint);\n\n /*** Admin Function ***/\n function _setComptroller(ComptrollerInterface newComptroller) public returns (uint);\n\n /*** Admin Function ***/\n function _setInterestRateModel(InterestRateModel newInterestRateModel) public returns (uint);\n\n function borrowBalanceStored(address account) public view returns (uint);\n\n function exchangeRateStored() public view returns (uint);\n}\n\ncontract VBep20Interface {\n /*** User Interface ***/\n\n function mint(uint mintAmount) external returns (uint);\n\n function mintBehalf(address receiver, uint mintAmount) external returns (uint);\n\n function redeem(uint redeemTokens) external returns (uint);\n\n function redeemUnderlying(uint redeemAmount) external returns (uint);\n\n function borrow(uint borrowAmount) external returns (uint);\n\n function repayBorrow(uint repayAmount) external returns (uint);\n\n function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint);\n\n function liquidateBorrow(\n address borrower,\n uint repayAmount,\n VTokenInterface vTokenCollateral\n ) external returns (uint);\n\n /*** Admin Functions ***/\n\n function _addReserves(uint addAmount) external returns (uint);\n}\n\ncontract VDelegatorInterface {\n /**\n * @notice Emitted when implementation is changed\n */\n event NewImplementation(address oldImplementation, address newImplementation);\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n * @param allowResign Flag to indicate whether to call _resignImplementation on the old implementation\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n */\n function _setImplementation(\n address implementation_,\n bool allowResign,\n bytes memory becomeImplementationData\n ) public;\n}\n\ncontract VDelegateInterface {\n /**\n * @notice Called by the delegator on a delegate to initialize it for duty\n * @dev Should revert if any issues arise which make it unfit for delegation\n * @param data The encoded bytes data for any initialization\n */\n function _becomeImplementation(bytes memory data) public;\n\n /**\n * @notice Called by the delegator on a delegate to forfeit its responsibility\n */\n function _resignImplementation() public;\n}\n" + }, + "contracts/Tokens/XVS/IXVSVesting.sol": { + "content": "pragma solidity ^0.5.16;\n\ninterface IXVSVesting {\n /// @param _recipient Address of the Vesting. recipient entitled to claim the vested funds\n /// @param _amount Total number of tokens Vested\n function deposit(address _recipient, uint256 _amount) external;\n}\n" + }, + "contracts/Tokens/XVS/XVS.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../../Utils/Tokenlock.sol\";\n\ncontract XVS is Tokenlock {\n /// @notice BEP-20 token name for this token\n string public constant name = \"Venus\";\n\n /// @notice BEP-20 token symbol for this token\n string public constant symbol = \"XVS\";\n\n /// @notice BEP-20 token decimals for this token\n uint8 public constant decimals = 18;\n\n /// @notice Total number of tokens in circulation\n uint public constant totalSupply = 30000000e18; // 30 million XVS\n\n /// @notice Allowance amounts on behalf of others\n mapping(address => mapping(address => uint96)) internal allowances;\n\n /// @notice Official record of token balances for each account\n mapping(address => uint96) internal balances;\n\n /// @notice A record of each accounts delegate\n mapping(address => address) public delegates;\n\n /// @notice A checkpoint for marking number of votes from a given block\n struct Checkpoint {\n uint32 fromBlock;\n uint96 votes;\n }\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 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 /// @notice A record of states for signing / validating signatures\n mapping(address => uint) public nonces;\n\n /// @notice An event thats emitted when an account changes its delegate\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /// @notice An event thats emitted when a delegate account's vote balance changes\n event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);\n\n /// @notice The standard BEP-20 transfer event\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n /// @notice The standard BEP-20 approval event\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n /**\n * @notice Construct a new XVS token\n * @param account The initial account to grant all the tokens\n */\n constructor(address account) public {\n balances[account] = uint96(totalSupply);\n emit Transfer(address(0), account, totalSupply);\n }\n\n /**\n * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`\n * @param account The address of the account holding the funds\n * @param spender The address of the account spending the funds\n * @return The number of tokens approved\n */\n function allowance(address account, address spender) external view returns (uint) {\n return allowances[account][spender];\n }\n\n /**\n * @notice Approve `spender` to transfer up to `amount` from `src`\n * @dev This will overwrite the approval amount for `spender`\n * @param spender The address of the account which may transfer tokens\n * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)\n * @return Whether or not the approval succeeded\n */\n function approve(address spender, uint rawAmount) external validLock returns (bool) {\n uint96 amount;\n if (rawAmount == uint(-1)) {\n amount = uint96(-1);\n } else {\n amount = safe96(rawAmount, \"XVS::approve: amount exceeds 96 bits\");\n }\n\n allowances[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /**\n * @notice Get the number of tokens held by the `account`\n * @param account The address of the account to get the balance of\n * @return The number of tokens held\n */\n function balanceOf(address account) external view returns (uint) {\n return balances[account];\n }\n\n /**\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transfer(address dst, uint rawAmount) external validLock returns (bool) {\n uint96 amount = safe96(rawAmount, \"XVS::transfer: amount exceeds 96 bits\");\n _transferTokens(msg.sender, dst, amount);\n return true;\n }\n\n /**\n * @notice Transfer `amount` tokens from `src` to `dst`\n * @param src The address of the source account\n * @param dst The address of the destination account\n * @param rawAmount The number of tokens to transfer\n * @return Whether or not the transfer succeeded\n */\n function transferFrom(address src, address dst, uint rawAmount) external validLock returns (bool) {\n address spender = msg.sender;\n uint96 spenderAllowance = allowances[src][spender];\n uint96 amount = safe96(rawAmount, \"XVS::approve: amount exceeds 96 bits\");\n\n if (spender != src && spenderAllowance != uint96(-1)) {\n uint96 newAllowance = sub96(\n spenderAllowance,\n amount,\n \"XVS::transferFrom: transfer amount exceeds spender allowance\"\n );\n allowances[src][spender] = newAllowance;\n\n emit Approval(src, spender, newAllowance);\n }\n\n _transferTokens(src, dst, amount);\n return true;\n }\n\n /**\n * @notice Delegate votes from `msg.sender` to `delegatee`\n * @param delegatee The address to delegate votes to\n */\n function delegate(address delegatee) public validLock {\n return _delegate(msg.sender, delegatee);\n }\n\n /**\n * @notice Delegates votes from signatory to `delegatee`\n * @param delegatee The address to delegate votes to\n * @param nonce The contract state required to match the signature\n * @param expiry The time at which to expire the signature\n * @param v The recovery byte of the signature\n * @param r Half of the ECDSA signature pair\n * @param s Half of the ECDSA signature pair\n */\n function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public validLock {\n bytes32 domainSeparator = keccak256(\n abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this))\n );\n bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));\n bytes32 digest = keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n address signatory = ecrecover(digest, v, r, s);\n require(signatory != address(0), \"XVS::delegateBySig: invalid signature\");\n require(nonce == nonces[signatory]++, \"XVS::delegateBySig: invalid nonce\");\n require(now <= expiry, \"XVS::delegateBySig: signature expired\");\n return _delegate(signatory, delegatee);\n }\n\n /**\n * @notice Gets the current votes balance for `account`\n * @param account The address to get votes balance\n * @return The number of current votes for `account`\n */\n function getCurrentVotes(address account) external view returns (uint96) {\n uint32 nCheckpoints = numCheckpoints[account];\n return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;\n }\n\n /**\n * @notice Determine the prior number of votes for an account as of a block number\n * @dev Block number must be a finalized block or else this function will revert to prevent misinformation.\n * @param account The address of the account to check\n * @param blockNumber The block number to get the vote balance at\n * @return The number of votes the account had as of the given block\n */\n function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {\n require(blockNumber < block.number, \"XVS::getPriorVotes: not yet determined\");\n\n uint32 nCheckpoints = numCheckpoints[account];\n if (nCheckpoints == 0) {\n return 0;\n }\n\n // First check most recent balance\n if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {\n return checkpoints[account][nCheckpoints - 1].votes;\n }\n\n // Next check implicit zero balance\n if (checkpoints[account][0].fromBlock > blockNumber) {\n return 0;\n }\n\n uint32 lower = 0;\n uint32 upper = nCheckpoints - 1;\n while (upper > lower) {\n uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\n Checkpoint memory cp = checkpoints[account][center];\n if (cp.fromBlock == blockNumber) {\n return cp.votes;\n } else if (cp.fromBlock < blockNumber) {\n lower = center;\n } else {\n upper = center - 1;\n }\n }\n return checkpoints[account][lower].votes;\n }\n\n function _delegate(address delegator, address delegatee) internal {\n address currentDelegate = delegates[delegator];\n uint96 delegatorBalance = balances[delegator];\n delegates[delegator] = delegatee;\n\n emit DelegateChanged(delegator, currentDelegate, delegatee);\n\n _moveDelegates(currentDelegate, delegatee, delegatorBalance);\n }\n\n function _transferTokens(address src, address dst, uint96 amount) internal {\n require(src != address(0), \"XVS::_transferTokens: cannot transfer from the zero address\");\n require(dst != address(0), \"XVS::_transferTokens: cannot transfer to the zero address\");\n\n balances[src] = sub96(balances[src], amount, \"XVS::_transferTokens: transfer amount exceeds balance\");\n balances[dst] = add96(balances[dst], amount, \"XVS::_transferTokens: transfer amount overflows\");\n emit Transfer(src, dst, amount);\n\n _moveDelegates(delegates[src], delegates[dst], amount);\n }\n\n function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {\n if (srcRep != dstRep && amount > 0) {\n if (srcRep != address(0)) {\n uint32 srcRepNum = numCheckpoints[srcRep];\n uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;\n uint96 srcRepNew = sub96(srcRepOld, amount, \"XVS::_moveVotes: vote amount underflows\");\n _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);\n }\n\n if (dstRep != address(0)) {\n uint32 dstRepNum = numCheckpoints[dstRep];\n uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;\n uint96 dstRepNew = add96(dstRepOld, amount, \"XVS::_moveVotes: vote amount overflows\");\n _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);\n }\n }\n }\n\n function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {\n uint32 blockNumber = safe32(block.number, \"XVS::_writeCheckpoint: block number exceeds 32 bits\");\n\n if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {\n checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;\n } else {\n checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);\n numCheckpoints[delegatee] = nCheckpoints + 1;\n }\n\n emit DelegateVotesChanged(delegatee, oldVotes, newVotes);\n }\n\n function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {\n require(n < 2 ** 32, errorMessage);\n return uint32(n);\n }\n\n function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {\n require(n < 2 ** 96, errorMessage);\n return uint96(n);\n }\n\n function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {\n uint96 c = a + b;\n require(c >= a, errorMessage);\n return c;\n }\n\n function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n function getChainId() internal pure returns (uint) {\n uint256 chainId;\n assembly {\n chainId := chainid()\n }\n return chainId;\n }\n}\n" + }, + "contracts/Tokens/XVS/XVSVesting.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../../Utils/IBEP20.sol\";\nimport \"../../Utils/SafeBEP20.sol\";\nimport \"./XVSVestingStorage.sol\";\nimport \"./XVSVestingProxy.sol\";\n\n/**\n * @title Venus's XVSVesting Contract\n * @author Venus\n */\ncontract XVSVesting is XVSVestingStorage {\n using SafeMath for uint256;\n using SafeBEP20 for IBEP20;\n\n /// @notice total vesting period for 1 year in seconds\n uint256 public constant TOTAL_VESTING_TIME = 365 * 24 * 60 * 60;\n\n /// @notice decimal precision for XVS\n uint256 public constant xvsDecimalsMultiplier = 1e18;\n\n /// @notice Emitted when XVSVested is claimed by recipient\n event VestedTokensClaimed(address recipient, uint256 amountClaimed);\n\n /// @notice Emitted when vrtConversionAddress is set\n event VRTConversionSet(address vrtConversionAddress);\n\n /// @notice Emitted when XVS is deposited for vesting\n event XVSVested(address indexed recipient, uint256 startTime, uint256 amount, uint256 withdrawnAmount);\n\n /// @notice Emitted when XVS is withdrawn by recipient\n event XVSWithdrawn(address recipient, uint256 amount);\n\n modifier nonZeroAddress(address _address) {\n require(_address != address(0), \"Address cannot be Zero\");\n _;\n }\n\n constructor() public {}\n\n /**\n * @notice initialize XVSVestingStorage\n * @param _xvsAddress The XVSToken address\n */\n function initialize(address _xvsAddress) public {\n require(msg.sender == admin, \"only admin may initialize the XVSVesting\");\n require(initialized == false, \"XVSVesting is already initialized\");\n require(_xvsAddress != address(0), \"_xvsAddress cannot be Zero\");\n xvs = IBEP20(_xvsAddress);\n\n _notEntered = true;\n initialized = true;\n }\n\n modifier isInitialized() {\n require(initialized == true, \"XVSVesting is not initialized\");\n _;\n }\n\n /**\n * @notice sets VRTConverter Address\n * @dev Note: If VRTConverter is not set, then Vesting is not allowed\n * @param _vrtConversionAddress The VRTConverterProxy Address\n */\n function setVRTConverter(address _vrtConversionAddress) public {\n require(msg.sender == admin, \"only admin may initialize the Vault\");\n require(_vrtConversionAddress != address(0), \"vrtConversionAddress cannot be Zero\");\n vrtConversionAddress = _vrtConversionAddress;\n emit VRTConversionSet(_vrtConversionAddress);\n }\n\n modifier onlyAdmin() {\n require(msg.sender == admin, \"only admin can\");\n _;\n }\n\n modifier onlyVrtConverter() {\n require(msg.sender == vrtConversionAddress, \"only VRTConversion Address can call the function\");\n _;\n }\n\n modifier vestingExistCheck(address recipient) {\n require(vestings[recipient].length > 0, \"recipient doesnot have any vestingRecord\");\n _;\n }\n\n /**\n * @notice Deposit XVS for Vesting\n * @param recipient The vesting recipient\n * @param depositAmount XVS amount for deposit\n */\n function deposit(\n address recipient,\n uint depositAmount\n ) external isInitialized onlyVrtConverter nonZeroAddress(recipient) {\n require(depositAmount > 0, \"Deposit amount must be non-zero\");\n\n VestingRecord[] storage vestingsOfRecipient = vestings[recipient];\n\n VestingRecord memory vesting = VestingRecord({\n recipient: recipient,\n startTime: getCurrentTime(),\n amount: depositAmount,\n withdrawnAmount: 0\n });\n\n vestingsOfRecipient.push(vesting);\n\n emit XVSVested(recipient, vesting.startTime, vesting.amount, vesting.withdrawnAmount);\n }\n\n /**\n * @notice Withdraw Vested XVS of recipient\n */\n function withdraw() external isInitialized vestingExistCheck(msg.sender) {\n address recipient = msg.sender;\n VestingRecord[] storage vestingsOfRecipient = vestings[recipient];\n uint256 vestingCount = vestingsOfRecipient.length;\n uint256 totalWithdrawableAmount = 0;\n\n for (uint i = 0; i < vestingCount; ++i) {\n VestingRecord storage vesting = vestingsOfRecipient[i];\n (, uint256 toWithdraw) = calculateWithdrawableAmount(\n vesting.amount,\n vesting.startTime,\n vesting.withdrawnAmount\n );\n if (toWithdraw > 0) {\n totalWithdrawableAmount = totalWithdrawableAmount.add(toWithdraw);\n vesting.withdrawnAmount = vesting.withdrawnAmount.add(toWithdraw);\n }\n }\n\n if (totalWithdrawableAmount > 0) {\n uint256 xvsBalance = xvs.balanceOf(address(this));\n require(xvsBalance >= totalWithdrawableAmount, \"Insufficient XVS for withdrawal\");\n emit XVSWithdrawn(recipient, totalWithdrawableAmount);\n xvs.safeTransfer(recipient, totalWithdrawableAmount);\n }\n }\n\n /**\n * @notice get Withdrawable XVS Amount\n * @param recipient The vesting recipient\n * @dev returns A tuple with totalWithdrawableAmount , totalVestedAmount and totalWithdrawnAmount\n */\n function getWithdrawableAmount(\n address recipient\n )\n public\n view\n isInitialized\n nonZeroAddress(recipient)\n vestingExistCheck(recipient)\n returns (uint256 totalWithdrawableAmount, uint256 totalVestedAmount, uint256 totalWithdrawnAmount)\n {\n VestingRecord[] storage vestingsOfRecipient = vestings[recipient];\n uint256 vestingCount = vestingsOfRecipient.length;\n\n for (uint i = 0; i < vestingCount; i++) {\n VestingRecord storage vesting = vestingsOfRecipient[i];\n (uint256 vestedAmount, uint256 toWithdraw) = calculateWithdrawableAmount(\n vesting.amount,\n vesting.startTime,\n vesting.withdrawnAmount\n );\n totalVestedAmount = totalVestedAmount.add(vestedAmount);\n totalWithdrawableAmount = totalWithdrawableAmount.add(toWithdraw);\n totalWithdrawnAmount = totalWithdrawnAmount.add(vesting.withdrawnAmount);\n }\n\n return (totalWithdrawableAmount, totalVestedAmount, totalWithdrawnAmount);\n }\n\n /**\n * @notice get Withdrawable XVS Amount\n * @param amount Amount deposited for vesting\n * @param vestingStartTime time in epochSeconds at the time of vestingDeposit\n * @param withdrawnAmount XVSAmount withdrawn from VestedAmount\n * @dev returns A tuple with vestedAmount and withdrawableAmount\n */\n function calculateWithdrawableAmount(\n uint256 amount,\n uint256 vestingStartTime,\n uint256 withdrawnAmount\n ) internal view returns (uint256, uint256) {\n uint256 vestedAmount = calculateVestedAmount(amount, vestingStartTime, getCurrentTime());\n uint toWithdraw = vestedAmount.sub(withdrawnAmount);\n return (vestedAmount, toWithdraw);\n }\n\n /**\n * @notice calculate total vested amount\n * @param vestingAmount Amount deposited for vesting\n * @param vestingStartTime time in epochSeconds at the time of vestingDeposit\n * @param currentTime currentTime in epochSeconds\n * @return Total XVS amount vested\n */\n function calculateVestedAmount(\n uint256 vestingAmount,\n uint256 vestingStartTime,\n uint256 currentTime\n ) internal view returns (uint256) {\n if (currentTime < vestingStartTime) {\n return 0;\n } else if (currentTime > vestingStartTime.add(TOTAL_VESTING_TIME)) {\n return vestingAmount;\n } else {\n return (vestingAmount.mul(currentTime.sub(vestingStartTime))).div(TOTAL_VESTING_TIME);\n }\n }\n\n /**\n * @notice current block timestamp\n * @return blocktimestamp\n */\n function getCurrentTime() public view returns (uint256) {\n return block.timestamp;\n }\n\n /*** Admin Functions ***/\n function _become(XVSVestingProxy xvsVestingProxy) public {\n require(msg.sender == xvsVestingProxy.admin(), \"only proxy admin can change brains\");\n xvsVestingProxy._acceptImplementation();\n }\n}\n" + }, + "contracts/Tokens/XVS/XVSVestingProxy.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./XVSVestingStorage.sol\";\n\ncontract XVSVestingProxy is XVSVestingAdminStorage {\n /**\n * @notice Emitted when pendingImplementation is changed\n */\n event NewPendingImplementation(address oldPendingImplementation, address newPendingImplementation);\n\n /**\n * @notice Emitted when pendingImplementation is accepted, which means XVSVesting 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(\n address implementation_,\n address _xvsAddress\n ) public nonZeroAddress(implementation_) nonZeroAddress(_xvsAddress) {\n // Creator of the contract is admin during initialization\n admin = msg.sender;\n\n // New implementations always get set via the settor (post-initialize)\n _setImplementation(implementation_);\n\n // First delegate gets to initialize the delegator (i.e. storage contract)\n delegateTo(implementation_, abi.encodeWithSignature(\"initialize(address)\", _xvsAddress));\n }\n\n modifier nonZeroAddress(address _address) {\n require(_address != address(0), \"Address cannot be Zero\");\n _;\n }\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n */\n function _setImplementation(address implementation_) public {\n require(msg.sender == admin, \"XVSVestingProxy::_setImplementation: admin only\");\n require(implementation_ != address(0), \"XVSVestingProxy::_setImplementation: invalid implementation address\");\n\n address oldImplementation = implementation;\n implementation = implementation_;\n\n emit NewImplementation(oldImplementation, implementation);\n }\n\n /**\n * @notice Internal method to delegate execution to another contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n * @param callee The contract to delegatecall\n * @param data The raw data to delegatecall\n * @return The returned bytes from the delegatecall\n */\n function delegateTo(address callee, bytes memory data) internal nonZeroAddress(callee) returns (bytes memory) {\n (bool success, bytes memory returnData) = callee.delegatecall(data);\n assembly {\n if eq(success, 0) {\n revert(add(returnData, 0x20), returndatasize)\n }\n }\n return returnData;\n }\n\n /*** Admin Functions ***/\n function _setPendingImplementation(\n address newPendingImplementation\n ) public nonZeroAddress(newPendingImplementation) {\n require(msg.sender == admin, \"Only admin can set Pending Implementation\");\n\n address oldPendingImplementation = pendingImplementation;\n\n pendingImplementation = newPendingImplementation;\n\n emit NewPendingImplementation(oldPendingImplementation, pendingImplementation);\n }\n\n /**\n * @notice Accepts new implementation of VRT Vault. msg.sender must be pendingImplementation\n * @dev Admin function for new implementation to accept it's role as implementation\n */\n function _acceptImplementation() public {\n // Check caller is pendingImplementation\n require(\n msg.sender == pendingImplementation,\n \"only address marked as pendingImplementation can accept Implementation\"\n );\n\n // Save current values for inclusion in log\n address oldImplementation = implementation;\n address oldPendingImplementation = pendingImplementation;\n\n implementation = pendingImplementation;\n\n pendingImplementation = address(0);\n\n emit NewImplementation(oldImplementation, implementation);\n emit NewPendingImplementation(oldPendingImplementation, pendingImplementation);\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 */\n function _setPendingAdmin(address newPendingAdmin) public nonZeroAddress(newPendingAdmin) {\n // Check caller = admin\n require(msg.sender == admin, \"only admin can set pending admin\");\n require(newPendingAdmin != pendingAdmin, \"New pendingAdmin can not be same as the previous one\");\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\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 */\n function _acceptAdmin() public {\n // Check caller is pendingAdmin\n require(msg.sender == pendingAdmin, \"only address marked as pendingAdmin can accept as Admin\");\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\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" + }, + "contracts/Tokens/XVS/XVSVestingStorage.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"../../Utils/SafeMath.sol\";\nimport \"../../Utils/IBEP20.sol\";\n\ncontract XVSVestingAdminStorage {\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 XVSVesting\n */\n address public implementation;\n\n /**\n * @notice Pending brains of XVSVesting\n */\n address public pendingImplementation;\n}\n\ncontract XVSVestingStorage is XVSVestingAdminStorage {\n struct VestingRecord {\n address recipient;\n uint256 startTime;\n uint256 amount;\n uint256 withdrawnAmount;\n }\n\n /// @notice Guard variable for re-entrancy checks\n bool public _notEntered;\n\n /// @notice indicator to check if the contract is initialized\n bool public initialized;\n\n /// @notice The XVS TOKEN!\n IBEP20 public xvs;\n\n /// @notice VRTConversion Contract Address\n address public vrtConversionAddress;\n\n /// @notice mapping of VestingRecord(s) for user(s)\n mapping(address => VestingRecord[]) public vestings;\n}\n" + }, + "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" + }, + "contracts/Utils/CarefulMath.sol": { + "content": "pragma solidity ^0.5.16;\n\n/**\n * @title Careful Math\n * @author Venus\n * @notice Derived from OpenZeppelin's SafeMath library\n * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol\n */\ncontract CarefulMath {\n /**\n * @dev Possible error codes that we can return\n */\n enum MathError {\n NO_ERROR,\n DIVISION_BY_ZERO,\n INTEGER_OVERFLOW,\n INTEGER_UNDERFLOW\n }\n\n /**\n * @dev Multiplies two numbers, returns an error on overflow.\n */\n function mulUInt(uint a, uint b) internal pure returns (MathError, uint) {\n if (a == 0) {\n return (MathError.NO_ERROR, 0);\n }\n\n uint c = a * b;\n\n if (c / a != b) {\n return (MathError.INTEGER_OVERFLOW, 0);\n } else {\n return (MathError.NO_ERROR, c);\n }\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function divUInt(uint a, uint b) internal pure returns (MathError, uint) {\n if (b == 0) {\n return (MathError.DIVISION_BY_ZERO, 0);\n }\n\n return (MathError.NO_ERROR, a / b);\n }\n\n /**\n * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).\n */\n function subUInt(uint a, uint b) internal pure returns (MathError, uint) {\n if (b <= a) {\n return (MathError.NO_ERROR, a - b);\n } else {\n return (MathError.INTEGER_UNDERFLOW, 0);\n }\n }\n\n /**\n * @dev Adds two numbers, returns an error on overflow.\n */\n function addUInt(uint a, uint b) internal pure returns (MathError, uint) {\n uint c = a + b;\n\n if (c >= a) {\n return (MathError.NO_ERROR, c);\n } else {\n return (MathError.INTEGER_OVERFLOW, 0);\n }\n }\n\n /**\n * @dev add a and b and then subtract c\n */\n function addThenSubUInt(uint a, uint b, uint c) internal pure returns (MathError, uint) {\n (MathError err0, uint sum) = addUInt(a, b);\n\n if (err0 != MathError.NO_ERROR) {\n return (err0, 0);\n }\n\n return subUInt(sum, c);\n }\n}\n" + }, + "contracts/Utils/Context.sol": { + "content": "pragma solidity ^0.5.16;\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 GSN 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 */\ncontract Context {\n // Empty internal constructor, to prevent people from mistakenly deploying\n // an instance of this contract, which should be used via inheritance.\n constructor() internal {}\n\n function _msgSender() internal view returns (address payable) {\n return msg.sender;\n }\n\n function _msgData() internal view returns (bytes memory) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n" + }, + "contracts/Utils/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// Adapted from OpenZeppelin Contracts v4.3.2 (utils/cryptography/ECDSA.sol)\n\n// SPDX-Copyright-Text: OpenZeppelin, 2021\n// SPDX-Copyright-Text: Venus, 2021\n\npragma solidity ^0.5.16;\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\ncontract ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n}\n" + }, + "contracts/Utils/ErrorReporter.sol": { + "content": "pragma solidity ^0.5.16;\n\ncontract ComptrollerErrorReporter {\n enum Error {\n NO_ERROR,\n UNAUTHORIZED,\n COMPTROLLER_MISMATCH,\n INSUFFICIENT_SHORTFALL,\n INSUFFICIENT_LIQUIDITY,\n INVALID_CLOSE_FACTOR,\n INVALID_COLLATERAL_FACTOR,\n INVALID_LIQUIDATION_INCENTIVE,\n MARKET_NOT_ENTERED, // no longer possible\n MARKET_NOT_LISTED,\n MARKET_ALREADY_LISTED,\n MATH_ERROR,\n NONZERO_BORROW_BALANCE,\n PRICE_ERROR,\n REJECTION,\n SNAPSHOT_ERROR,\n TOO_MANY_ASSETS,\n TOO_MUCH_REPAY,\n INSUFFICIENT_BALANCE_FOR_VAI,\n MARKET_NOT_COLLATERAL\n }\n\n enum FailureInfo {\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\n EXIT_MARKET_BALANCE_OWED,\n EXIT_MARKET_REJECTION,\n SET_CLOSE_FACTOR_OWNER_CHECK,\n SET_CLOSE_FACTOR_VALIDATION,\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\n SET_COLLATERAL_FACTOR_NO_EXISTS,\n SET_COLLATERAL_FACTOR_VALIDATION,\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\n SET_IMPLEMENTATION_OWNER_CHECK,\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\n SET_MAX_ASSETS_OWNER_CHECK,\n SET_PENDING_ADMIN_OWNER_CHECK,\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\n SET_PRICE_ORACLE_OWNER_CHECK,\n SUPPORT_MARKET_EXISTS,\n SUPPORT_MARKET_OWNER_CHECK,\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\n SET_VAI_MINT_RATE_CHECK,\n SET_VAICONTROLLER_OWNER_CHECK,\n SET_MINTED_VAI_REJECTION,\n SET_TREASURY_OWNER_CHECK,\n UNLIST_MARKET_NOT_LISTED\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\ncontract TokenErrorReporter {\n enum Error {\n NO_ERROR,\n UNAUTHORIZED,\n BAD_INPUT,\n COMPTROLLER_REJECTION,\n COMPTROLLER_CALCULATION_ERROR,\n INTEREST_RATE_MODEL_ERROR,\n INVALID_ACCOUNT_PAIR,\n INVALID_CLOSE_AMOUNT_REQUESTED,\n INVALID_COLLATERAL_FACTOR,\n MATH_ERROR,\n MARKET_NOT_FRESH,\n MARKET_NOT_LISTED,\n TOKEN_INSUFFICIENT_ALLOWANCE,\n TOKEN_INSUFFICIENT_BALANCE,\n TOKEN_INSUFFICIENT_CASH,\n TOKEN_TRANSFER_IN_FAILED,\n TOKEN_TRANSFER_OUT_FAILED,\n TOKEN_PRICE_ERROR\n }\n\n /*\n * Note: FailureInfo (but not Error) is kept in alphabetical order\n * This is because FailureInfo grows significantly faster, and\n * the order of Error has some meaning, while the order of FailureInfo\n * is entirely arbitrary.\n */\n enum FailureInfo {\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\n BORROW_ACCRUE_INTEREST_FAILED,\n BORROW_CASH_NOT_AVAILABLE,\n BORROW_FRESHNESS_CHECK,\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n BORROW_MARKET_NOT_LISTED,\n BORROW_COMPTROLLER_REJECTION,\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\n LIQUIDATE_COMPTROLLER_REJECTION,\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\n LIQUIDATE_FRESHNESS_CHECK,\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\n LIQUIDATE_SEIZE_TOO_MUCH,\n MINT_ACCRUE_INTEREST_FAILED,\n MINT_COMPTROLLER_REJECTION,\n MINT_EXCHANGE_CALCULATION_FAILED,\n MINT_EXCHANGE_RATE_READ_FAILED,\n MINT_FRESHNESS_CHECK,\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\n MINT_TRANSFER_IN_FAILED,\n MINT_TRANSFER_IN_NOT_POSSIBLE,\n REDEEM_ACCRUE_INTEREST_FAILED,\n REDEEM_COMPTROLLER_REJECTION,\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\n REDEEM_EXCHANGE_RATE_READ_FAILED,\n REDEEM_FRESHNESS_CHECK,\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\n REDUCE_RESERVES_ADMIN_CHECK,\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\n REDUCE_RESERVES_FRESH_CHECK,\n REDUCE_RESERVES_VALIDATION,\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_COMPTROLLER_REJECTION,\n REPAY_BORROW_FRESHNESS_CHECK,\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\n SET_COLLATERAL_FACTOR_VALIDATION,\n SET_COMPTROLLER_OWNER_CHECK,\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\n SET_MAX_ASSETS_OWNER_CHECK,\n SET_ORACLE_MARKET_NOT_LISTED,\n SET_PENDING_ADMIN_OWNER_CHECK,\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\n SET_RESERVE_FACTOR_ADMIN_CHECK,\n SET_RESERVE_FACTOR_FRESH_CHECK,\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\n TRANSFER_COMPTROLLER_REJECTION,\n TRANSFER_NOT_ALLOWED,\n TRANSFER_NOT_ENOUGH,\n TRANSFER_TOO_MUCH,\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\n ADD_RESERVES_FRESH_CHECK,\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE,\n TOKEN_GET_UNDERLYING_PRICE_ERROR,\n REPAY_VAI_COMPTROLLER_REJECTION,\n REPAY_VAI_FRESHNESS_CHECK,\n VAI_MINT_EXCHANGE_CALCULATION_FAILED,\n SFT_MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED\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\ncontract VAIControllerErrorReporter {\n enum Error {\n NO_ERROR,\n UNAUTHORIZED, // The sender is not authorized to perform this action.\n REJECTION, // The action would violate the comptroller, vaicontroller policy.\n SNAPSHOT_ERROR, // The comptroller could not get the account borrows and exchange rate from the market.\n PRICE_ERROR, // The comptroller could not obtain a required price of an asset.\n MATH_ERROR, // A math calculation error occurred.\n INSUFFICIENT_BALANCE_FOR_VAI // Caller does not have sufficient balance to mint VAI.\n }\n\n enum FailureInfo {\n SET_PENDING_ADMIN_OWNER_CHECK,\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\n SET_COMPTROLLER_OWNER_CHECK,\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\n VAI_MINT_REJECTION,\n VAI_BURN_REJECTION,\n VAI_LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\n VAI_LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\n VAI_LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\n VAI_LIQUIDATE_COMPTROLLER_REJECTION,\n VAI_LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\n VAI_LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\n VAI_LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\n VAI_LIQUIDATE_FRESHNESS_CHECK,\n VAI_LIQUIDATE_LIQUIDATOR_IS_BORROWER,\n VAI_LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\n VAI_LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\n VAI_LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\n VAI_LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\n VAI_LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\n VAI_LIQUIDATE_SEIZE_TOO_MUCH,\n MINT_FEE_CALCULATION_FAILED,\n SET_TREASURY_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" + }, + "contracts/Utils/Exponential.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./CarefulMath.sol\";\nimport \"./ExponentialNoError.sol\";\n\n/**\n * @title Exponential module for storing fixed-precision decimals\n * @author Venus\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\n * `Exp({mantissa: 5100000000000000000})`.\n */\ncontract Exponential is CarefulMath, ExponentialNoError {\n /**\n * @dev Creates an exponential from numerator and denominator values.\n * Note: Returns an error if (`num` * 10e18) > MAX_INT,\n * or if `denom` is zero.\n */\n function getExp(uint num, uint denom) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint scaledNumerator) = mulUInt(num, expScale);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n (MathError err1, uint rational) = divUInt(scaledNumerator, denom);\n if (err1 != MathError.NO_ERROR) {\n return (err1, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: rational }));\n }\n\n /**\n * @dev Adds two exponentials, returning a new exponential.\n */\n function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError error, uint result) = addUInt(a.mantissa, b.mantissa);\n\n return (error, Exp({ mantissa: result }));\n }\n\n /**\n * @dev Subtracts two exponentials, returning a new exponential.\n */\n function subExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError error, uint result) = subUInt(a.mantissa, b.mantissa);\n\n return (error, Exp({ mantissa: result }));\n }\n\n /**\n * @dev Multiply an Exp by a scalar, returning a new Exp.\n */\n function mulScalar(Exp memory a, uint scalar) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint scaledMantissa) = mulUInt(a.mantissa, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: scaledMantissa }));\n }\n\n /**\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\n */\n function mulScalarTruncate(Exp memory a, uint scalar) internal pure returns (MathError, uint) {\n (MathError err, Exp memory product) = mulScalar(a, scalar);\n if (err != MathError.NO_ERROR) {\n return (err, 0);\n }\n\n return (MathError.NO_ERROR, truncate(product));\n }\n\n /**\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\n */\n function mulScalarTruncateAddUInt(Exp memory a, uint scalar, uint addend) internal pure returns (MathError, uint) {\n (MathError err, Exp memory product) = mulScalar(a, scalar);\n if (err != MathError.NO_ERROR) {\n return (err, 0);\n }\n\n return addUInt(truncate(product), addend);\n }\n\n /**\n * @dev Divide an Exp by a scalar, returning a new Exp.\n */\n function divScalar(Exp memory a, uint scalar) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint descaledMantissa) = divUInt(a.mantissa, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n return (MathError.NO_ERROR, Exp({ mantissa: descaledMantissa }));\n }\n\n /**\n * @dev Divide a scalar by an Exp, returning a new Exp.\n */\n function divScalarByExp(uint scalar, Exp memory divisor) internal pure returns (MathError, Exp memory) {\n /*\n We are doing this as:\n getExp(mulUInt(expScale, scalar), divisor.mantissa)\n\n How it works:\n Exp = a / b;\n Scalar = s;\n `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale`\n */\n (MathError err0, uint numerator) = mulUInt(expScale, scalar);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n return getExp(numerator, divisor.mantissa);\n }\n\n /**\n * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer.\n */\n function divScalarByExpTruncate(uint scalar, Exp memory divisor) internal pure returns (MathError, uint) {\n (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);\n if (err != MathError.NO_ERROR) {\n return (err, 0);\n }\n\n return (MathError.NO_ERROR, truncate(fraction));\n }\n\n /**\n * @dev Multiplies two exponentials, returning a new exponential.\n */\n function mulExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n (MathError err0, uint doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);\n if (err0 != MathError.NO_ERROR) {\n return (err0, Exp({ mantissa: 0 }));\n }\n\n // We add half the scale before dividing so that we get rounding instead of truncation.\n // See \"Listing 6\" and text above it at https://accu.org/index.php/journals/1717\n // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.\n (MathError err1, uint doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct);\n if (err1 != MathError.NO_ERROR) {\n return (err1, Exp({ mantissa: 0 }));\n }\n\n (MathError err2, uint product) = divUInt(doubleScaledProductWithHalfScale, expScale);\n // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero.\n assert(err2 == MathError.NO_ERROR);\n\n return (MathError.NO_ERROR, Exp({ mantissa: product }));\n }\n\n /**\n * @dev Multiplies two exponentials given their mantissas, returning a new exponential.\n */\n function mulExp(uint a, uint b) internal pure returns (MathError, Exp memory) {\n return mulExp(Exp({ mantissa: a }), Exp({ mantissa: b }));\n }\n\n /**\n * @dev Multiplies three exponentials, returning a new exponential.\n */\n function mulExp3(Exp memory a, Exp memory b, Exp memory c) internal pure returns (MathError, Exp memory) {\n (MathError err, Exp memory ab) = mulExp(a, b);\n if (err != MathError.NO_ERROR) {\n return (err, ab);\n }\n return mulExp(ab, c);\n }\n\n /**\n * @dev Divides two exponentials, returning a new exponential.\n * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,\n * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)\n */\n function divExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\n return getExp(a.mantissa, b.mantissa);\n }\n}\n" + }, + "contracts/Utils/ExponentialNoError.sol": { + "content": "pragma solidity ^0.5.16;\n\n/**\n * @title Exponential module for storing fixed-precision decimals\n * @author Compound\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\n * `Exp({mantissa: 5100000000000000000})`.\n */\ncontract ExponentialNoError {\n uint internal constant expScale = 1e18;\n uint internal constant doubleScale = 1e36;\n uint internal constant halfExpScale = expScale / 2;\n uint internal constant mantissaOne = expScale;\n\n struct Exp {\n uint mantissa;\n }\n\n struct Double {\n uint mantissa;\n }\n\n /**\n * @dev Truncates the given exp to a whole number value.\n * For example, truncate(Exp{mantissa: 15 * expScale}) = 15\n */\n function truncate(Exp memory exp) internal pure returns (uint) {\n // Note: We are not using careful math here as we're performing a division that cannot fail\n return exp.mantissa / expScale;\n }\n\n /**\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\n */\n function mul_ScalarTruncate(Exp memory a, uint scalar) internal pure returns (uint) {\n Exp memory product = mul_(a, scalar);\n return truncate(product);\n }\n\n /**\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\n */\n function mul_ScalarTruncateAddUInt(Exp memory a, uint scalar, uint addend) internal pure returns (uint) {\n Exp memory product = mul_(a, scalar);\n return add_(truncate(product), addend);\n }\n\n /**\n * @dev Checks if first Exp is less than second Exp.\n */\n function lessThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa < right.mantissa;\n }\n\n /**\n * @dev Checks if left Exp <= right Exp.\n */\n function lessThanOrEqualExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa <= right.mantissa;\n }\n\n /**\n * @dev Checks if left Exp > right Exp.\n */\n function greaterThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\n return left.mantissa > right.mantissa;\n }\n\n /**\n * @dev returns true if Exp is exactly zero\n */\n function isZeroExp(Exp memory value) internal pure returns (bool) {\n return value.mantissa == 0;\n }\n\n function safe224(uint n, string memory errorMessage) internal pure returns (uint224) {\n require(n < 2 ** 224, errorMessage);\n return uint224(n);\n }\n\n function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {\n require(n < 2 ** 32, errorMessage);\n return uint32(n);\n }\n\n function add_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: add_(a.mantissa, b.mantissa) });\n }\n\n function add_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: add_(a.mantissa, b.mantissa) });\n }\n\n function add_(uint a, uint b) internal pure returns (uint) {\n return add_(a, b, \"addition overflow\");\n }\n\n function add_(uint a, uint b, string memory errorMessage) internal pure returns (uint) {\n uint c = a + b;\n require(c >= a, errorMessage);\n return c;\n }\n\n function sub_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: sub_(a.mantissa, b.mantissa) });\n }\n\n function sub_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: sub_(a.mantissa, b.mantissa) });\n }\n\n function sub_(uint a, uint b) internal pure returns (uint) {\n return sub_(a, b, \"subtraction underflow\");\n }\n\n function sub_(uint a, uint b, string memory errorMessage) internal pure returns (uint) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n function mul_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: mul_(a.mantissa, b.mantissa) / expScale });\n }\n\n function mul_(Exp memory a, uint b) internal pure returns (Exp memory) {\n return Exp({ mantissa: mul_(a.mantissa, b) });\n }\n\n function mul_(uint a, Exp memory b) internal pure returns (uint) {\n return mul_(a, b.mantissa) / expScale;\n }\n\n function mul_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: mul_(a.mantissa, b.mantissa) / doubleScale });\n }\n\n function mul_(Double memory a, uint b) internal pure returns (Double memory) {\n return Double({ mantissa: mul_(a.mantissa, b) });\n }\n\n function mul_(uint a, Double memory b) internal pure returns (uint) {\n return mul_(a, b.mantissa) / doubleScale;\n }\n\n function mul_(uint a, uint b) internal pure returns (uint) {\n return mul_(a, b, \"multiplication overflow\");\n }\n\n function mul_(uint a, uint b, string memory errorMessage) internal pure returns (uint) {\n if (a == 0 || b == 0) {\n return 0;\n }\n uint c = a * b;\n require(c / a == b, errorMessage);\n return c;\n }\n\n function div_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\n return Exp({ mantissa: div_(mul_(a.mantissa, expScale), b.mantissa) });\n }\n\n function div_(Exp memory a, uint b) internal pure returns (Exp memory) {\n return Exp({ mantissa: div_(a.mantissa, b) });\n }\n\n function div_(uint a, Exp memory b) internal pure returns (uint) {\n return div_(mul_(a, expScale), b.mantissa);\n }\n\n function div_(Double memory a, Double memory b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa) });\n }\n\n function div_(Double memory a, uint b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(a.mantissa, b) });\n }\n\n function div_(uint a, Double memory b) internal pure returns (uint) {\n return div_(mul_(a, doubleScale), b.mantissa);\n }\n\n function div_(uint a, uint b) internal pure returns (uint) {\n return div_(a, b, \"divide by zero\");\n }\n\n function div_(uint a, uint b, string memory errorMessage) internal pure returns (uint) {\n require(b > 0, errorMessage);\n return a / b;\n }\n\n function fraction(uint a, uint b) internal pure returns (Double memory) {\n return Double({ mantissa: div_(mul_(a, doubleScale), b) });\n }\n}\n" + }, + "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" + }, + "contracts/Utils/Ownable.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() internal {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public onlyOwner {\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n */\n function _transferOwnership(address newOwner) internal {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n" + }, + "contracts/Utils/Owned.sol": { + "content": "pragma solidity ^0.5.16;\n\ncontract Owned {\n address public owner;\n\n event OwnershipTransferred(address indexed _from, address indexed _to);\n\n constructor() public {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"Should be owner\");\n _;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n owner = newOwner;\n emit OwnershipTransferred(owner, newOwner);\n }\n}\n" + }, + "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" + }, + "contracts/Utils/SafeCast.sol": { + "content": "pragma solidity ^0.5.16;\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 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 < 2 ** 128, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(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 < 2 ** 64, \"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 < 2 ** 32, \"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 < 2 ** 16, \"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 < 2 ** 8, \"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 >= -2 ** 127 && value < 2 ** 127, \"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 >= -2 ** 63 && value < 2 ** 63, \"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 >= -2 ** 31 && value < 2 ** 31, \"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 >= -2 ** 15 && value < 2 ** 15, \"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 >= -2 ** 7 && value < 2 ** 7, \"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 require(value < 2 ** 255, \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "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" + }, + "contracts/Utils/Tokenlock.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./Owned.sol\";\n\ncontract Tokenlock is Owned {\n /// @notice Indicates if token is locked\n uint8 internal isLocked = 0;\n\n event Freezed();\n event UnFreezed();\n\n modifier validLock() {\n require(isLocked == 0, \"Token is locked\");\n _;\n }\n\n function freeze() public onlyOwner {\n isLocked = 1;\n\n emit Freezed();\n }\n\n function unfreeze() public onlyOwner {\n isLocked = 0;\n\n emit UnFreezed();\n }\n}\n" + }, + "contracts/VAIVault/VAIVault.sol": { + "content": "pragma solidity 0.5.16;\n\nimport \"../Utils/SafeBEP20.sol\";\nimport \"../Utils/IBEP20.sol\";\nimport \"./VAIVaultStorage.sol\";\nimport \"./VAIVaultErrorReporter.sol\";\nimport \"@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV5.sol\";\nimport { VAIVaultProxy } from \"./VAIVaultProxy.sol\";\n\n/**\n * @title VAI Vault\n * @author Venus\n * @notice The VAI Vault is configured for users to stake VAI And receive XVS as a reward.\n */\ncontract VAIVault is VAIVaultStorage, AccessControlledV5 {\n using SafeMath for uint256;\n using SafeBEP20 for IBEP20;\n\n /// @notice Event emitted when VAI deposit\n event Deposit(address indexed user, uint256 amount);\n\n /// @notice Event emitted when VAI withrawal\n event Withdraw(address indexed user, uint256 amount);\n\n /// @notice Event emitted when vault is paused\n event VaultPaused(address indexed admin);\n\n /// @notice Event emitted when vault is resumed after pause\n event VaultResumed(address indexed admin);\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 /*** Reentrancy Guard ***/\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant() {\n require(_notEntered, \"re-entered\");\n _notEntered = false;\n _;\n _notEntered = true; // get a gas-refund post-Istanbul\n }\n\n /**\n * @dev Prevents functions to execute when vault is paused.\n */\n modifier isActive() {\n require(!vaultPaused, \"Vault is paused\");\n _;\n }\n\n /**\n * @notice Pause vault\n */\n function pause() external {\n _checkAccessAllowed(\"pause()\");\n require(!vaultPaused, \"Vault is already paused\");\n vaultPaused = true;\n emit VaultPaused(msg.sender);\n }\n\n /**\n * @notice Resume vault\n */\n function resume() external {\n _checkAccessAllowed(\"resume()\");\n require(vaultPaused, \"Vault is not paused\");\n vaultPaused = false;\n emit VaultResumed(msg.sender);\n }\n\n /**\n * @notice Deposit VAI to VAIVault for XVS allocation\n * @param _amount The amount to deposit to vault\n */\n function deposit(uint256 _amount) external nonReentrant isActive {\n UserInfo storage user = userInfo[msg.sender];\n\n updateVault();\n\n // Transfer pending tokens to user\n updateAndPayOutPending(msg.sender);\n\n // Transfer in the amounts from user\n if (_amount > 0) {\n vai.safeTransferFrom(address(msg.sender), address(this), _amount);\n user.amount = user.amount.add(_amount);\n }\n\n user.rewardDebt = user.amount.mul(accXVSPerShare).div(1e18);\n emit Deposit(msg.sender, _amount);\n }\n\n /**\n * @notice Withdraw VAI from VAIVault\n * @param _amount The amount to withdraw from vault\n */\n function withdraw(uint256 _amount) external nonReentrant isActive {\n _withdraw(msg.sender, _amount);\n }\n\n /**\n * @notice Claim XVS from VAIVault\n */\n function claim() external nonReentrant isActive {\n _withdraw(msg.sender, 0);\n }\n\n /**\n * @notice Claim XVS from VAIVault\n * @param account The account for which to claim XVS\n */\n function claim(address account) external nonReentrant isActive {\n _withdraw(account, 0);\n }\n\n /**\n * @notice Low level withdraw function\n * @param account The account to withdraw from vault\n * @param _amount The amount to withdraw from vault\n */\n function _withdraw(address account, uint256 _amount) internal {\n UserInfo storage user = userInfo[account];\n require(user.amount >= _amount, \"withdraw: not good\");\n\n updateVault();\n updateAndPayOutPending(account); // Update balances of account this is not withdrawal but claiming XVS farmed\n\n if (_amount > 0) {\n user.amount = user.amount.sub(_amount);\n vai.safeTransfer(address(account), _amount);\n }\n user.rewardDebt = user.amount.mul(accXVSPerShare).div(1e18);\n\n emit Withdraw(account, _amount);\n }\n\n /**\n * @notice View function to see pending XVS on frontend\n * @param _user The user to see pending XVS\n * @return Amount of XVS the user can claim\n */\n function pendingXVS(address _user) public view returns (uint256) {\n UserInfo storage user = userInfo[_user];\n\n return user.amount.mul(accXVSPerShare).div(1e18).sub(user.rewardDebt);\n }\n\n /**\n * @notice Update and pay out pending XVS to user\n * @param account The user to pay out\n */\n function updateAndPayOutPending(address account) internal {\n uint256 pending = pendingXVS(account);\n\n if (pending > 0) {\n safeXVSTransfer(account, pending);\n }\n }\n\n /**\n * @notice Safe XVS transfer function, just in case if rounding error causes pool to not have enough XVS\n * @param _to The address that XVS to be transfered\n * @param _amount The amount that XVS to be transfered\n */\n function safeXVSTransfer(address _to, uint256 _amount) internal {\n uint256 xvsBal = xvs.balanceOf(address(this));\n\n if (_amount > xvsBal) {\n xvs.transfer(_to, xvsBal);\n xvsBalance = xvs.balanceOf(address(this));\n } else {\n xvs.transfer(_to, _amount);\n xvsBalance = xvs.balanceOf(address(this));\n }\n }\n\n /**\n * @notice Function that updates pending rewards\n */\n function updatePendingRewards() public isActive {\n uint256 newRewards = xvs.balanceOf(address(this)).sub(xvsBalance);\n\n if (newRewards > 0) {\n xvsBalance = xvs.balanceOf(address(this)); // If there is no change the balance didn't change\n pendingRewards = pendingRewards.add(newRewards);\n }\n }\n\n /**\n * @notice Update reward variables to be up-to-date\n */\n function updateVault() internal {\n updatePendingRewards();\n\n uint256 vaiBalance = vai.balanceOf(address(this));\n if (vaiBalance == 0) {\n // avoids division by 0 errors\n return;\n }\n\n accXVSPerShare = accXVSPerShare.add(pendingRewards.mul(1e18).div(vaiBalance));\n pendingRewards = 0;\n }\n\n /*** Admin Functions ***/\n\n function _become(VAIVaultProxy vaiVaultProxy) external {\n require(msg.sender == vaiVaultProxy.admin(), \"only proxy admin can change brains\");\n require(vaiVaultProxy._acceptImplementation() == 0, \"change not authorized\");\n }\n\n function setVenusInfo(address _xvs, address _vai) external onlyAdmin {\n require(_xvs != address(0) && _vai != address(0), \"addresses must not be zero\");\n require(address(xvs) == address(0) && address(vai) == address(0), \"addresses already set\");\n xvs = IBEP20(_xvs);\n vai = IBEP20(_vai);\n\n _notEntered = true;\n }\n\n /**\n * @notice Sets the address of the access control of this contract\n * @dev Admin function to set the access control address\n * @param newAccessControlAddress New address for the access control\n */\n function setAccessControl(address newAccessControlAddress) external onlyAdmin {\n _setAccessControlManager(newAccessControlAddress);\n }\n}\n" + }, + "contracts/VAIVault/VAIVaultErrorReporter.sol": { + "content": "pragma solidity ^0.5.16;\n\ncontract VAIVaultErrorReporter {\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" + }, + "contracts/VAIVault/VAIVaultProxy.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./VAIVaultStorage.sol\";\nimport \"./VAIVaultErrorReporter.sol\";\n\n/**\n * @title VAI Vault Proxy\n * @author Venus\n * @notice Proxy contract for the VAI Vault\n */\ncontract VAIVaultProxy is VAIVaultAdminStorage, VAIVaultErrorReporter {\n /**\n * @notice Emitted when pendingVAIVaultImplementation is changed\n */\n event NewPendingImplementation(address oldPendingImplementation, address newPendingImplementation);\n\n /**\n * @notice Emitted when pendingVAIVaultImplementation is accepted, which means VAI 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 = pendingVAIVaultImplementation;\n\n pendingVAIVaultImplementation = newPendingImplementation;\n\n emit NewPendingImplementation(oldPendingImplementation, pendingVAIVaultImplementation);\n\n return uint(Error.NO_ERROR);\n }\n\n /**\n * @notice Accepts new implementation of VAI 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 != pendingVAIVaultImplementation) {\n return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK);\n }\n\n // Save current values for inclusion in log\n address oldImplementation = vaiVaultImplementation;\n address oldPendingImplementation = pendingVAIVaultImplementation;\n\n vaiVaultImplementation = pendingVAIVaultImplementation;\n\n pendingVAIVaultImplementation = address(0);\n\n emit NewImplementation(oldImplementation, vaiVaultImplementation);\n emit NewPendingImplementation(oldPendingImplementation, pendingVAIVaultImplementation);\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, ) = vaiVaultImplementation.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" + }, + "contracts/VAIVault/VAIVaultStorage.sol": { + "content": "pragma solidity ^0.5.16;\nimport \"../Utils/SafeMath.sol\";\nimport \"../Utils/IBEP20.sol\";\n\ncontract VAIVaultAdminStorage {\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 VAI Vault\n */\n address public vaiVaultImplementation;\n\n /**\n * @notice Pending brains of VAI Vault\n */\n address public pendingVAIVaultImplementation;\n}\n\ncontract VAIVaultStorage is VAIVaultAdminStorage {\n /// @notice The XVS TOKEN!\n IBEP20 public xvs;\n\n /// @notice The VAI TOKEN!\n IBEP20 public vai;\n\n /// @notice Guard variable for re-entrancy checks\n bool internal _notEntered;\n\n /// @notice XVS balance of vault\n uint256 public xvsBalance;\n\n /// @notice Accumulated XVS per share\n uint256 public accXVSPerShare;\n\n //// pending rewards awaiting anyone to update\n uint256 public pendingRewards;\n\n /// @notice Info of each user.\n struct UserInfo {\n uint256 amount;\n uint256 rewardDebt;\n }\n\n // Info of each user that stakes tokens.\n mapping(address => UserInfo) public userInfo;\n\n /// @notice pause indicator for Vault\n bool public vaultPaused;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "contracts/VRTVault/VRTVault.sol": { + "content": "pragma solidity 0.5.16;\n\nimport \"../Utils/SafeBEP20.sol\";\nimport \"../Utils/IBEP20.sol\";\nimport \"./VRTVaultStorage.sol\";\nimport \"@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV5.sol\";\n\ninterface IVRTVaultProxy {\n function _acceptImplementation() external;\n\n function admin() external returns (address);\n}\n\ncontract VRTVault is VRTVaultStorage, AccessControlledV5 {\n using SafeMath for uint256;\n using SafeBEP20 for IBEP20;\n\n /// @notice The upper bound for lastAccruingBlock. Close to year 3,000, considering 3 seconds per block. Used to avoid a value absurdly high\n uint256 public constant MAX_LAST_ACCRUING_BLOCK = 9999999999;\n\n /// @notice Event emitted when vault is paused\n event VaultPaused(address indexed admin);\n\n /// @notice Event emitted when vault is resumed after pause\n event VaultResumed(address indexed admin);\n\n /// @notice Event emitted on VRT deposit\n event Deposit(address indexed user, uint256 amount);\n\n /// @notice Event emitted when accruedInterest and VRT PrincipalAmount is withrawn\n event Withdraw(\n address indexed user,\n uint256 withdrawnAmount,\n uint256 totalPrincipalAmount,\n uint256 accruedInterest\n );\n\n /// @notice Event emitted when Admin withdraw BEP20 token from contract\n event WithdrawToken(address indexed tokenAddress, address indexed receiver, uint256 amount);\n\n /// @notice Event emitted when accruedInterest is claimed\n event Claim(address indexed user, uint256 interestAmount);\n\n /// @notice Event emitted when lastAccruingBlock state variable changes\n event LastAccruingBlockChanged(uint256 oldLastAccruingBlock, uint256 newLastAccruingBlock);\n\n constructor() public {\n admin = msg.sender;\n }\n\n modifier onlyAdmin() {\n require(msg.sender == admin, \"only admin allowed\");\n _;\n }\n\n function initialize(address _vrtAddress, uint256 _interestRatePerBlock) public {\n require(msg.sender == admin, \"only admin may initialize the Vault\");\n require(_vrtAddress != address(0), \"vrtAddress cannot be Zero\");\n require(interestRatePerBlock == 0, \"Vault may only be initialized once\");\n\n // Set initial exchange rate\n interestRatePerBlock = _interestRatePerBlock;\n require(interestRatePerBlock > 0, \"interestRate Per Block must be greater than zero.\");\n\n // Set the VRT\n vrt = IBEP20(_vrtAddress);\n _notEntered = true;\n }\n\n modifier isInitialized() {\n require(interestRatePerBlock > 0, \"Vault is not initialized\");\n _;\n }\n\n modifier isActive() {\n require(!vaultPaused, \"Vault is paused\");\n _;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant() {\n require(_notEntered, \"re-entered\");\n _notEntered = false;\n _;\n _notEntered = true; // get a gas-refund post-Istanbul\n }\n\n modifier nonZeroAddress(address _address) {\n require(_address != address(0), \"Address cannot be Zero\");\n _;\n }\n\n modifier userHasPosition(address userAddress) {\n UserInfo storage user = userInfo[userAddress];\n require(user.userAddress != address(0), \"User does not have any position in the Vault.\");\n _;\n }\n\n /**\n * @notice Pause vault\n */\n function pause() external {\n _checkAccessAllowed(\"pause()\");\n require(!vaultPaused, \"Vault is already paused\");\n vaultPaused = true;\n emit VaultPaused(msg.sender);\n }\n\n /**\n * @notice Resume vault\n */\n function resume() external {\n _checkAccessAllowed(\"resume()\");\n require(vaultPaused, \"Vault is not paused\");\n vaultPaused = false;\n emit VaultResumed(msg.sender);\n }\n\n /**\n * @notice Deposit VRT to VRTVault for a fixed-interest-rate\n * @param depositAmount The amount to deposit to vault\n */\n function deposit(uint256 depositAmount) external nonReentrant isInitialized isActive {\n require(depositAmount > 0, \"Deposit amount must be non-zero\");\n\n address userAddress = msg.sender;\n UserInfo storage user = userInfo[userAddress];\n\n if (user.userAddress == address(0)) {\n user.userAddress = userAddress;\n user.totalPrincipalAmount = depositAmount;\n } else {\n // accrue Interest and transfer to the user\n uint256 accruedInterest = computeAccruedInterest(user.totalPrincipalAmount, user.accrualStartBlockNumber);\n\n user.totalPrincipalAmount = user.totalPrincipalAmount.add(depositAmount);\n\n if (accruedInterest > 0) {\n uint256 vrtBalance = vrt.balanceOf(address(this));\n require(\n vrtBalance >= accruedInterest,\n \"Failed to transfer accruedInterest, Insufficient VRT in Vault.\"\n );\n emit Claim(userAddress, accruedInterest);\n vrt.safeTransfer(user.userAddress, accruedInterest);\n }\n }\n\n uint256 currentBlock_ = getBlockNumber();\n if (lastAccruingBlock > currentBlock_) {\n user.accrualStartBlockNumber = currentBlock_;\n } else {\n user.accrualStartBlockNumber = lastAccruingBlock;\n }\n emit Deposit(userAddress, depositAmount);\n vrt.safeTransferFrom(userAddress, address(this), depositAmount);\n }\n\n /**\n * @notice get accruedInterest of the user's VRTDeposits in the Vault\n * @param userAddress Address of User in the the Vault\n * @return The interest accrued, in VRT\n */\n function getAccruedInterest(\n address userAddress\n ) public view nonZeroAddress(userAddress) isInitialized returns (uint256) {\n UserInfo storage user = userInfo[userAddress];\n if (user.accrualStartBlockNumber == 0) {\n return 0;\n }\n\n return computeAccruedInterest(user.totalPrincipalAmount, user.accrualStartBlockNumber);\n }\n\n /**\n * @notice get accruedInterest of the user's VRTDeposits in the Vault\n * @param totalPrincipalAmount of the User\n * @param accrualStartBlockNumber of the User\n * @return The interest accrued, in VRT\n */\n function computeAccruedInterest(\n uint256 totalPrincipalAmount,\n uint256 accrualStartBlockNumber\n ) internal view isInitialized returns (uint256) {\n uint256 blockNumber = getBlockNumber();\n uint256 _lastAccruingBlock = lastAccruingBlock;\n\n if (blockNumber > _lastAccruingBlock) {\n blockNumber = _lastAccruingBlock;\n }\n\n if (accrualStartBlockNumber == 0 || accrualStartBlockNumber >= blockNumber) {\n return 0;\n }\n\n // Number of blocks since deposit\n uint256 blockDelta = blockNumber.sub(accrualStartBlockNumber);\n uint256 accruedInterest = (totalPrincipalAmount.mul(interestRatePerBlock).mul(blockDelta)).div(1e18);\n return accruedInterest;\n }\n\n /**\n * @notice claim the accruedInterest of the user's VRTDeposits in the Vault\n */\n function claim() external nonReentrant isInitialized userHasPosition(msg.sender) isActive {\n _claim(msg.sender);\n }\n\n /**\n * @notice claim the accruedInterest of the user's VRTDeposits in the Vault\n * @param account The account for which to claim rewards\n */\n function claim(address account) external nonReentrant isInitialized userHasPosition(account) isActive {\n _claim(account);\n }\n\n /**\n * @notice Low level claim function\n * @param account The account for which to claim rewards\n */\n function _claim(address account) internal {\n uint256 accruedInterest = getAccruedInterest(account);\n if (accruedInterest > 0) {\n UserInfo storage user = userInfo[account];\n uint256 vrtBalance = vrt.balanceOf(address(this));\n require(vrtBalance >= accruedInterest, \"Failed to transfer VRT, Insufficient VRT in Vault.\");\n emit Claim(account, accruedInterest);\n uint256 currentBlock_ = getBlockNumber();\n if (lastAccruingBlock > currentBlock_) {\n user.accrualStartBlockNumber = currentBlock_;\n } else {\n user.accrualStartBlockNumber = lastAccruingBlock;\n }\n vrt.safeTransfer(user.userAddress, accruedInterest);\n }\n }\n\n /**\n * @notice withdraw accruedInterest and totalPrincipalAmount of the user's VRTDeposit in the Vault\n */\n function withdraw() external nonReentrant isInitialized userHasPosition(msg.sender) isActive {\n address userAddress = msg.sender;\n uint256 accruedInterest = getAccruedInterest(userAddress);\n\n UserInfo storage user = userInfo[userAddress];\n\n uint256 totalPrincipalAmount = user.totalPrincipalAmount;\n uint256 vrtForWithdrawal = accruedInterest.add(totalPrincipalAmount);\n user.totalPrincipalAmount = 0;\n user.accrualStartBlockNumber = getBlockNumber();\n\n uint256 vrtBalance = vrt.balanceOf(address(this));\n require(vrtBalance >= vrtForWithdrawal, \"Failed to transfer VRT, Insufficient VRT in Vault.\");\n\n emit Withdraw(userAddress, vrtForWithdrawal, totalPrincipalAmount, accruedInterest);\n vrt.safeTransfer(user.userAddress, vrtForWithdrawal);\n }\n\n /**\n * @notice withdraw BEP20 tokens from the contract to a recipient address.\n * @param tokenAddress address of the BEP20 token\n * @param receiver recipient of the BEP20 token\n * @param amount tokenAmount\n */\n function withdrawBep20(\n address tokenAddress,\n address receiver,\n uint256 amount\n ) external isInitialized nonZeroAddress(tokenAddress) nonZeroAddress(receiver) {\n _checkAccessAllowed(\"withdrawBep20(address,address,uint256)\");\n require(amount > 0, \"amount is invalid\");\n IBEP20 token = IBEP20(tokenAddress);\n require(amount <= token.balanceOf(address(this)), \"Insufficient amount in Vault\");\n emit WithdrawToken(tokenAddress, receiver, amount);\n token.safeTransfer(receiver, amount);\n }\n\n function setLastAccruingBlock(uint256 _lastAccruingBlock) external {\n _checkAccessAllowed(\"setLastAccruingBlock(uint256)\");\n require(_lastAccruingBlock < MAX_LAST_ACCRUING_BLOCK, \"_lastAccruingBlock is absurdly high\");\n\n uint256 oldLastAccruingBlock = lastAccruingBlock;\n uint256 currentBlock = getBlockNumber();\n if (oldLastAccruingBlock != 0) {\n require(currentBlock < oldLastAccruingBlock, \"Cannot change at this point\");\n }\n if (oldLastAccruingBlock == 0 || _lastAccruingBlock < oldLastAccruingBlock) {\n // Must be in future\n require(currentBlock < _lastAccruingBlock, \"Invalid _lastAccruingBlock interest have been accumulated\");\n }\n lastAccruingBlock = _lastAccruingBlock;\n emit LastAccruingBlockChanged(oldLastAccruingBlock, _lastAccruingBlock);\n }\n\n function getBlockNumber() public view returns (uint256) {\n return block.number;\n }\n\n /*** Admin Functions ***/\n\n function _become(IVRTVaultProxy vrtVaultProxy) external {\n require(msg.sender == vrtVaultProxy.admin(), \"only proxy admin can change brains\");\n vrtVaultProxy._acceptImplementation();\n }\n\n /**\n * @notice Sets the address of the access control of this contract\n * @dev Admin function to set the access control address\n * @param newAccessControlAddress New address for the access control\n */\n function setAccessControl(address newAccessControlAddress) external onlyAdmin {\n _setAccessControlManager(newAccessControlAddress);\n }\n}\n" + }, + "contracts/VRTVault/VRTVaultProxy.sol": { + "content": "pragma solidity ^0.5.16;\n\nimport \"./VRTVaultStorage.sol\";\n\ncontract VRTVaultProxy is VRTVaultAdminStorage {\n /**\n * @notice Emitted when pendingImplementation is changed\n */\n event NewPendingImplementation(address oldPendingImplementation, address newPendingImplementation);\n\n /**\n * @notice Emitted when pendingImplementation is accepted, which means VRT 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(address implementation_, address vrtAddress_, uint256 interestRatePerBlock_) public {\n // Creator of the contract is admin during initialization\n admin = msg.sender;\n\n // New implementations always get set via the settor (post-initialize)\n _setImplementation(implementation_);\n\n // First delegate gets to initialize the delegator (i.e. storage contract)\n delegateTo(\n implementation_,\n abi.encodeWithSignature(\"initialize(address,uint256)\", vrtAddress_, interestRatePerBlock_)\n );\n }\n\n /**\n * @notice Called by the admin to update the implementation of the delegator\n * @param implementation_ The address of the new implementation for delegation\n */\n function _setImplementation(address implementation_) public {\n require(msg.sender == admin, \"VRTVaultProxy::_setImplementation: admin only\");\n require(implementation_ != address(0), \"VRTVaultProxy::_setImplementation: invalid implementation address\");\n\n address oldImplementation = implementation;\n implementation = implementation_;\n\n emit NewImplementation(oldImplementation, implementation);\n }\n\n /**\n * @notice Internal method to delegate execution to another contract\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n * @param callee The contract to delegatecall\n * @param data The raw data to delegatecall\n * @return The returned bytes from the delegatecall\n */\n function delegateTo(address callee, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returnData) = callee.delegatecall(data);\n assembly {\n if eq(success, 0) {\n revert(add(returnData, 0x20), returndatasize)\n }\n }\n return returnData;\n }\n\n /*** Admin Functions ***/\n function _setPendingImplementation(address newPendingImplementation) public {\n require(msg.sender == admin, \"Only admin can set Pending Implementation\");\n\n address oldPendingImplementation = pendingImplementation;\n\n pendingImplementation = newPendingImplementation;\n\n emit NewPendingImplementation(oldPendingImplementation, pendingImplementation);\n }\n\n /**\n * @notice Accepts new implementation of VRT Vault. msg.sender must be pendingImplementation\n * @dev Admin function for new implementation to accept it's role as implementation\n */\n function _acceptImplementation() public {\n // Check caller is pendingImplementation\n require(\n msg.sender == pendingImplementation,\n \"only address marked as pendingImplementation can accept Implementation\"\n );\n\n // Save current values for inclusion in log\n address oldImplementation = implementation;\n address oldPendingImplementation = pendingImplementation;\n\n implementation = pendingImplementation;\n\n pendingImplementation = address(0);\n\n emit NewImplementation(oldImplementation, implementation);\n emit NewPendingImplementation(oldPendingImplementation, pendingImplementation);\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 */\n function _setPendingAdmin(address newPendingAdmin) public {\n // Check caller = admin\n require(msg.sender == admin, \"only admin can set pending admin\");\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\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 * @dev return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n */\n function _acceptAdmin() public {\n // Check caller is pendingAdmin\n require(msg.sender == pendingAdmin, \"only address marked as pendingAdmin can accept as Admin\");\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\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" + }, + "contracts/VRTVault/VRTVaultStorage.sol": { + "content": "pragma solidity ^0.5.16;\nimport \"../Utils/SafeMath.sol\";\nimport \"../Utils/IBEP20.sol\";\n\ncontract VRTVaultAdminStorage {\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 VRT Vault\n */\n address public implementation;\n\n /**\n * @notice Pending brains of VAI Vault\n */\n address public pendingImplementation;\n}\n\ncontract VRTVaultStorage is VRTVaultAdminStorage {\n /// @notice Guard variable for re-entrancy checks\n bool public _notEntered;\n\n /// @notice pause indicator for Vault\n bool public vaultPaused;\n\n /// @notice The VRT TOKEN!\n IBEP20 public vrt;\n\n /// @notice interestRate for accrual - per Block\n uint256 public interestRatePerBlock;\n\n /// @notice Info of each user.\n struct UserInfo {\n address userAddress;\n uint256 accrualStartBlockNumber;\n uint256 totalPrincipalAmount;\n uint256 lastWithdrawnBlockNumber;\n }\n\n // Info of each user that stakes tokens.\n mapping(address => UserInfo) public userInfo;\n\n /// @notice block number after which no interest will be accrued\n uint256 public lastAccruingBlock;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "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" + }, + "contracts/XVSVault/XVSVault.sol": { + "content": "// SPDX-License-Identifier: BSD-3-Clause\n\npragma solidity 0.5.16;\npragma experimental ABIEncoderV2;\n\nimport \"../Utils/ECDSA.sol\";\nimport \"../Utils/SafeBEP20.sol\";\nimport \"../Utils/IBEP20.sol\";\nimport \"./XVSVaultStorage.sol\";\nimport \"../Tokens/Prime/IPrime.sol\";\nimport \"../Utils/SafeCast.sol\";\nimport \"@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV5.sol\";\nimport \"@venusprotocol/solidity-utilities/contracts/TimeManagerV5.sol\";\n\nimport { XVSStore } from \"./XVSStore.sol\";\nimport { XVSVaultProxy } from \"./XVSVaultProxy.sol\";\n\n/**\n * @title XVS Vault\n * @author Venus\n * @notice The XVS Vault allows XVS holders to lock their XVS to recieve voting rights in Venus governance and are rewarded with XVS.\n */\ncontract XVSVault is XVSVaultStorage, ECDSA, AccessControlledV5, TimeManagerV5 {\n using SafeMath for uint256;\n using SafeCast for uint256;\n using SafeBEP20 for IBEP20;\n\n /// @notice The upper bound for the lock period in a pool, 10 years\n uint256 public constant MAX_LOCK_PERIOD = 60 * 60 * 24 * 365 * 10;\n\n /// @notice Event emitted when deposit\n event Deposit(address indexed user, address indexed rewardToken, uint256 indexed pid, uint256 amount);\n\n /// @notice Event emitted when execute withrawal\n event ExecutedWithdrawal(address indexed user, address indexed rewardToken, uint256 indexed pid, uint256 amount);\n\n /// @notice Event emitted when request withrawal\n event RequestedWithdrawal(address indexed user, address indexed rewardToken, uint256 indexed pid, uint256 amount);\n\n /// @notice An event thats emitted when an account changes its delegate\n event DelegateChangedV2(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /// @notice An event thats emitted when a delegate account's vote balance changes\n event DelegateVotesChangedV2(address indexed delegate, uint previousBalance, uint newBalance);\n\n /// @notice An event emitted when the reward store address is updated\n event StoreUpdated(address oldXvs, address oldStore, address newXvs, address newStore);\n\n /// @notice An event emitted when the withdrawal locking period is updated for a pool\n event WithdrawalLockingPeriodUpdated(address indexed rewardToken, uint indexed pid, uint oldPeriod, uint newPeriod);\n\n /// @notice An event emitted when the reward amount per block or second is modified for a pool\n event RewardAmountUpdated(address indexed rewardToken, uint oldReward, uint newReward);\n\n /// @notice An event emitted when a new pool is added\n event PoolAdded(\n address indexed rewardToken,\n uint indexed pid,\n address indexed token,\n uint allocPoints,\n uint rewardPerBlockOrSecond,\n uint lockPeriod\n );\n\n /// @notice An event emitted when a pool allocation points are updated\n event PoolUpdated(address indexed rewardToken, uint indexed pid, uint oldAllocPoints, uint newAllocPoints);\n\n /// @notice Event emitted when reward claimed\n event Claim(address indexed user, address indexed rewardToken, uint256 indexed pid, uint256 amount);\n\n /// @notice Event emitted when vault is paused\n event VaultPaused(address indexed admin);\n\n /// @notice Event emitted when vault is resumed after pause\n event VaultResumed(address indexed admin);\n\n /// @notice Event emitted when protocol logs a debt to a user due to insufficient funds for pending reward distribution\n event VaultDebtUpdated(\n address indexed rewardToken,\n address indexed userAddress,\n uint256 oldOwedAmount,\n uint256 newOwedAmount\n );\n\n /// @notice Emitted when prime token contract address is changed\n event NewPrimeToken(\n IPrime indexed oldPrimeToken,\n IPrime indexed newPrimeToken,\n address oldPrimeRewardToken,\n address newPrimeRewardToken,\n uint256 oldPrimePoolId,\n uint256 newPrimePoolId\n );\n\n /**\n * @notice XVSVault constructor\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 /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n */\n modifier nonReentrant() {\n require(_notEntered, \"re-entered\");\n _notEntered = false;\n _;\n _notEntered = true; // get a gas-refund post-Istanbul\n }\n\n /**\n * @dev Prevents functions to execute when vault is paused.\n */\n modifier isActive() {\n require(!vaultPaused, \"Vault is paused\");\n _;\n }\n\n /**\n * @notice Pauses vault\n */\n function pause() external {\n _checkAccessAllowed(\"pause()\");\n require(!vaultPaused, \"Vault is already paused\");\n vaultPaused = true;\n emit VaultPaused(msg.sender);\n }\n\n /**\n * @notice Resume vault\n */\n function resume() external {\n _checkAccessAllowed(\"resume()\");\n require(vaultPaused, \"Vault is not paused\");\n vaultPaused = false;\n emit VaultResumed(msg.sender);\n }\n\n /**\n * @notice Returns the number of pools with the specified reward token\n * @param rewardToken Reward token address\n * @return Number of pools that distribute the specified token as a reward\n */\n function poolLength(address rewardToken) external view returns (uint256) {\n return poolInfos[rewardToken].length;\n }\n\n /**\n * @notice Returns the number of reward tokens created per block or second\n * @param _rewardToken Reward token address\n * @return Number of reward tokens created per block or second\n */\n function rewardTokenAmountsPerBlock(address _rewardToken) external view returns (uint256) {\n return rewardTokenAmountsPerBlockOrSecond[_rewardToken];\n }\n\n /**\n * @notice Add a new token pool\n * @dev This vault DOES NOT support deflationary tokens — it expects that\n * the amount of transferred tokens would equal the actually deposited\n * amount. In practice this means that this vault DOES NOT support USDT\n * and similar tokens (that do not provide these guarantees).\n * @param _rewardToken Reward token address\n * @param _allocPoint Number of allocation points assigned to this pool\n * @param _token Staked token\n * @param _rewardPerBlockOrSecond Initial reward per block or second, in terms of _rewardToken\n * @param _lockPeriod A period between withdrawal request and a moment when it's executable\n */\n function add(\n address _rewardToken,\n uint256 _allocPoint,\n IBEP20 _token,\n uint256 _rewardPerBlockOrSecond,\n uint256 _lockPeriod\n ) external {\n _checkAccessAllowed(\"add(address,uint256,address,uint256,uint256)\");\n _ensureNonzeroAddress(_rewardToken);\n _ensureNonzeroAddress(address(_token));\n require(address(xvsStore) != address(0), \"Store contract address is empty\");\n require(_allocPoint > 0, \"Alloc points must not be zero\");\n\n massUpdatePools(_rewardToken);\n\n PoolInfo[] storage poolInfo = poolInfos[_rewardToken];\n\n uint256 length = poolInfo.length;\n for (uint256 pid = 0; pid < length; ++pid) {\n require(poolInfo[pid].token != _token, \"Pool already added\");\n }\n\n // We use balanceOf to get the supply amount, so shouldn't be possible to\n // configure pools with different reward token but the same staked token\n require(!isStakedToken[address(_token)], \"Token exists in other pool\");\n\n totalAllocPoints[_rewardToken] = totalAllocPoints[_rewardToken].add(_allocPoint);\n\n rewardTokenAmountsPerBlockOrSecond[_rewardToken] = _rewardPerBlockOrSecond;\n\n poolInfo.push(\n PoolInfo({\n token: _token,\n allocPoint: _allocPoint,\n lastRewardBlockOrSecond: getBlockNumberOrTimestamp(),\n accRewardPerShare: 0,\n lockPeriod: _lockPeriod\n })\n );\n isStakedToken[address(_token)] = true;\n\n XVSStore(xvsStore).setRewardToken(_rewardToken, true);\n\n emit PoolAdded(\n _rewardToken,\n poolInfo.length - 1,\n address(_token),\n _allocPoint,\n _rewardPerBlockOrSecond,\n _lockPeriod\n );\n }\n\n /**\n * @notice Update the given pool's reward allocation point\n * @param _rewardToken Reward token address\n * @param _pid Pool index\n * @param _allocPoint Number of allocation points assigned to this pool\n */\n function set(address _rewardToken, uint256 _pid, uint256 _allocPoint) external {\n _checkAccessAllowed(\"set(address,uint256,uint256)\");\n _ensureValidPool(_rewardToken, _pid);\n\n massUpdatePools(_rewardToken);\n\n PoolInfo[] storage poolInfo = poolInfos[_rewardToken];\n uint256 newTotalAllocPoints = totalAllocPoints[_rewardToken].sub(poolInfo[_pid].allocPoint).add(_allocPoint);\n require(newTotalAllocPoints > 0, \"Alloc points per reward token must not be zero\");\n\n uint256 oldAllocPoints = poolInfo[_pid].allocPoint;\n poolInfo[_pid].allocPoint = _allocPoint;\n totalAllocPoints[_rewardToken] = newTotalAllocPoints;\n\n emit PoolUpdated(_rewardToken, _pid, oldAllocPoints, _allocPoint);\n }\n\n /**\n * @notice Update the given reward token's amount per block or second\n * @param _rewardToken Reward token address\n * @param _rewardAmount Number of allocation points assigned to this pool\n */\n function setRewardAmountPerBlockOrSecond(address _rewardToken, uint256 _rewardAmount) external {\n _checkAccessAllowed(\"setRewardAmountPerBlockOrSecond(address,uint256)\");\n require(XVSStore(xvsStore).rewardTokens(_rewardToken), \"Invalid reward token\");\n massUpdatePools(_rewardToken);\n uint256 oldReward = rewardTokenAmountsPerBlockOrSecond[_rewardToken];\n rewardTokenAmountsPerBlockOrSecond[_rewardToken] = _rewardAmount;\n\n emit RewardAmountUpdated(_rewardToken, oldReward, _rewardAmount);\n }\n\n /**\n * @notice Update the lock period after which a requested withdrawal can be executed\n * @param _rewardToken Reward token address\n * @param _pid Pool index\n * @param _newPeriod New lock period\n */\n function setWithdrawalLockingPeriod(address _rewardToken, uint256 _pid, uint256 _newPeriod) external {\n _checkAccessAllowed(\"setWithdrawalLockingPeriod(address,uint256,uint256)\");\n _ensureValidPool(_rewardToken, _pid);\n require(_newPeriod > 0 && _newPeriod < MAX_LOCK_PERIOD, \"Invalid new locking period\");\n PoolInfo storage pool = poolInfos[_rewardToken][_pid];\n uint256 oldPeriod = pool.lockPeriod;\n pool.lockPeriod = _newPeriod;\n\n emit WithdrawalLockingPeriodUpdated(_rewardToken, _pid, oldPeriod, _newPeriod);\n }\n\n /**\n * @notice Deposit XVSVault for XVS allocation\n * @param _rewardToken The Reward Token Address\n * @param _pid The Pool Index\n * @param _amount The amount to deposit to vault\n */\n function deposit(address _rewardToken, uint256 _pid, uint256 _amount) external nonReentrant isActive {\n _ensureValidPool(_rewardToken, _pid);\n PoolInfo storage pool = poolInfos[_rewardToken][_pid];\n UserInfo storage user = userInfos[_rewardToken][_pid][msg.sender];\n _updatePool(_rewardToken, _pid);\n require(pendingWithdrawalsBeforeUpgrade(_rewardToken, _pid, msg.sender) == 0, \"execute pending withdrawal\");\n\n if (user.amount > 0) {\n uint256 pending = _computeReward(user, pool);\n if (pending > 0) {\n _transferReward(_rewardToken, msg.sender, pending);\n emit Claim(msg.sender, _rewardToken, _pid, pending);\n }\n }\n pool.token.safeTransferFrom(msg.sender, address(this), _amount);\n user.amount = user.amount.add(_amount);\n user.rewardDebt = _cumulativeReward(user, pool);\n\n // Update Delegate Amount\n if (address(pool.token) == xvsAddress) {\n _moveDelegates(address(0), delegates[msg.sender], safe96(_amount, \"XVSVault::deposit: votes overflow\"));\n }\n\n if (primeRewardToken == _rewardToken && _pid == primePoolId) {\n primeToken.xvsUpdated(msg.sender);\n }\n\n emit Deposit(msg.sender, _rewardToken, _pid, _amount);\n }\n\n /**\n * @notice Claim rewards for pool\n * @param _account The account for which to claim rewards\n * @param _rewardToken The Reward Token Address\n * @param _pid The Pool Index\n */\n function claim(address _account, address _rewardToken, uint256 _pid) external nonReentrant isActive {\n _ensureValidPool(_rewardToken, _pid);\n PoolInfo storage pool = poolInfos[_rewardToken][_pid];\n UserInfo storage user = userInfos[_rewardToken][_pid][_account];\n _updatePool(_rewardToken, _pid);\n require(pendingWithdrawalsBeforeUpgrade(_rewardToken, _pid, _account) == 0, \"execute pending withdrawal\");\n\n if (user.amount > 0) {\n uint256 pending = _computeReward(user, pool);\n\n if (pending > 0) {\n user.rewardDebt = _cumulativeReward(user, pool);\n\n _transferReward(_rewardToken, _account, pending);\n emit Claim(_account, _rewardToken, _pid, pending);\n }\n }\n }\n\n /**\n * @notice Pushes withdrawal request to the requests array and updates\n * the pending withdrawals amount. The requests are always sorted\n * by unlock time (descending) so that the earliest to execute requests\n * are always at the end of the array.\n * @param _user The user struct storage pointer\n * @param _requests The user's requests array storage pointer\n * @param _amount The amount being requested\n */\n function pushWithdrawalRequest(\n UserInfo storage _user,\n WithdrawalRequest[] storage _requests,\n uint _amount,\n uint _lockedUntil\n ) internal {\n uint i = _requests.length;\n _requests.push(WithdrawalRequest(0, 0, 1));\n // Keep it sorted so that the first to get unlocked request is always at the end\n for (; i > 0 && _requests[i - 1].lockedUntil <= _lockedUntil; --i) {\n _requests[i] = _requests[i - 1];\n }\n _requests[i] = WithdrawalRequest(_amount, _lockedUntil.toUint128(), 1);\n _user.pendingWithdrawals = _user.pendingWithdrawals.add(_amount);\n }\n\n /**\n * @notice Pops the requests with unlock time < now from the requests\n * array and deducts the computed amount from the user's pending\n * withdrawals counter. Assumes that the requests array is sorted\n * by unclock time (descending).\n * @dev This function **removes** the eligible requests from the requests\n * array. If this function is called, the withdrawal should actually\n * happen (or the transaction should be reverted).\n * @param _user The user struct storage pointer\n * @param _requests The user's requests array storage pointer\n * @return beforeUpgradeWithdrawalAmount The amount eligible for withdrawal before upgrade (this amount should be\n * sent to the user, otherwise the state would be inconsistent).\n * @return afterUpgradeWithdrawalAmount The amount eligible for withdrawal after upgrade (this amount should be\n * sent to the user, otherwise the state would be inconsistent).\n */\n function popEligibleWithdrawalRequests(\n UserInfo storage _user,\n WithdrawalRequest[] storage _requests\n ) internal returns (uint beforeUpgradeWithdrawalAmount, uint afterUpgradeWithdrawalAmount) {\n // Since the requests are sorted by their unlock time, we can just\n // pop them from the array and stop at the first not-yet-eligible one\n for (uint i = _requests.length; i > 0 && isUnlocked(_requests[i - 1]); --i) {\n if (_requests[i - 1].afterUpgrade == 1) {\n afterUpgradeWithdrawalAmount = afterUpgradeWithdrawalAmount.add(_requests[i - 1].amount);\n } else {\n beforeUpgradeWithdrawalAmount = beforeUpgradeWithdrawalAmount.add(_requests[i - 1].amount);\n }\n\n _requests.pop();\n }\n _user.pendingWithdrawals = _user.pendingWithdrawals.sub(\n afterUpgradeWithdrawalAmount.add(beforeUpgradeWithdrawalAmount)\n );\n return (beforeUpgradeWithdrawalAmount, afterUpgradeWithdrawalAmount);\n }\n\n /**\n * @notice Checks if the request is eligible for withdrawal.\n * @param _request The request struct storage pointer\n * @return True if the request is eligible for withdrawal, false otherwise\n */\n function isUnlocked(WithdrawalRequest storage _request) private view returns (bool) {\n return _request.lockedUntil <= block.timestamp;\n }\n\n /**\n * @notice Execute withdrawal to XVSVault for XVS allocation\n * @param _rewardToken The Reward Token Address\n * @param _pid The Pool Index\n */\n function executeWithdrawal(address _rewardToken, uint256 _pid) external nonReentrant isActive {\n _ensureValidPool(_rewardToken, _pid);\n PoolInfo storage pool = poolInfos[_rewardToken][_pid];\n UserInfo storage user = userInfos[_rewardToken][_pid][msg.sender];\n WithdrawalRequest[] storage requests = withdrawalRequests[_rewardToken][_pid][msg.sender];\n\n uint256 beforeUpgradeWithdrawalAmount;\n uint256 afterUpgradeWithdrawalAmount;\n\n (beforeUpgradeWithdrawalAmount, afterUpgradeWithdrawalAmount) = popEligibleWithdrawalRequests(user, requests);\n require(beforeUpgradeWithdrawalAmount > 0 || afterUpgradeWithdrawalAmount > 0, \"nothing to withdraw\");\n\n // Having both old-style and new-style requests is not allowed and shouldn't be possible\n require(beforeUpgradeWithdrawalAmount == 0 || afterUpgradeWithdrawalAmount == 0, \"inconsistent state\");\n\n if (beforeUpgradeWithdrawalAmount > 0) {\n _updatePool(_rewardToken, _pid);\n uint256 pending = user.amount.mul(pool.accRewardPerShare).div(1e12).sub(user.rewardDebt);\n XVSStore(xvsStore).safeRewardTransfer(_rewardToken, msg.sender, pending);\n user.amount = user.amount.sub(beforeUpgradeWithdrawalAmount);\n user.rewardDebt = user.amount.mul(pool.accRewardPerShare).div(1e12);\n pool.token.safeTransfer(address(msg.sender), beforeUpgradeWithdrawalAmount);\n } else {\n user.amount = user.amount.sub(afterUpgradeWithdrawalAmount);\n totalPendingWithdrawals[_rewardToken][_pid] = totalPendingWithdrawals[_rewardToken][_pid].sub(\n afterUpgradeWithdrawalAmount\n );\n pool.token.safeTransfer(address(msg.sender), afterUpgradeWithdrawalAmount);\n }\n\n emit ExecutedWithdrawal(\n msg.sender,\n _rewardToken,\n _pid,\n beforeUpgradeWithdrawalAmount.add(afterUpgradeWithdrawalAmount)\n );\n }\n\n /**\n * @notice Returns before and after upgrade pending withdrawal amount\n * @param _requests The user's requests array storage pointer\n * @return beforeUpgradeWithdrawalAmount The amount eligible for withdrawal before upgrade\n * @return afterUpgradeWithdrawalAmount The amount eligible for withdrawal after upgrade\n */\n function getRequestedWithdrawalAmount(\n WithdrawalRequest[] storage _requests\n ) internal view returns (uint beforeUpgradeWithdrawalAmount, uint afterUpgradeWithdrawalAmount) {\n for (uint i = _requests.length; i > 0; --i) {\n if (_requests[i - 1].afterUpgrade == 1) {\n afterUpgradeWithdrawalAmount = afterUpgradeWithdrawalAmount.add(_requests[i - 1].amount);\n } else {\n beforeUpgradeWithdrawalAmount = beforeUpgradeWithdrawalAmount.add(_requests[i - 1].amount);\n }\n }\n return (beforeUpgradeWithdrawalAmount, afterUpgradeWithdrawalAmount);\n }\n\n /**\n * @notice Request withdrawal to XVSVault for XVS allocation\n * @param _rewardToken The Reward Token Address\n * @param _pid The Pool Index\n * @param _amount The amount to withdraw from the vault\n */\n function requestWithdrawal(address _rewardToken, uint256 _pid, uint256 _amount) external nonReentrant isActive {\n _ensureValidPool(_rewardToken, _pid);\n require(_amount > 0, \"requested amount cannot be zero\");\n UserInfo storage user = userInfos[_rewardToken][_pid][msg.sender];\n require(user.amount >= user.pendingWithdrawals.add(_amount), \"requested amount is invalid\");\n\n PoolInfo storage pool = poolInfos[_rewardToken][_pid];\n WithdrawalRequest[] storage requests = withdrawalRequests[_rewardToken][_pid][msg.sender];\n\n uint beforeUpgradeWithdrawalAmount;\n\n (beforeUpgradeWithdrawalAmount, ) = getRequestedWithdrawalAmount(requests);\n require(beforeUpgradeWithdrawalAmount == 0, \"execute pending withdrawal\");\n\n _updatePool(_rewardToken, _pid);\n uint256 pending = _computeReward(user, pool);\n _transferReward(_rewardToken, msg.sender, pending);\n\n uint lockedUntil = pool.lockPeriod.add(block.timestamp);\n\n pushWithdrawalRequest(user, requests, _amount, lockedUntil);\n totalPendingWithdrawals[_rewardToken][_pid] = totalPendingWithdrawals[_rewardToken][_pid].add(_amount);\n user.rewardDebt = _cumulativeReward(user, pool);\n\n // Update Delegate Amount\n if (address(pool.token) == xvsAddress) {\n _moveDelegates(\n delegates[msg.sender],\n address(0),\n safe96(_amount, \"XVSVault::requestWithdrawal: votes overflow\")\n );\n }\n\n if (primeRewardToken == _rewardToken && _pid == primePoolId) {\n primeToken.xvsUpdated(msg.sender);\n }\n\n emit Claim(msg.sender, _rewardToken, _pid, pending);\n emit RequestedWithdrawal(msg.sender, _rewardToken, _pid, _amount);\n }\n\n /**\n * @notice Get unlocked withdrawal amount\n * @param _rewardToken The Reward Token Address\n * @param _pid The Pool Index\n * @param _user The User Address\n * @return withdrawalAmount Amount that the user can withdraw\n */\n function getEligibleWithdrawalAmount(\n address _rewardToken,\n uint256 _pid,\n address _user\n ) external view returns (uint withdrawalAmount) {\n _ensureValidPool(_rewardToken, _pid);\n WithdrawalRequest[] storage requests = withdrawalRequests[_rewardToken][_pid][_user];\n // Since the requests are sorted by their unlock time, we can take\n // the entries from the end of the array and stop at the first\n // not-yet-eligible one\n for (uint i = requests.length; i > 0 && isUnlocked(requests[i - 1]); --i) {\n withdrawalAmount = withdrawalAmount.add(requests[i - 1].amount);\n }\n return withdrawalAmount;\n }\n\n /**\n * @notice Get requested amount\n * @param _rewardToken The Reward Token Address\n * @param _pid The Pool Index\n * @param _user The User Address\n * @return Total amount of requested but not yet executed withdrawals (including both executable and locked ones)\n */\n function getRequestedAmount(address _rewardToken, uint256 _pid, address _user) external view returns (uint256) {\n _ensureValidPool(_rewardToken, _pid);\n UserInfo storage user = userInfos[_rewardToken][_pid][_user];\n return user.pendingWithdrawals;\n }\n\n /**\n * @notice Returns the array of withdrawal requests that have not been executed yet\n * @param _rewardToken The Reward Token Address\n * @param _pid The Pool Index\n * @param _user The User Address\n * @return An array of withdrawal requests\n */\n function getWithdrawalRequests(\n address _rewardToken,\n uint256 _pid,\n address _user\n ) external view returns (WithdrawalRequest[] memory) {\n _ensureValidPool(_rewardToken, _pid);\n return withdrawalRequests[_rewardToken][_pid][_user];\n }\n\n /**\n * @notice View function to see pending XVSs on frontend\n * @param _rewardToken Reward token address\n * @param _pid Pool index\n * @param _user User address\n * @return Reward the user is eligible for in this pool, in terms of _rewardToken\n */\n function pendingReward(address _rewardToken, uint256 _pid, address _user) external view returns (uint256) {\n _ensureValidPool(_rewardToken, _pid);\n PoolInfo storage pool = poolInfos[_rewardToken][_pid];\n UserInfo storage user = userInfos[_rewardToken][_pid][_user];\n uint256 accRewardPerShare = pool.accRewardPerShare;\n uint256 supply = pool.token.balanceOf(address(this)).sub(totalPendingWithdrawals[_rewardToken][_pid]);\n uint256 curBlockNumberOrSecond = getBlockNumberOrTimestamp();\n uint256 rewardTokenPerBlockOrSecond = rewardTokenAmountsPerBlockOrSecond[_rewardToken];\n if (curBlockNumberOrSecond > pool.lastRewardBlockOrSecond && supply != 0) {\n uint256 multiplier = curBlockNumberOrSecond.sub(pool.lastRewardBlockOrSecond);\n uint256 reward = multiplier.mul(rewardTokenPerBlockOrSecond).mul(pool.allocPoint).div(\n totalAllocPoints[_rewardToken]\n );\n accRewardPerShare = accRewardPerShare.add(reward.mul(1e12).div(supply));\n }\n WithdrawalRequest[] storage requests = withdrawalRequests[_rewardToken][_pid][_user];\n (, uint256 afterUpgradeWithdrawalAmount) = getRequestedWithdrawalAmount(requests);\n return user.amount.sub(afterUpgradeWithdrawalAmount).mul(accRewardPerShare).div(1e12).sub(user.rewardDebt);\n }\n\n // Update reward variables for all pools. Be careful of gas spending!\n function massUpdatePools(address _rewardToken) internal {\n uint256 length = poolInfos[_rewardToken].length;\n for (uint256 pid = 0; pid < length; ++pid) {\n _updatePool(_rewardToken, pid);\n }\n }\n\n /**\n * @notice Update reward variables of the given pool to be up-to-date\n * @param _rewardToken Reward token address\n * @param _pid Pool index\n */\n function updatePool(address _rewardToken, uint256 _pid) external isActive {\n _ensureValidPool(_rewardToken, _pid);\n _updatePool(_rewardToken, _pid);\n }\n\n // Update reward variables of the given pool to be up-to-date.\n function _updatePool(address _rewardToken, uint256 _pid) internal {\n PoolInfo storage pool = poolInfos[_rewardToken][_pid];\n if (getBlockNumberOrTimestamp() <= pool.lastRewardBlockOrSecond) {\n return;\n }\n uint256 supply = pool.token.balanceOf(address(this));\n supply = supply.sub(totalPendingWithdrawals[_rewardToken][_pid]);\n if (supply == 0) {\n pool.lastRewardBlockOrSecond = getBlockNumberOrTimestamp();\n return;\n }\n uint256 curBlockNumberOrSecond = getBlockNumberOrTimestamp();\n uint256 multiplier = curBlockNumberOrSecond.sub(pool.lastRewardBlockOrSecond);\n uint256 reward = multiplier.mul(rewardTokenAmountsPerBlockOrSecond[_rewardToken]).mul(pool.allocPoint).div(\n totalAllocPoints[_rewardToken]\n );\n pool.accRewardPerShare = pool.accRewardPerShare.add(reward.mul(1e12).div(supply));\n pool.lastRewardBlockOrSecond = getBlockNumberOrTimestamp();\n }\n\n function _ensureValidPool(address rewardToken, uint256 pid) internal view {\n require(pid < poolInfos[rewardToken].length, \"vault: pool exists?\");\n }\n\n /**\n * @notice Get user info with reward token address and pid\n * @param _rewardToken Reward token address\n * @param _pid Pool index\n * @param _user User address\n * @return amount Deposited amount\n * @return rewardDebt Reward debt (technical value used to track past payouts)\n * @return pendingWithdrawals Requested but not yet executed withdrawals\n */\n function getUserInfo(\n address _rewardToken,\n uint256 _pid,\n address _user\n ) external view returns (uint256 amount, uint256 rewardDebt, uint256 pendingWithdrawals) {\n _ensureValidPool(_rewardToken, _pid);\n UserInfo storage user = userInfos[_rewardToken][_pid][_user];\n amount = user.amount;\n rewardDebt = user.rewardDebt;\n pendingWithdrawals = user.pendingWithdrawals;\n }\n\n /**\n * @notice Gets the total pending withdrawal amount of a user before upgrade\n * @param _rewardToken The Reward Token Address\n * @param _pid The Pool Index\n * @param _user The address of the user\n * @return beforeUpgradeWithdrawalAmount Total pending withdrawal amount in requests made before the vault upgrade\n */\n function pendingWithdrawalsBeforeUpgrade(\n address _rewardToken,\n uint256 _pid,\n address _user\n ) public view returns (uint256 beforeUpgradeWithdrawalAmount) {\n WithdrawalRequest[] storage requests = withdrawalRequests[_rewardToken][_pid][_user];\n (beforeUpgradeWithdrawalAmount, ) = getRequestedWithdrawalAmount(requests);\n return beforeUpgradeWithdrawalAmount;\n }\n\n /**\n * @notice Get the XVS stake balance of an account (excluding the pending withdrawals)\n * @param account The address of the account to check\n * @return The balance that user staked\n */\n function getStakeAmount(address account) internal view returns (uint96) {\n require(xvsAddress != address(0), \"XVSVault::getStakeAmount: xvs address is not set\");\n\n PoolInfo[] storage poolInfo = poolInfos[xvsAddress];\n\n uint256 length = poolInfo.length;\n for (uint256 pid = 0; pid < length; ++pid) {\n if (address(poolInfo[pid].token) == address(xvsAddress)) {\n UserInfo storage user = userInfos[xvsAddress][pid][account];\n return safe96(user.amount.sub(user.pendingWithdrawals), \"XVSVault::getStakeAmount: votes overflow\");\n }\n }\n return uint96(0);\n }\n\n /**\n * @notice Delegate votes from `msg.sender` to `delegatee`\n * @param delegatee The address to delegate votes to\n */\n function delegate(address delegatee) external isActive {\n return _delegate(msg.sender, delegatee);\n }\n\n /**\n * @notice Delegates votes from signatory to `delegatee`\n * @param delegatee The address to delegate votes to\n * @param nonce The contract state required to match the signature\n * @param expiry The time at which to expire the signature\n * @param v The recovery byte of the signature\n * @param r Half of the ECDSA signature pair\n * @param s Half of the ECDSA signature pair\n */\n function delegateBySig(\n address delegatee,\n uint nonce,\n uint expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external isActive {\n bytes32 domainSeparator = keccak256(\n abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(\"XVSVault\")), getChainId(), address(this))\n );\n bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));\n bytes32 digest = keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n address signatory = ECDSA.recover(digest, v, r, s);\n require(nonce == nonces[signatory]++, \"XVSVault::delegateBySig: invalid nonce\");\n require(block.timestamp <= expiry, \"XVSVault::delegateBySig: signature expired\");\n return _delegate(signatory, delegatee);\n }\n\n /**\n * @notice Gets the current votes balance for `account`\n * @param account The address to get votes balance\n * @return The number of current votes for `account`\n */\n function getCurrentVotes(address account) external view returns (uint96) {\n uint32 nCheckpoints = numCheckpoints[account];\n return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;\n }\n\n function _delegate(address delegator, address delegatee) internal {\n address currentDelegate = delegates[delegator];\n uint96 delegatorBalance = getStakeAmount(delegator);\n delegates[delegator] = delegatee;\n\n emit DelegateChangedV2(delegator, currentDelegate, delegatee);\n\n _moveDelegates(currentDelegate, delegatee, delegatorBalance);\n }\n\n function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {\n if (srcRep != dstRep && amount > 0) {\n if (srcRep != address(0)) {\n uint32 srcRepNum = numCheckpoints[srcRep];\n uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;\n uint96 srcRepNew = sub96(srcRepOld, amount, \"XVSVault::_moveVotes: vote amount underflows\");\n _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);\n }\n\n if (dstRep != address(0)) {\n uint32 dstRepNum = numCheckpoints[dstRep];\n uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;\n uint96 dstRepNew = add96(dstRepOld, amount, \"XVSVault::_moveVotes: vote amount overflows\");\n _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);\n }\n }\n }\n\n function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {\n uint32 blockNumberOrSecond = safe32(\n getBlockNumberOrTimestamp(),\n \"XVSVault::_writeCheckpoint: block number or second exceeds 32 bits\"\n );\n\n if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlockOrSecond == blockNumberOrSecond) {\n checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;\n } else {\n checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumberOrSecond, newVotes);\n numCheckpoints[delegatee] = nCheckpoints + 1;\n }\n\n emit DelegateVotesChangedV2(delegatee, oldVotes, newVotes);\n }\n\n function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {\n require(n < 2 ** 32, errorMessage);\n return uint32(n);\n }\n\n function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {\n require(n < 2 ** 96, errorMessage);\n return uint96(n);\n }\n\n function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {\n uint96 c = a + b;\n require(c >= a, errorMessage);\n return c;\n }\n\n function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n function getChainId() internal pure returns (uint) {\n uint256 chainId;\n assembly {\n chainId := chainid()\n }\n return chainId;\n }\n\n /**\n * @notice Determine the xvs stake balance for an account\n * @param account The address of the account to check\n * @param blockNumberOrSecond The block number or second to get the vote balance at\n * @return The balance that user staked\n */\n function getPriorVotes(address account, uint256 blockNumberOrSecond) external view returns (uint96) {\n require(blockNumberOrSecond < getBlockNumberOrTimestamp(), \"XVSVault::getPriorVotes: not yet determined\");\n\n uint32 nCheckpoints = numCheckpoints[account];\n if (nCheckpoints == 0) {\n return 0;\n }\n\n // First check most recent balance\n if (checkpoints[account][nCheckpoints - 1].fromBlockOrSecond <= blockNumberOrSecond) {\n return checkpoints[account][nCheckpoints - 1].votes;\n }\n\n // Next check implicit zero balance\n if (checkpoints[account][0].fromBlockOrSecond > blockNumberOrSecond) {\n return 0;\n }\n\n uint32 lower = 0;\n uint32 upper = nCheckpoints - 1;\n while (upper > lower) {\n uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\n Checkpoint memory cp = checkpoints[account][center];\n if (cp.fromBlockOrSecond == blockNumberOrSecond) {\n return cp.votes;\n } else if (cp.fromBlockOrSecond < blockNumberOrSecond) {\n lower = center;\n } else {\n upper = center - 1;\n }\n }\n return checkpoints[account][lower].votes;\n }\n\n /*** Admin Functions ***/\n\n function _become(XVSVaultProxy xvsVaultProxy) external {\n require(msg.sender == xvsVaultProxy.admin(), \"only proxy admin can change brains\");\n require(xvsVaultProxy._acceptImplementation() == 0, \"change not authorized\");\n }\n\n function setXvsStore(address _xvs, address _xvsStore) external onlyAdmin {\n _ensureNonzeroAddress(_xvs);\n _ensureNonzeroAddress(_xvsStore);\n\n address oldXvsContract = xvsAddress;\n address oldStore = xvsStore;\n require(oldXvsContract == address(0), \"already initialized\");\n\n xvsAddress = _xvs;\n xvsStore = _xvsStore;\n\n _notEntered = true;\n\n emit StoreUpdated(oldXvsContract, oldStore, _xvs, _xvsStore);\n }\n\n /**\n * @notice Sets the address of the prime token contract\n * @param _primeToken address of the prime token contract\n * @param _primeRewardToken address of reward token\n * @param _primePoolId pool id for reward\n */\n function setPrimeToken(IPrime _primeToken, address _primeRewardToken, uint256 _primePoolId) external onlyAdmin {\n require(address(_primeToken) != address(0), \"prime token cannot be zero address\");\n require(_primeRewardToken != address(0), \"reward cannot be zero address\");\n\n _ensureValidPool(_primeRewardToken, _primePoolId);\n\n emit NewPrimeToken(primeToken, _primeToken, primeRewardToken, _primeRewardToken, primePoolId, _primePoolId);\n\n primeToken = _primeToken;\n primeRewardToken = _primeRewardToken;\n primePoolId = _primePoolId;\n }\n\n /**\n * @dev Initializes the contract to use either blocks or seconds\n * @param timeBased_ A boolean indicating whether the contract is based on time or block\n * If timeBased is true than blocksPerYear_ param is ignored as blocksOrSecondsPerYear is set to SECONDS_PER_YEAR\n * @param blocksPerYear_ The number of blocks per year\n */\n function initializeTimeManager(bool timeBased_, uint256 blocksPerYear_) external onlyAdmin {\n _initializeTimeManager(timeBased_, blocksPerYear_);\n }\n\n /**\n * @notice Sets the address of the access control of this contract\n * @dev Admin function to set the access control address\n * @param newAccessControlAddress New address for the access control\n */\n function setAccessControl(address newAccessControlAddress) external onlyAdmin {\n _setAccessControlManager(newAccessControlAddress);\n }\n\n /**\n * @dev Reverts if the provided address is a zero address\n * @param address_ Address to check\n */\n function _ensureNonzeroAddress(address address_) internal pure {\n require(address_ != address(0), \"zero address not allowed\");\n }\n\n /**\n * @dev Transfers the reward to the user, taking into account the rewards store\n * balance and the previous debt. If there are not enough rewards in the store,\n * transfers the available funds and records the debt amount in pendingRewardTransfers.\n * @param rewardToken Reward token address\n * @param userAddress User address\n * @param amount Reward amount, in reward tokens\n */\n function _transferReward(address rewardToken, address userAddress, uint256 amount) internal {\n address xvsStore_ = xvsStore;\n uint256 storeBalance = IBEP20(rewardToken).balanceOf(xvsStore_);\n uint256 debtDueToFailedTransfers = pendingRewardTransfers[rewardToken][userAddress];\n uint256 fullAmount = amount.add(debtDueToFailedTransfers);\n\n if (fullAmount <= storeBalance) {\n if (debtDueToFailedTransfers != 0) {\n pendingRewardTransfers[rewardToken][userAddress] = 0;\n emit VaultDebtUpdated(rewardToken, userAddress, debtDueToFailedTransfers, 0);\n }\n XVSStore(xvsStore_).safeRewardTransfer(rewardToken, userAddress, fullAmount);\n return;\n }\n // Overflow isn't possible due to the check above\n uint256 newOwedAmount = fullAmount - storeBalance;\n pendingRewardTransfers[rewardToken][userAddress] = newOwedAmount;\n emit VaultDebtUpdated(rewardToken, userAddress, debtDueToFailedTransfers, newOwedAmount);\n XVSStore(xvsStore_).safeRewardTransfer(rewardToken, userAddress, storeBalance);\n }\n\n /**\n * @dev Computes cumulative reward for all user's shares\n * @param user UserInfo storage struct\n * @param pool PoolInfo storage struct\n */\n function _cumulativeReward(UserInfo storage user, PoolInfo storage pool) internal view returns (uint256) {\n return user.amount.sub(user.pendingWithdrawals).mul(pool.accRewardPerShare).div(1e12);\n }\n\n /**\n * @dev Computes the reward for all user's shares\n * @param user UserInfo storage struct\n * @param pool PoolInfo storage struct\n */\n function _computeReward(UserInfo storage user, PoolInfo storage pool) internal view returns (uint256) {\n return _cumulativeReward(user, pool).sub(user.rewardDebt);\n }\n}\n" + }, + "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" + }, + "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" + }, + "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" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "storageLayout", + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "evm.gasEstimates" + ], + "": ["ast"] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} diff --git a/deployments/bsctestnet/vTWT.json b/deployments/bsctestnet/vTWT.json new file mode 100644 index 000000000..dbb06cd1b --- /dev/null +++ b/deployments/bsctestnet/vTWT.json @@ -0,0 +1,2382 @@ +{ + "address": "0x95DaED37fdD3F557b3A5cCEb7D50Be65b36721DF", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "cashPrior", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "interestAccumulated", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "info", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "detail", + "type": "uint256" + } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + } + ], + "name": "MintBehalf", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlAddress", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldImplementation", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "NewImplementation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldPendingAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPendingAdmin", + "type": "address" + } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReserveFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "benefactor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "protocolShareReserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + } + ], + "name": "_addReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + } + ], + "name": "_reduceReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "_setComptroller", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "_setInterestRateModel", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "newPendingAdmin", + "type": "address" + } + ], + "name": "_setPendingAdmin", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "_setReserveFactor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOfUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "borrowBalanceCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "borrowBalanceStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptroller", + "outputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAccountSnapshot", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [ + { + "internalType": "contract InterestRateModel", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isVToken", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "internalType": "contract VTokenInterface", + "name": "vTokenCollateral", + "type": "address" + } + ], + "name": "liquidateBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + } + ], + "name": "redeemUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrowBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x0003a62dd40ff1a25a777a22311b5111669d703bb7c646cd5ee6760907ca16e2", + "receipt": { + "to": null, + "from": "0x14A1c22EF6d2eF6cE33c0b018d8A34D02021e5c8", + "contractAddress": "0x95DaED37fdD3F557b3A5cCEb7D50Be65b36721DF", + "transactionIndex": 1, + "gasUsed": "2097552", + "logsBloom": "0x01000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000800000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004100000000000000200000000000080000100000000000000000000000000000000800000000000000000000004000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x40b5bc59426fccb8254f7dfdee2bee53cedfca12669e0cc87bbcf6b6b645acdf", + "transactionHash": "0x0003a62dd40ff1a25a777a22311b5111669d703bb7c646cd5ee6760907ca16e2", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 44785558, + "transactionHash": "0x0003a62dd40ff1a25a777a22311b5111669d703bb7c646cd5ee6760907ca16e2", + "address": "0x95DaED37fdD3F557b3A5cCEb7D50Be65b36721DF", + "topics": ["0x7ac369dbd14fa5ea3f473ed67cc9d598964a77501540ba6751eb0b3decf5870d"], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000094d1820b2d1c7c7452a163983dc888cec546b77d", + "logIndex": 0, + "blockHash": "0x40b5bc59426fccb8254f7dfdee2bee53cedfca12669e0cc87bbcf6b6b645acdf" + }, + { + "transactionIndex": 1, + "blockNumber": 44785558, + "transactionHash": "0x0003a62dd40ff1a25a777a22311b5111669d703bb7c646cd5ee6760907ca16e2", + "address": "0x95DaED37fdD3F557b3A5cCEb7D50Be65b36721DF", + "topics": ["0xedffc32e068c7c95dfd4bdfd5c4d939a084d6b11c4199eac8436ed234d72f926"], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f1a8b40ca68d08effa31a16a83f4fd9b5c174872", + "logIndex": 1, + "blockHash": "0x40b5bc59426fccb8254f7dfdee2bee53cedfca12669e0cc87bbcf6b6b645acdf" + }, + { + "transactionIndex": 1, + "blockNumber": 44785558, + "transactionHash": "0x0003a62dd40ff1a25a777a22311b5111669d703bb7c646cd5ee6760907ca16e2", + "address": "0x95DaED37fdD3F557b3A5cCEb7D50Be65b36721DF", + "topics": ["0xd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a"], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ad6aa8bb4829560412a94aa930745f407bf8000b", + "logIndex": 2, + "blockHash": "0x40b5bc59426fccb8254f7dfdee2bee53cedfca12669e0cc87bbcf6b6b645acdf" + } + ], + "blockNumber": 44785558, + "cumulativeGasUsed": "2135577", + "status": 1, + "byzantium": true + }, + "args": [ + "0xb99c6b26fdf3678c6e2aff8466e3625a0e7182f8", + "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D", + "0xF1A8B40CA68d08EFfa31a16a83f4fd9b5c174872", + "10000000000000000000000000000", + "Venus TWT", + "vTWT", + 8, + "0xce10739590001705F7FF231611ba4A48B2820327", + "0xad6aa8Bb4829560412A94AA930745f407BF8000B", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "a2594572bdae270af6749f50c8019b6c", + "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"underlying_\",\"type\":\"address\"},{\"internalType\":\"contract ComptrollerInterface\",\"name\":\"comptroller_\",\"type\":\"address\"},{\"internalType\":\"contract InterestRateModel\",\"name\":\"interestRateModel_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialExchangeRateMantissa_\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"name_\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol_\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"address payable\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"becomeImplementationData\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cashPrior\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"interestAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"borrowIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalBorrows\",\"type\":\"uint256\"}],\"name\":\"AccrueInterest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"borrowAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"accountBorrows\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalBorrows\",\"type\":\"uint256\"}],\"name\":\"Borrow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"error\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"info\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"detail\",\"type\":\"uint256\"}],\"name\":\"Failure\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"vTokenCollateral\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"seizeTokens\",\"type\":\"uint256\"}],\"name\":\"LiquidateBorrow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"mintTokens\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalSupply\",\"type\":\"uint256\"}],\"name\":\"Mint\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"payer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"mintTokens\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalSupply\",\"type\":\"uint256\"}],\"name\":\"MintBehalf\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldAccessControlAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAccessControlAddress\",\"type\":\"address\"}],\"name\":\"NewAccessControlManager\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"NewAdmin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ComptrollerInterface\",\"name\":\"oldComptroller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract ComptrollerInterface\",\"name\":\"newComptroller\",\"type\":\"address\"}],\"name\":\"NewComptroller\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldImplementation\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"NewImplementation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract InterestRateModel\",\"name\":\"oldInterestRateModel\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract InterestRateModel\",\"name\":\"newInterestRateModel\",\"type\":\"address\"}],\"name\":\"NewMarketInterestRateModel\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldPendingAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newPendingAdmin\",\"type\":\"address\"}],\"name\":\"NewPendingAdmin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldProtocolShareReserve\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newProtocolShareReserve\",\"type\":\"address\"}],\"name\":\"NewProtocolShareReserve\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldReduceReservesBlockDelta\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newReduceReservesBlockDelta\",\"type\":\"uint256\"}],\"name\":\"NewReduceReservesBlockDelta\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldReserveFactorMantissa\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newReserveFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"NewReserveFactor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"redeemAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"redeemTokens\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalSupply\",\"type\":\"uint256\"}],\"name\":\"Redeem\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"redeemTokens\",\"type\":\"uint256\"}],\"name\":\"RedeemFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"payer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"accountBorrows\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalBorrows\",\"type\":\"uint256\"}],\"name\":\"RepayBorrow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"benefactor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"addAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newTotalReserves\",\"type\":\"uint256\"}],\"name\":\"ReservesAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"protocolShareReserve\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"reduceAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newTotalReserves\",\"type\":\"uint256\"}],\"name\":\"ReservesReduced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"constant\":false,\"inputs\":[],\"name\":\"_acceptAdmin\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"addAmount\",\"type\":\"uint256\"}],\"name\":\"_addReserves\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"reduceAmount\",\"type\":\"uint256\"}],\"name\":\"_reduceReserves\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"contract ComptrollerInterface\",\"name\":\"newComptroller\",\"type\":\"address\"}],\"name\":\"_setComptroller\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"allowResign\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"becomeImplementationData\",\"type\":\"bytes\"}],\"name\":\"_setImplementation\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"contract InterestRateModel\",\"name\":\"newInterestRateModel\",\"type\":\"address\"}],\"name\":\"_setInterestRateModel\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"newPendingAdmin\",\"type\":\"address\"}],\"name\":\"_setPendingAdmin\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newReserveFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"_setReserveFactor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"accessControlManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"accrualBlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"accrueInterest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOfUnderlying\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowAmount\",\"type\":\"uint256\"}],\"name\":\"borrow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"borrowBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"borrowBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"borrowIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"borrowRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"comptroller\",\"outputs\":[{\"internalType\":\"contract ComptrollerInterface\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"delegateToImplementation\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"delegateToViewImplementation\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getAccountSnapshot\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getCash\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"interestRateModel\",\"outputs\":[{\"internalType\":\"contract InterestRateModel\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isVToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"},{\"internalType\":\"contract VTokenInterface\",\"name\":\"vTokenCollateral\",\"type\":\"address\"}],\"name\":\"liquidateBorrow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"}],\"name\":\"mintBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"pendingAdmin\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"protocolShareReserve\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"redeemTokens\",\"type\":\"uint256\"}],\"name\":\"redeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"redeemAmount\",\"type\":\"uint256\"}],\"name\":\"redeemUnderlying\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"reduceReservesBlockDelta\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"reduceReservesBlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayBorrow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayBorrowBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"reserveFactorMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"seizeTokens\",\"type\":\"uint256\"}],\"name\":\"seize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"supplyRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalBorrows\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"totalBorrowsCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalReserves\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"dst\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"src\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"dst\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"underlying\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Venus\",\"methods\":{\"_acceptAdmin()\":{\"details\":\"Admin function for pending admin to accept role and update admin\",\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"_addReserves(uint256)\":{\"params\":{\"addAmount\":\"Amount of reserves to add\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"_reduceReserves(uint256)\":{\"params\":{\"reduceAmount\":\"Amount of reduction to reserves\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"_setComptroller(address)\":{\"details\":\"Admin function to set a new comptroller\",\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"_setImplementation(address,bool,bytes)\":{\"params\":{\"allowResign\":\"Flag to indicate whether to call _resignImplementation on the old implementation\",\"becomeImplementationData\":\"The encoded bytes data to be passed to _becomeImplementation\",\"implementation_\":\"The address of the new implementation for delegation\"}},\"_setInterestRateModel(address)\":{\"details\":\"Admin function to accrue interest and update the interest rate model\",\"params\":{\"newInterestRateModel\":\"The new interest rate model to use\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"_setPendingAdmin(address)\":{\"details\":\"Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\",\"params\":{\"newPendingAdmin\":\"New pending admin.\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"_setReserveFactor(uint256)\":{\"details\":\"Admin function to accrue interest and set a new reserve factor\",\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"accrueInterest()\":{\"details\":\"This calculates interest accrued from the last checkpointed block up to the current block and writes new checkpoint to storage.\"},\"allowance(address,address)\":{\"params\":{\"owner\":\"The address of the account which owns the tokens to be spent\",\"spender\":\"The address of the account which may transfer tokens\"},\"return\":\"The number of tokens allowed to be spent (-1 means infinite)\"},\"approve(address,uint256)\":{\"details\":\"This will overwrite the approval amount for `spender` and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\",\"params\":{\"amount\":\"The number of tokens that are approved (-1 means infinite)\",\"spender\":\"The address of the account which may transfer tokens\"},\"return\":\"Whether or not the approval succeeded\"},\"balanceOf(address)\":{\"params\":{\"owner\":\"The address of the account to query\"},\"return\":\"The number of tokens owned by `owner`\"},\"balanceOfUnderlying(address)\":{\"details\":\"This also accrues interest in a transaction\",\"params\":{\"owner\":\"The address of the account to query\"},\"return\":\"The amount of underlying owned by `owner`\"},\"borrow(uint256)\":{\"params\":{\"borrowAmount\":\"The amount of the underlying asset to borrow\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"borrowBalanceCurrent(address)\":{\"params\":{\"account\":\"The address whose balance should be calculated after updating borrowIndex\"},\"return\":\"The calculated balance\"},\"borrowBalanceStored(address)\":{\"params\":{\"account\":\"The address whose balance should be calculated\"},\"return\":\"The calculated balance\"},\"borrowRatePerBlock()\":{\"return\":\"The borrow interest rate per block, scaled by 1e18\"},\"constructor\":{\"params\":{\"admin_\":\"Address of the administrator of this token\",\"becomeImplementationData\":\"The encoded args for becomeImplementation\",\"comptroller_\":\"The address of the comptroller\",\"decimals_\":\"BEP-20 decimal precision of this token\",\"implementation_\":\"The address of the implementation the contract delegates to\",\"initialExchangeRateMantissa_\":\"The initial exchange rate, scaled by 1e18\",\"interestRateModel_\":\"The address of the interest rate model\",\"name_\":\"BEP-20 name of this token\",\"symbol_\":\"BEP-20 symbol of this token\",\"underlying_\":\"The address of the underlying asset\"}},\"delegateToImplementation(bytes)\":{\"details\":\"It returns to the external caller whatever the implementation returns or forwards reverts\",\"params\":{\"data\":\"The raw data to delegatecall\"},\"return\":\"The returned bytes from the delegatecall\"},\"delegateToViewImplementation(bytes)\":{\"details\":\"It returns to the external caller whatever the implementation returns or forwards reverts There are an additional 2 prefix uints from the wrapper returndata, which we ignore since we make an extra hop.\",\"params\":{\"data\":\"The raw data to delegatecall\"},\"return\":\"The returned bytes from the delegatecall\"},\"exchangeRateCurrent()\":{\"return\":\"Calculated exchange rate scaled by 1e18\"},\"exchangeRateStored()\":{\"details\":\"This function does not accrue interest before calculating the exchange rate\",\"return\":\"Calculated exchange rate scaled by 1e18\"},\"getAccountSnapshot(address)\":{\"details\":\"This is used by comptroller to more efficiently perform liquidity checks.\",\"params\":{\"account\":\"Address of the account to snapshot\"},\"return\":\"(possible error, token balance, borrow balance, exchange rate mantissa)\"},\"getCash()\":{\"return\":\"The quantity of underlying asset owned by this contract\"},\"liquidateBorrow(address,uint256,address)\":{\"params\":{\"borrower\":\"The borrower of this vToken to be liquidated\",\"repayAmount\":\"The amount of the underlying borrowed asset to repay\",\"vTokenCollateral\":\"The market in which to seize collateral from the borrower\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"mint(uint256)\":{\"details\":\"Accrues interest whether or not the operation succeeds, unless reverted\",\"params\":{\"mintAmount\":\"The amount of the underlying asset to supply\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"mintBehalf(address,uint256)\":{\"details\":\"Accrues interest whether or not the operation succeeds, unless reverted\",\"params\":{\"mintAmount\":\"The amount of the underlying asset to supply\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"redeem(uint256)\":{\"details\":\"Accrues interest whether or not the operation succeeds, unless reverted\",\"params\":{\"redeemTokens\":\"The number of vTokens to redeem into underlying asset\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"redeemUnderlying(uint256)\":{\"details\":\"Accrues interest whether or not the operation succeeds, unless reverted\",\"params\":{\"redeemAmount\":\"The amount of underlying to redeem\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"repayBorrow(uint256)\":{\"params\":{\"repayAmount\":\"The amount to repay\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"repayBorrowBehalf(address,uint256)\":{\"params\":{\"borrower\":\"The account with the debt being payed off\",\"repayAmount\":\"The amount to repay\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"seize(address,address,uint256)\":{\"details\":\"Will fail unless called by another vToken during the process of liquidation. It's absolutely critical to use msg.sender as the borrowed vToken and not a parameter.\",\"params\":{\"borrower\":\"The account having collateral seized\",\"liquidator\":\"The account receiving seized collateral\",\"seizeTokens\":\"The number of vTokens to seize\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"supplyRatePerBlock()\":{\"return\":\"The supply interest rate per block, scaled by 1e18\"},\"totalBorrowsCurrent()\":{\"return\":\"The total borrows with interest\"},\"transfer(address,uint256)\":{\"params\":{\"amount\":\"The number of tokens to transfer\",\"dst\":\"The address of the destination account\"},\"return\":\"Whether or not the transfer succeeded\"},\"transferFrom(address,address,uint256)\":{\"params\":{\"amount\":\"The number of tokens to transfer\",\"dst\":\"The address of the destination account\",\"src\":\"The address of the source account\"},\"return\":\"Whether or not the transfer succeeded\"}},\"title\":\"Venus's VBep20Delegator Contract\"},\"userdoc\":{\"methods\":{\"_acceptAdmin()\":{\"notice\":\"Accepts transfer of admin rights. `msg.sender` must be pendingAdmin\"},\"_addReserves(uint256)\":{\"notice\":\"Accrues interest and adds reserves by transferring from admin\"},\"_reduceReserves(uint256)\":{\"notice\":\"Accrues interest and reduces reserves by transferring to admin\"},\"_setComptroller(address)\":{\"notice\":\"Sets a new comptroller for the market\"},\"_setImplementation(address,bool,bytes)\":{\"notice\":\"Called by the admin to update the implementation of the delegator\"},\"_setInterestRateModel(address)\":{\"notice\":\"Accrues interest and updates the interest rate model using `_setInterestRateModelFresh`\"},\"_setPendingAdmin(address)\":{\"notice\":\"Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\"},\"_setReserveFactor(uint256)\":{\"notice\":\"Accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh\"},\"accrueInterest()\":{\"notice\":\"Applies accrued interest to total borrows and reserves.\"},\"allowance(address,address)\":{\"notice\":\"Get the current allowance from `owner` for `spender`\"},\"approve(address,uint256)\":{\"notice\":\"Approve `spender` to transfer up to `amount` from `src`\"},\"balanceOf(address)\":{\"notice\":\"Get the token balance of the `owner`\"},\"balanceOfUnderlying(address)\":{\"notice\":\"Get the underlying balance of the `owner`\"},\"borrow(uint256)\":{\"notice\":\"Sender borrows assets from the protocol to their own address\"},\"borrowBalanceCurrent(address)\":{\"notice\":\"Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex\"},\"borrowBalanceStored(address)\":{\"notice\":\"Return the borrow balance of account based on stored data\"},\"borrowRatePerBlock()\":{\"notice\":\"Returns the current per-block borrow interest rate for this vToken\"},\"constructor\":\"Construct a new money market\",\"delegateToImplementation(bytes)\":{\"notice\":\"Delegates execution to the implementation contract\"},\"delegateToViewImplementation(bytes)\":{\"notice\":\"Delegates execution to an implementation contract\"},\"exchangeRateCurrent()\":{\"notice\":\"Accrue interest then return the up-to-date exchange rate\"},\"exchangeRateStored()\":{\"notice\":\"Calculates the exchange rate from the underlying to the VToken\"},\"getAccountSnapshot(address)\":{\"notice\":\"Get a snapshot of the account's balances and the cached exchange rate\"},\"getCash()\":{\"notice\":\"Get cash balance of this vToken in the underlying asset\"},\"liquidateBorrow(address,uint256,address)\":{\"notice\":\"The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator.\"},\"mint(uint256)\":{\"notice\":\"Sender supplies assets into the market and receives vTokens in exchange\"},\"mintBehalf(address,uint256)\":{\"notice\":\"Sender supplies assets into the market and receiver receives vTokens in exchange\"},\"redeem(uint256)\":{\"notice\":\"Sender redeems vTokens in exchange for the underlying asset\"},\"redeemUnderlying(uint256)\":{\"notice\":\"Sender redeems vTokens in exchange for a specified amount of underlying asset\"},\"repayBorrow(uint256)\":{\"notice\":\"Sender repays their own borrow\"},\"repayBorrowBehalf(address,uint256)\":{\"notice\":\"Sender repays a borrow belonging to another borrower\"},\"seize(address,address,uint256)\":{\"notice\":\"Transfers collateral tokens (this market) to the liquidator.\"},\"supplyRatePerBlock()\":{\"notice\":\"Returns the current per-block supply interest rate for this vToken\"},\"totalBorrowsCurrent()\":{\"notice\":\"Returns the current total borrows plus accrued interest\"},\"transfer(address,uint256)\":{\"notice\":\"Transfer `amount` tokens from `msg.sender` to `dst`\"},\"transferFrom(address,address,uint256)\":{\"notice\":\"Transfer `amount` tokens from `src` to `dst`\"}},\"notice\":\"vTokens which wrap an EIP-20 underlying and delegate to an implementation\"}},\"settings\":{\"compilationTarget\":{\"contracts/Tokens/VTokens/VBep20Delegator.sol\":\"VBep20Delegator\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV5.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-3-Clause\\npragma solidity 0.5.16;\\n\\n/**\\n * @title IAccessControlManagerV5\\n * @author Venus\\n * @notice Interface implemented by the `AccessControlManagerV5` contract.\\n */\\ninterface IAccessControlManagerV5 {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n\\n /**\\n * @notice Gives a function call permission to one single account\\n * @dev this function can be called only from Role Admin or DEFAULT_ADMIN_ROLE\\n * \\t\\tMay emit a {RoleGranted} event.\\n * @param contractAddress address of contract for which call permissions will be granted\\n * @param functionSig signature e.g. \\\"functionName(uint,bool)\\\"\\n */\\n function giveCallPermission(address contractAddress, string calldata functionSig, address accountToPermit) external;\\n\\n /**\\n * @notice Revokes an account's permission to a particular function call\\n * @dev this function can be called only from Role Admin or DEFAULT_ADMIN_ROLE\\n * \\t\\tMay emit a {RoleRevoked} event.\\n * @param contractAddress address of contract for which call permissions will be revoked\\n * @param functionSig signature e.g. \\\"functionName(uint,bool)\\\"\\n */\\n function revokeCallPermission(\\n address contractAddress,\\n string calldata functionSig,\\n address accountToRevoke\\n ) external;\\n\\n /**\\n * @notice Verifies if the given account can call a praticular contract's function\\n * @dev Since the contract is calling itself this function, we can get contracts address with msg.sender\\n * @param account address (eoa or contract) for which call permissions will be checked\\n * @param functionSig signature e.g. \\\"functionName(uint,bool)\\\"\\n * @return false if the user account cannot call the particular contract function\\n *\\n */\\n function isAllowedToCall(address account, string calldata functionSig) external view returns (bool);\\n\\n function hasPermission(\\n address account,\\n address contractAddress,\\n string calldata functionSig\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x3563db4c75f7aa0b8a982bab591907dda192438a2368511b62a9c587a3e54226\"},\"contracts/Comptroller/ComptrollerInterface.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"../Tokens/VTokens/VToken.sol\\\";\\nimport \\\"../Oracle/PriceOracle.sol\\\";\\nimport \\\"../Tokens/VAI/VAIControllerInterface.sol\\\";\\nimport { ComptrollerTypes } from \\\"./ComptrollerStorage.sol\\\";\\n\\ncontract ComptrollerInterface {\\n /// @notice Indicator that this is a Comptroller contract (for inspection)\\n bool public constant isComptroller = true;\\n\\n /*** Assets You Are In ***/\\n\\n function enterMarkets(address[] calldata vTokens) external returns (uint[] memory);\\n\\n function exitMarket(address vToken) external returns (uint);\\n\\n /*** Policy Hooks ***/\\n\\n function mintAllowed(address vToken, address minter, uint mintAmount) external returns (uint);\\n\\n function mintVerify(address vToken, address minter, uint mintAmount, uint mintTokens) external;\\n\\n function redeemAllowed(address vToken, address redeemer, uint redeemTokens) external returns (uint);\\n\\n function redeemVerify(address vToken, address redeemer, uint redeemAmount, uint redeemTokens) external;\\n\\n function borrowAllowed(address vToken, address borrower, uint borrowAmount) external returns (uint);\\n\\n function borrowVerify(address vToken, address borrower, uint borrowAmount) external;\\n\\n function repayBorrowAllowed(\\n address vToken,\\n address payer,\\n address borrower,\\n uint repayAmount\\n ) external returns (uint);\\n\\n function repayBorrowVerify(\\n address vToken,\\n address payer,\\n address borrower,\\n uint repayAmount,\\n uint borrowerIndex\\n ) external;\\n\\n function liquidateBorrowAllowed(\\n address vTokenBorrowed,\\n address vTokenCollateral,\\n address liquidator,\\n address borrower,\\n uint repayAmount\\n ) external returns (uint);\\n\\n function liquidateBorrowVerify(\\n address vTokenBorrowed,\\n address vTokenCollateral,\\n address liquidator,\\n address borrower,\\n uint repayAmount,\\n uint seizeTokens\\n ) external;\\n\\n function seizeAllowed(\\n address vTokenCollateral,\\n address vTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint seizeTokens\\n ) external returns (uint);\\n\\n function seizeVerify(\\n address vTokenCollateral,\\n address vTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint seizeTokens\\n ) external;\\n\\n function transferAllowed(address vToken, address src, address dst, uint transferTokens) external returns (uint);\\n\\n function transferVerify(address vToken, address src, address dst, uint transferTokens) external;\\n\\n /*** Liquidity/Liquidation Calculations ***/\\n\\n function liquidateCalculateSeizeTokens(\\n address vTokenBorrowed,\\n address vTokenCollateral,\\n uint repayAmount\\n ) external view returns (uint, uint);\\n\\n function setMintedVAIOf(address owner, uint amount) external returns (uint);\\n\\n function liquidateVAICalculateSeizeTokens(\\n address vTokenCollateral,\\n uint repayAmount\\n ) external view returns (uint, uint);\\n\\n function getXVSAddress() public view returns (address);\\n\\n function markets(address) external view returns (bool, uint);\\n\\n function oracle() external view returns (PriceOracle);\\n\\n function getAccountLiquidity(address) external view returns (uint, uint, uint);\\n\\n function getAssetsIn(address) external view returns (VToken[] memory);\\n\\n function claimVenus(address) external;\\n\\n function venusAccrued(address) external view returns (uint);\\n\\n function venusSupplySpeeds(address) external view returns (uint);\\n\\n function venusBorrowSpeeds(address) external view returns (uint);\\n\\n function getAllMarkets() external view returns (VToken[] memory);\\n\\n function venusSupplierIndex(address, address) external view returns (uint);\\n\\n function venusInitialIndex() external view returns (uint224);\\n\\n function venusBorrowerIndex(address, address) external view returns (uint);\\n\\n function venusBorrowState(address) external view returns (uint224, uint32);\\n\\n function venusSupplyState(address) external view returns (uint224, uint32);\\n\\n function approvedDelegates(address borrower, address delegate) external view returns (bool);\\n\\n function vaiController() external view returns (VAIControllerInterface);\\n\\n function liquidationIncentiveMantissa() external view returns (uint);\\n\\n function protocolPaused() external view returns (bool);\\n\\n function actionPaused(address market, ComptrollerTypes.Action action) public view returns (bool);\\n\\n function mintedVAIs(address user) external view returns (uint);\\n\\n function vaiMintRate() external view returns (uint);\\n}\\n\\ninterface IVAIVault {\\n function updatePendingRewards() external;\\n}\\n\\ninterface IComptroller {\\n function liquidationIncentiveMantissa() external view returns (uint);\\n\\n /*** Treasury Data ***/\\n function treasuryAddress() external view returns (address);\\n\\n function treasuryPercent() external view returns (uint);\\n}\\n\",\"keccak256\":\"0x4f4965dd8614b455952a2ef186fd8a509affbc56078a4aa8702f46d4c8209793\"},\"contracts/Comptroller/ComptrollerLensInterface.sol\":{\"content\":\"pragma solidity ^0.5.16;\\npragma experimental ABIEncoderV2;\\n\\nimport \\\"../Tokens/VTokens/VToken.sol\\\";\\n\\ninterface ComptrollerLensInterface {\\n function liquidateCalculateSeizeTokens(\\n address comptroller,\\n address vTokenBorrowed,\\n address vTokenCollateral,\\n uint actualRepayAmount\\n ) external view returns (uint, uint);\\n\\n function liquidateVAICalculateSeizeTokens(\\n address comptroller,\\n address vTokenCollateral,\\n uint actualRepayAmount\\n ) external view returns (uint, uint);\\n\\n function getHypotheticalAccountLiquidity(\\n address comptroller,\\n address account,\\n VToken vTokenModify,\\n uint redeemTokens,\\n uint borrowAmount\\n ) external view returns (uint, uint, uint);\\n}\\n\",\"keccak256\":\"0xc824e034221740c1957891547c78a123b595017cf102629454a04d36637e9c4a\"},\"contracts/Comptroller/ComptrollerStorage.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-3-Clause\\n\\npragma solidity ^0.5.16;\\n\\nimport { VToken } from \\\"../Tokens/VTokens/VToken.sol\\\";\\nimport { PriceOracle } from \\\"../Oracle/PriceOracle.sol\\\";\\nimport { VAIControllerInterface } from \\\"../Tokens/VAI/VAIControllerInterface.sol\\\";\\nimport { ComptrollerLensInterface } from \\\"./ComptrollerLensInterface.sol\\\";\\nimport { IPrime } from \\\"../Tokens/Prime/IPrime.sol\\\";\\n\\ninterface ComptrollerTypes {\\n enum Action {\\n MINT,\\n REDEEM,\\n BORROW,\\n REPAY,\\n SEIZE,\\n LIQUIDATE,\\n TRANSFER,\\n ENTER_MARKET,\\n EXIT_MARKET\\n }\\n}\\n\\ncontract UnitrollerAdminStorage {\\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 Unitroller\\n */\\n address public comptrollerImplementation;\\n\\n /**\\n * @notice Pending brains of Unitroller\\n */\\n address public pendingComptrollerImplementation;\\n}\\n\\ncontract ComptrollerV1Storage is ComptrollerTypes, UnitrollerAdminStorage {\\n /**\\n * @notice Oracle which gives the price of any given asset\\n */\\n PriceOracle public oracle;\\n\\n /**\\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\\n */\\n uint256 public closeFactorMantissa;\\n\\n /**\\n * @notice Multiplier representing the discount on collateral that a liquidator receives\\n */\\n uint256 public liquidationIncentiveMantissa;\\n\\n /**\\n * @notice Max number of assets a single account can participate in (borrow or use as collateral)\\n */\\n uint256 public maxAssets;\\n\\n /**\\n * @notice Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\\n */\\n mapping(address => VToken[]) public accountAssets;\\n\\n struct Market {\\n /// @notice Whether or not this market is listed\\n bool isListed;\\n /**\\n * @notice Multiplier representing the most one can borrow against their collateral in this market.\\n * For instance, 0.9 to allow borrowing 90% of collateral value.\\n * Must be between 0 and 1, and stored as a mantissa.\\n */\\n uint256 collateralFactorMantissa;\\n /// @notice Per-market mapping of \\\"accounts in this asset\\\"\\n mapping(address => bool) accountMembership;\\n /// @notice Whether or not this market receives XVS\\n bool isVenus;\\n }\\n\\n /**\\n * @notice Official mapping of vTokens -> Market metadata\\n * @dev Used e.g. to determine if a market is supported\\n */\\n mapping(address => Market) public markets;\\n\\n /**\\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\\n */\\n address public pauseGuardian;\\n\\n /// @notice Whether minting is paused (deprecated, superseded by actionPaused)\\n bool private _mintGuardianPaused;\\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\\n bool private _borrowGuardianPaused;\\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\\n bool internal transferGuardianPaused;\\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\\n bool internal seizeGuardianPaused;\\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\\n mapping(address => bool) internal mintGuardianPaused;\\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\\n mapping(address => bool) internal borrowGuardianPaused;\\n\\n struct VenusMarketState {\\n /// @notice The market's last updated venusBorrowIndex or venusSupplyIndex\\n uint224 index;\\n /// @notice The block number the index was last updated at\\n uint32 block;\\n }\\n\\n /// @notice A list of all markets\\n VToken[] public allMarkets;\\n\\n /// @notice The rate at which the flywheel distributes XVS, per block\\n uint256 internal venusRate;\\n\\n /// @notice The portion of venusRate that each market currently receives\\n mapping(address => uint256) internal venusSpeeds;\\n\\n /// @notice The Venus market supply state for each market\\n mapping(address => VenusMarketState) public venusSupplyState;\\n\\n /// @notice The Venus market borrow state for each market\\n mapping(address => VenusMarketState) public venusBorrowState;\\n\\n /// @notice The Venus supply index for each market for each supplier as of the last time they accrued XVS\\n mapping(address => mapping(address => uint256)) public venusSupplierIndex;\\n\\n /// @notice The Venus borrow index for each market for each borrower as of the last time they accrued XVS\\n mapping(address => mapping(address => uint256)) public venusBorrowerIndex;\\n\\n /// @notice The XVS accrued but not yet transferred to each user\\n mapping(address => uint256) public venusAccrued;\\n\\n /// @notice The Address of VAIController\\n VAIControllerInterface public vaiController;\\n\\n /// @notice The minted VAI amount to each user\\n mapping(address => uint256) public mintedVAIs;\\n\\n /// @notice VAI Mint Rate as a percentage\\n uint256 public vaiMintRate;\\n\\n /**\\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\\n */\\n bool public mintVAIGuardianPaused;\\n bool public repayVAIGuardianPaused;\\n\\n /**\\n * @notice Pause/Unpause whole protocol actions\\n */\\n bool public protocolPaused;\\n\\n /// @notice The rate at which the flywheel distributes XVS to VAI Minters, per block (deprecated)\\n uint256 private venusVAIRate;\\n}\\n\\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\\n /// @notice The rate at which the flywheel distributes XVS to VAI Vault, per block\\n uint256 public venusVAIVaultRate;\\n\\n // address of VAI Vault\\n address public vaiVaultAddress;\\n\\n // start block of release to VAI Vault\\n uint256 public releaseStartBlock;\\n\\n // minimum release amount to VAI Vault\\n uint256 public minReleaseAmount;\\n}\\n\\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\\n address public borrowCapGuardian;\\n\\n /// @notice Borrow caps enforced by borrowAllowed for each vToken address.\\n mapping(address => uint256) public borrowCaps;\\n}\\n\\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\\n /// @notice Treasury Guardian address\\n address public treasuryGuardian;\\n\\n /// @notice Treasury address\\n address public treasuryAddress;\\n\\n /// @notice Fee percent of accrued interest with decimal 18\\n uint256 public treasuryPercent;\\n}\\n\\ncontract ComptrollerV5Storage is ComptrollerV4Storage {\\n /// @notice The portion of XVS that each contributor receives per block (deprecated)\\n mapping(address => uint256) private venusContributorSpeeds;\\n\\n /// @notice Last block at which a contributor's XVS rewards have been allocated (deprecated)\\n mapping(address => uint256) private lastContributorBlock;\\n}\\n\\ncontract ComptrollerV6Storage is ComptrollerV5Storage {\\n address public liquidatorContract;\\n}\\n\\ncontract ComptrollerV7Storage is ComptrollerV6Storage {\\n ComptrollerLensInterface public comptrollerLens;\\n}\\n\\ncontract ComptrollerV8Storage is ComptrollerV7Storage {\\n /// @notice Supply caps enforced by mintAllowed for each vToken address. Defaults to zero which corresponds to minting notAllowed\\n mapping(address => uint256) public supplyCaps;\\n}\\n\\ncontract ComptrollerV9Storage is ComptrollerV8Storage {\\n /// @notice AccessControlManager address\\n address internal accessControl;\\n\\n /// @notice True if a certain action is paused on a certain market\\n mapping(address => mapping(uint256 => bool)) internal _actionPaused;\\n}\\n\\ncontract ComptrollerV10Storage is ComptrollerV9Storage {\\n /// @notice The rate at which venus is distributed to the corresponding borrow market (per block)\\n mapping(address => uint256) public venusBorrowSpeeds;\\n\\n /// @notice The rate at which venus is distributed to the corresponding supply market (per block)\\n mapping(address => uint256) public venusSupplySpeeds;\\n}\\n\\ncontract ComptrollerV11Storage is ComptrollerV10Storage {\\n /// @notice Whether the delegate is allowed to borrow or redeem on behalf of the user\\n //mapping(address user => mapping (address delegate => bool approved)) public approvedDelegates;\\n mapping(address => mapping(address => bool)) public approvedDelegates;\\n}\\n\\ncontract ComptrollerV12Storage is ComptrollerV11Storage {\\n /// @notice Whether forced liquidation is enabled for all users borrowing in a certain market\\n mapping(address => bool) public isForcedLiquidationEnabled;\\n}\\n\\ncontract ComptrollerV13Storage is ComptrollerV12Storage {\\n struct FacetAddressAndPosition {\\n address facetAddress;\\n uint96 functionSelectorPosition; // position in _facetFunctionSelectors.functionSelectors array\\n }\\n\\n struct FacetFunctionSelectors {\\n bytes4[] functionSelectors;\\n uint256 facetAddressPosition; // position of facetAddress in _facetAddresses array\\n }\\n\\n mapping(bytes4 => FacetAddressAndPosition) internal _selectorToFacetAndPosition;\\n // maps facet addresses to function selectors\\n mapping(address => FacetFunctionSelectors) internal _facetFunctionSelectors;\\n // facet addresses\\n address[] internal _facetAddresses;\\n}\\n\\ncontract ComptrollerV14Storage is ComptrollerV13Storage {\\n /// @notice Prime token address\\n IPrime public prime;\\n}\\n\\ncontract ComptrollerV15Storage is ComptrollerV14Storage {\\n /// @notice Whether forced liquidation is enabled for the borrows of a user in a market\\n mapping(address /* user */ => mapping(address /* market */ => bool)) public isForcedLiquidationEnabledForUser;\\n}\\n\\ncontract ComptrollerV16Storage is ComptrollerV15Storage {\\n /// @notice The XVS token contract address\\n address internal xvs;\\n\\n /// @notice The XVS vToken contract address\\n address internal xvsVToken;\\n}\\n\",\"keccak256\":\"0x06608bb502e91c33fda8c0dd88cc79a49a078fab521bc27d10fc3a69c1da55f4\"},\"contracts/InterestRateModels/InterestRateModel.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\n/**\\n * @title Venus's InterestRateModel Interface\\n * @author Venus\\n */\\ncontract InterestRateModel {\\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\\n bool public constant isInterestRateModel = true;\\n\\n /**\\n * @notice Calculates the current borrow interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amnount of reserves the market has\\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);\\n\\n /**\\n * @notice Calculates the current supply interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amnount of reserves the market has\\n * @param reserveFactorMantissa The current reserve factor the market has\\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint cash,\\n uint borrows,\\n uint reserves,\\n uint reserveFactorMantissa\\n ) external view returns (uint);\\n}\\n\",\"keccak256\":\"0x7896290ed5d98f1b744676c0cf5cb0bc656befdd8a79ae4cd2d9f90d83aaa52d\"},\"contracts/Oracle/PriceOracle.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"../Tokens/VTokens/VToken.sol\\\";\\n\\ncontract PriceOracle {\\n /// @notice Indicator that this is a PriceOracle contract (for inspection)\\n bool public constant isPriceOracle = true;\\n\\n /**\\n * @notice Get the underlying price of a vToken asset\\n * @param vToken The vToken to get the underlying price of\\n * @return The underlying asset price mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function getUnderlyingPrice(VToken vToken) external view returns (uint);\\n}\\n\",\"keccak256\":\"0x0f68d0e07decba8fb9a77df1659170f310b487cc0b650f53ca6aa55ed62b28de\"},\"contracts/Tokens/EIP20Interface.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\n/**\\n * @title BEP 20 Token Standard Interface\\n * https://eips.ethereum.org/EIPS/eip-20\\n */\\ninterface EIP20Interface {\\n function name() external view returns (string memory);\\n\\n function symbol() external view returns (string memory);\\n\\n function decimals() external view returns (uint8);\\n\\n /**\\n * @notice Get the total number of tokens in circulation\\n * @return The supply of tokens\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @notice Gets the balance of the specified address\\n * @param owner The address from which the balance will be retrieved\\n * @return balance\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n * @return success whether or not the transfer succeeded\\n */\\n function transfer(address dst, uint256 amount) external returns (bool success);\\n\\n /**\\n * @notice Transfer `amount` tokens from `src` to `dst`\\n * @param src The address of the source account\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n * @return success whether or not the transfer succeeded\\n */\\n function transferFrom(address src, address dst, uint256 amount) external returns (bool success);\\n\\n /**\\n * @notice Approve `spender` to transfer up to `amount` from `src`\\n * @dev This will overwrite the approval amount for `spender`\\n * @param spender The address of the account which may transfer tokens\\n * @param amount The number of tokens that are approved (-1 means infinite)\\n * @return success whether or not the approval succeeded\\n */\\n function approve(address spender, uint256 amount) external returns (bool success);\\n\\n /**\\n * @notice Get the current allowance from `owner` for `spender`\\n * @param owner The address of the account which owns the tokens to be spent\\n * @param spender The address of the account which may transfer tokens\\n * @return remaining The number of tokens allowed to be spent\\n */\\n function allowance(address owner, address spender) external view returns (uint256 remaining);\\n\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n}\\n\",\"keccak256\":\"0x7e89ffa9c0d432c4db8bd5388ff68e33934dcdb1d038d74bbed3b2fdae3eb532\"},\"contracts/Tokens/EIP20NonStandardInterface.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\n/**\\n * @title EIP20NonStandardInterface\\n * @dev Version of BEP20 with no return values for `transfer` and `transferFrom`\\n * See https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\\n */\\ninterface EIP20NonStandardInterface {\\n /**\\n * @notice Get the total number of tokens in circulation\\n * @return The supply of tokens\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @notice Gets the balance of the specified address\\n * @param owner The address from which the balance will be retrieved\\n * @return balance of the owner\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n ///\\n /// !!!!!!!!!!!!!!\\n /// !!! NOTICE !!! `transfer` does not return a value, in violation of the BEP-20 specification\\n /// !!!!!!!!!!!!!!\\n ///\\n\\n /**\\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n */\\n function transfer(address dst, uint256 amount) external;\\n\\n ///\\n /// !!!!!!!!!!!!!!\\n /// !!! NOTICE !!! `transferFrom` does not return a value, in violation of the BEP-20 specification\\n /// !!!!!!!!!!!!!!\\n ///\\n\\n /**\\n * @notice Transfer `amount` tokens from `src` to `dst`\\n * @param src The address of the source account\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n */\\n function transferFrom(address src, address dst, uint256 amount) external;\\n\\n /**\\n * @notice Approve `spender` to transfer up to `amount` from `src`\\n * @dev This will overwrite the approval amount for `spender`\\n * @param spender The address of the account which may transfer tokens\\n * @param amount The number of tokens that are approved\\n * @return success Whether or not the approval succeeded\\n */\\n function approve(address spender, uint256 amount) external returns (bool success);\\n\\n /**\\n * @notice Get the current allowance from `owner` for `spender`\\n * @param owner The address of the account which owns the tokens to be spent\\n * @param spender The address of the account which may transfer tokens\\n * @return remaining The number of tokens allowed to be spent\\n */\\n function allowance(address owner, address spender) external view returns (uint256 remaining);\\n\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n}\\n\",\"keccak256\":\"0x05a3a7d5ab47de3964c95d706dcc18fe7583b1d064dbb74808c0f2774f347afa\"},\"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\",\"keccak256\":\"0x58861c0c05b8757f1a5d50b107eff479c8680878e6aa51bc93af420caf73f500\"},\"contracts/Tokens/VAI/VAIControllerInterface.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport { VTokenInterface } from \\\"../VTokens/VTokenInterfaces.sol\\\";\\n\\ncontract VAIControllerInterface {\\n function mintVAI(uint256 mintVAIAmount) external returns (uint256);\\n\\n function repayVAI(uint256 amount) external returns (uint256, uint256);\\n\\n function repayVAIBehalf(address borrower, uint256 amount) external returns (uint256, uint256);\\n\\n function liquidateVAI(\\n address borrower,\\n uint256 repayAmount,\\n VTokenInterface vTokenCollateral\\n ) external returns (uint256, uint256);\\n\\n function getMintableVAI(address minter) external view returns (uint256, uint256);\\n\\n function getVAIAddress() external view returns (address);\\n\\n function getVAIRepayAmount(address account) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x1f020ff46cb0efa0ebf563f449fd4d8aa1c8b8ed53c46860d71a08548d7fdfaa\"},\"contracts/Tokens/VTokens/VBep20Delegator.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"./VTokenInterfaces.sol\\\";\\n\\n/**\\n * @title Venus's VBep20Delegator Contract\\n * @notice vTokens which wrap an EIP-20 underlying and delegate to an implementation\\n * @author Venus\\n */\\ncontract VBep20Delegator is VTokenInterface, VBep20Interface, VDelegatorInterface {\\n /**\\n * @notice Construct a new money market\\n * @param underlying_ The address of the underlying asset\\n * @param comptroller_ The address of the comptroller\\n * @param interestRateModel_ The address of the interest rate model\\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\\n * @param name_ BEP-20 name of this token\\n * @param symbol_ BEP-20 symbol of this token\\n * @param decimals_ BEP-20 decimal precision of this token\\n * @param admin_ Address of the administrator of this token\\n * @param implementation_ The address of the implementation the contract delegates to\\n * @param becomeImplementationData The encoded args for becomeImplementation\\n */\\n constructor(\\n address underlying_,\\n ComptrollerInterface comptroller_,\\n InterestRateModel interestRateModel_,\\n uint initialExchangeRateMantissa_,\\n string memory name_,\\n string memory symbol_,\\n uint8 decimals_,\\n address payable admin_,\\n address implementation_,\\n bytes memory becomeImplementationData\\n ) public {\\n // Creator of the contract is admin during initialization\\n admin = msg.sender;\\n\\n // First delegate gets to initialize the delegator (i.e. storage contract)\\n delegateTo(\\n implementation_,\\n abi.encodeWithSignature(\\n \\\"initialize(address,address,address,uint256,string,string,uint8)\\\",\\n underlying_,\\n comptroller_,\\n interestRateModel_,\\n initialExchangeRateMantissa_,\\n name_,\\n symbol_,\\n decimals_\\n )\\n );\\n\\n // New implementations always get set via the settor (post-initialize)\\n _setImplementation(implementation_, false, becomeImplementationData);\\n\\n // Set the proper admin now that initialization is done\\n admin = admin_;\\n }\\n\\n /**\\n * @notice Delegates execution to an implementation contract\\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\\n */\\n function() external payable {\\n require(msg.value == 0, \\\"VBep20Delegator:fallback: cannot send value to fallback\\\");\\n\\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 /**\\n * @notice Sender supplies assets into the market and receives vTokens in exchange\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param mintAmount The amount of the underlying asset to supply\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function mint(uint mintAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"mint(uint256)\\\", mintAmount));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Sender supplies assets into the market and receiver receives vTokens in exchange\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param mintAmount The amount of the underlying asset to supply\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function mintBehalf(address receiver, uint mintAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"mintBehalf(address,uint256)\\\", receiver, mintAmount)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Sender redeems vTokens in exchange for the underlying asset\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param redeemTokens The number of vTokens to redeem into underlying asset\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function redeem(uint redeemTokens) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"redeem(uint256)\\\", redeemTokens));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Sender redeems vTokens in exchange for a specified amount of underlying asset\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param redeemAmount The amount of underlying to redeem\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function redeemUnderlying(uint redeemAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"redeemUnderlying(uint256)\\\", redeemAmount)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Sender borrows assets from the protocol to their own address\\n * @param borrowAmount The amount of the underlying asset to borrow\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function borrow(uint borrowAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"borrow(uint256)\\\", borrowAmount));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Sender repays their own borrow\\n * @param repayAmount The amount to repay\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function repayBorrow(uint repayAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"repayBorrow(uint256)\\\", repayAmount));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Sender repays a borrow belonging to another borrower\\n * @param borrower The account with the debt being payed off\\n * @param repayAmount The amount to repay\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"repayBorrowBehalf(address,uint256)\\\", borrower, repayAmount)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice The sender liquidates the borrowers collateral.\\n * The collateral seized is transferred to the liquidator.\\n * @param borrower The borrower of this vToken to be liquidated\\n * @param vTokenCollateral The market in which to seize collateral from the borrower\\n * @param repayAmount The amount of the underlying borrowed asset to repay\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function liquidateBorrow(\\n address borrower,\\n uint repayAmount,\\n VTokenInterface vTokenCollateral\\n ) external returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"liquidateBorrow(address,uint256,address)\\\", borrower, repayAmount, vTokenCollateral)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n function transfer(address dst, uint amount) external returns (bool) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"transfer(address,uint256)\\\", dst, amount));\\n return abi.decode(data, (bool));\\n }\\n\\n /**\\n * @notice Transfer `amount` tokens from `src` to `dst`\\n * @param src The address of the source account\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n function transferFrom(address src, address dst, uint256 amount) external returns (bool) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"transferFrom(address,address,uint256)\\\", src, dst, amount)\\n );\\n return abi.decode(data, (bool));\\n }\\n\\n /**\\n * @notice Approve `spender` to transfer up to `amount` from `src`\\n * @dev This will overwrite the approval amount for `spender`\\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\\n * @param spender The address of the account which may transfer tokens\\n * @param amount The number of tokens that are approved (-1 means infinite)\\n * @return Whether or not the approval succeeded\\n */\\n function approve(address spender, uint256 amount) external returns (bool) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"approve(address,uint256)\\\", spender, amount)\\n );\\n return abi.decode(data, (bool));\\n }\\n\\n /**\\n * @notice Get the underlying balance of the `owner`\\n * @dev This also accrues interest in a transaction\\n * @param owner The address of the account to query\\n * @return The amount of underlying owned by `owner`\\n */\\n function balanceOfUnderlying(address owner) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"balanceOfUnderlying(address)\\\", owner));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Returns the current total borrows plus accrued interest\\n * @return The total borrows with interest\\n */\\n function totalBorrowsCurrent() external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"totalBorrowsCurrent()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex\\n * @param account The address whose balance should be calculated after updating borrowIndex\\n * @return The calculated balance\\n */\\n function borrowBalanceCurrent(address account) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"borrowBalanceCurrent(address)\\\", account));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Transfers collateral tokens (this market) to the liquidator.\\n * @dev Will fail unless called by another vToken during the process of liquidation.\\n * It's absolutely critical to use msg.sender as the borrowed vToken and not a parameter.\\n * @param liquidator The account receiving seized collateral\\n * @param borrower The account having collateral seized\\n * @param seizeTokens The number of vTokens to seize\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function seize(address liquidator, address borrower, uint seizeTokens) external returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"seize(address,address,uint256)\\\", liquidator, borrower, seizeTokens)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /*** Admin Functions ***/\\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _setPendingAdmin(address payable newPendingAdmin) external returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"_setPendingAdmin(address)\\\", newPendingAdmin)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh\\n * @dev Admin function to accrue interest and set a new reserve factor\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _setReserveFactor(uint newReserveFactorMantissa) external returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"_setReserveFactor(uint256)\\\", newReserveFactorMantissa)\\n );\\n return abi.decode(data, (uint));\\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _acceptAdmin() external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"_acceptAdmin()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Accrues interest and adds reserves by transferring from admin\\n * @param addAmount Amount of reserves to add\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _addReserves(uint addAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"_addReserves(uint256)\\\", addAmount));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Accrues interest and reduces reserves by transferring to admin\\n * @param reduceAmount Amount of reduction to reserves\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _reduceReserves(uint reduceAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"_reduceReserves(uint256)\\\", reduceAmount));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Get cash balance of this vToken in the underlying asset\\n * @return The quantity of underlying asset owned by this contract\\n */\\n function getCash() external view returns (uint) {\\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\\\"getCash()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Get the current allowance from `owner` for `spender`\\n * @param owner The address of the account which owns the tokens to be spent\\n * @param spender The address of the account which may transfer tokens\\n * @return The number of tokens allowed to be spent (-1 means infinite)\\n */\\n function allowance(address owner, address spender) external view returns (uint) {\\n bytes memory data = delegateToViewImplementation(\\n abi.encodeWithSignature(\\\"allowance(address,address)\\\", owner, spender)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Get the token balance of the `owner`\\n * @param owner The address of the account to query\\n * @return The number of tokens owned by `owner`\\n */\\n function balanceOf(address owner) external view returns (uint) {\\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\\\"balanceOf(address)\\\", owner));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Get a snapshot of the account's balances and the cached exchange rate\\n * @dev This is used by comptroller to more efficiently perform liquidity checks.\\n * @param account Address of the account to snapshot\\n * @return (possible error, token balance, borrow balance, exchange rate mantissa)\\n */\\n function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) {\\n bytes memory data = delegateToViewImplementation(\\n abi.encodeWithSignature(\\\"getAccountSnapshot(address)\\\", account)\\n );\\n return abi.decode(data, (uint, uint, uint, uint));\\n }\\n\\n /**\\n * @notice Returns the current per-block borrow interest rate for this vToken\\n * @return The borrow interest rate per block, scaled by 1e18\\n */\\n function borrowRatePerBlock() external view returns (uint) {\\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\\\"borrowRatePerBlock()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Returns the current per-block supply interest rate for this vToken\\n * @return The supply interest rate per block, scaled by 1e18\\n */\\n function supplyRatePerBlock() external view returns (uint) {\\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\\\"supplyRatePerBlock()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Called by the admin to update the implementation of the delegator\\n * @param implementation_ The address of the new implementation for delegation\\n * @param allowResign Flag to indicate whether to call _resignImplementation on the old implementation\\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\\n */\\n // @custom:access Only callable by admin\\n function _setImplementation(\\n address implementation_,\\n bool allowResign,\\n bytes memory becomeImplementationData\\n ) public {\\n require(msg.sender == admin, \\\"VBep20Delegator::_setImplementation: Caller must be admin\\\");\\n\\n if (allowResign) {\\n delegateToImplementation(abi.encodeWithSignature(\\\"_resignImplementation()\\\"));\\n }\\n\\n address oldImplementation = implementation;\\n implementation = implementation_;\\n\\n delegateToImplementation(abi.encodeWithSignature(\\\"_becomeImplementation(bytes)\\\", becomeImplementationData));\\n\\n emit NewImplementation(oldImplementation, implementation);\\n }\\n\\n /**\\n * @notice Accrue interest then return the up-to-date exchange rate\\n * @return Calculated exchange rate scaled by 1e18\\n */\\n function exchangeRateCurrent() public returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"exchangeRateCurrent()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Applies accrued interest to total borrows and reserves.\\n * @dev This calculates interest accrued from the last checkpointed block\\n * up to the current block and writes new checkpoint to storage.\\n */\\n function accrueInterest() public returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"accrueInterest()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Sets a new comptroller for the market\\n * @dev Admin function to set a new comptroller\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"_setComptroller(address)\\\", newComptroller)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Accrues interest and updates the interest rate model using `_setInterestRateModelFresh`\\n * @dev Admin function to accrue interest and update the interest rate model\\n * @param newInterestRateModel The new interest rate model to use\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _setInterestRateModel(InterestRateModel newInterestRateModel) public returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"_setInterestRateModel(address)\\\", newInterestRateModel)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Delegates execution to the implementation contract\\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\\n * @param data The raw data to delegatecall\\n * @return The returned bytes from the delegatecall\\n */\\n function delegateToImplementation(bytes memory data) public returns (bytes memory) {\\n return delegateTo(implementation, data);\\n }\\n\\n /**\\n * @notice Delegates execution to an implementation contract\\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\\n * There are an additional 2 prefix uints from the wrapper returndata, which we ignore since we make an extra hop.\\n * @param data The raw data to delegatecall\\n * @return The returned bytes from the delegatecall\\n */\\n function delegateToViewImplementation(bytes memory data) public view returns (bytes memory) {\\n (bool success, bytes memory returnData) = address(this).staticcall(\\n abi.encodeWithSignature(\\\"delegateToImplementation(bytes)\\\", data)\\n );\\n assembly {\\n if eq(success, 0) {\\n revert(add(returnData, 0x20), returndatasize)\\n }\\n }\\n return abi.decode(returnData, (bytes));\\n }\\n\\n /**\\n * @notice Return the borrow balance of account based on stored data\\n * @param account The address whose balance should be calculated\\n * @return The calculated balance\\n */\\n function borrowBalanceStored(address account) public view returns (uint) {\\n bytes memory data = delegateToViewImplementation(\\n abi.encodeWithSignature(\\\"borrowBalanceStored(address)\\\", account)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Calculates the exchange rate from the underlying to the VToken\\n * @dev This function does not accrue interest before calculating the exchange rate\\n * @return Calculated exchange rate scaled by 1e18\\n */\\n function exchangeRateStored() public view returns (uint) {\\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\\\"exchangeRateStored()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Internal method to delegate execution to another contract\\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\\n * @param callee The contract to delegatecall\\n * @param data The raw data to delegatecall\\n * @return The returned bytes from the delegatecall\\n */\\n function delegateTo(address callee, bytes memory data) internal returns (bytes memory) {\\n (bool success, bytes memory returnData) = callee.delegatecall(data);\\n assembly {\\n if eq(success, 0) {\\n revert(add(returnData, 0x20), returndatasize)\\n }\\n }\\n return returnData;\\n }\\n}\\n\",\"keccak256\":\"0xfb7ad07b6ca2171914cef37d02fb97e6e55f4f0935c5c5cba33ab31f3613bce9\"},\"contracts/Tokens/VTokens/VToken.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"../../Comptroller/ComptrollerInterface.sol\\\";\\nimport \\\"../../Utils/ErrorReporter.sol\\\";\\nimport \\\"../../Utils/Exponential.sol\\\";\\nimport \\\"../../Tokens/EIP20Interface.sol\\\";\\nimport \\\"../../Tokens/EIP20NonStandardInterface.sol\\\";\\nimport \\\"../../InterestRateModels/InterestRateModel.sol\\\";\\nimport \\\"./VTokenInterfaces.sol\\\";\\nimport { IAccessControlManagerV5 } from \\\"@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV5.sol\\\";\\n\\n/**\\n * @title Venus's vToken Contract\\n * @notice Abstract base for vTokens\\n * @author Venus\\n */\\ncontract VToken is VTokenInterface, Exponential, TokenErrorReporter {\\n struct MintLocalVars {\\n MathError mathErr;\\n uint exchangeRateMantissa;\\n uint mintTokens;\\n uint totalSupplyNew;\\n uint accountTokensNew;\\n uint actualMintAmount;\\n }\\n\\n struct RedeemLocalVars {\\n MathError mathErr;\\n uint exchangeRateMantissa;\\n uint redeemTokens;\\n uint redeemAmount;\\n uint totalSupplyNew;\\n uint accountTokensNew;\\n }\\n\\n struct BorrowLocalVars {\\n MathError mathErr;\\n uint accountBorrows;\\n uint accountBorrowsNew;\\n uint totalBorrowsNew;\\n }\\n\\n struct RepayBorrowLocalVars {\\n Error err;\\n MathError mathErr;\\n uint repayAmount;\\n uint borrowerIndex;\\n uint accountBorrows;\\n uint accountBorrowsNew;\\n uint totalBorrowsNew;\\n uint actualRepayAmount;\\n }\\n\\n /*** Reentrancy Guard ***/\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n */\\n modifier nonReentrant() {\\n require(_notEntered, \\\"re-entered\\\");\\n _notEntered = false;\\n _;\\n _notEntered = true; // get a gas-refund post-Istanbul\\n }\\n\\n /**\\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n // @custom:event Emits Transfer event\\n function transfer(address dst, uint256 amount) external nonReentrant returns (bool) {\\n return transferTokens(msg.sender, msg.sender, dst, amount) == uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Transfer `amount` tokens from `src` to `dst`\\n * @param src The address of the source account\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n // @custom:event Emits Transfer event\\n function transferFrom(address src, address dst, uint256 amount) external nonReentrant returns (bool) {\\n return transferTokens(msg.sender, src, dst, amount) == uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Approve `spender` to transfer up to `amount` from `src`\\n * @dev This will overwrite the approval amount for `spender`\\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\\n * @param spender The address of the account which may transfer tokens\\n * @param amount The number of tokens that are approved (-1 means infinite)\\n * @return Whether or not the approval succeeded\\n */\\n // @custom:event Emits Approval event on successful approve\\n function approve(address spender, uint256 amount) external returns (bool) {\\n transferAllowances[msg.sender][spender] = amount;\\n emit Approval(msg.sender, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @notice Get the underlying balance of the `owner`\\n * @dev This also accrues interest in a transaction\\n * @param owner The address of the account to query\\n * @return The amount of underlying owned by `owner`\\n */\\n function balanceOfUnderlying(address owner) external returns (uint) {\\n Exp memory exchangeRate = Exp({ mantissa: exchangeRateCurrent() });\\n (MathError mErr, uint balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]);\\n ensureNoMathError(mErr);\\n return balance;\\n }\\n\\n /**\\n * @notice Returns the current total borrows plus accrued interest\\n * @return The total borrows with interest\\n */\\n function totalBorrowsCurrent() external nonReentrant returns (uint) {\\n require(accrueInterest() == uint(Error.NO_ERROR), \\\"accrue interest failed\\\");\\n return totalBorrows;\\n }\\n\\n /**\\n * @notice Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex\\n * @param account The address whose balance should be calculated after updating borrowIndex\\n * @return The calculated balance\\n */\\n function borrowBalanceCurrent(address account) external nonReentrant returns (uint) {\\n require(accrueInterest() == uint(Error.NO_ERROR), \\\"accrue interest failed\\\");\\n return borrowBalanceStored(account);\\n }\\n\\n /**\\n * @notice Transfers collateral tokens (this market) to the liquidator.\\n * @dev Will fail unless called by another vToken during the process of liquidation.\\n * Its absolutely critical to use msg.sender as the borrowed vToken and not a parameter.\\n * @param liquidator The account receiving seized collateral\\n * @param borrower The account having collateral seized\\n * @param seizeTokens The number of vTokens to seize\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n // @custom:event Emits Transfer event\\n function seize(address liquidator, address borrower, uint seizeTokens) external nonReentrant returns (uint) {\\n return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);\\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n // @custom:event Emits NewPendingAdmin event with old and new admin addresses\\n function _setPendingAdmin(address payable newPendingAdmin) external returns (uint) {\\n // Check caller = admin\\n ensureAdmin(msg.sender);\\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n // @custom:event Emits NewAdmin event on successful acceptance\\n // @custom:event Emits NewPendingAdmin event with null new pending admin\\n function _acceptAdmin() external 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 * @notice accrues interest and sets a new reserve factor for the protocol using `_setReserveFactorFresh`\\n * @dev Governor function to accrue interest and set a new reserve factor\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n // @custom:event Emits NewReserveFactor event\\n function _setReserveFactor(uint newReserveFactorMantissa_) external nonReentrant returns (uint) {\\n ensureAllowed(\\\"_setReserveFactor(uint256)\\\");\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reserve factor change failed.\\n return fail(Error(error), FailureInfo.SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED);\\n }\\n // _setReserveFactorFresh emits reserve-factor-specific logs on errors, so we don't need to.\\n return _setReserveFactorFresh(newReserveFactorMantissa_);\\n }\\n\\n /**\\n * @notice Sets the address of the access control manager of this contract\\n * @dev Admin function to set the access control address\\n * @param newAccessControlManagerAddress New address for the access control\\n * @return uint 0=success, otherwise will revert\\n */\\n function setAccessControlManager(address newAccessControlManagerAddress) external returns (uint) {\\n // Check caller is admin\\n ensureAdmin(msg.sender);\\n\\n ensureNonZeroAddress(newAccessControlManagerAddress);\\n\\n emit NewAccessControlManager(accessControlManager, newAccessControlManagerAddress);\\n accessControlManager = newAccessControlManagerAddress;\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Accrues interest and reduces reserves by transferring to protocol share reserve\\n * @param reduceAmount_ Amount of reduction to reserves\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n // @custom:event Emits ReservesReduced event\\n function _reduceReserves(uint reduceAmount_) external nonReentrant returns (uint) {\\n ensureAllowed(\\\"_reduceReserves(uint256)\\\");\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed.\\n return fail(Error(error), FailureInfo.REDUCE_RESERVES_ACCRUE_INTEREST_FAILED);\\n }\\n\\n // If reserves were reduced in accrueInterest\\n if (reduceReservesBlockNumber == block.number) return (uint(Error.NO_ERROR));\\n // _reduceReservesFresh emits reserve-reduction-specific logs on errors, so we don't need to.\\n return _reduceReservesFresh(reduceAmount_);\\n }\\n\\n /**\\n * @notice Get the current allowance from `owner` for `spender`\\n * @param owner The address of the account which owns the tokens to be spent\\n * @param spender The address of the account which may transfer tokens\\n * @return The number of tokens allowed to be spent (-1 means infinite)\\n */\\n function allowance(address owner, address spender) external view returns (uint256) {\\n return transferAllowances[owner][spender];\\n }\\n\\n /**\\n * @notice Get the token balance of the `owner`\\n * @param owner The address of the account to query\\n * @return The number of tokens owned by `owner`\\n */\\n function balanceOf(address owner) external view returns (uint256) {\\n return accountTokens[owner];\\n }\\n\\n /**\\n * @notice Get a snapshot of the account's balances, and the cached exchange rate\\n * @dev This is used by comptroller to more efficiently perform liquidity checks.\\n * @param account Address of the account to snapshot\\n * @return (possible error, token balance, borrow balance, exchange rate mantissa)\\n */\\n function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) {\\n uint vTokenBalance = accountTokens[account];\\n uint borrowBalance;\\n uint exchangeRateMantissa;\\n\\n MathError mErr;\\n\\n (mErr, borrowBalance) = borrowBalanceStoredInternal(account);\\n if (mErr != MathError.NO_ERROR) {\\n return (uint(Error.MATH_ERROR), 0, 0, 0);\\n }\\n\\n (mErr, exchangeRateMantissa) = exchangeRateStoredInternal();\\n if (mErr != MathError.NO_ERROR) {\\n return (uint(Error.MATH_ERROR), 0, 0, 0);\\n }\\n\\n return (uint(Error.NO_ERROR), vTokenBalance, borrowBalance, exchangeRateMantissa);\\n }\\n\\n /**\\n * @notice Returns the current per-block supply interest rate for this vToken\\n * @return The supply interest rate per block, scaled by 1e18\\n */\\n function supplyRatePerBlock() external view returns (uint) {\\n return interestRateModel.getSupplyRate(getCashPrior(), totalBorrows, totalReserves, reserveFactorMantissa);\\n }\\n\\n /**\\n * @notice Returns the current per-block borrow interest rate for this vToken\\n * @return The borrow interest rate per block, scaled by 1e18\\n */\\n function borrowRatePerBlock() external view returns (uint) {\\n return interestRateModel.getBorrowRate(getCashPrior(), totalBorrows, totalReserves);\\n }\\n\\n /**\\n * @notice Get cash balance of this vToken in the underlying asset\\n * @return The quantity of underlying asset owned by this contract\\n */\\n function getCash() external view returns (uint) {\\n return getCashPrior();\\n }\\n\\n /**\\n * @notice Governance function to set new threshold of block difference after which funds will be sent to the protocol share reserve\\n * @param newReduceReservesBlockDelta_ block difference value\\n */\\n function setReduceReservesBlockDelta(uint256 newReduceReservesBlockDelta_) external {\\n require(newReduceReservesBlockDelta_ > 0, \\\"Invalid Input\\\");\\n ensureAllowed(\\\"setReduceReservesBlockDelta(uint256)\\\");\\n emit NewReduceReservesBlockDelta(reduceReservesBlockDelta, newReduceReservesBlockDelta_);\\n reduceReservesBlockDelta = newReduceReservesBlockDelta_;\\n }\\n\\n /**\\n * @notice Sets protocol share reserve contract address\\n * @param protcolShareReserve_ The address of protocol share reserve contract\\n */\\n function setProtocolShareReserve(address payable protcolShareReserve_) external {\\n // Check caller is admin\\n ensureAdmin(msg.sender);\\n ensureNonZeroAddress(protcolShareReserve_);\\n emit NewProtocolShareReserve(protocolShareReserve, protcolShareReserve_);\\n protocolShareReserve = protcolShareReserve_;\\n }\\n\\n /**\\n * @notice Initialize the money market\\n * @param comptroller_ The address of the Comptroller\\n * @param interestRateModel_ The address of the interest rate model\\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\\n * @param name_ EIP-20 name of this token\\n * @param symbol_ EIP-20 symbol of this token\\n * @param decimals_ EIP-20 decimal precision of this token\\n */\\n function initialize(\\n ComptrollerInterface comptroller_,\\n InterestRateModel interestRateModel_,\\n uint initialExchangeRateMantissa_,\\n string memory name_,\\n string memory symbol_,\\n uint8 decimals_\\n ) public {\\n ensureAdmin(msg.sender);\\n require(accrualBlockNumber == 0 && borrowIndex == 0, \\\"market may only be initialized once\\\");\\n\\n // Set initial exchange rate\\n initialExchangeRateMantissa = initialExchangeRateMantissa_;\\n require(initialExchangeRateMantissa > 0, \\\"initial exchange rate must be greater than zero.\\\");\\n\\n // Set the comptroller\\n uint err = _setComptroller(comptroller_);\\n require(err == uint(Error.NO_ERROR), \\\"setting comptroller failed\\\");\\n\\n // Initialize block number and borrow index (block number mocks depend on comptroller being set)\\n accrualBlockNumber = block.number;\\n borrowIndex = mantissaOne;\\n\\n // Set the interest rate model (depends on block number / borrow index)\\n err = _setInterestRateModelFresh(interestRateModel_);\\n require(err == uint(Error.NO_ERROR), \\\"setting interest rate model failed\\\");\\n\\n name = name_;\\n symbol = symbol_;\\n decimals = decimals_;\\n\\n // The counter starts true to prevent changing it from zero to non-zero (i.e. smaller cost/refund)\\n _notEntered = true;\\n }\\n\\n /**\\n * @notice Accrue interest then return the up-to-date exchange rate\\n * @return Calculated exchange rate scaled by 1e18\\n */\\n function exchangeRateCurrent() public nonReentrant returns (uint) {\\n require(accrueInterest() == uint(Error.NO_ERROR), \\\"accrue interest failed\\\");\\n return exchangeRateStored();\\n }\\n\\n /**\\n * @notice Applies accrued interest to total borrows and reserves\\n * @dev This calculates interest accrued from the last checkpointed block\\n * up to the current block and writes new checkpoint to storage and\\n * reduce spread reserves to protocol share reserve\\n * if currentBlock - reduceReservesBlockNumber >= blockDelta\\n */\\n // @custom:event Emits AccrueInterest event\\n function accrueInterest() public returns (uint) {\\n /* Remember the initial block number */\\n uint currentBlockNumber = block.number;\\n uint accrualBlockNumberPrior = accrualBlockNumber;\\n\\n /* Short-circuit accumulating 0 interest */\\n if (accrualBlockNumberPrior == currentBlockNumber) {\\n return uint(Error.NO_ERROR);\\n }\\n\\n /* Read the previous values out of storage */\\n uint cashPrior = getCashPrior();\\n uint borrowsPrior = totalBorrows;\\n uint reservesPrior = totalReserves;\\n uint borrowIndexPrior = borrowIndex;\\n\\n /* Calculate the current borrow interest rate */\\n uint borrowRateMantissa = interestRateModel.getBorrowRate(cashPrior, borrowsPrior, reservesPrior);\\n require(borrowRateMantissa <= borrowRateMaxMantissa, \\\"borrow rate is absurdly high\\\");\\n\\n /* Calculate the number of blocks elapsed since the last accrual */\\n (MathError mathErr, uint blockDelta) = subUInt(currentBlockNumber, accrualBlockNumberPrior);\\n ensureNoMathError(mathErr);\\n\\n /*\\n * Calculate the interest accumulated into borrows and reserves and the new index:\\n * simpleInterestFactor = borrowRate * blockDelta\\n * interestAccumulated = simpleInterestFactor * totalBorrows\\n * totalBorrowsNew = interestAccumulated + totalBorrows\\n * totalReservesNew = interestAccumulated * reserveFactor + totalReserves\\n * borrowIndexNew = simpleInterestFactor * borrowIndex + borrowIndex\\n */\\n\\n Exp memory simpleInterestFactor;\\n uint interestAccumulated;\\n uint totalBorrowsNew;\\n uint totalReservesNew;\\n uint borrowIndexNew;\\n\\n (mathErr, simpleInterestFactor) = mulScalar(Exp({ mantissa: borrowRateMantissa }), blockDelta);\\n if (mathErr != MathError.NO_ERROR) {\\n return\\n failOpaque(\\n Error.MATH_ERROR,\\n FailureInfo.ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\\n uint(mathErr)\\n );\\n }\\n\\n (mathErr, interestAccumulated) = mulScalarTruncate(simpleInterestFactor, borrowsPrior);\\n if (mathErr != MathError.NO_ERROR) {\\n return\\n failOpaque(\\n Error.MATH_ERROR,\\n FailureInfo.ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\\n uint(mathErr)\\n );\\n }\\n\\n (mathErr, totalBorrowsNew) = addUInt(interestAccumulated, borrowsPrior);\\n if (mathErr != MathError.NO_ERROR) {\\n return\\n failOpaque(\\n Error.MATH_ERROR,\\n FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\\n uint(mathErr)\\n );\\n }\\n\\n (mathErr, totalReservesNew) = mulScalarTruncateAddUInt(\\n Exp({ mantissa: reserveFactorMantissa }),\\n interestAccumulated,\\n reservesPrior\\n );\\n if (mathErr != MathError.NO_ERROR) {\\n return\\n failOpaque(\\n Error.MATH_ERROR,\\n FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\\n uint(mathErr)\\n );\\n }\\n\\n (mathErr, borrowIndexNew) = mulScalarTruncateAddUInt(simpleInterestFactor, borrowIndexPrior, borrowIndexPrior);\\n if (mathErr != MathError.NO_ERROR) {\\n return\\n failOpaque(\\n Error.MATH_ERROR,\\n FailureInfo.ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\\n uint(mathErr)\\n );\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /* We write the previously calculated values into storage */\\n accrualBlockNumber = currentBlockNumber;\\n borrowIndex = borrowIndexNew;\\n totalBorrows = totalBorrowsNew;\\n totalReserves = totalReservesNew;\\n\\n (mathErr, blockDelta) = subUInt(currentBlockNumber, reduceReservesBlockNumber);\\n ensureNoMathError(mathErr);\\n if (blockDelta >= reduceReservesBlockDelta) {\\n reduceReservesBlockNumber = currentBlockNumber;\\n if (cashPrior < totalReservesNew) {\\n _reduceReservesFresh(cashPrior);\\n } else {\\n _reduceReservesFresh(totalReservesNew);\\n }\\n }\\n\\n /* We emit an AccrueInterest event */\\n emit AccrueInterest(cashPrior, interestAccumulated, borrowIndexNew, totalBorrowsNew);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets a new comptroller for the market\\n * @dev Admin function to set a new comptroller\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n // @custom:event Emits NewComptroller event\\n function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) {\\n // Check caller is admin\\n ensureAdmin(msg.sender);\\n\\n ComptrollerInterface oldComptroller = comptroller;\\n // Ensure invoke comptroller.isComptroller() returns true\\n require(newComptroller.isComptroller(), \\\"marker method returned false\\\");\\n\\n // Set market's comptroller to newComptroller\\n comptroller = newComptroller;\\n\\n // Emit NewComptroller(oldComptroller, newComptroller)\\n emit NewComptroller(oldComptroller, newComptroller);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Accrues interest and updates the interest rate model using _setInterestRateModelFresh\\n * @dev Governance function to accrue interest and update the interest rate model\\n * @param newInterestRateModel_ The new interest rate model to use\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _setInterestRateModel(InterestRateModel newInterestRateModel_) public returns (uint) {\\n ensureAllowed(\\\"_setInterestRateModel(address)\\\");\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted change of interest rate model failed\\n return fail(Error(error), FailureInfo.SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED);\\n }\\n // _setInterestRateModelFresh emits interest-rate-model-update-specific logs on errors, so we don't need to.\\n return _setInterestRateModelFresh(newInterestRateModel_);\\n }\\n\\n /**\\n * @notice Calculates the exchange rate from the underlying to the VToken\\n * @dev This function does not accrue interest before calculating the exchange rate\\n * @return Calculated exchange rate scaled by 1e18\\n */\\n function exchangeRateStored() public view returns (uint) {\\n (MathError err, uint result) = exchangeRateStoredInternal();\\n ensureNoMathError(err);\\n return result;\\n }\\n\\n /**\\n * @notice Return the borrow balance of account based on stored data\\n * @param account The address whose balance should be calculated\\n * @return The calculated balance\\n */\\n function borrowBalanceStored(address account) public view returns (uint) {\\n (MathError err, uint result) = borrowBalanceStoredInternal(account);\\n ensureNoMathError(err);\\n return result;\\n }\\n\\n /**\\n * @notice Transfers `tokens` tokens from `src` to `dst` by `spender`\\n * @dev Called by both `transfer` and `transferFrom` internally\\n * @param spender The address of the account performing the transfer\\n * @param src The address of the source account\\n * @param dst The address of the destination account\\n * @param tokens The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n function transferTokens(address spender, address src, address dst, uint tokens) internal returns (uint) {\\n /* Fail if transfer not allowed */\\n uint allowed = comptroller.transferAllowed(address(this), src, dst, tokens);\\n if (allowed != 0) {\\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.TRANSFER_COMPTROLLER_REJECTION, allowed);\\n }\\n\\n /* Do not allow self-transfers */\\n if (src == dst) {\\n return fail(Error.BAD_INPUT, FailureInfo.TRANSFER_NOT_ALLOWED);\\n }\\n\\n /* Get the allowance, infinite for the account owner */\\n uint startingAllowance = 0;\\n if (spender == src) {\\n startingAllowance = uint(-1);\\n } else {\\n startingAllowance = transferAllowances[src][spender];\\n }\\n\\n /* Do the calculations, checking for {under,over}flow */\\n MathError mathErr;\\n uint allowanceNew;\\n uint srvTokensNew;\\n uint dstTokensNew;\\n\\n (mathErr, allowanceNew) = subUInt(startingAllowance, tokens);\\n if (mathErr != MathError.NO_ERROR) {\\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ALLOWED);\\n }\\n\\n (mathErr, srvTokensNew) = subUInt(accountTokens[src], tokens);\\n if (mathErr != MathError.NO_ERROR) {\\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ENOUGH);\\n }\\n\\n (mathErr, dstTokensNew) = addUInt(accountTokens[dst], tokens);\\n if (mathErr != MathError.NO_ERROR) {\\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_TOO_MUCH);\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n accountTokens[src] = srvTokensNew;\\n accountTokens[dst] = dstTokensNew;\\n\\n /* Eat some of the allowance (if necessary) */\\n if (startingAllowance != uint(-1)) {\\n transferAllowances[src][spender] = allowanceNew;\\n }\\n\\n /* We emit a Transfer event */\\n emit Transfer(src, dst, tokens);\\n\\n comptroller.transferVerify(address(this), src, dst, tokens);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sender supplies assets into the market and receives vTokens in exchange\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param mintAmount The amount of the underlying asset to supply\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\\n */\\n function mintInternal(uint mintAmount) internal nonReentrant returns (uint, uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted mint failed\\n return (fail(Error(error), FailureInfo.MINT_ACCRUE_INTEREST_FAILED), 0);\\n }\\n // mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to\\n return mintFresh(msg.sender, mintAmount);\\n }\\n\\n /**\\n * @notice User supplies assets into the market and receives vTokens in exchange\\n * @dev Assumes interest has already been accrued up to the current block\\n * @param minter The address of the account which is supplying the assets\\n * @param mintAmount The amount of the underlying asset to supply\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\\n */\\n function mintFresh(address minter, uint mintAmount) internal returns (uint, uint) {\\n /* Fail if mint not allowed */\\n uint allowed = comptroller.mintAllowed(address(this), minter, mintAmount);\\n if (allowed != 0) {\\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\\n }\\n\\n /* Verify market's block number equals current block number */\\n if (accrualBlockNumber != block.number) {\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\\n }\\n\\n MintLocalVars memory vars;\\n\\n (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();\\n if (vars.mathErr != MathError.NO_ERROR) {\\n return (failOpaque(Error.MATH_ERROR, FailureInfo.MINT_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr)), 0);\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /*\\n * We call `doTransferIn` for the minter and the mintAmount.\\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\\n * side-effects occurred. The function returns the amount actually transferred,\\n * in case of a fee. On success, the vToken holds an additional `actualMintAmount`\\n * of cash.\\n */\\n vars.actualMintAmount = doTransferIn(minter, mintAmount);\\n\\n /*\\n * We get the current exchange rate and calculate the number of vTokens to be minted:\\n * mintTokens = actualMintAmount / exchangeRate\\n */\\n\\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\\n vars.actualMintAmount,\\n Exp({ mantissa: vars.exchangeRateMantissa })\\n );\\n ensureNoMathError(vars.mathErr);\\n\\n /*\\n * We calculate the new total supply of vTokens and minter token balance, checking for overflow:\\n * totalSupplyNew = totalSupply + mintTokens\\n * accountTokensNew = accountTokens[minter] + mintTokens\\n */\\n (vars.mathErr, vars.totalSupplyNew) = addUInt(totalSupply, vars.mintTokens);\\n ensureNoMathError(vars.mathErr);\\n (vars.mathErr, vars.accountTokensNew) = addUInt(accountTokens[minter], vars.mintTokens);\\n ensureNoMathError(vars.mathErr);\\n\\n /* We write previously calculated values into storage */\\n totalSupply = vars.totalSupplyNew;\\n accountTokens[minter] = vars.accountTokensNew;\\n\\n /* We emit a Mint event, and a Transfer event */\\n emit Mint(minter, vars.actualMintAmount, vars.mintTokens, vars.accountTokensNew);\\n emit Transfer(address(this), minter, vars.mintTokens);\\n\\n /* We call the defense and prime accrue interest hook */\\n comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);\\n\\n return (uint(Error.NO_ERROR), vars.actualMintAmount);\\n }\\n\\n /**\\n * @notice Sender supplies assets into the market and receiver receives vTokens in exchange\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param receiver The address of the account which is receiving the vTokens\\n * @param mintAmount The amount of the underlying asset to supply\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\\n */\\n function mintBehalfInternal(address receiver, uint mintAmount) internal nonReentrant returns (uint, uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted mintBehalf failed\\n return (fail(Error(error), FailureInfo.MINT_ACCRUE_INTEREST_FAILED), 0);\\n }\\n // mintBelahfFresh emits the actual Mint event if successful and logs on errors, so we don't need to\\n return mintBehalfFresh(msg.sender, receiver, mintAmount);\\n }\\n\\n /**\\n * @notice Payer supplies assets into the market and receiver receives vTokens in exchange\\n * @dev Assumes interest has already been accrued up to the current block\\n * @param payer The address of the account which is paying the underlying token\\n * @param receiver The address of the account which is receiving vToken\\n * @param mintAmount The amount of the underlying asset to supply\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\\n */\\n function mintBehalfFresh(address payer, address receiver, uint mintAmount) internal returns (uint, uint) {\\n ensureNonZeroAddress(receiver);\\n /* Fail if mint not allowed */\\n uint allowed = comptroller.mintAllowed(address(this), receiver, mintAmount);\\n if (allowed != 0) {\\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\\n }\\n\\n /* Verify market's block number equals current block number */\\n if (accrualBlockNumber != block.number) {\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\\n }\\n\\n MintLocalVars memory vars;\\n\\n (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();\\n if (vars.mathErr != MathError.NO_ERROR) {\\n return (failOpaque(Error.MATH_ERROR, FailureInfo.MINT_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr)), 0);\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /*\\n * We call `doTransferIn` for the payer and the mintAmount.\\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\\n * side-effects occurred. The function returns the amount actually transferred,\\n * in case of a fee. On success, the vToken holds an additional `actualMintAmount`\\n * of cash.\\n */\\n vars.actualMintAmount = doTransferIn(payer, mintAmount);\\n\\n /*\\n * We get the current exchange rate and calculate the number of vTokens to be minted:\\n * mintTokens = actualMintAmount / exchangeRate\\n */\\n\\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\\n vars.actualMintAmount,\\n Exp({ mantissa: vars.exchangeRateMantissa })\\n );\\n ensureNoMathError(vars.mathErr);\\n\\n /*\\n * We calculate the new total supply of vTokens and receiver token balance, checking for overflow:\\n * totalSupplyNew = totalSupply + mintTokens\\n * accountTokensNew = accountTokens[receiver] + mintTokens\\n */\\n (vars.mathErr, vars.totalSupplyNew) = addUInt(totalSupply, vars.mintTokens);\\n ensureNoMathError(vars.mathErr);\\n\\n (vars.mathErr, vars.accountTokensNew) = addUInt(accountTokens[receiver], vars.mintTokens);\\n ensureNoMathError(vars.mathErr);\\n\\n /* We write previously calculated values into storage */\\n totalSupply = vars.totalSupplyNew;\\n accountTokens[receiver] = vars.accountTokensNew;\\n\\n /* We emit a MintBehalf event, and a Transfer event */\\n emit MintBehalf(payer, receiver, vars.actualMintAmount, vars.mintTokens, vars.accountTokensNew);\\n emit Transfer(address(this), receiver, vars.mintTokens);\\n\\n /* We call the defense and prime accrue interest hook */\\n comptroller.mintVerify(address(this), receiver, vars.actualMintAmount, vars.mintTokens);\\n\\n return (uint(Error.NO_ERROR), vars.actualMintAmount);\\n }\\n\\n /**\\n * @notice Redeemer redeems vTokens in exchange for the underlying assets, transferred to the receiver. Redeemer and receiver can be the same\\n * address, or different addresses if the receiver was previously approved by the redeemer as a valid delegate (see MarketFacet.updateDelegate)\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param redeemer The address of the account which is redeeming the tokens\\n * @param receiver The receiver of the tokens\\n * @param redeemTokens The number of vTokens to redeem into underlying\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function redeemInternal(\\n address redeemer,\\n address payable receiver,\\n uint redeemTokens\\n ) internal nonReentrant returns (uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed\\n return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);\\n }\\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\\n return redeemFresh(redeemer, receiver, redeemTokens, 0);\\n }\\n\\n /**\\n * @notice Sender redeems underlying assets on behalf of some other address. This function is only available\\n * for senders, explicitly marked as delegates of the supplier using `comptroller.updateDelegate`\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param redeemer The address of the account which is redeeming the tokens\\n * @param receiver The receiver of the tokens, if called by a delegate\\n * @param redeemAmount The amount of underlying to receive from redeeming vTokens\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function redeemUnderlyingInternal(\\n address redeemer,\\n address payable receiver,\\n uint redeemAmount\\n ) internal nonReentrant returns (uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed\\n return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);\\n }\\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\\n return redeemFresh(redeemer, receiver, 0, redeemAmount);\\n }\\n\\n /**\\n * @notice Redeemer redeems vTokens in exchange for the underlying assets, transferred to the receiver. Redeemer and receiver can be the same\\n * address, or different addresses if the receiver was previously approved by the redeemer as a valid delegate (see MarketFacet.updateDelegate)\\n * @dev Assumes interest has already been accrued up to the current block\\n * @param redeemer The address of the account which is redeeming the tokens\\n * @param receiver The receiver of the tokens\\n * @param redeemTokensIn The number of vTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)\\n * @param redeemAmountIn The number of underlying tokens to receive from redeeming vTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n // solhint-disable-next-line code-complexity\\n function redeemFresh(\\n address redeemer,\\n address payable receiver,\\n uint redeemTokensIn,\\n uint redeemAmountIn\\n ) internal returns (uint) {\\n require(redeemTokensIn == 0 || redeemAmountIn == 0, \\\"one of redeemTokensIn or redeemAmountIn must be zero\\\");\\n\\n RedeemLocalVars memory vars;\\n\\n /* exchangeRate = invoke Exchange Rate Stored() */\\n (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();\\n ensureNoMathError(vars.mathErr);\\n\\n /* If redeemTokensIn > 0: */\\n if (redeemTokensIn > 0) {\\n /*\\n * We calculate the exchange rate and the amount of underlying to be redeemed:\\n * redeemTokens = redeemTokensIn\\n * redeemAmount = redeemTokensIn x exchangeRateCurrent\\n */\\n vars.redeemTokens = redeemTokensIn;\\n\\n (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(\\n Exp({ mantissa: vars.exchangeRateMantissa }),\\n redeemTokensIn\\n );\\n ensureNoMathError(vars.mathErr);\\n } else {\\n /*\\n * We get the current exchange rate and calculate the amount to be redeemed:\\n * redeemTokens = redeemAmountIn / exchangeRate\\n * redeemAmount = redeemAmountIn\\n */\\n\\n (vars.mathErr, vars.redeemTokens) = divScalarByExpTruncate(\\n redeemAmountIn,\\n Exp({ mantissa: vars.exchangeRateMantissa })\\n );\\n ensureNoMathError(vars.mathErr);\\n\\n vars.redeemAmount = redeemAmountIn;\\n }\\n\\n /* Fail if redeem not allowed */\\n uint allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);\\n if (allowed != 0) {\\n revert(\\\"math error\\\");\\n }\\n\\n /* Verify market's block number equals current block number */\\n if (accrualBlockNumber != block.number) {\\n revert(\\\"math error\\\");\\n }\\n\\n /*\\n * We calculate the new total supply and redeemer balance, checking for underflow:\\n * totalSupplyNew = totalSupply - redeemTokens\\n * accountTokensNew = accountTokens[redeemer] - redeemTokens\\n */\\n (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);\\n ensureNoMathError(vars.mathErr);\\n\\n (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);\\n ensureNoMathError(vars.mathErr);\\n\\n /* Fail gracefully if protocol has insufficient cash */\\n if (getCashPrior() < vars.redeemAmount) {\\n revert(\\\"math error\\\");\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /* We write previously calculated values into storage */\\n totalSupply = vars.totalSupplyNew;\\n accountTokens[redeemer] = vars.accountTokensNew;\\n\\n /*\\n * We invoke doTransferOut for the receiver and the redeemAmount.\\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\\n * On success, the vToken has redeemAmount less of cash.\\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\\n */\\n\\n uint feeAmount;\\n uint remainedAmount;\\n if (IComptroller(address(comptroller)).treasuryPercent() != 0) {\\n (vars.mathErr, feeAmount) = mulUInt(\\n vars.redeemAmount,\\n IComptroller(address(comptroller)).treasuryPercent()\\n );\\n ensureNoMathError(vars.mathErr);\\n\\n (vars.mathErr, feeAmount) = divUInt(feeAmount, 1e18);\\n ensureNoMathError(vars.mathErr);\\n\\n (vars.mathErr, remainedAmount) = subUInt(vars.redeemAmount, feeAmount);\\n ensureNoMathError(vars.mathErr);\\n\\n doTransferOut(address(uint160(IComptroller(address(comptroller)).treasuryAddress())), feeAmount);\\n\\n emit RedeemFee(redeemer, feeAmount, vars.redeemTokens);\\n } else {\\n remainedAmount = vars.redeemAmount;\\n }\\n\\n doTransferOut(receiver, remainedAmount);\\n\\n /* We emit a Transfer event, and a Redeem event */\\n emit Transfer(redeemer, address(this), vars.redeemTokens);\\n emit Redeem(redeemer, remainedAmount, vars.redeemTokens, vars.accountTokensNew);\\n\\n /* We call the defense and prime accrue interest hook */\\n comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Receiver gets the borrow on behalf of the borrower address\\n * @param borrower The borrower, on behalf of whom to borrow\\n * @param receiver The account that would receive the funds (can be the same as the borrower)\\n * @param borrowAmount The amount of the underlying asset to borrow\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function borrowInternal(\\n address borrower,\\n address payable receiver,\\n uint borrowAmount\\n ) internal nonReentrant returns (uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed\\n return fail(Error(error), FailureInfo.BORROW_ACCRUE_INTEREST_FAILED);\\n }\\n // borrowFresh emits borrow-specific logs on errors, so we don't need to\\n return borrowFresh(borrower, receiver, borrowAmount);\\n }\\n\\n /**\\n * @notice Receiver gets the borrow on behalf of the borrower address\\n * @dev Before calling this function, ensure that the interest has been accrued\\n * @param borrower The borrower, on behalf of whom to borrow\\n * @param receiver The account that would receive the funds (can be the same as the borrower)\\n * @param borrowAmount The amount of the underlying asset to borrow\\n * @return uint Returns 0 on success, otherwise revert (see ErrorReporter.sol for details).\\n */\\n function borrowFresh(address borrower, address payable receiver, uint borrowAmount) internal returns (uint) {\\n /* Revert if borrow not allowed */\\n uint allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);\\n if (allowed != 0) {\\n revert(\\\"math error\\\");\\n }\\n\\n /* Verify market's block number equals current block number */\\n if (accrualBlockNumber != block.number) {\\n revert(\\\"math error\\\");\\n }\\n\\n /* Revert if protocol has insufficient underlying cash */\\n if (getCashPrior() < borrowAmount) {\\n revert(\\\"math error\\\");\\n }\\n\\n BorrowLocalVars memory vars;\\n\\n /*\\n * We calculate the new borrower and total borrow balances, failing on overflow:\\n * accountBorrowsNew = accountBorrows + borrowAmount\\n * totalBorrowsNew = totalBorrows + borrowAmount\\n */\\n (vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower);\\n ensureNoMathError(vars.mathErr);\\n\\n (vars.mathErr, vars.accountBorrowsNew) = addUInt(vars.accountBorrows, borrowAmount);\\n ensureNoMathError(vars.mathErr);\\n\\n (vars.mathErr, vars.totalBorrowsNew) = addUInt(totalBorrows, borrowAmount);\\n ensureNoMathError(vars.mathErr);\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /* We write the previously calculated values into storage */\\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\\n accountBorrows[borrower].interestIndex = borrowIndex;\\n totalBorrows = vars.totalBorrowsNew;\\n\\n /*\\n * We invoke doTransferOut for the receiver and the borrowAmount.\\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\\n * On success, the vToken borrowAmount less of cash.\\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\\n */\\n doTransferOut(receiver, borrowAmount);\\n\\n /* We emit a Borrow event */\\n emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\\n\\n /* We call the defense and prime accrue interest hook */\\n comptroller.borrowVerify(address(this), borrower, borrowAmount);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sender repays their own borrow\\n * @param repayAmount The amount to repay\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\n */\\n function repayBorrowInternal(uint repayAmount) internal nonReentrant returns (uint, uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed\\n return (fail(Error(error), FailureInfo.REPAY_BORROW_ACCRUE_INTEREST_FAILED), 0);\\n }\\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\\n return repayBorrowFresh(msg.sender, msg.sender, repayAmount);\\n }\\n\\n /**\\n * @notice Sender repays a borrow belonging to another borrowing account\\n * @param borrower The account with the debt being payed off\\n * @param repayAmount The amount to repay\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\n */\\n function repayBorrowBehalfInternal(address borrower, uint repayAmount) internal nonReentrant returns (uint, uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed\\n return (fail(Error(error), FailureInfo.REPAY_BEHALF_ACCRUE_INTEREST_FAILED), 0);\\n }\\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\\n return repayBorrowFresh(msg.sender, borrower, repayAmount);\\n }\\n\\n /**\\n * @notice Borrows are repaid by another user (possibly the borrower).\\n * @param payer The account paying off the borrow\\n * @param borrower The account with the debt being payed off\\n * @param repayAmount The amount of undelrying tokens being returned\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\n */\\n function repayBorrowFresh(address payer, address borrower, uint repayAmount) internal returns (uint, uint) {\\n /* Fail if repayBorrow not allowed */\\n uint allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount);\\n if (allowed != 0) {\\n return (\\n failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_BORROW_COMPTROLLER_REJECTION, allowed),\\n 0\\n );\\n }\\n\\n /* Verify market's block number equals current block number */\\n if (accrualBlockNumber != block.number) {\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0);\\n }\\n\\n RepayBorrowLocalVars memory vars;\\n\\n /* We remember the original borrowerIndex for verification purposes */\\n vars.borrowerIndex = accountBorrows[borrower].interestIndex;\\n\\n /* We fetch the amount the borrower owes, with accumulated interest */\\n (vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower);\\n if (vars.mathErr != MathError.NO_ERROR) {\\n return (\\n failOpaque(\\n Error.MATH_ERROR,\\n FailureInfo.REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\n uint(vars.mathErr)\\n ),\\n 0\\n );\\n }\\n\\n /* If repayAmount == -1, repayAmount = accountBorrows */\\n if (repayAmount == uint(-1)) {\\n vars.repayAmount = vars.accountBorrows;\\n } else {\\n vars.repayAmount = repayAmount;\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /*\\n * We call doTransferIn for the payer and the repayAmount\\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\\n * On success, the vToken holds an additional repayAmount of cash.\\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\\n * it returns the amount actually transferred, in case of a fee.\\n */\\n vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount);\\n\\n /*\\n * We calculate the new borrower and total borrow balances, failing on underflow:\\n * accountBorrowsNew = accountBorrows - actualRepayAmount\\n * totalBorrowsNew = totalBorrows - actualRepayAmount\\n */\\n (vars.mathErr, vars.accountBorrowsNew) = subUInt(vars.accountBorrows, vars.actualRepayAmount);\\n ensureNoMathError(vars.mathErr);\\n\\n (vars.mathErr, vars.totalBorrowsNew) = subUInt(totalBorrows, vars.actualRepayAmount);\\n ensureNoMathError(vars.mathErr);\\n\\n /* We write the previously calculated values into storage */\\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\\n accountBorrows[borrower].interestIndex = borrowIndex;\\n totalBorrows = vars.totalBorrowsNew;\\n\\n /* We emit a RepayBorrow event */\\n emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\\n\\n /* We call the defense and prime accrue interest hook */\\n comptroller.repayBorrowVerify(address(this), payer, borrower, vars.actualRepayAmount, vars.borrowerIndex);\\n\\n return (uint(Error.NO_ERROR), vars.actualRepayAmount);\\n }\\n\\n /**\\n * @notice The sender liquidates the borrowers collateral.\\n * The collateral seized is transferred to the liquidator.\\n * @param borrower The borrower of this vToken to be liquidated\\n * @param vTokenCollateral The market in which to seize collateral from the borrower\\n * @param repayAmount The amount of the underlying borrowed asset to repay\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\n */\\n function liquidateBorrowInternal(\\n address borrower,\\n uint repayAmount,\\n VTokenInterface vTokenCollateral\\n ) internal nonReentrant returns (uint, uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted liquidation failed\\n return (fail(Error(error), FailureInfo.LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED), 0);\\n }\\n\\n error = vTokenCollateral.accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted liquidation failed\\n return (fail(Error(error), FailureInfo.LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED), 0);\\n }\\n\\n // liquidateBorrowFresh emits borrow-specific logs on errors, so we don't need to\\n return liquidateBorrowFresh(msg.sender, borrower, repayAmount, vTokenCollateral);\\n }\\n\\n /**\\n * @notice The liquidator liquidates the borrowers collateral.\\n * The collateral seized is transferred to the liquidator.\\n * @param borrower The borrower of this vToken to be liquidated\\n * @param liquidator The address repaying the borrow and seizing collateral\\n * @param vTokenCollateral The market in which to seize collateral from the borrower\\n * @param repayAmount The amount of the underlying borrowed asset to repay\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\n */\\n // solhint-disable-next-line code-complexity\\n function liquidateBorrowFresh(\\n address liquidator,\\n address borrower,\\n uint repayAmount,\\n VTokenInterface vTokenCollateral\\n ) internal returns (uint, uint) {\\n /* Fail if liquidate not allowed */\\n uint allowed = comptroller.liquidateBorrowAllowed(\\n address(this),\\n address(vTokenCollateral),\\n liquidator,\\n borrower,\\n repayAmount\\n );\\n if (allowed != 0) {\\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0);\\n }\\n\\n /* Verify market's block number equals current block number */\\n if (accrualBlockNumber != block.number) {\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0);\\n }\\n\\n /* Verify vTokenCollateral market's block number equals current block number */\\n if (vTokenCollateral.accrualBlockNumber() != block.number) {\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0);\\n }\\n\\n /* Fail if borrower = liquidator */\\n if (borrower == liquidator) {\\n return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0);\\n }\\n\\n /* Fail if repayAmount = 0 */\\n if (repayAmount == 0) {\\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0);\\n }\\n\\n /* Fail if repayAmount = -1 */\\n if (repayAmount == uint(-1)) {\\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0);\\n }\\n\\n /* Fail if repayBorrow fails */\\n (uint repayBorrowError, uint actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount);\\n if (repayBorrowError != uint(Error.NO_ERROR)) {\\n return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0);\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /* We calculate the number of collateral tokens that will be seized */\\n (uint amountSeizeError, uint seizeTokens) = comptroller.liquidateCalculateSeizeTokens(\\n address(this),\\n address(vTokenCollateral),\\n actualRepayAmount\\n );\\n require(amountSeizeError == uint(Error.NO_ERROR), \\\"LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED\\\");\\n\\n /* Revert if borrower collateral token balance < seizeTokens */\\n require(vTokenCollateral.balanceOf(borrower) >= seizeTokens, \\\"LIQUIDATE_SEIZE_TOO_MUCH\\\");\\n\\n // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call\\n uint seizeError;\\n if (address(vTokenCollateral) == address(this)) {\\n seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens);\\n } else {\\n seizeError = vTokenCollateral.seize(liquidator, borrower, seizeTokens);\\n }\\n\\n /* Revert if seize tokens fails (since we cannot be sure of side effects) */\\n require(seizeError == uint(Error.NO_ERROR), \\\"token seizure failed\\\");\\n\\n /* We emit a LiquidateBorrow event */\\n emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, address(vTokenCollateral), seizeTokens);\\n\\n /* We call the defense and prime accrue interest hook */\\n comptroller.liquidateBorrowVerify(\\n address(this),\\n address(vTokenCollateral),\\n liquidator,\\n borrower,\\n actualRepayAmount,\\n seizeTokens\\n );\\n\\n return (uint(Error.NO_ERROR), actualRepayAmount);\\n }\\n\\n /**\\n * @notice Transfers collateral tokens (this market) to the liquidator.\\n * @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another vToken.\\n * Its absolutely critical to use msg.sender as the seizer vToken and not a parameter.\\n * @param seizerToken The contract seizing the collateral (i.e. borrowed vToken)\\n * @param liquidator The account receiving seized collateral\\n * @param borrower The account having collateral seized\\n * @param seizeTokens The number of vTokens to seize\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function seizeInternal(\\n address seizerToken,\\n address liquidator,\\n address borrower,\\n uint seizeTokens\\n ) internal returns (uint) {\\n /* Fail if seize not allowed */\\n uint allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);\\n if (allowed != 0) {\\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed);\\n }\\n\\n /* Fail if borrower = liquidator */\\n if (borrower == liquidator) {\\n return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER);\\n }\\n\\n MathError mathErr;\\n uint borrowerTokensNew;\\n uint liquidatorTokensNew;\\n\\n /*\\n * We calculate the new borrower and liquidator token balances, failing on underflow/overflow:\\n * borrowerTokensNew = accountTokens[borrower] - seizeTokens\\n * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens\\n */\\n (mathErr, borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);\\n if (mathErr != MathError.NO_ERROR) {\\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint(mathErr));\\n }\\n\\n (mathErr, liquidatorTokensNew) = addUInt(accountTokens[liquidator], seizeTokens);\\n if (mathErr != MathError.NO_ERROR) {\\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint(mathErr));\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /* We write the previously calculated values into storage */\\n accountTokens[borrower] = borrowerTokensNew;\\n accountTokens[liquidator] = liquidatorTokensNew;\\n\\n /* Emit a Transfer event */\\n emit Transfer(borrower, liquidator, seizeTokens);\\n\\n /* We call the defense and prime accrue interest hook */\\n comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets a new reserve factor for the protocol (requires fresh interest accrual)\\n * @dev Governance function to set a new reserve factor\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _setReserveFactorFresh(uint newReserveFactorMantissa) internal returns (uint) {\\n // Verify market's block number equals current block number\\n if (accrualBlockNumber != block.number) {\\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_RESERVE_FACTOR_FRESH_CHECK);\\n }\\n\\n // Check newReserveFactor \\u2264 maxReserveFactor\\n if (newReserveFactorMantissa > reserveFactorMaxMantissa) {\\n return fail(Error.BAD_INPUT, FailureInfo.SET_RESERVE_FACTOR_BOUNDS_CHECK);\\n }\\n\\n uint oldReserveFactorMantissa = reserveFactorMantissa;\\n reserveFactorMantissa = newReserveFactorMantissa;\\n\\n emit NewReserveFactor(oldReserveFactorMantissa, newReserveFactorMantissa);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Accrues interest and adds reserves by transferring from `msg.sender`\\n * @param addAmount Amount of addition to reserves\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _addReservesInternal(uint addAmount) internal nonReentrant returns (uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed.\\n return fail(Error(error), FailureInfo.ADD_RESERVES_ACCRUE_INTEREST_FAILED);\\n }\\n\\n // _addReservesFresh emits reserve-addition-specific logs on errors, so we don't need to.\\n (error, ) = _addReservesFresh(addAmount);\\n return error;\\n }\\n\\n /**\\n * @notice Add reserves by transferring from caller\\n * @dev Requires fresh interest accrual\\n * @param addAmount Amount of addition to reserves\\n * @return (uint, uint) An error code (0=success, otherwise a failure (see ErrorReporter.sol for details)) and the actual amount added, net token fees\\n */\\n function _addReservesFresh(uint addAmount) internal returns (uint, uint) {\\n // totalReserves + actualAddAmount\\n uint totalReservesNew;\\n uint actualAddAmount;\\n\\n // We fail gracefully unless market's block number equals current block number\\n if (accrualBlockNumber != block.number) {\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.ADD_RESERVES_FRESH_CHECK), actualAddAmount);\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /*\\n * We call doTransferIn for the caller and the addAmount\\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\\n * On success, the vToken holds an additional addAmount of cash.\\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\\n * it returns the amount actually transferred, in case of a fee.\\n */\\n\\n actualAddAmount = doTransferIn(msg.sender, addAmount);\\n\\n totalReservesNew = totalReserves + actualAddAmount;\\n\\n /* Revert on overflow */\\n require(totalReservesNew >= totalReserves, \\\"add reserves unexpected overflow\\\");\\n\\n // Store reserves[n+1] = reserves[n] + actualAddAmount\\n totalReserves = totalReservesNew;\\n\\n /* Emit NewReserves(admin, actualAddAmount, reserves[n+1]) */\\n emit ReservesAdded(msg.sender, actualAddAmount, totalReservesNew);\\n\\n /* Return (NO_ERROR, actualAddAmount) */\\n return (uint(Error.NO_ERROR), actualAddAmount);\\n }\\n\\n /**\\n * @notice Reduces reserves by transferring to protocol share reserve contract\\n * @dev Requires fresh interest accrual\\n * @param reduceAmount Amount of reduction to reserves\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _reduceReservesFresh(uint reduceAmount) internal returns (uint) {\\n if (reduceAmount == 0) {\\n return uint(Error.NO_ERROR);\\n }\\n\\n // We fail gracefully unless market's block number equals current block number\\n if (accrualBlockNumber != block.number) {\\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDUCE_RESERVES_FRESH_CHECK);\\n }\\n\\n // Fail gracefully if protocol has insufficient underlying cash\\n if (getCashPrior() < reduceAmount) {\\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDUCE_RESERVES_CASH_NOT_AVAILABLE);\\n }\\n\\n // Check reduceAmount \\u2264 reserves[n] (totalReserves)\\n if (reduceAmount > totalReserves) {\\n return fail(Error.BAD_INPUT, FailureInfo.REDUCE_RESERVES_VALIDATION);\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n // totalReserves - reduceAmount\\n uint totalReservesNew = totalReserves - reduceAmount;\\n\\n // Store reserves[n+1] = reserves[n] - reduceAmount\\n totalReserves = totalReservesNew;\\n\\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\\n doTransferOut(protocolShareReserve, reduceAmount);\\n\\n IProtocolShareReserveV5(protocolShareReserve).updateAssetsState(\\n address(comptroller),\\n underlying,\\n IProtocolShareReserveV5.IncomeType.SPREAD\\n );\\n\\n emit ReservesReduced(protocolShareReserve, reduceAmount, totalReservesNew);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice updates the interest rate model (requires fresh interest accrual)\\n * @dev Governance function to update the interest rate model\\n * @param newInterestRateModel the new interest rate model to use\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _setInterestRateModelFresh(InterestRateModel newInterestRateModel) internal returns (uint) {\\n // Used to store old model for use in the event that is emitted on success\\n InterestRateModel oldInterestRateModel;\\n // We fail gracefully unless market's block number equals current block number\\n if (accrualBlockNumber != block.number) {\\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_INTEREST_RATE_MODEL_FRESH_CHECK);\\n }\\n\\n // Track the market's current interest rate model\\n oldInterestRateModel = interestRateModel;\\n\\n // Ensure invoke newInterestRateModel.isInterestRateModel() returns true\\n require(newInterestRateModel.isInterestRateModel(), \\\"marker method returned false\\\");\\n\\n // Set the interest rate model to newInterestRateModel\\n interestRateModel = newInterestRateModel;\\n\\n // Emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel)\\n emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /*** Safe Token ***/\\n\\n /**\\n * @dev Performs a transfer in, reverting upon failure. Returns the amount actually transferred to the protocol, in case of a fee.\\n * This may revert due to insufficient balance or insufficient allowance.\\n */\\n function doTransferIn(address from, uint amount) internal returns (uint);\\n\\n /**\\n * @dev Performs a transfer out, ideally returning an explanatory error code upon failure rather than reverting.\\n * If caller has not called checked protocol's balance, may revert due to insufficient cash held in the contract.\\n * If caller has checked protocol's balance, and verified it is >= amount, this should not revert in normal conditions.\\n */\\n function doTransferOut(address payable to, uint amount) internal;\\n\\n /**\\n * @notice Return the borrow balance of account based on stored data\\n * @param account The address whose balance should be calculated\\n * @return Tuple of error code and the calculated balance or 0 if error code is non-zero\\n */\\n function borrowBalanceStoredInternal(address account) internal view returns (MathError, uint) {\\n /* Note: we do not assert that the market is up to date */\\n MathError mathErr;\\n uint principalTimesIndex;\\n uint result;\\n\\n /* Get borrowBalance and borrowIndex */\\n BorrowSnapshot storage borrowSnapshot = accountBorrows[account];\\n\\n /* If borrowBalance = 0 then borrowIndex is likely also 0.\\n * Rather than failing the calculation with a division by 0, we immediately return 0 in this case.\\n */\\n if (borrowSnapshot.principal == 0) {\\n return (MathError.NO_ERROR, 0);\\n }\\n\\n /* Calculate new borrow balance using the interest index:\\n * recentBorrowBalance = borrower.borrowBalance * market.borrowIndex / borrower.borrowIndex\\n */\\n (mathErr, principalTimesIndex) = mulUInt(borrowSnapshot.principal, borrowIndex);\\n if (mathErr != MathError.NO_ERROR) {\\n return (mathErr, 0);\\n }\\n\\n (mathErr, result) = divUInt(principalTimesIndex, borrowSnapshot.interestIndex);\\n if (mathErr != MathError.NO_ERROR) {\\n return (mathErr, 0);\\n }\\n\\n return (MathError.NO_ERROR, result);\\n }\\n\\n /**\\n * @notice Calculates the exchange rate from the underlying to the vToken\\n * @dev This function does not accrue interest before calculating the exchange rate\\n * @return Tuple of error code and calculated exchange rate scaled by 1e18\\n */\\n function exchangeRateStoredInternal() internal view returns (MathError, uint) {\\n uint _totalSupply = totalSupply;\\n if (_totalSupply == 0) {\\n /*\\n * If there are no tokens minted:\\n * exchangeRate = initialExchangeRate\\n */\\n return (MathError.NO_ERROR, initialExchangeRateMantissa);\\n } else {\\n /*\\n * Otherwise:\\n * exchangeRate = (totalCash + totalBorrows - totalReserves) / totalSupply\\n */\\n uint totalCash = getCashPrior();\\n uint cashPlusBorrowsMinusReserves;\\n Exp memory exchangeRate;\\n MathError mathErr;\\n\\n (mathErr, cashPlusBorrowsMinusReserves) = addThenSubUInt(totalCash, totalBorrows, totalReserves);\\n if (mathErr != MathError.NO_ERROR) {\\n return (mathErr, 0);\\n }\\n\\n (mathErr, exchangeRate) = getExp(cashPlusBorrowsMinusReserves, _totalSupply);\\n if (mathErr != MathError.NO_ERROR) {\\n return (mathErr, 0);\\n }\\n\\n return (MathError.NO_ERROR, exchangeRate.mantissa);\\n }\\n }\\n\\n function ensureAllowed(string memory functionSig) private view {\\n require(\\n IAccessControlManagerV5(accessControlManager).isAllowedToCall(msg.sender, functionSig),\\n \\\"access denied\\\"\\n );\\n }\\n\\n function ensureAdmin(address caller_) private view {\\n require(caller_ == admin, \\\"Unauthorized\\\");\\n }\\n\\n function ensureNoMathError(MathError mErr) private pure {\\n require(mErr == MathError.NO_ERROR, \\\"math error\\\");\\n }\\n\\n function ensureNonZeroAddress(address address_) private pure {\\n require(address_ != address(0), \\\"zero address\\\");\\n }\\n\\n /*** Safe Token ***/\\n\\n /**\\n * @notice Gets balance of this contract in terms of the underlying\\n * @dev This excludes the value of the current message, if any\\n * @return The quantity of underlying owned by this contract\\n */\\n function getCashPrior() internal view returns (uint);\\n}\\n\",\"keccak256\":\"0xfdbcdbd6cab4aeba2c06f39adbfbd8e42a3e50d02aed628c2d76b97659d84b68\"},\"contracts/Tokens/VTokens/VTokenInterfaces.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"../../Comptroller/ComptrollerInterface.sol\\\";\\nimport \\\"../../InterestRateModels/InterestRateModel.sol\\\";\\n\\ninterface IProtocolShareReserveV5 {\\n enum IncomeType {\\n SPREAD,\\n LIQUIDATION\\n }\\n\\n function updateAssetsState(address comptroller, address asset, IncomeType kind) external;\\n}\\n\\ncontract VTokenStorageBase {\\n /**\\n * @notice Container for borrow balance information\\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\\n */\\n struct BorrowSnapshot {\\n uint principal;\\n uint interestIndex;\\n }\\n\\n /**\\n * @dev Guard variable for re-entrancy checks\\n */\\n bool internal _notEntered;\\n\\n /**\\n * @notice EIP-20 token name for this token\\n */\\n string public name;\\n\\n /**\\n * @notice EIP-20 token symbol for this token\\n */\\n string public symbol;\\n\\n /**\\n * @notice EIP-20 token decimals for this token\\n */\\n uint8 public decimals;\\n\\n /**\\n * @notice Maximum borrow rate that can ever be applied (.0005% / block)\\n */\\n\\n uint internal constant borrowRateMaxMantissa = 0.0005e16;\\n\\n /**\\n * @notice Maximum fraction of interest that can be set aside for reserves\\n */\\n uint internal constant reserveFactorMaxMantissa = 1e18;\\n\\n /**\\n * @notice Administrator for this contract\\n */\\n address payable public admin;\\n\\n /**\\n * @notice Pending administrator for this contract\\n */\\n address payable public pendingAdmin;\\n\\n /**\\n * @notice Contract which oversees inter-vToken operations\\n */\\n ComptrollerInterface public comptroller;\\n\\n /**\\n * @notice Model which tells what the current interest rate should be\\n */\\n InterestRateModel public interestRateModel;\\n\\n /**\\n * @notice Initial exchange rate used when minting the first VTokens (used when totalSupply = 0)\\n */\\n uint internal initialExchangeRateMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for reserves\\n */\\n uint public reserveFactorMantissa;\\n\\n /**\\n * @notice Block number that interest was last accrued at\\n */\\n uint public accrualBlockNumber;\\n\\n /**\\n * @notice Accumulator of the total earned interest rate since the opening of the market\\n */\\n uint public borrowIndex;\\n\\n /**\\n * @notice Total amount of outstanding borrows of the underlying in this market\\n */\\n uint public totalBorrows;\\n\\n /**\\n * @notice Total amount of reserves of the underlying held in this market\\n */\\n uint public totalReserves;\\n\\n /**\\n * @notice Total number of tokens in circulation\\n */\\n uint public totalSupply;\\n\\n /**\\n * @notice Official record of token balances for each account\\n */\\n mapping(address => uint) internal accountTokens;\\n\\n /**\\n * @notice Approved token transfer amounts on behalf of others\\n */\\n mapping(address => mapping(address => uint)) internal transferAllowances;\\n\\n /**\\n * @notice Mapping of account addresses to outstanding borrow balances\\n */\\n mapping(address => BorrowSnapshot) internal accountBorrows;\\n\\n /**\\n * @notice Underlying asset for this VToken\\n */\\n address public underlying;\\n\\n /**\\n * @notice Implementation address for this contract\\n */\\n address public implementation;\\n\\n /**\\n * @notice delta block after which reserves will be reduced\\n */\\n uint public reduceReservesBlockDelta;\\n\\n /**\\n * @notice last block number at which reserves were reduced\\n */\\n uint public reduceReservesBlockNumber;\\n\\n /**\\n * @notice address of protocol share reserve contract\\n */\\n address payable public protocolShareReserve;\\n\\n /**\\n * @notice address of accessControlManager\\n */\\n\\n address public accessControlManager;\\n}\\n\\ncontract VTokenStorage is VTokenStorageBase {\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\\ncontract VTokenInterface is VTokenStorage {\\n /**\\n * @notice Indicator that this is a vToken contract (for inspection)\\n */\\n bool public constant isVToken = true;\\n\\n /*** Market Events ***/\\n\\n /**\\n * @notice Event emitted when interest is accrued\\n */\\n event AccrueInterest(uint cashPrior, uint interestAccumulated, uint borrowIndex, uint totalBorrows);\\n\\n /**\\n * @notice Event emitted when tokens are minted\\n */\\n event Mint(address minter, uint mintAmount, uint mintTokens, uint256 totalSupply);\\n\\n /**\\n * @notice Event emitted when tokens are minted behalf by payer to receiver\\n */\\n event MintBehalf(address payer, address receiver, uint mintAmount, uint mintTokens, uint256 totalSupply);\\n\\n /**\\n * @notice Event emitted when tokens are redeemed\\n */\\n event Redeem(address redeemer, uint redeemAmount, uint redeemTokens, uint256 totalSupply);\\n\\n /**\\n * @notice Event emitted when tokens are redeemed and fee is transferred\\n */\\n event RedeemFee(address redeemer, uint feeAmount, uint redeemTokens);\\n\\n /**\\n * @notice Event emitted when underlying is borrowed\\n */\\n event Borrow(address borrower, uint borrowAmount, uint accountBorrows, uint totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is repaid\\n */\\n event RepayBorrow(address payer, address borrower, uint repayAmount, uint accountBorrows, uint totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is liquidated\\n */\\n event LiquidateBorrow(\\n address liquidator,\\n address borrower,\\n uint repayAmount,\\n address vTokenCollateral,\\n uint seizeTokens\\n );\\n\\n /*** Admin Events ***/\\n\\n /**\\n * @notice Event emitted when pendingAdmin is changed\\n */\\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\\n\\n /**\\n * @notice Event emitted when pendingAdmin is accepted, which means admin has been updated\\n */\\n event NewAdmin(address oldAdmin, address newAdmin);\\n\\n /**\\n * @notice Event emitted when comptroller is changed\\n */\\n event NewComptroller(ComptrollerInterface oldComptroller, ComptrollerInterface newComptroller);\\n\\n /**\\n * @notice Event emitted when interestRateModel is changed\\n */\\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\\n\\n /**\\n * @notice Event emitted when the reserve factor is changed\\n */\\n event NewReserveFactor(uint oldReserveFactorMantissa, uint newReserveFactorMantissa);\\n\\n /**\\n * @notice Event emitted when the reserves are added\\n */\\n event ReservesAdded(address benefactor, uint addAmount, uint newTotalReserves);\\n\\n /**\\n * @notice Event emitted when the reserves are reduced\\n */\\n event ReservesReduced(address protocolShareReserve, uint reduceAmount, uint newTotalReserves);\\n\\n /**\\n * @notice EIP20 Transfer event\\n */\\n event Transfer(address indexed from, address indexed to, uint amount);\\n\\n /**\\n * @notice EIP20 Approval event\\n */\\n event Approval(address indexed owner, address indexed spender, uint amount);\\n\\n /**\\n * @notice Event emitted when block delta for reduce reserves get updated\\n */\\n event NewReduceReservesBlockDelta(uint256 oldReduceReservesBlockDelta, uint256 newReduceReservesBlockDelta);\\n\\n /**\\n * @notice Event emitted when address of ProtocolShareReserve contract get updated\\n */\\n event NewProtocolShareReserve(address indexed oldProtocolShareReserve, address indexed newProtocolShareReserve);\\n\\n /**\\n * @notice Failure event\\n */\\n event Failure(uint error, uint info, uint detail);\\n\\n /// @notice Emitted when access control address is changed by admin\\n event NewAccessControlManager(address oldAccessControlAddress, address newAccessControlAddress);\\n\\n /*** User Interface ***/\\n\\n function transfer(address dst, uint amount) external returns (bool);\\n\\n function transferFrom(address src, address dst, uint amount) external returns (bool);\\n\\n function approve(address spender, uint amount) external returns (bool);\\n\\n function balanceOfUnderlying(address owner) external returns (uint);\\n\\n function totalBorrowsCurrent() external returns (uint);\\n\\n function borrowBalanceCurrent(address account) external returns (uint);\\n\\n function seize(address liquidator, address borrower, uint seizeTokens) external returns (uint);\\n\\n /*** Admin Function ***/\\n function _setPendingAdmin(address payable newPendingAdmin) external returns (uint);\\n\\n /*** Admin Function ***/\\n function _acceptAdmin() external returns (uint);\\n\\n /*** Admin Function ***/\\n function _setReserveFactor(uint newReserveFactorMantissa) external returns (uint);\\n\\n /*** Admin Function ***/\\n function _reduceReserves(uint reduceAmount) external returns (uint);\\n\\n function balanceOf(address owner) external view returns (uint);\\n\\n function allowance(address owner, address spender) external view returns (uint);\\n\\n function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint);\\n\\n function borrowRatePerBlock() external view returns (uint);\\n\\n function supplyRatePerBlock() external view returns (uint);\\n\\n function getCash() external view returns (uint);\\n\\n function exchangeRateCurrent() public returns (uint);\\n\\n function accrueInterest() public returns (uint);\\n\\n /*** Admin Function ***/\\n function _setComptroller(ComptrollerInterface newComptroller) public returns (uint);\\n\\n /*** Admin Function ***/\\n function _setInterestRateModel(InterestRateModel newInterestRateModel) public returns (uint);\\n\\n function borrowBalanceStored(address account) public view returns (uint);\\n\\n function exchangeRateStored() public view returns (uint);\\n}\\n\\ncontract VBep20Interface {\\n /*** User Interface ***/\\n\\n function mint(uint mintAmount) external returns (uint);\\n\\n function mintBehalf(address receiver, uint mintAmount) external returns (uint);\\n\\n function redeem(uint redeemTokens) external returns (uint);\\n\\n function redeemUnderlying(uint redeemAmount) external returns (uint);\\n\\n function borrow(uint borrowAmount) external returns (uint);\\n\\n function repayBorrow(uint repayAmount) external returns (uint);\\n\\n function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint);\\n\\n function liquidateBorrow(\\n address borrower,\\n uint repayAmount,\\n VTokenInterface vTokenCollateral\\n ) external returns (uint);\\n\\n /*** Admin Functions ***/\\n\\n function _addReserves(uint addAmount) external returns (uint);\\n}\\n\\ncontract VDelegatorInterface {\\n /**\\n * @notice Emitted when implementation is changed\\n */\\n event NewImplementation(address oldImplementation, address newImplementation);\\n\\n /**\\n * @notice Called by the admin to update the implementation of the delegator\\n * @param implementation_ The address of the new implementation for delegation\\n * @param allowResign Flag to indicate whether to call _resignImplementation on the old implementation\\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\\n */\\n function _setImplementation(\\n address implementation_,\\n bool allowResign,\\n bytes memory becomeImplementationData\\n ) public;\\n}\\n\\ncontract VDelegateInterface {\\n /**\\n * @notice Called by the delegator on a delegate to initialize it for duty\\n * @dev Should revert if any issues arise which make it unfit for delegation\\n * @param data The encoded bytes data for any initialization\\n */\\n function _becomeImplementation(bytes memory data) public;\\n\\n /**\\n * @notice Called by the delegator on a delegate to forfeit its responsibility\\n */\\n function _resignImplementation() public;\\n}\\n\",\"keccak256\":\"0x2f12533847458414b423cc85677489709d772bec4e48933ae983d6861202a41b\"},\"contracts/Utils/CarefulMath.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\n/**\\n * @title Careful Math\\n * @author Venus\\n * @notice Derived from OpenZeppelin's SafeMath library\\n * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol\\n */\\ncontract CarefulMath {\\n /**\\n * @dev Possible error codes that we can return\\n */\\n enum MathError {\\n NO_ERROR,\\n DIVISION_BY_ZERO,\\n INTEGER_OVERFLOW,\\n INTEGER_UNDERFLOW\\n }\\n\\n /**\\n * @dev Multiplies two numbers, returns an error on overflow.\\n */\\n function mulUInt(uint a, uint b) internal pure returns (MathError, uint) {\\n if (a == 0) {\\n return (MathError.NO_ERROR, 0);\\n }\\n\\n uint c = a * b;\\n\\n if (c / a != b) {\\n return (MathError.INTEGER_OVERFLOW, 0);\\n } else {\\n return (MathError.NO_ERROR, c);\\n }\\n }\\n\\n /**\\n * @dev Integer division of two numbers, truncating the quotient.\\n */\\n function divUInt(uint a, uint b) internal pure returns (MathError, uint) {\\n if (b == 0) {\\n return (MathError.DIVISION_BY_ZERO, 0);\\n }\\n\\n return (MathError.NO_ERROR, a / b);\\n }\\n\\n /**\\n * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).\\n */\\n function subUInt(uint a, uint b) internal pure returns (MathError, uint) {\\n if (b <= a) {\\n return (MathError.NO_ERROR, a - b);\\n } else {\\n return (MathError.INTEGER_UNDERFLOW, 0);\\n }\\n }\\n\\n /**\\n * @dev Adds two numbers, returns an error on overflow.\\n */\\n function addUInt(uint a, uint b) internal pure returns (MathError, uint) {\\n uint c = a + b;\\n\\n if (c >= a) {\\n return (MathError.NO_ERROR, c);\\n } else {\\n return (MathError.INTEGER_OVERFLOW, 0);\\n }\\n }\\n\\n /**\\n * @dev add a and b and then subtract c\\n */\\n function addThenSubUInt(uint a, uint b, uint c) internal pure returns (MathError, uint) {\\n (MathError err0, uint sum) = addUInt(a, b);\\n\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, 0);\\n }\\n\\n return subUInt(sum, c);\\n }\\n}\\n\",\"keccak256\":\"0x5bd84fb723641b98d0559272323b90ce42595f025af89cfb214d8c064c9ee3c3\"},\"contracts/Utils/ErrorReporter.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\ncontract ComptrollerErrorReporter {\\n enum Error {\\n NO_ERROR,\\n UNAUTHORIZED,\\n COMPTROLLER_MISMATCH,\\n INSUFFICIENT_SHORTFALL,\\n INSUFFICIENT_LIQUIDITY,\\n INVALID_CLOSE_FACTOR,\\n INVALID_COLLATERAL_FACTOR,\\n INVALID_LIQUIDATION_INCENTIVE,\\n MARKET_NOT_ENTERED, // no longer possible\\n MARKET_NOT_LISTED,\\n MARKET_ALREADY_LISTED,\\n MATH_ERROR,\\n NONZERO_BORROW_BALANCE,\\n PRICE_ERROR,\\n REJECTION,\\n SNAPSHOT_ERROR,\\n TOO_MANY_ASSETS,\\n TOO_MUCH_REPAY,\\n INSUFFICIENT_BALANCE_FOR_VAI,\\n MARKET_NOT_COLLATERAL\\n }\\n\\n enum FailureInfo {\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\\n EXIT_MARKET_BALANCE_OWED,\\n EXIT_MARKET_REJECTION,\\n SET_CLOSE_FACTOR_OWNER_CHECK,\\n SET_CLOSE_FACTOR_VALIDATION,\\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\\n SET_COLLATERAL_FACTOR_NO_EXISTS,\\n SET_COLLATERAL_FACTOR_VALIDATION,\\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\\n SET_IMPLEMENTATION_OWNER_CHECK,\\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\\n SET_MAX_ASSETS_OWNER_CHECK,\\n SET_PENDING_ADMIN_OWNER_CHECK,\\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\\n SET_PRICE_ORACLE_OWNER_CHECK,\\n SUPPORT_MARKET_EXISTS,\\n SUPPORT_MARKET_OWNER_CHECK,\\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\\n SET_VAI_MINT_RATE_CHECK,\\n SET_VAICONTROLLER_OWNER_CHECK,\\n SET_MINTED_VAI_REJECTION,\\n SET_TREASURY_OWNER_CHECK,\\n UNLIST_MARKET_NOT_LISTED\\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\\ncontract TokenErrorReporter {\\n enum Error {\\n NO_ERROR,\\n UNAUTHORIZED,\\n BAD_INPUT,\\n COMPTROLLER_REJECTION,\\n COMPTROLLER_CALCULATION_ERROR,\\n INTEREST_RATE_MODEL_ERROR,\\n INVALID_ACCOUNT_PAIR,\\n INVALID_CLOSE_AMOUNT_REQUESTED,\\n INVALID_COLLATERAL_FACTOR,\\n MATH_ERROR,\\n MARKET_NOT_FRESH,\\n MARKET_NOT_LISTED,\\n TOKEN_INSUFFICIENT_ALLOWANCE,\\n TOKEN_INSUFFICIENT_BALANCE,\\n TOKEN_INSUFFICIENT_CASH,\\n TOKEN_TRANSFER_IN_FAILED,\\n TOKEN_TRANSFER_OUT_FAILED,\\n TOKEN_PRICE_ERROR\\n }\\n\\n /*\\n * Note: FailureInfo (but not Error) is kept in alphabetical order\\n * This is because FailureInfo grows significantly faster, and\\n * the order of Error has some meaning, while the order of FailureInfo\\n * is entirely arbitrary.\\n */\\n enum FailureInfo {\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\n BORROW_ACCRUE_INTEREST_FAILED,\\n BORROW_CASH_NOT_AVAILABLE,\\n BORROW_FRESHNESS_CHECK,\\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\n BORROW_MARKET_NOT_LISTED,\\n BORROW_COMPTROLLER_REJECTION,\\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\\n LIQUIDATE_COMPTROLLER_REJECTION,\\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\\n LIQUIDATE_FRESHNESS_CHECK,\\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\\n LIQUIDATE_SEIZE_TOO_MUCH,\\n MINT_ACCRUE_INTEREST_FAILED,\\n MINT_COMPTROLLER_REJECTION,\\n MINT_EXCHANGE_CALCULATION_FAILED,\\n MINT_EXCHANGE_RATE_READ_FAILED,\\n MINT_FRESHNESS_CHECK,\\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\\n MINT_TRANSFER_IN_FAILED,\\n MINT_TRANSFER_IN_NOT_POSSIBLE,\\n REDEEM_ACCRUE_INTEREST_FAILED,\\n REDEEM_COMPTROLLER_REJECTION,\\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\\n REDEEM_EXCHANGE_RATE_READ_FAILED,\\n REDEEM_FRESHNESS_CHECK,\\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\\n REDUCE_RESERVES_ADMIN_CHECK,\\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\\n REDUCE_RESERVES_FRESH_CHECK,\\n REDUCE_RESERVES_VALIDATION,\\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_COMPTROLLER_REJECTION,\\n REPAY_BORROW_FRESHNESS_CHECK,\\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\\n SET_COLLATERAL_FACTOR_VALIDATION,\\n SET_COMPTROLLER_OWNER_CHECK,\\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\\n SET_MAX_ASSETS_OWNER_CHECK,\\n SET_ORACLE_MARKET_NOT_LISTED,\\n SET_PENDING_ADMIN_OWNER_CHECK,\\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\\n SET_RESERVE_FACTOR_ADMIN_CHECK,\\n SET_RESERVE_FACTOR_FRESH_CHECK,\\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\\n TRANSFER_COMPTROLLER_REJECTION,\\n TRANSFER_NOT_ALLOWED,\\n TRANSFER_NOT_ENOUGH,\\n TRANSFER_TOO_MUCH,\\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\\n ADD_RESERVES_FRESH_CHECK,\\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE,\\n TOKEN_GET_UNDERLYING_PRICE_ERROR,\\n REPAY_VAI_COMPTROLLER_REJECTION,\\n REPAY_VAI_FRESHNESS_CHECK,\\n VAI_MINT_EXCHANGE_CALCULATION_FAILED,\\n SFT_MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED\\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\\ncontract VAIControllerErrorReporter {\\n enum Error {\\n NO_ERROR,\\n UNAUTHORIZED, // The sender is not authorized to perform this action.\\n REJECTION, // The action would violate the comptroller, vaicontroller policy.\\n SNAPSHOT_ERROR, // The comptroller could not get the account borrows and exchange rate from the market.\\n PRICE_ERROR, // The comptroller could not obtain a required price of an asset.\\n MATH_ERROR, // A math calculation error occurred.\\n INSUFFICIENT_BALANCE_FOR_VAI // Caller does not have sufficient balance to mint VAI.\\n }\\n\\n enum FailureInfo {\\n SET_PENDING_ADMIN_OWNER_CHECK,\\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\\n SET_COMPTROLLER_OWNER_CHECK,\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\\n VAI_MINT_REJECTION,\\n VAI_BURN_REJECTION,\\n VAI_LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\\n VAI_LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\\n VAI_LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\\n VAI_LIQUIDATE_COMPTROLLER_REJECTION,\\n VAI_LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\\n VAI_LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\\n VAI_LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\\n VAI_LIQUIDATE_FRESHNESS_CHECK,\\n VAI_LIQUIDATE_LIQUIDATOR_IS_BORROWER,\\n VAI_LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\\n VAI_LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\\n VAI_LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\\n VAI_LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\\n VAI_LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\\n VAI_LIQUIDATE_SEIZE_TOO_MUCH,\\n MINT_FEE_CALCULATION_FAILED,\\n SET_TREASURY_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\",\"keccak256\":\"0x4f5a41ef380336395706659e2b8f315870dcf3d617ea6f81104424500b15b1ef\"},\"contracts/Utils/Exponential.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"./CarefulMath.sol\\\";\\nimport \\\"./ExponentialNoError.sol\\\";\\n\\n/**\\n * @title Exponential module for storing fixed-precision decimals\\n * @author Venus\\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\\n * `Exp({mantissa: 5100000000000000000})`.\\n */\\ncontract Exponential is CarefulMath, ExponentialNoError {\\n /**\\n * @dev Creates an exponential from numerator and denominator values.\\n * Note: Returns an error if (`num` * 10e18) > MAX_INT,\\n * or if `denom` is zero.\\n */\\n function getExp(uint num, uint denom) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint scaledNumerator) = mulUInt(num, expScale);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n (MathError err1, uint rational) = divUInt(scaledNumerator, denom);\\n if (err1 != MathError.NO_ERROR) {\\n return (err1, Exp({ mantissa: 0 }));\\n }\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: rational }));\\n }\\n\\n /**\\n * @dev Adds two exponentials, returning a new exponential.\\n */\\n function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n (MathError error, uint result) = addUInt(a.mantissa, b.mantissa);\\n\\n return (error, Exp({ mantissa: result }));\\n }\\n\\n /**\\n * @dev Subtracts two exponentials, returning a new exponential.\\n */\\n function subExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n (MathError error, uint result) = subUInt(a.mantissa, b.mantissa);\\n\\n return (error, Exp({ mantissa: result }));\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, returning a new Exp.\\n */\\n function mulScalar(Exp memory a, uint scalar) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint scaledMantissa) = mulUInt(a.mantissa, scalar);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: scaledMantissa }));\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\\n */\\n function mulScalarTruncate(Exp memory a, uint scalar) internal pure returns (MathError, uint) {\\n (MathError err, Exp memory product) = mulScalar(a, scalar);\\n if (err != MathError.NO_ERROR) {\\n return (err, 0);\\n }\\n\\n return (MathError.NO_ERROR, truncate(product));\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\\n */\\n function mulScalarTruncateAddUInt(Exp memory a, uint scalar, uint addend) internal pure returns (MathError, uint) {\\n (MathError err, Exp memory product) = mulScalar(a, scalar);\\n if (err != MathError.NO_ERROR) {\\n return (err, 0);\\n }\\n\\n return addUInt(truncate(product), addend);\\n }\\n\\n /**\\n * @dev Divide an Exp by a scalar, returning a new Exp.\\n */\\n function divScalar(Exp memory a, uint scalar) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint descaledMantissa) = divUInt(a.mantissa, scalar);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: descaledMantissa }));\\n }\\n\\n /**\\n * @dev Divide a scalar by an Exp, returning a new Exp.\\n */\\n function divScalarByExp(uint scalar, Exp memory divisor) internal pure returns (MathError, Exp memory) {\\n /*\\n We are doing this as:\\n getExp(mulUInt(expScale, scalar), divisor.mantissa)\\n\\n How it works:\\n Exp = a / b;\\n Scalar = s;\\n `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale`\\n */\\n (MathError err0, uint numerator) = mulUInt(expScale, scalar);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n return getExp(numerator, divisor.mantissa);\\n }\\n\\n /**\\n * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer.\\n */\\n function divScalarByExpTruncate(uint scalar, Exp memory divisor) internal pure returns (MathError, uint) {\\n (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);\\n if (err != MathError.NO_ERROR) {\\n return (err, 0);\\n }\\n\\n return (MathError.NO_ERROR, truncate(fraction));\\n }\\n\\n /**\\n * @dev Multiplies two exponentials, returning a new exponential.\\n */\\n function mulExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n // We add half the scale before dividing so that we get rounding instead of truncation.\\n // See \\\"Listing 6\\\" and text above it at https://accu.org/index.php/journals/1717\\n // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.\\n (MathError err1, uint doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct);\\n if (err1 != MathError.NO_ERROR) {\\n return (err1, Exp({ mantissa: 0 }));\\n }\\n\\n (MathError err2, uint product) = divUInt(doubleScaledProductWithHalfScale, expScale);\\n // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero.\\n assert(err2 == MathError.NO_ERROR);\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: product }));\\n }\\n\\n /**\\n * @dev Multiplies two exponentials given their mantissas, returning a new exponential.\\n */\\n function mulExp(uint a, uint b) internal pure returns (MathError, Exp memory) {\\n return mulExp(Exp({ mantissa: a }), Exp({ mantissa: b }));\\n }\\n\\n /**\\n * @dev Multiplies three exponentials, returning a new exponential.\\n */\\n function mulExp3(Exp memory a, Exp memory b, Exp memory c) internal pure returns (MathError, Exp memory) {\\n (MathError err, Exp memory ab) = mulExp(a, b);\\n if (err != MathError.NO_ERROR) {\\n return (err, ab);\\n }\\n return mulExp(ab, c);\\n }\\n\\n /**\\n * @dev Divides two exponentials, returning a new exponential.\\n * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,\\n * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)\\n */\\n function divExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n return getExp(a.mantissa, b.mantissa);\\n }\\n}\\n\",\"keccak256\":\"0x92a68e9f6de3a70b103aa0ddb68faa8e60c443b1268e03853d5054171fe8e290\"},\"contracts/Utils/ExponentialNoError.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\n/**\\n * @title Exponential module for storing fixed-precision decimals\\n * @author Compound\\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\\n * `Exp({mantissa: 5100000000000000000})`.\\n */\\ncontract ExponentialNoError {\\n uint internal constant expScale = 1e18;\\n uint internal constant doubleScale = 1e36;\\n uint internal constant halfExpScale = expScale / 2;\\n uint internal constant mantissaOne = expScale;\\n\\n struct Exp {\\n uint mantissa;\\n }\\n\\n struct Double {\\n uint mantissa;\\n }\\n\\n /**\\n * @dev Truncates the given exp to a whole number value.\\n * For example, truncate(Exp{mantissa: 15 * expScale}) = 15\\n */\\n function truncate(Exp memory exp) internal pure returns (uint) {\\n // Note: We are not using careful math here as we're performing a division that cannot fail\\n return exp.mantissa / expScale;\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\\n */\\n function mul_ScalarTruncate(Exp memory a, uint scalar) internal pure returns (uint) {\\n Exp memory product = mul_(a, scalar);\\n return truncate(product);\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\\n */\\n function mul_ScalarTruncateAddUInt(Exp memory a, uint scalar, uint addend) internal pure returns (uint) {\\n Exp memory product = mul_(a, scalar);\\n return add_(truncate(product), addend);\\n }\\n\\n /**\\n * @dev Checks if first Exp is less than second Exp.\\n */\\n function lessThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\n return left.mantissa < right.mantissa;\\n }\\n\\n /**\\n * @dev Checks if left Exp <= right Exp.\\n */\\n function lessThanOrEqualExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\n return left.mantissa <= right.mantissa;\\n }\\n\\n /**\\n * @dev Checks if left Exp > right Exp.\\n */\\n function greaterThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\n return left.mantissa > right.mantissa;\\n }\\n\\n /**\\n * @dev returns true if Exp is exactly zero\\n */\\n function isZeroExp(Exp memory value) internal pure returns (bool) {\\n return value.mantissa == 0;\\n }\\n\\n function safe224(uint n, string memory errorMessage) internal pure returns (uint224) {\\n require(n < 2 ** 224, errorMessage);\\n return uint224(n);\\n }\\n\\n function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {\\n require(n < 2 ** 32, errorMessage);\\n return uint32(n);\\n }\\n\\n function add_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: add_(a.mantissa, b.mantissa) });\\n }\\n\\n function add_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: add_(a.mantissa, b.mantissa) });\\n }\\n\\n function add_(uint a, uint b) internal pure returns (uint) {\\n return add_(a, b, \\\"addition overflow\\\");\\n }\\n\\n function add_(uint a, uint b, string memory errorMessage) internal pure returns (uint) {\\n uint c = a + b;\\n require(c >= a, errorMessage);\\n return c;\\n }\\n\\n function sub_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: sub_(a.mantissa, b.mantissa) });\\n }\\n\\n function sub_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: sub_(a.mantissa, b.mantissa) });\\n }\\n\\n function sub_(uint a, uint b) internal pure returns (uint) {\\n return sub_(a, b, \\\"subtraction underflow\\\");\\n }\\n\\n function sub_(uint a, uint b, string memory errorMessage) internal pure returns (uint) {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n\\n function mul_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: mul_(a.mantissa, b.mantissa) / expScale });\\n }\\n\\n function mul_(Exp memory a, uint b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: mul_(a.mantissa, b) });\\n }\\n\\n function mul_(uint a, Exp memory b) internal pure returns (uint) {\\n return mul_(a, b.mantissa) / expScale;\\n }\\n\\n function mul_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: mul_(a.mantissa, b.mantissa) / doubleScale });\\n }\\n\\n function mul_(Double memory a, uint b) internal pure returns (Double memory) {\\n return Double({ mantissa: mul_(a.mantissa, b) });\\n }\\n\\n function mul_(uint a, Double memory b) internal pure returns (uint) {\\n return mul_(a, b.mantissa) / doubleScale;\\n }\\n\\n function mul_(uint a, uint b) internal pure returns (uint) {\\n return mul_(a, b, \\\"multiplication overflow\\\");\\n }\\n\\n function mul_(uint a, uint b, string memory errorMessage) internal pure returns (uint) {\\n if (a == 0 || b == 0) {\\n return 0;\\n }\\n uint c = a * b;\\n require(c / a == b, errorMessage);\\n return c;\\n }\\n\\n function div_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: div_(mul_(a.mantissa, expScale), b.mantissa) });\\n }\\n\\n function div_(Exp memory a, uint b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: div_(a.mantissa, b) });\\n }\\n\\n function div_(uint a, Exp memory b) internal pure returns (uint) {\\n return div_(mul_(a, expScale), b.mantissa);\\n }\\n\\n function div_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa) });\\n }\\n\\n function div_(Double memory a, uint b) internal pure returns (Double memory) {\\n return Double({ mantissa: div_(a.mantissa, b) });\\n }\\n\\n function div_(uint a, Double memory b) internal pure returns (uint) {\\n return div_(mul_(a, doubleScale), b.mantissa);\\n }\\n\\n function div_(uint a, uint b) internal pure returns (uint) {\\n return div_(a, b, \\\"divide by zero\\\");\\n }\\n\\n function div_(uint a, uint b, string memory errorMessage) internal pure returns (uint) {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n\\n function fraction(uint a, uint b) internal pure returns (Double memory) {\\n return Double({ mantissa: div_(mul_(a, doubleScale), b) });\\n }\\n}\\n\",\"keccak256\":\"0x237e63d9ad2bf232d70f854b8867a465913cab4d2033d295ec7736bf618ca302\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620026af380380620026af83398181016040526101408110156200003857600080fd5b81516020830151604080850151606086015160808701805193519597949692959194919392820192846401000000008211156200007457600080fd5b9083019060208201858111156200008a57600080fd5b8251640100000000811182820188101715620000a557600080fd5b82525081516020918201929091019080838360005b83811015620000d4578181015183820152602001620000ba565b50505050905090810190601f168015620001025780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200012657600080fd5b9083019060208201858111156200013c57600080fd5b82516401000000008111828201881017156200015757600080fd5b82525081516020918201929091019080838360005b83811015620001865781810151838201526020016200016c565b50505050905090810190601f168015620001b45780820380516001836020036101000a031916815260200191505b50604081815260208301519083015160608401516080909401805192969195919284640100000000821115620001e957600080fd5b908301906020820185811115620001ff57600080fd5b82516401000000008111828201881017156200021a57600080fd5b82525081516020918201929091019080838360005b83811015620002495781810151838201526020016200022f565b50505050905090810190601f168015620002775780820380516001836020036101000a031916815260200191505b5060405250505033600360016101000a8154816001600160a01b0302191690836001600160a01b0316021790555062000424828b8b8b8b8b8b8b60405160240180886001600160a01b03166001600160a01b03168152602001876001600160a01b03166001600160a01b03168152602001866001600160a01b03166001600160a01b0316815260200185815260200180602001806020018460ff1660ff168152602001838103835286818151815260200191508051906020019080838360005b838110156200035157818101518382015260200162000337565b50505050905090810190601f1680156200037f5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015620003b45781810151838201526020016200039a565b50505050905090810190601f168015620003e25780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03908116631a31d46560e01b17909152909a50620004721698505050505050505050565b506200043c826000836001600160e01b036200053916565b5050600380546001600160a01b0390921661010002610100600160a81b0319909216919091179055506200071a95505050505050565b606060006060846001600160a01b0316846040518082805190602001908083835b60208310620004b45780518252601f19909201916020918201910162000493565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811462000516576040519150601f19603f3d011682016040523d82523d6000602084013e6200051b565b606091505b5091509150600082141562000531573d60208201fd5b949350505050565b60035461010090046001600160a01b03163314620005895760405162461bcd60e51b8152600401808060200182810382526039815260200180620026766039913960400191505060405180910390fd5b8115620005cb576040805160048152602481019091526020810180516001600160e01b0390811663153ab50560e01b17909152620005c99190620006f016565b505b601280546001600160a01b038581166001600160a01b03198316179092556040516020602482018181528551604484015285519490931693620006a1938693909283926064909201919085019080838360005b83811015620006385781810151838201526020016200061e565b50505050905090810190601f168015620006665780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03908116630adccee560e31b17909152909350620006f016915050565b50601254604080516001600160a01b038085168252909216602083015280517fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a9281900390910190a150505050565b60125460609062000714906001600160a01b0316836001600160e01b036200047216565b92915050565b611f4c806200072a6000396000f3fe6080604052600436106103505760003560e01c806373acee98116101c6578063bd6d894d116100f7578063e9c714f211610095578063f5e3c4621161006f578063f5e3c46214610db4578063f851a44014610df7578063f8f9da2814610e0c578063fca7820b14610e2157610350565b8063e9c714f214610d57578063f2b3abbd14610d6c578063f3fdb15a14610d9f57610350565b8063d1109c2f116100d1578063d1109c2f14610cc8578063db006a7514610cdd578063dd62ed3e14610d07578063e9a44fd914610d4257610350565b8063bd6d894d14610c30578063c37f68e214610c45578063c5ebeaec14610c9e57610350565b8063a9059cbb11610164578063ae9d70b01161013e578063ae9d70b014610b90578063b2a02ff114610ba5578063b4a0bdf314610be8578063b71d1a0c14610bfd57610350565b8063a9059cbb14610b2d578063aa5af0fd14610b66578063ae96f14114610b7b57610350565b806395d89b41116101a057806395d89b4114610aa657806395dd919314610abb578063a0712d6814610aee578063a6afed9514610b1857610350565b806373acee9814610a52578063852a12e314610a675780638f840ddd14610a9157610350565b80633af9e669116102a0578063555bcc401161023e578063601a0bf111610218578063601a0bf1146109cb5780636c540baf146109f55780636f307dc314610a0a57806370a0823114610a1f57610350565b8063555bcc40146108d75780635c60da1b146109a15780635fe3b567146109b657610350565b80633e9410101161027a5780633e941010146107b45780634487152f146107de5780634576b5db1461088f57806347bd3718146108c257610350565b80633af9e669146107575780633b1d21a21461078a5780633d9ea3a11461079f57610350565b806318160ddd1161030d57806323b872dd116102e757806323b872dd1461067f5780632608f818146106c257806326782247146106fb578063313ce5671461072c57610350565b806318160ddd1461061c578063182df0f51461063157806323323e031461064657610350565b806306fdde03146104105780630933c1ed1461049a578063095ea7b31461054b5780630e75270214610598578063173b9904146105d457806317bfdfbc146105e9575b341561038d5760405162461bcd60e51b8152600401808060200182810382526037815260200180611ee16037913960400191505060405180910390fd5b6012546040516000916001600160a01b031690829036908083838082843760405192019450600093509091505080830381855af49150503d80600081146103f0576040519150601f19603f3d011682016040523d82523d6000602084013e6103f5565b606091505b505090506040513d6000823e81801561040c573d82f35b3d82fd5b34801561041c57600080fd5b50610425610e4b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561045f578181015183820152602001610447565b50505050905090810190601f16801561048c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104a657600080fd5b50610425600480360360208110156104bd57600080fd5b810190602081018135600160201b8111156104d757600080fd5b8201836020820111156104e957600080fd5b803590602001918460018302840111600160201b8311171561050a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610ed8945050505050565b34801561055757600080fd5b506105846004803603604081101561056e57600080fd5b506001600160a01b038135169060200135610ef7565b604080519115158252519081900360200190f35b3480156105a457600080fd5b506105c2600480360360208110156105bb57600080fd5b5035610f6e565b60408051918252519081900360200190f35b3480156105e057600080fd5b506105c2610fd5565b3480156105f557600080fd5b506105c26004803603602081101561060c57600080fd5b50356001600160a01b0316610fdb565b34801561062857600080fd5b506105c261102d565b34801561063d57600080fd5b506105c2611033565b34801561065257600080fd5b506105c26004803603604081101561066957600080fd5b506001600160a01b03813516906020013561108a565b34801561068b57600080fd5b50610584600480360360608110156106a257600080fd5b506001600160a01b038135811691602081013590911690604001356110e0565b3480156106ce57600080fd5b506105c2600480360360408110156106e557600080fd5b506001600160a01b038135169060200135611160565b34801561070757600080fd5b506107106111b6565b604080516001600160a01b039092168252519081900360200190f35b34801561073857600080fd5b506107416111c5565b6040805160ff9092168252519081900360200190f35b34801561076357600080fd5b506105c26004803603602081101561077a57600080fd5b50356001600160a01b03166111ce565b34801561079657600080fd5b506105c2611220565b3480156107ab57600080fd5b50610584611258565b3480156107c057600080fd5b506105c2600480360360208110156107d757600080fd5b503561125d565b3480156107ea57600080fd5b506104256004803603602081101561080157600080fd5b810190602081018135600160201b81111561081b57600080fd5b82018360208201111561082d57600080fd5b803590602001918460018302840111600160201b8311171561084e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506112a4945050505050565b34801561089b57600080fd5b506105c2600480360360208110156108b257600080fd5b50356001600160a01b03166114c3565b3480156108ce57600080fd5b506105c2611515565b3480156108e357600080fd5b5061099f600480360360608110156108fa57600080fd5b6001600160a01b03823516916020810135151591810190606081016040820135600160201b81111561092b57600080fd5b82018360208201111561093d57600080fd5b803590602001918460018302840111600160201b8311171561095e57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061151b945050505050565b005b3480156109ad57600080fd5b506107106116be565b3480156109c257600080fd5b506107106116cd565b3480156109d757600080fd5b506105c2600480360360208110156109ee57600080fd5b50356116dc565b348015610a0157600080fd5b506105c2611723565b348015610a1657600080fd5b50610710611729565b348015610a2b57600080fd5b506105c260048036036020811015610a4257600080fd5b50356001600160a01b0316611738565b348015610a5e57600080fd5b506105c261178a565b348015610a7357600080fd5b506105c260048036036020811015610a8a57600080fd5b50356117c2565b348015610a9d57600080fd5b506105c2611809565b348015610ab257600080fd5b5061042561180f565b348015610ac757600080fd5b506105c260048036036020811015610ade57600080fd5b50356001600160a01b0316611867565b348015610afa57600080fd5b506105c260048036036020811015610b1157600080fd5b50356118b9565b348015610b2457600080fd5b506105c2611900565b348015610b3957600080fd5b5061058460048036036040811015610b5057600080fd5b506001600160a01b038135169060200135611938565b348015610b7257600080fd5b506105c261198e565b348015610b8757600080fd5b506105c2611994565b348015610b9c57600080fd5b506105c261199a565b348015610bb157600080fd5b506105c260048036036060811015610bc857600080fd5b506001600160a01b038135811691602081013590911690604001356119d2565b348015610bf457600080fd5b50610710611a30565b348015610c0957600080fd5b506105c260048036036020811015610c2057600080fd5b50356001600160a01b0316611a3f565b348015610c3c57600080fd5b506105c2611a91565b348015610c5157600080fd5b50610c7860048036036020811015610c6857600080fd5b50356001600160a01b0316611ac9565b604080519485526020850193909352838301919091526060830152519081900360800190f35b348015610caa57600080fd5b506105c260048036036020811015610cc157600080fd5b5035611b5b565b348015610cd457600080fd5b506105c2611ba2565b348015610ce957600080fd5b506105c260048036036020811015610d0057600080fd5b5035611ba8565b348015610d1357600080fd5b506105c260048036036040811015610d2a57600080fd5b506001600160a01b0381358116916020013516611bef565b348015610d4e57600080fd5b50610710611c49565b348015610d6357600080fd5b506105c2611c58565b348015610d7857600080fd5b506105c260048036036020811015610d8f57600080fd5b50356001600160a01b0316611c90565b348015610dab57600080fd5b50610710611ce2565b348015610dc057600080fd5b506105c260048036036060811015610dd757600080fd5b506001600160a01b03813581169160208101359160409091013516611cf1565b348015610e0357600080fd5b50610710611d52565b348015610e1857600080fd5b506105c2611d66565b348015610e2d57600080fd5b506105c260048036036020811015610e4457600080fd5b5035611d9e565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610ed05780601f10610ea557610100808354040283529160200191610ed0565b820191906000526020600020905b815481529060010190602001808311610eb357829003601f168201915b505050505081565b601254606090610ef1906001600160a01b031683611de5565b92915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052600090606090610f4d90610ed8565b9050808060200190516020811015610f6457600080fd5b5051949350505050565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663073a938160e11b179052600090606090610fb590610ed8565b9050808060200190516020811015610fcc57600080fd5b50519392505050565b60085481565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166305eff7ef60e21b179052600090606090610fb590610ed8565b600d5481565b6040805160048152602481019091526020810180516001600160e01b031663182df0f560e01b17905260009060609061106b906112a4565b905080806020019051602081101561108257600080fd5b505191505090565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b03166323323e0360e01b179052600090606090610f4d90610ed8565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905260009060609061113e90610ed8565b905080806020019051602081101561115557600080fd5b505195945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b03166304c11f0360e31b179052600090606090610f4d90610ed8565b6004546001600160a01b031681565b60035460ff1681565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316633af9e66960e01b179052600090606090610fb590610ed8565b6040805160048152602481019091526020810180516001600160e01b0316631d8e90d160e11b17905260009060609061106b906112a4565b600181565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b03166303e9410160e41b179052600090606090610fb590610ed8565b606060006060306001600160a01b0316846040516024018080602001828103825283818151815260200191508051906020019080838360005b838110156112f55781810151838201526020016112dd565b50505050905090810190601f1680156113225780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b0316630933c1ed60e01b178152905182519295509350839250908083835b6020831061137d5780518252601f19909201916020918201910161135e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d80600081146113dd576040519150601f19603f3d011682016040523d82523d6000602084013e6113e2565b606091505b509150915060008214156113f7573d60208201fd5b80806020019051602081101561140c57600080fd5b8101908080516040519392919084600160201b82111561142b57600080fd5b90830190602082018581111561144057600080fd5b8251600160201b81118282018810171561145957600080fd5b82525081516020918201929091019080838360005b8381101561148657818101518382015260200161146e565b50505050905090810190601f1680156114b35780820380516001836020036101000a031916815260200191505b5060405250505092505050919050565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316634576b5db60e01b179052600090606090610fb590610ed8565b600b5481565b60035461010090046001600160a01b031633146115695760405162461bcd60e51b8152600401808060200182810382526039815260200180611ea86039913960400191505060405180910390fd5b81156115a3576040805160048152602481019091526020810180516001600160e01b031663153ab50560e01b1790526115a190610ed8565b505b601280546001600160a01b038581166001600160a01b0319831617909255604051602060248201818152855160448401528551949093169361166f938693909283926064909201919085019080838360005b8381101561160d5781810151838201526020016115f5565b50505050905090810190601f16801561163a5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b0316630adccee560e31b1790529250610ed8915050565b50601254604080516001600160a01b038085168252909216602083015280517fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a9281900390910190a150505050565b6012546001600160a01b031681565b6005546001600160a01b031681565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663601a0bf160e01b179052600090606090610fb590610ed8565b60095481565b6011546001600160a01b031681565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166370a0823160e01b179052600090606090610fb5906112a4565b6040805160048152602481019091526020810180516001600160e01b0316630e759dd360e31b17905260009060609061106b90610ed8565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663852a12e360e01b179052600090606090610fb590610ed8565b600c5481565b6002805460408051602060018416156101000260001901909316849004601f81018490048402820184019092528181529291830182828015610ed05780601f10610ea557610100808354040283529160200191610ed0565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166395dd919360e01b179052600090606090610fb5906112a4565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663140e25ad60e31b179052600090606090610fb590610ed8565b6040805160048152602481019091526020810180516001600160e01b031663a6afed9560e01b17905260009060609061106b90610ed8565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052600090606090610f4d90610ed8565b600a5481565b60145481565b6040805160048152602481019091526020810180516001600160e01b0316630ae9d70b60e41b17905260009060609061106b906112a4565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b031663b2a02ff160e01b17905260009060609061113e90610ed8565b6016546001600160a01b031681565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316632dc7468360e21b179052600090606090610fb590610ed8565b6040805160048152602481019091526020810180516001600160e01b031663bd6d894d60e01b17905260009060609061106b90610ed8565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166361bfb47160e11b179052600090819081908190606090611b21906112a4565b9050808060200190516080811015611b3857600080fd5b508051602082015160408301516060909301519199909850919650945092505050565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663317afabb60e21b179052600090606090610fb590610ed8565b60135481565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663db006a7560e01b179052600090606090610fb590610ed8565b604080516001600160a01b03808516602483015283166044808301919091528251808303909101815260649091019091526020810180516001600160e01b0316636eb1769f60e11b179052600090606090610f4d906112a4565b6015546001600160a01b031681565b6040805160048152602481019091526020810180516001600160e01b03166374e38a7960e11b17905260009060609061106b90610ed8565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b031663f2b3abbd60e01b179052600090606090610fb590610ed8565b6006546001600160a01b031681565b604080516001600160a01b0380861660248301526044820185905283166064808301919091528251808303909101815260849091019091526020810180516001600160e01b0316637af1e23160e11b17905260009060609061113e90610ed8565b60035461010090046001600160a01b031681565b6040805160048152602481019091526020810180516001600160e01b0316631f1f3b4560e31b17905260009060609061106b906112a4565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663fca7820b60e01b179052600090606090610fb590610ed8565b606060006060846001600160a01b0316846040518082805190602001908083835b60208310611e255780518252601f199092019160209182019101611e06565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114611e85576040519150601f19603f3d011682016040523d82523d6000602084013e611e8a565b606091505b50915091506000821415611e9f573d60208201fd5b94935050505056fe56426570323044656c656761746f723a3a5f736574496d706c656d656e746174696f6e3a2043616c6c6572206d7573742062652061646d696e56426570323044656c656761746f723a66616c6c6261636b3a2063616e6e6f742073656e642076616c756520746f2066616c6c6261636ba265627a7a72315820313cbbc168c63eea8616b08cf5101539115d66fbf45db7e777f5526a7041422464736f6c6343000510003256426570323044656c656761746f723a3a5f736574496d706c656d656e746174696f6e3a2043616c6c6572206d7573742062652061646d696e", + "deployedBytecode": "0x6080604052600436106103505760003560e01c806373acee98116101c6578063bd6d894d116100f7578063e9c714f211610095578063f5e3c4621161006f578063f5e3c46214610db4578063f851a44014610df7578063f8f9da2814610e0c578063fca7820b14610e2157610350565b8063e9c714f214610d57578063f2b3abbd14610d6c578063f3fdb15a14610d9f57610350565b8063d1109c2f116100d1578063d1109c2f14610cc8578063db006a7514610cdd578063dd62ed3e14610d07578063e9a44fd914610d4257610350565b8063bd6d894d14610c30578063c37f68e214610c45578063c5ebeaec14610c9e57610350565b8063a9059cbb11610164578063ae9d70b01161013e578063ae9d70b014610b90578063b2a02ff114610ba5578063b4a0bdf314610be8578063b71d1a0c14610bfd57610350565b8063a9059cbb14610b2d578063aa5af0fd14610b66578063ae96f14114610b7b57610350565b806395d89b41116101a057806395d89b4114610aa657806395dd919314610abb578063a0712d6814610aee578063a6afed9514610b1857610350565b806373acee9814610a52578063852a12e314610a675780638f840ddd14610a9157610350565b80633af9e669116102a0578063555bcc401161023e578063601a0bf111610218578063601a0bf1146109cb5780636c540baf146109f55780636f307dc314610a0a57806370a0823114610a1f57610350565b8063555bcc40146108d75780635c60da1b146109a15780635fe3b567146109b657610350565b80633e9410101161027a5780633e941010146107b45780634487152f146107de5780634576b5db1461088f57806347bd3718146108c257610350565b80633af9e669146107575780633b1d21a21461078a5780633d9ea3a11461079f57610350565b806318160ddd1161030d57806323b872dd116102e757806323b872dd1461067f5780632608f818146106c257806326782247146106fb578063313ce5671461072c57610350565b806318160ddd1461061c578063182df0f51461063157806323323e031461064657610350565b806306fdde03146104105780630933c1ed1461049a578063095ea7b31461054b5780630e75270214610598578063173b9904146105d457806317bfdfbc146105e9575b341561038d5760405162461bcd60e51b8152600401808060200182810382526037815260200180611ee16037913960400191505060405180910390fd5b6012546040516000916001600160a01b031690829036908083838082843760405192019450600093509091505080830381855af49150503d80600081146103f0576040519150601f19603f3d011682016040523d82523d6000602084013e6103f5565b606091505b505090506040513d6000823e81801561040c573d82f35b3d82fd5b34801561041c57600080fd5b50610425610e4b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561045f578181015183820152602001610447565b50505050905090810190601f16801561048c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104a657600080fd5b50610425600480360360208110156104bd57600080fd5b810190602081018135600160201b8111156104d757600080fd5b8201836020820111156104e957600080fd5b803590602001918460018302840111600160201b8311171561050a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610ed8945050505050565b34801561055757600080fd5b506105846004803603604081101561056e57600080fd5b506001600160a01b038135169060200135610ef7565b604080519115158252519081900360200190f35b3480156105a457600080fd5b506105c2600480360360208110156105bb57600080fd5b5035610f6e565b60408051918252519081900360200190f35b3480156105e057600080fd5b506105c2610fd5565b3480156105f557600080fd5b506105c26004803603602081101561060c57600080fd5b50356001600160a01b0316610fdb565b34801561062857600080fd5b506105c261102d565b34801561063d57600080fd5b506105c2611033565b34801561065257600080fd5b506105c26004803603604081101561066957600080fd5b506001600160a01b03813516906020013561108a565b34801561068b57600080fd5b50610584600480360360608110156106a257600080fd5b506001600160a01b038135811691602081013590911690604001356110e0565b3480156106ce57600080fd5b506105c2600480360360408110156106e557600080fd5b506001600160a01b038135169060200135611160565b34801561070757600080fd5b506107106111b6565b604080516001600160a01b039092168252519081900360200190f35b34801561073857600080fd5b506107416111c5565b6040805160ff9092168252519081900360200190f35b34801561076357600080fd5b506105c26004803603602081101561077a57600080fd5b50356001600160a01b03166111ce565b34801561079657600080fd5b506105c2611220565b3480156107ab57600080fd5b50610584611258565b3480156107c057600080fd5b506105c2600480360360208110156107d757600080fd5b503561125d565b3480156107ea57600080fd5b506104256004803603602081101561080157600080fd5b810190602081018135600160201b81111561081b57600080fd5b82018360208201111561082d57600080fd5b803590602001918460018302840111600160201b8311171561084e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506112a4945050505050565b34801561089b57600080fd5b506105c2600480360360208110156108b257600080fd5b50356001600160a01b03166114c3565b3480156108ce57600080fd5b506105c2611515565b3480156108e357600080fd5b5061099f600480360360608110156108fa57600080fd5b6001600160a01b03823516916020810135151591810190606081016040820135600160201b81111561092b57600080fd5b82018360208201111561093d57600080fd5b803590602001918460018302840111600160201b8311171561095e57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061151b945050505050565b005b3480156109ad57600080fd5b506107106116be565b3480156109c257600080fd5b506107106116cd565b3480156109d757600080fd5b506105c2600480360360208110156109ee57600080fd5b50356116dc565b348015610a0157600080fd5b506105c2611723565b348015610a1657600080fd5b50610710611729565b348015610a2b57600080fd5b506105c260048036036020811015610a4257600080fd5b50356001600160a01b0316611738565b348015610a5e57600080fd5b506105c261178a565b348015610a7357600080fd5b506105c260048036036020811015610a8a57600080fd5b50356117c2565b348015610a9d57600080fd5b506105c2611809565b348015610ab257600080fd5b5061042561180f565b348015610ac757600080fd5b506105c260048036036020811015610ade57600080fd5b50356001600160a01b0316611867565b348015610afa57600080fd5b506105c260048036036020811015610b1157600080fd5b50356118b9565b348015610b2457600080fd5b506105c2611900565b348015610b3957600080fd5b5061058460048036036040811015610b5057600080fd5b506001600160a01b038135169060200135611938565b348015610b7257600080fd5b506105c261198e565b348015610b8757600080fd5b506105c2611994565b348015610b9c57600080fd5b506105c261199a565b348015610bb157600080fd5b506105c260048036036060811015610bc857600080fd5b506001600160a01b038135811691602081013590911690604001356119d2565b348015610bf457600080fd5b50610710611a30565b348015610c0957600080fd5b506105c260048036036020811015610c2057600080fd5b50356001600160a01b0316611a3f565b348015610c3c57600080fd5b506105c2611a91565b348015610c5157600080fd5b50610c7860048036036020811015610c6857600080fd5b50356001600160a01b0316611ac9565b604080519485526020850193909352838301919091526060830152519081900360800190f35b348015610caa57600080fd5b506105c260048036036020811015610cc157600080fd5b5035611b5b565b348015610cd457600080fd5b506105c2611ba2565b348015610ce957600080fd5b506105c260048036036020811015610d0057600080fd5b5035611ba8565b348015610d1357600080fd5b506105c260048036036040811015610d2a57600080fd5b506001600160a01b0381358116916020013516611bef565b348015610d4e57600080fd5b50610710611c49565b348015610d6357600080fd5b506105c2611c58565b348015610d7857600080fd5b506105c260048036036020811015610d8f57600080fd5b50356001600160a01b0316611c90565b348015610dab57600080fd5b50610710611ce2565b348015610dc057600080fd5b506105c260048036036060811015610dd757600080fd5b506001600160a01b03813581169160208101359160409091013516611cf1565b348015610e0357600080fd5b50610710611d52565b348015610e1857600080fd5b506105c2611d66565b348015610e2d57600080fd5b506105c260048036036020811015610e4457600080fd5b5035611d9e565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610ed05780601f10610ea557610100808354040283529160200191610ed0565b820191906000526020600020905b815481529060010190602001808311610eb357829003601f168201915b505050505081565b601254606090610ef1906001600160a01b031683611de5565b92915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052600090606090610f4d90610ed8565b9050808060200190516020811015610f6457600080fd5b5051949350505050565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663073a938160e11b179052600090606090610fb590610ed8565b9050808060200190516020811015610fcc57600080fd5b50519392505050565b60085481565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166305eff7ef60e21b179052600090606090610fb590610ed8565b600d5481565b6040805160048152602481019091526020810180516001600160e01b031663182df0f560e01b17905260009060609061106b906112a4565b905080806020019051602081101561108257600080fd5b505191505090565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b03166323323e0360e01b179052600090606090610f4d90610ed8565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905260009060609061113e90610ed8565b905080806020019051602081101561115557600080fd5b505195945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b03166304c11f0360e31b179052600090606090610f4d90610ed8565b6004546001600160a01b031681565b60035460ff1681565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316633af9e66960e01b179052600090606090610fb590610ed8565b6040805160048152602481019091526020810180516001600160e01b0316631d8e90d160e11b17905260009060609061106b906112a4565b600181565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b03166303e9410160e41b179052600090606090610fb590610ed8565b606060006060306001600160a01b0316846040516024018080602001828103825283818151815260200191508051906020019080838360005b838110156112f55781810151838201526020016112dd565b50505050905090810190601f1680156113225780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b0316630933c1ed60e01b178152905182519295509350839250908083835b6020831061137d5780518252601f19909201916020918201910161135e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d80600081146113dd576040519150601f19603f3d011682016040523d82523d6000602084013e6113e2565b606091505b509150915060008214156113f7573d60208201fd5b80806020019051602081101561140c57600080fd5b8101908080516040519392919084600160201b82111561142b57600080fd5b90830190602082018581111561144057600080fd5b8251600160201b81118282018810171561145957600080fd5b82525081516020918201929091019080838360005b8381101561148657818101518382015260200161146e565b50505050905090810190601f1680156114b35780820380516001836020036101000a031916815260200191505b5060405250505092505050919050565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316634576b5db60e01b179052600090606090610fb590610ed8565b600b5481565b60035461010090046001600160a01b031633146115695760405162461bcd60e51b8152600401808060200182810382526039815260200180611ea86039913960400191505060405180910390fd5b81156115a3576040805160048152602481019091526020810180516001600160e01b031663153ab50560e01b1790526115a190610ed8565b505b601280546001600160a01b038581166001600160a01b0319831617909255604051602060248201818152855160448401528551949093169361166f938693909283926064909201919085019080838360005b8381101561160d5781810151838201526020016115f5565b50505050905090810190601f16801561163a5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b0316630adccee560e31b1790529250610ed8915050565b50601254604080516001600160a01b038085168252909216602083015280517fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a9281900390910190a150505050565b6012546001600160a01b031681565b6005546001600160a01b031681565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663601a0bf160e01b179052600090606090610fb590610ed8565b60095481565b6011546001600160a01b031681565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166370a0823160e01b179052600090606090610fb5906112a4565b6040805160048152602481019091526020810180516001600160e01b0316630e759dd360e31b17905260009060609061106b90610ed8565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663852a12e360e01b179052600090606090610fb590610ed8565b600c5481565b6002805460408051602060018416156101000260001901909316849004601f81018490048402820184019092528181529291830182828015610ed05780601f10610ea557610100808354040283529160200191610ed0565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166395dd919360e01b179052600090606090610fb5906112a4565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663140e25ad60e31b179052600090606090610fb590610ed8565b6040805160048152602481019091526020810180516001600160e01b031663a6afed9560e01b17905260009060609061106b90610ed8565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052600090606090610f4d90610ed8565b600a5481565b60145481565b6040805160048152602481019091526020810180516001600160e01b0316630ae9d70b60e41b17905260009060609061106b906112a4565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b031663b2a02ff160e01b17905260009060609061113e90610ed8565b6016546001600160a01b031681565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316632dc7468360e21b179052600090606090610fb590610ed8565b6040805160048152602481019091526020810180516001600160e01b031663bd6d894d60e01b17905260009060609061106b90610ed8565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166361bfb47160e11b179052600090819081908190606090611b21906112a4565b9050808060200190516080811015611b3857600080fd5b508051602082015160408301516060909301519199909850919650945092505050565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663317afabb60e21b179052600090606090610fb590610ed8565b60135481565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663db006a7560e01b179052600090606090610fb590610ed8565b604080516001600160a01b03808516602483015283166044808301919091528251808303909101815260649091019091526020810180516001600160e01b0316636eb1769f60e11b179052600090606090610f4d906112a4565b6015546001600160a01b031681565b6040805160048152602481019091526020810180516001600160e01b03166374e38a7960e11b17905260009060609061106b90610ed8565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b031663f2b3abbd60e01b179052600090606090610fb590610ed8565b6006546001600160a01b031681565b604080516001600160a01b0380861660248301526044820185905283166064808301919091528251808303909101815260849091019091526020810180516001600160e01b0316637af1e23160e11b17905260009060609061113e90610ed8565b60035461010090046001600160a01b031681565b6040805160048152602481019091526020810180516001600160e01b0316631f1f3b4560e31b17905260009060609061106b906112a4565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663fca7820b60e01b179052600090606090610fb590610ed8565b606060006060846001600160a01b0316846040518082805190602001908083835b60208310611e255780518252601f199092019160209182019101611e06565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114611e85576040519150601f19603f3d011682016040523d82523d6000602084013e611e8a565b606091505b50915091506000821415611e9f573d60208201fd5b94935050505056fe56426570323044656c656761746f723a3a5f736574496d706c656d656e746174696f6e3a2043616c6c6572206d7573742062652061646d696e56426570323044656c656761746f723a66616c6c6261636b3a2063616e6e6f742073656e642076616c756520746f2066616c6c6261636ba265627a7a72315820313cbbc168c63eea8616b08cf5101539115d66fbf45db7e777f5526a7041422464736f6c63430005100032", + "devdoc": { + "author": "Venus", + "methods": { + "_acceptAdmin()": { + "details": "Admin function for pending admin to accept role and update admin", + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "_addReserves(uint256)": { + "params": { + "addAmount": "Amount of reserves to add" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "_reduceReserves(uint256)": { + "params": { + "reduceAmount": "Amount of reduction to reserves" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "_setComptroller(address)": { + "details": "Admin function to set a new comptroller", + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "_setImplementation(address,bool,bytes)": { + "params": { + "allowResign": "Flag to indicate whether to call _resignImplementation on the old implementation", + "becomeImplementationData": "The encoded bytes data to be passed to _becomeImplementation", + "implementation_": "The address of the new implementation for delegation" + } + }, + "_setInterestRateModel(address)": { + "details": "Admin function to accrue interest and update the interest rate model", + "params": { + "newInterestRateModel": "The new interest rate model to use" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "_setPendingAdmin(address)": { + "details": "Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.", + "params": { + "newPendingAdmin": "New pending admin." + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "_setReserveFactor(uint256)": { + "details": "Admin function to accrue interest and set a new reserve factor", + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "accrueInterest()": { + "details": "This calculates interest accrued from the last checkpointed block up to the current block and writes new checkpoint to storage." + }, + "allowance(address,address)": { + "params": { + "owner": "The address of the account which owns the tokens to be spent", + "spender": "The address of the account which may transfer tokens" + }, + "return": "The number of tokens allowed to be spent (-1 means infinite)" + }, + "approve(address,uint256)": { + "details": "This will overwrite the approval amount for `spender` and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)", + "params": { + "amount": "The number of tokens that are approved (-1 means infinite)", + "spender": "The address of the account which may transfer tokens" + }, + "return": "Whether or not the approval succeeded" + }, + "balanceOf(address)": { + "params": { + "owner": "The address of the account to query" + }, + "return": "The number of tokens owned by `owner`" + }, + "balanceOfUnderlying(address)": { + "details": "This also accrues interest in a transaction", + "params": { + "owner": "The address of the account to query" + }, + "return": "The amount of underlying owned by `owner`" + }, + "borrow(uint256)": { + "params": { + "borrowAmount": "The amount of the underlying asset to borrow" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "borrowBalanceCurrent(address)": { + "params": { + "account": "The address whose balance should be calculated after updating borrowIndex" + }, + "return": "The calculated balance" + }, + "borrowBalanceStored(address)": { + "params": { + "account": "The address whose balance should be calculated" + }, + "return": "The calculated balance" + }, + "borrowRatePerBlock()": { + "return": "The borrow interest rate per block, scaled by 1e18" + }, + "constructor": { + "params": { + "admin_": "Address of the administrator of this token", + "becomeImplementationData": "The encoded args for becomeImplementation", + "comptroller_": "The address of the comptroller", + "decimals_": "BEP-20 decimal precision of this token", + "implementation_": "The address of the implementation the contract delegates to", + "initialExchangeRateMantissa_": "The initial exchange rate, scaled by 1e18", + "interestRateModel_": "The address of the interest rate model", + "name_": "BEP-20 name of this token", + "symbol_": "BEP-20 symbol of this token", + "underlying_": "The address of the underlying asset" + } + }, + "delegateToImplementation(bytes)": { + "details": "It returns to the external caller whatever the implementation returns or forwards reverts", + "params": { + "data": "The raw data to delegatecall" + }, + "return": "The returned bytes from the delegatecall" + }, + "delegateToViewImplementation(bytes)": { + "details": "It returns to the external caller whatever the implementation returns or forwards reverts There are an additional 2 prefix uints from the wrapper returndata, which we ignore since we make an extra hop.", + "params": { + "data": "The raw data to delegatecall" + }, + "return": "The returned bytes from the delegatecall" + }, + "exchangeRateCurrent()": { + "return": "Calculated exchange rate scaled by 1e18" + }, + "exchangeRateStored()": { + "details": "This function does not accrue interest before calculating the exchange rate", + "return": "Calculated exchange rate scaled by 1e18" + }, + "getAccountSnapshot(address)": { + "details": "This is used by comptroller to more efficiently perform liquidity checks.", + "params": { + "account": "Address of the account to snapshot" + }, + "return": "(possible error, token balance, borrow balance, exchange rate mantissa)" + }, + "getCash()": { + "return": "The quantity of underlying asset owned by this contract" + }, + "liquidateBorrow(address,uint256,address)": { + "params": { + "borrower": "The borrower of this vToken to be liquidated", + "repayAmount": "The amount of the underlying borrowed asset to repay", + "vTokenCollateral": "The market in which to seize collateral from the borrower" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "mint(uint256)": { + "details": "Accrues interest whether or not the operation succeeds, unless reverted", + "params": { + "mintAmount": "The amount of the underlying asset to supply" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "mintBehalf(address,uint256)": { + "details": "Accrues interest whether or not the operation succeeds, unless reverted", + "params": { + "mintAmount": "The amount of the underlying asset to supply" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "redeem(uint256)": { + "details": "Accrues interest whether or not the operation succeeds, unless reverted", + "params": { + "redeemTokens": "The number of vTokens to redeem into underlying asset" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "redeemUnderlying(uint256)": { + "details": "Accrues interest whether or not the operation succeeds, unless reverted", + "params": { + "redeemAmount": "The amount of underlying to redeem" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "repayBorrow(uint256)": { + "params": { + "repayAmount": "The amount to repay" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "repayBorrowBehalf(address,uint256)": { + "params": { + "borrower": "The account with the debt being payed off", + "repayAmount": "The amount to repay" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "seize(address,address,uint256)": { + "details": "Will fail unless called by another vToken during the process of liquidation. It's absolutely critical to use msg.sender as the borrowed vToken and not a parameter.", + "params": { + "borrower": "The account having collateral seized", + "liquidator": "The account receiving seized collateral", + "seizeTokens": "The number of vTokens to seize" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "supplyRatePerBlock()": { + "return": "The supply interest rate per block, scaled by 1e18" + }, + "totalBorrowsCurrent()": { + "return": "The total borrows with interest" + }, + "transfer(address,uint256)": { + "params": { + "amount": "The number of tokens to transfer", + "dst": "The address of the destination account" + }, + "return": "Whether or not the transfer succeeded" + }, + "transferFrom(address,address,uint256)": { + "params": { + "amount": "The number of tokens to transfer", + "dst": "The address of the destination account", + "src": "The address of the source account" + }, + "return": "Whether or not the transfer succeeded" + } + }, + "title": "Venus's VBep20Delegator Contract" + }, + "userdoc": { + "methods": { + "_acceptAdmin()": { + "notice": "Accepts transfer of admin rights. `msg.sender` must be pendingAdmin" + }, + "_addReserves(uint256)": { + "notice": "Accrues interest and adds reserves by transferring from admin" + }, + "_reduceReserves(uint256)": { + "notice": "Accrues interest and reduces reserves by transferring to admin" + }, + "_setComptroller(address)": { + "notice": "Sets a new comptroller for the market" + }, + "_setImplementation(address,bool,bytes)": { + "notice": "Called by the admin to update the implementation of the delegator" + }, + "_setInterestRateModel(address)": { + "notice": "Accrues interest and updates the interest rate model using `_setInterestRateModelFresh`" + }, + "_setPendingAdmin(address)": { + "notice": "Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer." + }, + "_setReserveFactor(uint256)": { + "notice": "Accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh" + }, + "accrueInterest()": { + "notice": "Applies accrued interest to total borrows and reserves." + }, + "allowance(address,address)": { + "notice": "Get the current allowance from `owner` for `spender`" + }, + "approve(address,uint256)": { + "notice": "Approve `spender` to transfer up to `amount` from `src`" + }, + "balanceOf(address)": { + "notice": "Get the token balance of the `owner`" + }, + "balanceOfUnderlying(address)": { + "notice": "Get the underlying balance of the `owner`" + }, + "borrow(uint256)": { + "notice": "Sender borrows assets from the protocol to their own address" + }, + "borrowBalanceCurrent(address)": { + "notice": "Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex" + }, + "borrowBalanceStored(address)": { + "notice": "Return the borrow balance of account based on stored data" + }, + "borrowRatePerBlock()": { + "notice": "Returns the current per-block borrow interest rate for this vToken" + }, + "constructor": "Construct a new money market", + "delegateToImplementation(bytes)": { + "notice": "Delegates execution to the implementation contract" + }, + "delegateToViewImplementation(bytes)": { + "notice": "Delegates execution to an implementation contract" + }, + "exchangeRateCurrent()": { + "notice": "Accrue interest then return the up-to-date exchange rate" + }, + "exchangeRateStored()": { + "notice": "Calculates the exchange rate from the underlying to the VToken" + }, + "getAccountSnapshot(address)": { + "notice": "Get a snapshot of the account's balances and the cached exchange rate" + }, + "getCash()": { + "notice": "Get cash balance of this vToken in the underlying asset" + }, + "liquidateBorrow(address,uint256,address)": { + "notice": "The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator." + }, + "mint(uint256)": { + "notice": "Sender supplies assets into the market and receives vTokens in exchange" + }, + "mintBehalf(address,uint256)": { + "notice": "Sender supplies assets into the market and receiver receives vTokens in exchange" + }, + "redeem(uint256)": { + "notice": "Sender redeems vTokens in exchange for the underlying asset" + }, + "redeemUnderlying(uint256)": { + "notice": "Sender redeems vTokens in exchange for a specified amount of underlying asset" + }, + "repayBorrow(uint256)": { + "notice": "Sender repays their own borrow" + }, + "repayBorrowBehalf(address,uint256)": { + "notice": "Sender repays a borrow belonging to another borrower" + }, + "seize(address,address,uint256)": { + "notice": "Transfers collateral tokens (this market) to the liquidator." + }, + "supplyRatePerBlock()": { + "notice": "Returns the current per-block supply interest rate for this vToken" + }, + "totalBorrowsCurrent()": { + "notice": "Returns the current total borrows plus accrued interest" + }, + "transfer(address,uint256)": { + "notice": "Transfer `amount` tokens from `msg.sender` to `dst`" + }, + "transferFrom(address,address,uint256)": { + "notice": "Transfer `amount` tokens from `src` to `dst`" + } + }, + "notice": "vTokens which wrap an EIP-20 underlying and delegate to an implementation" + }, + "storageLayout": { + "storage": [ + { + "astId": 23508, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "_notEntered", + "offset": 0, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 23510, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "name", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 23512, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "symbol", + "offset": 0, + "slot": "2", + "type": "t_string_storage" + }, + { + "astId": 23514, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "decimals", + "offset": 0, + "slot": "3", + "type": "t_uint8" + }, + { + "astId": 23522, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "admin", + "offset": 1, + "slot": "3", + "type": "t_address_payable" + }, + { + "astId": 23524, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "pendingAdmin", + "offset": 0, + "slot": "4", + "type": "t_address_payable" + }, + { + "astId": 23526, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "comptroller", + "offset": 0, + "slot": "5", + "type": "t_contract(ComptrollerInterface)2406" + }, + { + "astId": 23528, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "interestRateModel", + "offset": 0, + "slot": "6", + "type": "t_contract(InterestRateModel)9296" + }, + { + "astId": 23530, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "initialExchangeRateMantissa", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 23532, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "reserveFactorMantissa", + "offset": 0, + "slot": "8", + "type": "t_uint256" + }, + { + "astId": 23534, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "accrualBlockNumber", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 23536, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "borrowIndex", + "offset": 0, + "slot": "10", + "type": "t_uint256" + }, + { + "astId": 23538, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "totalBorrows", + "offset": 0, + "slot": "11", + "type": "t_uint256" + }, + { + "astId": 23540, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "totalReserves", + "offset": 0, + "slot": "12", + "type": "t_uint256" + }, + { + "astId": 23542, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "totalSupply", + "offset": 0, + "slot": "13", + "type": "t_uint256" + }, + { + "astId": 23546, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "accountTokens", + "offset": 0, + "slot": "14", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 23552, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "transferAllowances", + "offset": 0, + "slot": "15", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 23556, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "accountBorrows", + "offset": 0, + "slot": "16", + "type": "t_mapping(t_address,t_struct(BorrowSnapshot)23506_storage)" + }, + { + "astId": 23558, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "underlying", + "offset": 0, + "slot": "17", + "type": "t_address" + }, + { + "astId": 23560, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "implementation", + "offset": 0, + "slot": "18", + "type": "t_address" + }, + { + "astId": 23562, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "reduceReservesBlockDelta", + "offset": 0, + "slot": "19", + "type": "t_uint256" + }, + { + "astId": 23564, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "reduceReservesBlockNumber", + "offset": 0, + "slot": "20", + "type": "t_uint256" + }, + { + "astId": 23566, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "protocolShareReserve", + "offset": 0, + "slot": "21", + "type": "t_address_payable" + }, + { + "astId": 23568, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "accessControlManager", + "offset": 0, + "slot": "22", + "type": "t_address" + }, + { + "astId": 23575, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "__gap", + "offset": 0, + "slot": "23", + "type": "t_array(t_uint256)50_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_address_payable": { + "encoding": "inplace", + "label": "address payable", + "numberOfBytes": "20" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(ComptrollerInterface)2406": { + "encoding": "inplace", + "label": "contract ComptrollerInterface", + "numberOfBytes": "20" + }, + "t_contract(InterestRateModel)9296": { + "encoding": "inplace", + "label": "contract InterestRateModel", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_struct(BorrowSnapshot)23506_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct VTokenStorageBase.BorrowSnapshot)", + "numberOfBytes": "32", + "value": "t_struct(BorrowSnapshot)23506_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(BorrowSnapshot)23506_storage": { + "encoding": "inplace", + "label": "struct VTokenStorageBase.BorrowSnapshot", + "members": [ + { + "astId": 23503, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "principal", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 23505, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "interestIndex", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} diff --git a/helpers/deploymentConfig.ts b/helpers/deploymentConfig.ts index 90eec24ef..d806d091d 100644 --- a/helpers/deploymentConfig.ts +++ b/helpers/deploymentConfig.ts @@ -52,7 +52,7 @@ export type NetworkConfig = { }; export const getGlobalConfig: () => Promise = async () => { - const vTreasuryAddress = (await ethers.getContract("VTreasuryV8")).address; + const vTreasuryAddress = (await ethers.getContract("VTreasury")).address; return { hardhat: { tokensConfig: [ @@ -143,6 +143,13 @@ export const getGlobalConfig: () => Promise = async () => { symbol: "FDUSD", decimals: 18, }, + { + isMock: false, + name: "Trust Wallet", + symbol: "TWT", + decimals: 18, + tokenAddress: "0xb99c6b26fdf3678c6e2aff8466e3625a0e7182f8", + }, ], marketsConfig: [ { @@ -162,6 +169,22 @@ export const getGlobalConfig: () => Promise = async () => { borrowCap: convertToUnit(4_400_000, 18), vTokenReceiver: vTreasuryAddress, }, + { + name: "Venus TWT", + asset: "TWT", + symbol: "vTWT", + rateModel: InterestRateModels.JumpRate.toString(), + baseRatePerYear: convertToUnit("0.02", 18), + multiplierPerYear: convertToUnit("0.2", 18), + jumpMultiplierPerYear: convertToUnit("3", 18), + kink_: convertToUnit("0.5", 18), + collateralFactor: convertToUnit("0.5", 18), + reserveFactor: convertToUnit("0.25", 18), + initialSupply: convertToUnit(5_000, 18), + supplyCap: convertToUnit(3_000_000, 18), + borrowCap: convertToUnit(1_000_000, 18), + vTokenReceiver: vTreasuryAddress, + }, ], }, bscmainnet: { diff --git a/yarn.lock b/yarn.lock index d3a92846e..8d06cf8c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3583,24 +3583,6 @@ __metadata: languageName: node linkType: hard -"@venusprotocol/protocol-reserve@npm:^2.3.0": - version: 2.3.0 - resolution: "@venusprotocol/protocol-reserve@npm:2.3.0" - dependencies: - "@nomiclabs/hardhat-ethers": ^2.2.3 - "@openzeppelin/contracts": ^4.8.3 - "@openzeppelin/contracts-upgradeable": ^4.8.3 - "@openzeppelin/hardhat-upgrades": ^1.21.0 - "@solidity-parser/parser": ^0.13.2 - "@venusprotocol/solidity-utilities": ^2.0.3 - "@venusprotocol/venus-protocol": ^9.1.0 - ethers: ^5.7.0 - hardhat-deploy: ^0.11.14 - module-alias: ^2.2.2 - checksum: b9e12702281d0790c0136f922400b5f90ff88d04d2af97580620a2677190c1957a4fdb38ff6600ff5e4f71e4d521c8bb013d7775814a2f68e3883544f38caa95 - languageName: node - linkType: hard - "@venusprotocol/protocol-reserve@npm:^2.4.0": version: 2.4.0 resolution: "@venusprotocol/protocol-reserve@npm:2.4.0" @@ -3633,21 +3615,6 @@ __metadata: languageName: node linkType: hard -"@venusprotocol/token-bridge@npm:^2.2.0": - version: 2.2.0 - resolution: "@venusprotocol/token-bridge@npm:2.2.0" - dependencies: - "@layerzerolabs/solidity-examples": ^1.0.0 - "@openzeppelin/contracts": ^4.8.3 - "@openzeppelin/contracts-upgradeable": ^4.8.3 - "@openzeppelin/hardhat-upgrades": ^1.21.0 - "@solidity-parser/parser": ^0.13.2 - ethers: ^5.7.0 - module-alias: ^2.2.2 - checksum: 86bdefc8853cd334bedbb9d63b4a8d266271dcaa28705fdb6368a66fbc22838e0d1c00cf4b9eb2083c925a6a3e47bbfebd234d660b0660a9b437a52a5f0d7a90 - languageName: node - linkType: hard - "@venusprotocol/token-bridge@npm:^2.3.0": version: 2.3.0 resolution: "@venusprotocol/token-bridge@npm:2.3.0" @@ -3663,25 +3630,7 @@ __metadata: languageName: node linkType: hard -"@venusprotocol/venus-protocol@npm:^9.1.0": - version: 9.2.0 - resolution: "@venusprotocol/venus-protocol@npm:9.2.0" - dependencies: - "@nomicfoundation/hardhat-ethers": ^3.0.0 - "@openzeppelin/contracts": 4.9.3 - "@openzeppelin/contracts-upgradeable": ^4.8.0 - "@venusprotocol/governance-contracts": ^2.3.0 - "@venusprotocol/protocol-reserve": ^2.3.0 - "@venusprotocol/solidity-utilities": ^2.0.3 - "@venusprotocol/token-bridge": ^2.2.0 - bignumber.js: ^9.1.2 - dotenv: ^16.0.1 - module-alias: ^2.2.2 - checksum: 5d0b6a7355c9cd44463fdd982a43828d9129cce5a16430593fbda8dc366226367cc559e87dd10a74605a16cf8919c49b9210d833461582eb32b17e5397b1ebaa - languageName: node - linkType: hard - -"@venusprotocol/venus-protocol@workspace:.": +"@venusprotocol/venus-protocol@^9.1.0, @venusprotocol/venus-protocol@workspace:.": version: 0.0.0-use.local resolution: "@venusprotocol/venus-protocol@workspace:." dependencies: From 0bf8812e232130184608ed8626d9aeb6e60ea36a Mon Sep 17 00:00:00 2001 From: GitGuru7 Date: Wed, 16 Oct 2024 11:32:18 +0000 Subject: [PATCH 2/5] feat: updating deployment files --- deployments/bsctestnet.json | 9849 +++++++++++++++---------- deployments/bsctestnet_addresses.json | 2 + 2 files changed, 5894 insertions(+), 3957 deletions(-) diff --git a/deployments/bsctestnet.json b/deployments/bsctestnet.json index f73c63485..ea7b72100 100644 --- a/deployments/bsctestnet.json +++ b/deployments/bsctestnet.json @@ -1847,6 +1847,257 @@ } ] }, + "JumpRateModel_base200bps_slope2000bps_jump30000bps_kink5000bps": { + "address": "0xF1A8B40CA68d08EFfa31a16a83f4fd9b5c174872", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "baseRatePerYear", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "multiplierPerYear", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "jumpMultiplierPerYear", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink_", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "baseRatePerBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "multiplierPerBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "jumpMultiplierPerBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "kink", + "type": "uint256" + } + ], + "name": "NewInterestParams", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "baseRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "blocksPerYear", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "cash", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrows", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserves", + "type": "uint256" + } + ], + "name": "getBorrowRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "cash", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrows", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveFactorMantissa", + "type": "uint256" + } + ], + "name": "getSupplyRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isInterestRateModel", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "jumpMultiplierPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "kink", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "multiplierPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "cash", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrows", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserves", + "type": "uint256" + } + ], + "name": "utilizationRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ] + }, "LTC": { "address": "0x969F147B6b8D81f86175de33206A4FD43dF17913", "abi": [ @@ -56933,24 +57184,1453 @@ "type": "address" }, { - "internalType": "contract VToken", + "internalType": "contract VToken", + "name": "vTokenCollateral", + "type": "address" + } + ], + "name": "liquidateBorrow", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "mint", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + } + ], + "name": "redeemUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "repayBorrow", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + } + ], + "name": "repayBorrowBehalf", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ] + }, + "vBTC": { + "address": "0xb6e9322C49FD75a367Fcb17B0Fcd62C5070EbCBe", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "cashPrior", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "interestAccumulated", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "info", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "detail", + "type": "uint256" + } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldImplementation", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "NewImplementation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldPendingAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPendingAdmin", + "type": "address" + } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReserveFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "benefactor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "admin", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + } + ], + "name": "_addReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + } + ], + "name": "_reduceReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "_setComptroller", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "_setInterestRateModel", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "newPendingAdmin", + "type": "address" + } + ], + "name": "_setPendingAdmin", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "_setReserveFactor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOfUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "borrowBalanceCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "borrowBalanceStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptroller", + "outputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAccountSnapshot", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [ + { + "internalType": "contract InterestRateModel", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isVToken", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "internalType": "contract VTokenInterface", "name": "vTokenCollateral", "type": "address" } ], "name": "liquidateBorrow", - "outputs": [], - "payable": true, - "stateMutability": "payable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", "type": "function" }, { "constant": false, - "inputs": [], + "inputs": [ + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], "name": "mint", - "outputs": [], - "payable": true, - "stateMutability": "payable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", "type": "function" }, { @@ -57027,11 +58707,23 @@ }, { "constant": false, - "inputs": [], + "inputs": [ + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], "name": "repayBorrow", - "outputs": [], - "payable": true, - "stateMutability": "payable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", "type": "function" }, { @@ -57041,12 +58733,23 @@ "internalType": "address", "name": "borrower", "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" } ], "name": "repayBorrowBehalf", - "outputs": [], - "payable": true, - "stateMutability": "payable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", "type": "function" }, { @@ -57241,66 +58944,25 @@ "payable": false, "stateMutability": "nonpayable", "type": "function" - } - ] - }, - "vBTC": { - "address": "0xb6e9322C49FD75a367Fcb17B0Fcd62C5070EbCBe", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [ { "internalType": "address", - "name": "implementation_", + "name": "", "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" } ], "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, @@ -57473,6 +59135,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -57484,17 +59152,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -57502,18 +59188,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -57522,17 +59208,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -57573,6 +59278,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -57612,11 +59355,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -57685,7 +59459,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -57729,11 +59503,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -57770,12 +59539,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -57791,6 +59575,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -57812,37 +59605,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -57884,7 +59652,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -57900,6 +59668,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -58103,24 +59886,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -58129,18 +59908,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -58150,12 +59929,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -58163,41 +59942,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -58300,6 +60067,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -58382,6 +60234,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -58412,6 +60290,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -58454,6 +60347,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -58547,6 +60470,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -58708,9 +60694,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vBUSD": { + "address": "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -58884,12 +60926,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -58901,35 +60937,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -58937,18 +60955,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -58957,36 +60975,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -59027,44 +61026,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -59104,42 +61065,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -59208,7 +61138,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -59252,6 +61182,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -59288,27 +61223,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -59324,15 +61244,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -59354,12 +61265,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -59401,7 +61337,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -59417,21 +61353,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -59634,32 +61555,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -59720,6 +61615,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -59816,91 +61753,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -59983,32 +61835,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -60039,21 +61865,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -60096,36 +61907,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -60219,69 +62000,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -60443,65 +62161,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vBUSD": { - "address": "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -60675,6 +62337,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -60686,17 +62354,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -60704,18 +62390,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -60724,17 +62410,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -60775,6 +62480,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -60814,11 +62557,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -60887,7 +62661,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -60931,11 +62705,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -60972,12 +62741,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -60993,6 +62777,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -61014,37 +62807,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -61086,7 +62854,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -61102,6 +62870,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -61305,24 +63088,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -61331,18 +63110,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -61352,12 +63131,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -61365,41 +63144,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -61502,6 +63269,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -61584,6 +63436,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -61614,6 +63492,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -61656,6 +63549,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -61749,6 +63672,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -61910,9 +63896,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vETH": { + "address": "0x162D005F0Fff510E54958Cfc5CF32A3180A84aab", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -62086,12 +64128,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -62103,35 +64139,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -62139,18 +64157,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -62159,36 +64177,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -62229,44 +64228,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -62306,42 +64267,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -62410,7 +64340,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -62454,6 +64384,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -62490,27 +64425,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -62526,15 +64446,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -62556,12 +64467,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -62603,7 +64539,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -62619,21 +64555,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -62836,32 +64757,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -62922,6 +64817,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -63018,91 +64955,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -63185,32 +65037,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -63241,21 +65067,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -63298,36 +65109,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -63421,69 +65202,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -63645,65 +65363,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vETH": { - "address": "0x162D005F0Fff510E54958Cfc5CF32A3180A84aab", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -63877,6 +65539,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -63888,17 +65556,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -63906,18 +65592,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -63926,17 +65612,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -63977,6 +65682,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -64016,11 +65759,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -64089,7 +65863,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -64133,11 +65907,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -64174,12 +65943,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -64195,6 +65979,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -64216,37 +66009,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -64288,7 +66056,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -64304,6 +66072,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -64507,24 +66290,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -64533,18 +66312,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -64554,12 +66333,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -64567,41 +66346,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -64704,6 +66471,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -64786,6 +66638,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -64816,6 +66694,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -64858,6 +66751,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -64951,6 +66874,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -65112,9 +67098,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vFDUSD": { + "address": "0xF06e662a00796c122AaAE935EC4F0Be3F74f5636", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -65393,6 +67435,25 @@ "name": "NewComptroller", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldImplementation", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "NewImplementation", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -65656,6 +67717,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -65692,27 +67758,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -65728,15 +67779,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -65758,12 +67800,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -65805,7 +67872,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -66038,32 +68105,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -66124,6 +68165,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -66220,91 +68303,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -66623,69 +68621,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -66847,65 +68782,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vFDUSD": { - "address": "0xF06e662a00796c122AaAE935EC4F0Be3F74f5636", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -67184,25 +69063,6 @@ "name": "NewComptroller", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "oldImplementation", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "NewImplementation", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -67466,11 +69326,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -67507,12 +69362,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -67528,6 +69398,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -67549,37 +69428,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -67621,7 +69475,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -67855,24 +69709,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -67881,18 +69731,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -67902,12 +69752,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -67915,41 +69765,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -68052,6 +69890,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -68226,6 +70149,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeemBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -68247,6 +70196,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + } + ], + "name": "redeemUnderlyingBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -68370,6 +70345,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -68531,9 +70569,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vLTC": { + "address": "0xAfc13BC065ABeE838540823431055D2ea52eBA52", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -68707,12 +70801,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -68724,35 +70812,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -68760,18 +70830,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -68780,36 +70850,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -68850,44 +70901,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -68927,42 +70940,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -69031,7 +71013,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -69075,6 +71057,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -69111,27 +71098,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -69147,15 +71119,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -69177,12 +71140,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -69224,7 +71212,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -69240,21 +71228,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -69457,32 +71430,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -69543,6 +71490,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -69639,91 +71628,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -69806,32 +71710,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -69862,21 +71740,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -69898,32 +71761,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "redeemBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -69945,62 +71782,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "internalType": "uint256", - "name": "redeemAmount", - "type": "uint256" - } - ], - "name": "redeemUnderlyingBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -70094,69 +71875,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -70318,65 +72036,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vLTC": { - "address": "0xAfc13BC065ABeE838540823431055D2ea52eBA52", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -70550,6 +72212,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -70561,17 +72229,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -70579,18 +72265,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -70599,17 +72285,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -70650,6 +72355,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -70689,11 +72432,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -70762,7 +72536,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -70806,11 +72580,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -70847,12 +72616,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -70868,6 +72652,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -70889,37 +72682,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -70961,7 +72729,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -70977,6 +72745,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -71180,24 +72963,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -71206,18 +72985,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -71227,12 +73006,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -71240,41 +73019,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -71377,6 +73144,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -71459,6 +73311,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -71489,6 +73367,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -71531,6 +73424,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -71624,6 +73547,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -71785,9 +73771,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vSXP": { + "address": "0x74469281310195A04840Daf6EdF576F559a3dE80", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -71961,12 +74003,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -71978,35 +74014,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -72014,18 +74032,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -72034,36 +74052,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -72104,44 +74103,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -72181,42 +74142,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -72285,7 +74215,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -72329,6 +74259,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -72365,27 +74300,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -72401,15 +74321,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -72431,12 +74342,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -72478,7 +74414,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -72494,21 +74430,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -72711,32 +74632,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -72797,6 +74692,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -72893,91 +74830,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -73060,32 +74912,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -73116,21 +74942,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -73173,36 +74984,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -73296,69 +75077,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -73520,65 +75238,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vSXP": { - "address": "0x74469281310195A04840Daf6EdF576F559a3dE80", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -73752,6 +75414,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -73763,17 +75431,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -73781,18 +75467,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -73801,17 +75487,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -73852,6 +75557,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -73891,11 +75634,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -73964,7 +75738,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -74008,11 +75782,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -74049,12 +75818,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -74070,6 +75854,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -74091,37 +75884,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -74163,7 +75931,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -74179,6 +75947,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -74382,24 +76165,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -74408,18 +76187,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -74429,12 +76208,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -74442,41 +76221,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -74579,6 +76346,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -74661,6 +76513,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -74691,6 +76569,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -74733,6 +76626,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -74826,6 +76749,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -74987,9 +76973,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vTRX": { + "address": "0x369Fea97f6fB7510755DCA389088d9E2e2819278", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -75163,12 +77205,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -75200,12 +77236,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "MintBehalf", @@ -75217,17 +77247,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAccessControlAddress", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAccessControlAddress", + "name": "newAdmin", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewAdmin", "type": "event" }, { @@ -75235,18 +77265,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAdmin", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAdmin", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAdmin", + "name": "NewComptroller", "type": "event" }, { @@ -75254,18 +77284,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldImplementation", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -75306,44 +77336,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -75383,12 +77375,6 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", @@ -75487,7 +77473,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -75531,6 +77517,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -75567,27 +77558,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -75603,15 +77579,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -75633,12 +77600,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -75680,7 +77672,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -75696,21 +77688,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -75913,32 +77890,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -75999,6 +77950,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -76095,91 +78088,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -76318,21 +78226,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -76375,36 +78268,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -76498,69 +78361,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -76722,65 +78522,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vTRX": { - "address": "0x369Fea97f6fB7510755DCA389088d9E2e2819278", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -76954,6 +78698,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -76985,6 +78735,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "MintBehalf", @@ -76996,17 +78752,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewAdmin", + "name": "NewAccessControlManager", "type": "event" }, { @@ -77014,18 +78770,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAdmin", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAdmin", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAdmin", "type": "event" }, { @@ -77033,18 +78789,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldImplementation", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newImplementation", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewImplementation", + "name": "NewComptroller", "type": "event" }, { @@ -77085,6 +78841,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -77124,6 +78918,12 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", @@ -77222,7 +79022,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -77266,11 +79066,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -77307,12 +79102,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -77328,6 +79138,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -77349,37 +79168,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -77421,7 +79215,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -77437,6 +79231,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -77640,24 +79449,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -77666,18 +79471,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -77687,12 +79492,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -77700,41 +79505,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -77837,6 +79630,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -77975,6 +79853,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -78017,6 +79910,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -78110,6 +80033,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -78271,9 +80257,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vTUSD": { + "address": "0xEFAACF73CE2D38ED40991f29E72B12C74bd4cf23", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -78447,12 +80489,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -78484,12 +80520,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "MintBehalf", @@ -78501,17 +80531,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAccessControlAddress", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAccessControlAddress", + "name": "newAdmin", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewAdmin", "type": "event" }, { @@ -78519,18 +80549,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAdmin", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAdmin", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAdmin", + "name": "NewComptroller", "type": "event" }, { @@ -78538,18 +80568,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldImplementation", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -78590,44 +80620,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -78667,12 +80659,6 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", @@ -78771,7 +80757,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -78815,6 +80801,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -78851,27 +80842,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -78887,15 +80863,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -78917,12 +80884,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -78964,7 +80956,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -78980,21 +80972,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -79197,32 +81174,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -79283,6 +81234,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -79379,91 +81372,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -79602,21 +81510,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -79659,36 +81552,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -79782,69 +81645,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -80006,65 +81806,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vTUSD": { - "address": "0xEFAACF73CE2D38ED40991f29E72B12C74bd4cf23", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -80238,6 +81982,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -80269,6 +82019,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "MintBehalf", @@ -80280,17 +82036,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewAdmin", + "name": "NewAccessControlManager", "type": "event" }, { @@ -80298,18 +82054,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAdmin", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAdmin", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAdmin", "type": "event" }, { @@ -80317,18 +82073,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldImplementation", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newImplementation", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewImplementation", + "name": "NewComptroller", "type": "event" }, { @@ -80369,6 +82125,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -80408,6 +82202,12 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", @@ -80506,7 +82306,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -80550,11 +82350,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -80591,12 +82386,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -80612,6 +82422,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -80633,37 +82452,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -80705,7 +82499,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -80721,6 +82515,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -80924,24 +82733,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -80950,18 +82755,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -80971,12 +82776,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -80984,41 +82789,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -81121,6 +82914,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -81259,6 +83137,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -81301,6 +83194,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -81394,6 +83317,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -81555,9 +83541,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vTWT": { + "address": "0x95DaED37fdD3F557b3A5cCEb7D50Be65b36721DF", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -81836,6 +83878,25 @@ "name": "NewComptroller", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldImplementation", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "NewImplementation", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -82099,6 +84160,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -82135,27 +84201,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -82171,15 +84222,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -82201,12 +84243,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -82248,7 +84315,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -82481,32 +84548,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -82567,6 +84608,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -82663,91 +84746,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -83066,69 +85064,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], diff --git a/deployments/bsctestnet_addresses.json b/deployments/bsctestnet_addresses.json index 2d57e175d..d6309e86f 100644 --- a/deployments/bsctestnet_addresses.json +++ b/deployments/bsctestnet_addresses.json @@ -9,6 +9,7 @@ "DefaultProxyAdmin": "0x7877ffd62649b6a1557b55d4c20fcbab17344c91", "ETH": "0x98f7A83361F7Ac8765CcEBAB1425da6b341958a7", "JumpRateModel_base0bps_slope687bps_jump25000bps_kink8000bps": "0xf59B7f2733a549dCF82b804d69d9c6a38985B90B", + "JumpRateModel_base200bps_slope2000bps_jump30000bps_kink5000bps": "0xF1A8B40CA68d08EFfa31a16a83f4fd9b5c174872", "LTC": "0x969F147B6b8D81f86175de33206A4FD43dF17913", "Liquidator": "0x55AEABa76ecf144031Ef64E222166eb28Cb4865F", "Liquidator_Implementation": "0x83372155dd4a4306af82795d5a27d40188ed1f3b", @@ -90,6 +91,7 @@ "vSXP": "0x74469281310195A04840Daf6EdF576F559a3dE80", "vTRX": "0x369Fea97f6fB7510755DCA389088d9E2e2819278", "vTUSD": "0xEFAACF73CE2D38ED40991f29E72B12C74bd4cf23", + "vTWT": "0x95DaED37fdD3F557b3A5cCEb7D50Be65b36721DF", "vUSDC": "0xD5C4C2e2facBEB59D0216D0595d63FcDc6F9A1a7", "vUSDT": "0xb7526572FFE56AB9D7489838Bf2E18e3323b441A", "vWBETH": "0x35566ED3AF9E537Be487C98b1811cDf95ad0C32b", From 84308d48964c084ccb71b2309d8fdebaf2772aa4 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Wed, 16 Oct 2024 17:12:42 +0530 Subject: [PATCH 3/5] fix: hardhat deployments --- helpers/deploymentConfig.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/helpers/deploymentConfig.ts b/helpers/deploymentConfig.ts index d806d091d..b36ca7d22 100644 --- a/helpers/deploymentConfig.ts +++ b/helpers/deploymentConfig.ts @@ -52,7 +52,12 @@ export type NetworkConfig = { }; export const getGlobalConfig: () => Promise = async () => { - const vTreasuryAddress = (await ethers.getContract("VTreasury")).address; + let vTreasuryAddress; + try { + vTreasuryAddress = (await ethers.getContract("VTreasuryV8")).address; + } catch { + vTreasuryAddress = (await ethers.getContract("VTreasury")).address; + } return { hardhat: { tokensConfig: [ From f92fcf858990cb47dc0b375feca6c2032eeb692e Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Wed, 16 Oct 2024 19:37:01 +0530 Subject: [PATCH 4/5] feat: add mainnet deployments of TWT market --- ...slope2000bps_jump30000bps_kink5000bps.json | 380 +++ deployments/bscmainnet/vTWT.json | 2382 +++++++++++++++++ helpers/deploymentConfig.ts | 49 +- 3 files changed, 2780 insertions(+), 31 deletions(-) create mode 100644 deployments/bscmainnet/JumpRateModel_base200bps_slope2000bps_jump30000bps_kink5000bps.json create mode 100644 deployments/bscmainnet/vTWT.json diff --git a/deployments/bscmainnet/JumpRateModel_base200bps_slope2000bps_jump30000bps_kink5000bps.json b/deployments/bscmainnet/JumpRateModel_base200bps_slope2000bps_jump30000bps_kink5000bps.json new file mode 100644 index 000000000..eda9c4682 --- /dev/null +++ b/deployments/bscmainnet/JumpRateModel_base200bps_slope2000bps_jump30000bps_kink5000bps.json @@ -0,0 +1,380 @@ +{ + "address": "0x2dE4739a9C68B02B54C0d8323752551d724b3cc2", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "baseRatePerYear", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "multiplierPerYear", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "jumpMultiplierPerYear", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink_", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "baseRatePerBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "multiplierPerBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "jumpMultiplierPerBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "kink", + "type": "uint256" + } + ], + "name": "NewInterestParams", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "baseRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "blocksPerYear", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "cash", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrows", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserves", + "type": "uint256" + } + ], + "name": "getBorrowRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "cash", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrows", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveFactorMantissa", + "type": "uint256" + } + ], + "name": "getSupplyRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isInterestRateModel", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "jumpMultiplierPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "kink", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "multiplierPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "cash", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrows", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserves", + "type": "uint256" + } + ], + "name": "utilizationRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x87f1794103146d04816be5bc119ec5553a7206a4b670ae817d200161a0024ca2", + "receipt": { + "to": null, + "from": "0x92054EdBb53eCC4f2A1787e92f479CE10392A658", + "contractAddress": "0x2dE4739a9C68B02B54C0d8323752551d724b3cc2", + "transactionIndex": 123, + "gasUsed": "488660", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000004000000000000000000000000080000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x9e5d625223eda1e4ab652ab50650dd305e04c2585f4f27093c9a53ae794d3e6a", + "transactionHash": "0x87f1794103146d04816be5bc119ec5553a7206a4b670ae817d200161a0024ca2", + "logs": [ + { + "transactionIndex": 123, + "blockNumber": 43167708, + "transactionHash": "0x87f1794103146d04816be5bc119ec5553a7206a4b670ae817d200161a0024ca2", + "address": "0x2dE4739a9C68B02B54C0d8323752551d724b3cc2", + "topics": ["0x6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d"], + "data": "0x0000000000000000000000000000000000000000000000000000000071672e7f000000000000000000000000000000000000000000000000000000046e07d0f60000000000000000000000000000000000000000000000000000004272753e6d00000000000000000000000000000000000000000000000006f05b59d3b20000", + "logIndex": 188, + "blockHash": "0x9e5d625223eda1e4ab652ab50650dd305e04c2585f4f27093c9a53ae794d3e6a" + } + ], + "blockNumber": 43167708, + "cumulativeGasUsed": "8585040", + "status": 1, + "byzantium": true + }, + "args": ["20000000000000000", "200000000000000000", "3000000000000000000", "500000000000000000"], + "numDeployments": 1, + "solcInputHash": "a2594572bdae270af6749f50c8019b6c", + "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"baseRatePerYear\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"multiplierPerYear\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jumpMultiplierPerYear\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"kink_\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"baseRatePerBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"multiplierPerBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jumpMultiplierPerBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"kink\",\"type\":\"uint256\"}],\"name\":\"NewInterestParams\",\"type\":\"event\"},{\"constant\":true,\"inputs\":[],\"name\":\"baseRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"blocksPerYear\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cash\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"borrows\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserves\",\"type\":\"uint256\"}],\"name\":\"getBorrowRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cash\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"borrows\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserves\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"getSupplyRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isInterestRateModel\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"jumpMultiplierPerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"kink\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"multiplierPerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cash\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"borrows\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserves\",\"type\":\"uint256\"}],\"name\":\"utilizationRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Venus\",\"methods\":{\"constructor\":{\"params\":{\"baseRatePerYear\":\"The approximate target base APR, as a mantissa (scaled by 1e18)\",\"jumpMultiplierPerYear\":\"The multiplierPerBlock after hitting a specified utilization point\",\"kink_\":\"The utilization point at which the jump multiplier is applied\",\"multiplierPerYear\":\"The rate of increase in interest rate wrt utilization (scaled by 1e18)\"}},\"getBorrowRate(uint256,uint256,uint256)\":{\"params\":{\"borrows\":\"The amount of borrows in the market\",\"cash\":\"The amount of cash in the market\",\"reserves\":\"The amount of reserves in the market\"},\"return\":\"The borrow rate percentage per block as a mantissa (scaled by 1e18)\"},\"getSupplyRate(uint256,uint256,uint256,uint256)\":{\"params\":{\"borrows\":\"The amount of borrows in the market\",\"cash\":\"The amount of cash in the market\",\"reserveFactorMantissa\":\"The current reserve factor for the market\",\"reserves\":\"The amount of reserves in the market\"},\"return\":\"The supply rate percentage per block as a mantissa (scaled by 1e18)\"},\"utilizationRate(uint256,uint256,uint256)\":{\"params\":{\"borrows\":\"The amount of borrows in the market\",\"cash\":\"The amount of cash in the market\",\"reserves\":\"The amount of reserves in the market (currently unused)\"},\"return\":\"The utilization rate as a mantissa between [0, 1e18]\"}},\"title\":\"Venus's JumpRateModel Contract\"},\"userdoc\":{\"methods\":{\"constructor\":\"Construct an interest rate model\",\"getBorrowRate(uint256,uint256,uint256)\":{\"notice\":\"Calculates the current borrow rate per block, with the error code expected by the market\"},\"getSupplyRate(uint256,uint256,uint256,uint256)\":{\"notice\":\"Calculates the current supply rate per block\"},\"utilizationRate(uint256,uint256,uint256)\":{\"notice\":\"Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\"}}}},\"settings\":{\"compilationTarget\":{\"contracts/InterestRateModels/JumpRateModel.sol\":\"JumpRateModel\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/InterestRateModels/InterestRateModel.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\n/**\\n * @title Venus's InterestRateModel Interface\\n * @author Venus\\n */\\ncontract InterestRateModel {\\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\\n bool public constant isInterestRateModel = true;\\n\\n /**\\n * @notice Calculates the current borrow interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amnount of reserves the market has\\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);\\n\\n /**\\n * @notice Calculates the current supply interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amnount of reserves the market has\\n * @param reserveFactorMantissa The current reserve factor the market has\\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint cash,\\n uint borrows,\\n uint reserves,\\n uint reserveFactorMantissa\\n ) external view returns (uint);\\n}\\n\",\"keccak256\":\"0x7896290ed5d98f1b744676c0cf5cb0bc656befdd8a79ae4cd2d9f90d83aaa52d\"},\"contracts/InterestRateModels/JumpRateModel.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"../Utils/SafeMath.sol\\\";\\nimport \\\"./InterestRateModel.sol\\\";\\n\\n/**\\n * @title Venus's JumpRateModel Contract\\n * @author Venus\\n */\\ncontract JumpRateModel is InterestRateModel {\\n using SafeMath for uint;\\n\\n event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock, uint jumpMultiplierPerBlock, uint kink);\\n\\n /**\\n * @notice The approximate number of blocks per year that is assumed by the interest rate model\\n */\\n uint public constant blocksPerYear = (60 * 60 * 24 * 365) / 3; // (assuming 3s blocks)\\n\\n /**\\n * @notice The multiplier of utilization rate that gives the slope of the interest rate\\n */\\n uint public multiplierPerBlock;\\n\\n /**\\n * @notice The base interest rate which is the y-intercept when utilization rate is 0\\n */\\n uint public baseRatePerBlock;\\n\\n /**\\n * @notice The multiplierPerBlock after hitting a specified utilization point\\n */\\n uint public jumpMultiplierPerBlock;\\n\\n /**\\n * @notice The utilization point at which the jump multiplier is applied\\n */\\n uint public kink;\\n\\n /**\\n * @notice Construct an interest rate model\\n * @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)\\n * @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)\\n * @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point\\n * @param kink_ The utilization point at which the jump multiplier is applied\\n */\\n constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) public {\\n baseRatePerBlock = baseRatePerYear.div(blocksPerYear);\\n multiplierPerBlock = multiplierPerYear.div(blocksPerYear);\\n jumpMultiplierPerBlock = jumpMultiplierPerYear.div(blocksPerYear);\\n kink = kink_;\\n\\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);\\n }\\n\\n /**\\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\\n * @param cash The amount of cash in the market\\n * @param borrows The amount of borrows in the market\\n * @param reserves The amount of reserves in the market (currently unused)\\n * @return The utilization rate as a mantissa between [0, 1e18]\\n */\\n function utilizationRate(uint cash, uint borrows, uint reserves) public pure returns (uint) {\\n // Utilization rate is 0 when there are no borrows\\n if (borrows == 0) {\\n return 0;\\n }\\n\\n return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));\\n }\\n\\n /**\\n * @notice Calculates the current borrow rate per block, with the error code expected by the market\\n * @param cash The amount of cash in the market\\n * @param borrows The amount of borrows in the market\\n * @param reserves The amount of reserves in the market\\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18)\\n */\\n function getBorrowRate(uint cash, uint borrows, uint reserves) public view returns (uint) {\\n uint util = utilizationRate(cash, borrows, reserves);\\n\\n if (util <= kink) {\\n return util.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\\n } else {\\n uint normalRate = kink.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\\n uint excessUtil = util.sub(kink);\\n return excessUtil.mul(jumpMultiplierPerBlock).div(1e18).add(normalRate);\\n }\\n }\\n\\n /**\\n * @notice Calculates the current supply rate per block\\n * @param cash The amount of cash in the market\\n * @param borrows The amount of borrows in the market\\n * @param reserves The amount of reserves in the market\\n * @param reserveFactorMantissa The current reserve factor for the market\\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint cash,\\n uint borrows,\\n uint reserves,\\n uint reserveFactorMantissa\\n ) public view returns (uint) {\\n uint oneMinusReserveFactor = uint(1e18).sub(reserveFactorMantissa);\\n uint borrowRate = getBorrowRate(cash, borrows, reserves);\\n uint rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);\\n return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);\\n }\\n}\\n\",\"keccak256\":\"0x0c90d867067f823ca47664590f132385830ed66d2cfccdf242c028d0a85bd7c9\"},\"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\",\"keccak256\":\"0x9431fd772ed4abc038cdfe9ce6c0066897bd1685ad45848748d1952935d5b8ef\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516108113803806108118339818101604052608081101561003357600080fd5b508051602080830151604084015160609094015192939092909161006590859062a066809061039e6100fd821b17901c565b6001556100808362a066806100fd602090811b61039e17901c565b60005561009b8262a066806100fd602090811b61039e17901c565b60028190556003829055600154600054604080519283526020830191909152818101929092526060810183905290517f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9181900360800190a1505050506101ee565b600061014583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061014c60201b60201c565b9392505050565b600081836101d85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561019d578181015183820152602001610185565b50505050905090810190601f1680156101ca5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816101e457fe5b0495945050505050565b610614806101fd6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063a385fb9611610066578063a385fb9614610120578063b816881614610128578063b9f9850a14610157578063f14039de1461015f578063fd2da3391461016757610093565b806315f24053146100985780632191f92a146100d35780636e71e2d8146100ef5780638726bb8914610118575b600080fd5b6100c1600480360360608110156100ae57600080fd5b508035906020810135906040013561016f565b60408051918252519081900360200190f35b6100db610247565b604080519115158252519081900360200190f35b6100c16004803603606081101561010557600080fd5b508035906020810135906040013561024c565b6100c161029e565b6100c16102a4565b6100c16004803603608081101561013e57600080fd5b50803590602081013590604081013590606001356102ab565b6100c161032a565b6100c1610330565b6100c1610336565b60008061017d85858561024c565b905060035481116101cf576101c76001546101bb670de0b6b3a76400006101af6000548661033c90919063ffffffff16565b9063ffffffff61039e16565b9063ffffffff6103e016565b915050610240565b60006101fa6001546101bb670de0b6b3a76400006101af60005460035461033c90919063ffffffff16565b905060006102136003548461042290919063ffffffff16565b905061023a826101bb670de0b6b3a76400006101af6002548661033c90919063ffffffff16565b93505050505b9392505050565b600181565b60008261025b57506000610240565b61029661027e83610272878763ffffffff6103e016565b9063ffffffff61042216565b6101af85670de0b6b3a764000063ffffffff61033c16565b949350505050565b60005481565b62a0668081565b6000806102c6670de0b6b3a76400008463ffffffff61042216565b905060006102d587878761016f565b905060006102f5670de0b6b3a76400006101af848663ffffffff61033c16565b905061031e670de0b6b3a76400006101af836103128c8c8c61024c565b9063ffffffff61033c16565b98975050505050505050565b60025481565b60015481565b60035481565b60008261034b57506000610398565b8282028284828161035857fe5b04146103955760405162461bcd60e51b81526004018080602001828103825260218152602001806105bf6021913960400191505060405180910390fd5b90505b92915050565b600061039583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610464565b600061039583836040518060400160405280601b81526020017f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815250610506565b600061039583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610564565b600081836104f05760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156104b557818101518382015260200161049d565b50505050905090810190601f1680156104e25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816104fc57fe5b0495945050505050565b6000838301828582101561055b5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104b557818101518382015260200161049d565b50949350505050565b600081848411156105b65760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104b557818101518382015260200161049d565b50505090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158208d524531d4bd676b08c415f951c89512128d7ce72185b07b426ac97c6c3b50a564736f6c63430005100032", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063a385fb9611610066578063a385fb9614610120578063b816881614610128578063b9f9850a14610157578063f14039de1461015f578063fd2da3391461016757610093565b806315f24053146100985780632191f92a146100d35780636e71e2d8146100ef5780638726bb8914610118575b600080fd5b6100c1600480360360608110156100ae57600080fd5b508035906020810135906040013561016f565b60408051918252519081900360200190f35b6100db610247565b604080519115158252519081900360200190f35b6100c16004803603606081101561010557600080fd5b508035906020810135906040013561024c565b6100c161029e565b6100c16102a4565b6100c16004803603608081101561013e57600080fd5b50803590602081013590604081013590606001356102ab565b6100c161032a565b6100c1610330565b6100c1610336565b60008061017d85858561024c565b905060035481116101cf576101c76001546101bb670de0b6b3a76400006101af6000548661033c90919063ffffffff16565b9063ffffffff61039e16565b9063ffffffff6103e016565b915050610240565b60006101fa6001546101bb670de0b6b3a76400006101af60005460035461033c90919063ffffffff16565b905060006102136003548461042290919063ffffffff16565b905061023a826101bb670de0b6b3a76400006101af6002548661033c90919063ffffffff16565b93505050505b9392505050565b600181565b60008261025b57506000610240565b61029661027e83610272878763ffffffff6103e016565b9063ffffffff61042216565b6101af85670de0b6b3a764000063ffffffff61033c16565b949350505050565b60005481565b62a0668081565b6000806102c6670de0b6b3a76400008463ffffffff61042216565b905060006102d587878761016f565b905060006102f5670de0b6b3a76400006101af848663ffffffff61033c16565b905061031e670de0b6b3a76400006101af836103128c8c8c61024c565b9063ffffffff61033c16565b98975050505050505050565b60025481565b60015481565b60035481565b60008261034b57506000610398565b8282028284828161035857fe5b04146103955760405162461bcd60e51b81526004018080602001828103825260218152602001806105bf6021913960400191505060405180910390fd5b90505b92915050565b600061039583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610464565b600061039583836040518060400160405280601b81526020017f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815250610506565b600061039583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610564565b600081836104f05760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156104b557818101518382015260200161049d565b50505050905090810190601f1680156104e25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816104fc57fe5b0495945050505050565b6000838301828582101561055b5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104b557818101518382015260200161049d565b50949350505050565b600081848411156105b65760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104b557818101518382015260200161049d565b50505090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158208d524531d4bd676b08c415f951c89512128d7ce72185b07b426ac97c6c3b50a564736f6c63430005100032", + "devdoc": { + "author": "Venus", + "methods": { + "constructor": { + "params": { + "baseRatePerYear": "The approximate target base APR, as a mantissa (scaled by 1e18)", + "jumpMultiplierPerYear": "The multiplierPerBlock after hitting a specified utilization point", + "kink_": "The utilization point at which the jump multiplier is applied", + "multiplierPerYear": "The rate of increase in interest rate wrt utilization (scaled by 1e18)" + } + }, + "getBorrowRate(uint256,uint256,uint256)": { + "params": { + "borrows": "The amount of borrows in the market", + "cash": "The amount of cash in the market", + "reserves": "The amount of reserves in the market" + }, + "return": "The borrow rate percentage per block as a mantissa (scaled by 1e18)" + }, + "getSupplyRate(uint256,uint256,uint256,uint256)": { + "params": { + "borrows": "The amount of borrows in the market", + "cash": "The amount of cash in the market", + "reserveFactorMantissa": "The current reserve factor for the market", + "reserves": "The amount of reserves in the market" + }, + "return": "The supply rate percentage per block as a mantissa (scaled by 1e18)" + }, + "utilizationRate(uint256,uint256,uint256)": { + "params": { + "borrows": "The amount of borrows in the market", + "cash": "The amount of cash in the market", + "reserves": "The amount of reserves in the market (currently unused)" + }, + "return": "The utilization rate as a mantissa between [0, 1e18]" + } + }, + "title": "Venus's JumpRateModel Contract" + }, + "userdoc": { + "methods": { + "constructor": "Construct an interest rate model", + "getBorrowRate(uint256,uint256,uint256)": { + "notice": "Calculates the current borrow rate per block, with the error code expected by the market" + }, + "getSupplyRate(uint256,uint256,uint256,uint256)": { + "notice": "Calculates the current supply rate per block" + }, + "utilizationRate(uint256,uint256,uint256)": { + "notice": "Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`" + } + } + }, + "storageLayout": { + "storage": [ + { + "astId": 9329, + "contract": "contracts/InterestRateModels/JumpRateModel.sol:JumpRateModel", + "label": "multiplierPerBlock", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 9331, + "contract": "contracts/InterestRateModels/JumpRateModel.sol:JumpRateModel", + "label": "baseRatePerBlock", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 9333, + "contract": "contracts/InterestRateModels/JumpRateModel.sol:JumpRateModel", + "label": "jumpMultiplierPerBlock", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 9335, + "contract": "contracts/InterestRateModels/JumpRateModel.sol:JumpRateModel", + "label": "kink", + "offset": 0, + "slot": "3", + "type": "t_uint256" + } + ], + "types": { + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/deployments/bscmainnet/vTWT.json b/deployments/bscmainnet/vTWT.json new file mode 100644 index 000000000..833597efb --- /dev/null +++ b/deployments/bscmainnet/vTWT.json @@ -0,0 +1,2382 @@ +{ + "address": "0x4d41a36D04D97785bcEA57b057C412b278e6Edcc", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "cashPrior", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "interestAccumulated", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "info", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "detail", + "type": "uint256" + } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + } + ], + "name": "MintBehalf", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlAddress", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldImplementation", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "NewImplementation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldPendingAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPendingAdmin", + "type": "address" + } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReserveFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "benefactor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "protocolShareReserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + } + ], + "name": "_addReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + } + ], + "name": "_reduceReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "_setComptroller", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "_setInterestRateModel", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "newPendingAdmin", + "type": "address" + } + ], + "name": "_setPendingAdmin", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "_setReserveFactor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOfUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "borrowBalanceCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "borrowBalanceStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptroller", + "outputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAccountSnapshot", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [ + { + "internalType": "contract InterestRateModel", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isVToken", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "internalType": "contract VTokenInterface", + "name": "vTokenCollateral", + "type": "address" + } + ], + "name": "liquidateBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + } + ], + "name": "redeemUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrowBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xfe2a510af35b7643952d649030b7d78a22dd9d5cc82330ee6a8018513f1ca1ac", + "receipt": { + "to": null, + "from": "0x92054EdBb53eCC4f2A1787e92f479CE10392A658", + "contractAddress": "0x4d41a36D04D97785bcEA57b057C412b278e6Edcc", + "transactionIndex": 139, + "gasUsed": "2097646", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000040000000001000000000000000000000000000000800000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000004100000000000000000000000000080000100000000000000000000000000000000000000000000000000000004000000000002000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000", + "blockHash": "0xfca3355a9b8e9b883bd0e97c9c71351ded31cf5da2a77c7edc32b0c8c243aa1f", + "transactionHash": "0xfe2a510af35b7643952d649030b7d78a22dd9d5cc82330ee6a8018513f1ca1ac", + "logs": [ + { + "transactionIndex": 139, + "blockNumber": 43167710, + "transactionHash": "0xfe2a510af35b7643952d649030b7d78a22dd9d5cc82330ee6a8018513f1ca1ac", + "address": "0x4d41a36D04D97785bcEA57b057C412b278e6Edcc", + "topics": ["0x7ac369dbd14fa5ea3f473ed67cc9d598964a77501540ba6751eb0b3decf5870d"], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000fd36e2c2a6789db23113685031d7f16329158384", + "logIndex": 394, + "blockHash": "0xfca3355a9b8e9b883bd0e97c9c71351ded31cf5da2a77c7edc32b0c8c243aa1f" + }, + { + "transactionIndex": 139, + "blockNumber": 43167710, + "transactionHash": "0xfe2a510af35b7643952d649030b7d78a22dd9d5cc82330ee6a8018513f1ca1ac", + "address": "0x4d41a36D04D97785bcEA57b057C412b278e6Edcc", + "topics": ["0xedffc32e068c7c95dfd4bdfd5c4d939a084d6b11c4199eac8436ed234d72f926"], + "data": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000002de4739a9c68b02b54c0d8323752551d724b3cc2", + "logIndex": 395, + "blockHash": "0xfca3355a9b8e9b883bd0e97c9c71351ded31cf5da2a77c7edc32b0c8c243aa1f" + }, + { + "transactionIndex": 139, + "blockNumber": 43167710, + "transactionHash": "0xfe2a510af35b7643952d649030b7d78a22dd9d5cc82330ee6a8018513f1ca1ac", + "address": "0x4d41a36D04D97785bcEA57b057C412b278e6Edcc", + "topics": ["0xd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a"], + "data": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000006e5cff66c7b671fa1d5782866d80bd15955d79f6", + "logIndex": 396, + "blockHash": "0xfca3355a9b8e9b883bd0e97c9c71351ded31cf5da2a77c7edc32b0c8c243aa1f" + } + ], + "blockNumber": 43167710, + "cumulativeGasUsed": "16456917", + "status": 1, + "byzantium": true + }, + "args": [ + "0x4B0F1812e5Df2A09796481Ff14017e6005508003", + "0xfD36E2c2a6789Db23113685031d7F16329158384", + "0x2dE4739a9C68B02B54C0d8323752551d724b3cc2", + "10000000000000000000000000000", + "Venus TWT", + "vTWT", + 8, + "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396", + "0x6E5cFf66C7b671fA1D5782866D80BD15955d79F6", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "a2594572bdae270af6749f50c8019b6c", + "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"underlying_\",\"type\":\"address\"},{\"internalType\":\"contract ComptrollerInterface\",\"name\":\"comptroller_\",\"type\":\"address\"},{\"internalType\":\"contract InterestRateModel\",\"name\":\"interestRateModel_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialExchangeRateMantissa_\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"name_\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol_\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"address payable\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"becomeImplementationData\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cashPrior\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"interestAccumulated\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"borrowIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalBorrows\",\"type\":\"uint256\"}],\"name\":\"AccrueInterest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"borrowAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"accountBorrows\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalBorrows\",\"type\":\"uint256\"}],\"name\":\"Borrow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"error\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"info\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"detail\",\"type\":\"uint256\"}],\"name\":\"Failure\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"vTokenCollateral\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"seizeTokens\",\"type\":\"uint256\"}],\"name\":\"LiquidateBorrow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"mintTokens\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalSupply\",\"type\":\"uint256\"}],\"name\":\"Mint\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"payer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"mintTokens\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalSupply\",\"type\":\"uint256\"}],\"name\":\"MintBehalf\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldAccessControlAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAccessControlAddress\",\"type\":\"address\"}],\"name\":\"NewAccessControlManager\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"NewAdmin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ComptrollerInterface\",\"name\":\"oldComptroller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract ComptrollerInterface\",\"name\":\"newComptroller\",\"type\":\"address\"}],\"name\":\"NewComptroller\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldImplementation\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"NewImplementation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract InterestRateModel\",\"name\":\"oldInterestRateModel\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract InterestRateModel\",\"name\":\"newInterestRateModel\",\"type\":\"address\"}],\"name\":\"NewMarketInterestRateModel\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldPendingAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newPendingAdmin\",\"type\":\"address\"}],\"name\":\"NewPendingAdmin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldProtocolShareReserve\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newProtocolShareReserve\",\"type\":\"address\"}],\"name\":\"NewProtocolShareReserve\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldReduceReservesBlockDelta\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newReduceReservesBlockDelta\",\"type\":\"uint256\"}],\"name\":\"NewReduceReservesBlockDelta\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldReserveFactorMantissa\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newReserveFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"NewReserveFactor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"redeemAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"redeemTokens\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalSupply\",\"type\":\"uint256\"}],\"name\":\"Redeem\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"redeemTokens\",\"type\":\"uint256\"}],\"name\":\"RedeemFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"payer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"accountBorrows\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalBorrows\",\"type\":\"uint256\"}],\"name\":\"RepayBorrow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"benefactor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"addAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newTotalReserves\",\"type\":\"uint256\"}],\"name\":\"ReservesAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"protocolShareReserve\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"reduceAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newTotalReserves\",\"type\":\"uint256\"}],\"name\":\"ReservesReduced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"constant\":false,\"inputs\":[],\"name\":\"_acceptAdmin\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"addAmount\",\"type\":\"uint256\"}],\"name\":\"_addReserves\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"reduceAmount\",\"type\":\"uint256\"}],\"name\":\"_reduceReserves\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"contract ComptrollerInterface\",\"name\":\"newComptroller\",\"type\":\"address\"}],\"name\":\"_setComptroller\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"allowResign\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"becomeImplementationData\",\"type\":\"bytes\"}],\"name\":\"_setImplementation\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"contract InterestRateModel\",\"name\":\"newInterestRateModel\",\"type\":\"address\"}],\"name\":\"_setInterestRateModel\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"newPendingAdmin\",\"type\":\"address\"}],\"name\":\"_setPendingAdmin\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newReserveFactorMantissa\",\"type\":\"uint256\"}],\"name\":\"_setReserveFactor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"accessControlManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"accrualBlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"accrueInterest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOfUnderlying\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowAmount\",\"type\":\"uint256\"}],\"name\":\"borrow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"borrowBalanceCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"borrowBalanceStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"borrowIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"borrowRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"comptroller\",\"outputs\":[{\"internalType\":\"contract ComptrollerInterface\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"delegateToImplementation\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"delegateToViewImplementation\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"exchangeRateStored\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getAccountSnapshot\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getCash\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"interestRateModel\",\"outputs\":[{\"internalType\":\"contract InterestRateModel\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isVToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"},{\"internalType\":\"contract VTokenInterface\",\"name\":\"vTokenCollateral\",\"type\":\"address\"}],\"name\":\"liquidateBorrow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"}],\"name\":\"mintBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"pendingAdmin\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"protocolShareReserve\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"redeemTokens\",\"type\":\"uint256\"}],\"name\":\"redeem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"redeemAmount\",\"type\":\"uint256\"}],\"name\":\"redeemUnderlying\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"reduceReservesBlockDelta\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"reduceReservesBlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayBorrow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"repayAmount\",\"type\":\"uint256\"}],\"name\":\"repayBorrowBehalf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"reserveFactorMantissa\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"seizeTokens\",\"type\":\"uint256\"}],\"name\":\"seize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"supplyRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalBorrows\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"totalBorrowsCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalReserves\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"dst\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"src\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"dst\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"underlying\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Venus\",\"methods\":{\"_acceptAdmin()\":{\"details\":\"Admin function for pending admin to accept role and update admin\",\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"_addReserves(uint256)\":{\"params\":{\"addAmount\":\"Amount of reserves to add\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"_reduceReserves(uint256)\":{\"params\":{\"reduceAmount\":\"Amount of reduction to reserves\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"_setComptroller(address)\":{\"details\":\"Admin function to set a new comptroller\",\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"_setImplementation(address,bool,bytes)\":{\"params\":{\"allowResign\":\"Flag to indicate whether to call _resignImplementation on the old implementation\",\"becomeImplementationData\":\"The encoded bytes data to be passed to _becomeImplementation\",\"implementation_\":\"The address of the new implementation for delegation\"}},\"_setInterestRateModel(address)\":{\"details\":\"Admin function to accrue interest and update the interest rate model\",\"params\":{\"newInterestRateModel\":\"The new interest rate model to use\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"_setPendingAdmin(address)\":{\"details\":\"Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\",\"params\":{\"newPendingAdmin\":\"New pending admin.\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"_setReserveFactor(uint256)\":{\"details\":\"Admin function to accrue interest and set a new reserve factor\",\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"accrueInterest()\":{\"details\":\"This calculates interest accrued from the last checkpointed block up to the current block and writes new checkpoint to storage.\"},\"allowance(address,address)\":{\"params\":{\"owner\":\"The address of the account which owns the tokens to be spent\",\"spender\":\"The address of the account which may transfer tokens\"},\"return\":\"The number of tokens allowed to be spent (-1 means infinite)\"},\"approve(address,uint256)\":{\"details\":\"This will overwrite the approval amount for `spender` and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\",\"params\":{\"amount\":\"The number of tokens that are approved (-1 means infinite)\",\"spender\":\"The address of the account which may transfer tokens\"},\"return\":\"Whether or not the approval succeeded\"},\"balanceOf(address)\":{\"params\":{\"owner\":\"The address of the account to query\"},\"return\":\"The number of tokens owned by `owner`\"},\"balanceOfUnderlying(address)\":{\"details\":\"This also accrues interest in a transaction\",\"params\":{\"owner\":\"The address of the account to query\"},\"return\":\"The amount of underlying owned by `owner`\"},\"borrow(uint256)\":{\"params\":{\"borrowAmount\":\"The amount of the underlying asset to borrow\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"borrowBalanceCurrent(address)\":{\"params\":{\"account\":\"The address whose balance should be calculated after updating borrowIndex\"},\"return\":\"The calculated balance\"},\"borrowBalanceStored(address)\":{\"params\":{\"account\":\"The address whose balance should be calculated\"},\"return\":\"The calculated balance\"},\"borrowRatePerBlock()\":{\"return\":\"The borrow interest rate per block, scaled by 1e18\"},\"constructor\":{\"params\":{\"admin_\":\"Address of the administrator of this token\",\"becomeImplementationData\":\"The encoded args for becomeImplementation\",\"comptroller_\":\"The address of the comptroller\",\"decimals_\":\"BEP-20 decimal precision of this token\",\"implementation_\":\"The address of the implementation the contract delegates to\",\"initialExchangeRateMantissa_\":\"The initial exchange rate, scaled by 1e18\",\"interestRateModel_\":\"The address of the interest rate model\",\"name_\":\"BEP-20 name of this token\",\"symbol_\":\"BEP-20 symbol of this token\",\"underlying_\":\"The address of the underlying asset\"}},\"delegateToImplementation(bytes)\":{\"details\":\"It returns to the external caller whatever the implementation returns or forwards reverts\",\"params\":{\"data\":\"The raw data to delegatecall\"},\"return\":\"The returned bytes from the delegatecall\"},\"delegateToViewImplementation(bytes)\":{\"details\":\"It returns to the external caller whatever the implementation returns or forwards reverts There are an additional 2 prefix uints from the wrapper returndata, which we ignore since we make an extra hop.\",\"params\":{\"data\":\"The raw data to delegatecall\"},\"return\":\"The returned bytes from the delegatecall\"},\"exchangeRateCurrent()\":{\"return\":\"Calculated exchange rate scaled by 1e18\"},\"exchangeRateStored()\":{\"details\":\"This function does not accrue interest before calculating the exchange rate\",\"return\":\"Calculated exchange rate scaled by 1e18\"},\"getAccountSnapshot(address)\":{\"details\":\"This is used by comptroller to more efficiently perform liquidity checks.\",\"params\":{\"account\":\"Address of the account to snapshot\"},\"return\":\"(possible error, token balance, borrow balance, exchange rate mantissa)\"},\"getCash()\":{\"return\":\"The quantity of underlying asset owned by this contract\"},\"liquidateBorrow(address,uint256,address)\":{\"params\":{\"borrower\":\"The borrower of this vToken to be liquidated\",\"repayAmount\":\"The amount of the underlying borrowed asset to repay\",\"vTokenCollateral\":\"The market in which to seize collateral from the borrower\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"mint(uint256)\":{\"details\":\"Accrues interest whether or not the operation succeeds, unless reverted\",\"params\":{\"mintAmount\":\"The amount of the underlying asset to supply\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"mintBehalf(address,uint256)\":{\"details\":\"Accrues interest whether or not the operation succeeds, unless reverted\",\"params\":{\"mintAmount\":\"The amount of the underlying asset to supply\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"redeem(uint256)\":{\"details\":\"Accrues interest whether or not the operation succeeds, unless reverted\",\"params\":{\"redeemTokens\":\"The number of vTokens to redeem into underlying asset\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"redeemUnderlying(uint256)\":{\"details\":\"Accrues interest whether or not the operation succeeds, unless reverted\",\"params\":{\"redeemAmount\":\"The amount of underlying to redeem\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"repayBorrow(uint256)\":{\"params\":{\"repayAmount\":\"The amount to repay\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"repayBorrowBehalf(address,uint256)\":{\"params\":{\"borrower\":\"The account with the debt being payed off\",\"repayAmount\":\"The amount to repay\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"seize(address,address,uint256)\":{\"details\":\"Will fail unless called by another vToken during the process of liquidation. It's absolutely critical to use msg.sender as the borrowed vToken and not a parameter.\",\"params\":{\"borrower\":\"The account having collateral seized\",\"liquidator\":\"The account receiving seized collateral\",\"seizeTokens\":\"The number of vTokens to seize\"},\"return\":\"uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\"},\"supplyRatePerBlock()\":{\"return\":\"The supply interest rate per block, scaled by 1e18\"},\"totalBorrowsCurrent()\":{\"return\":\"The total borrows with interest\"},\"transfer(address,uint256)\":{\"params\":{\"amount\":\"The number of tokens to transfer\",\"dst\":\"The address of the destination account\"},\"return\":\"Whether or not the transfer succeeded\"},\"transferFrom(address,address,uint256)\":{\"params\":{\"amount\":\"The number of tokens to transfer\",\"dst\":\"The address of the destination account\",\"src\":\"The address of the source account\"},\"return\":\"Whether or not the transfer succeeded\"}},\"title\":\"Venus's VBep20Delegator Contract\"},\"userdoc\":{\"methods\":{\"_acceptAdmin()\":{\"notice\":\"Accepts transfer of admin rights. `msg.sender` must be pendingAdmin\"},\"_addReserves(uint256)\":{\"notice\":\"Accrues interest and adds reserves by transferring from admin\"},\"_reduceReserves(uint256)\":{\"notice\":\"Accrues interest and reduces reserves by transferring to admin\"},\"_setComptroller(address)\":{\"notice\":\"Sets a new comptroller for the market\"},\"_setImplementation(address,bool,bytes)\":{\"notice\":\"Called by the admin to update the implementation of the delegator\"},\"_setInterestRateModel(address)\":{\"notice\":\"Accrues interest and updates the interest rate model using `_setInterestRateModelFresh`\"},\"_setPendingAdmin(address)\":{\"notice\":\"Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\"},\"_setReserveFactor(uint256)\":{\"notice\":\"Accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh\"},\"accrueInterest()\":{\"notice\":\"Applies accrued interest to total borrows and reserves.\"},\"allowance(address,address)\":{\"notice\":\"Get the current allowance from `owner` for `spender`\"},\"approve(address,uint256)\":{\"notice\":\"Approve `spender` to transfer up to `amount` from `src`\"},\"balanceOf(address)\":{\"notice\":\"Get the token balance of the `owner`\"},\"balanceOfUnderlying(address)\":{\"notice\":\"Get the underlying balance of the `owner`\"},\"borrow(uint256)\":{\"notice\":\"Sender borrows assets from the protocol to their own address\"},\"borrowBalanceCurrent(address)\":{\"notice\":\"Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex\"},\"borrowBalanceStored(address)\":{\"notice\":\"Return the borrow balance of account based on stored data\"},\"borrowRatePerBlock()\":{\"notice\":\"Returns the current per-block borrow interest rate for this vToken\"},\"constructor\":\"Construct a new money market\",\"delegateToImplementation(bytes)\":{\"notice\":\"Delegates execution to the implementation contract\"},\"delegateToViewImplementation(bytes)\":{\"notice\":\"Delegates execution to an implementation contract\"},\"exchangeRateCurrent()\":{\"notice\":\"Accrue interest then return the up-to-date exchange rate\"},\"exchangeRateStored()\":{\"notice\":\"Calculates the exchange rate from the underlying to the VToken\"},\"getAccountSnapshot(address)\":{\"notice\":\"Get a snapshot of the account's balances and the cached exchange rate\"},\"getCash()\":{\"notice\":\"Get cash balance of this vToken in the underlying asset\"},\"liquidateBorrow(address,uint256,address)\":{\"notice\":\"The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator.\"},\"mint(uint256)\":{\"notice\":\"Sender supplies assets into the market and receives vTokens in exchange\"},\"mintBehalf(address,uint256)\":{\"notice\":\"Sender supplies assets into the market and receiver receives vTokens in exchange\"},\"redeem(uint256)\":{\"notice\":\"Sender redeems vTokens in exchange for the underlying asset\"},\"redeemUnderlying(uint256)\":{\"notice\":\"Sender redeems vTokens in exchange for a specified amount of underlying asset\"},\"repayBorrow(uint256)\":{\"notice\":\"Sender repays their own borrow\"},\"repayBorrowBehalf(address,uint256)\":{\"notice\":\"Sender repays a borrow belonging to another borrower\"},\"seize(address,address,uint256)\":{\"notice\":\"Transfers collateral tokens (this market) to the liquidator.\"},\"supplyRatePerBlock()\":{\"notice\":\"Returns the current per-block supply interest rate for this vToken\"},\"totalBorrowsCurrent()\":{\"notice\":\"Returns the current total borrows plus accrued interest\"},\"transfer(address,uint256)\":{\"notice\":\"Transfer `amount` tokens from `msg.sender` to `dst`\"},\"transferFrom(address,address,uint256)\":{\"notice\":\"Transfer `amount` tokens from `src` to `dst`\"}},\"notice\":\"vTokens which wrap an EIP-20 underlying and delegate to an implementation\"}},\"settings\":{\"compilationTarget\":{\"contracts/Tokens/VTokens/VBep20Delegator.sol\":\"VBep20Delegator\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV5.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-3-Clause\\npragma solidity 0.5.16;\\n\\n/**\\n * @title IAccessControlManagerV5\\n * @author Venus\\n * @notice Interface implemented by the `AccessControlManagerV5` contract.\\n */\\ninterface IAccessControlManagerV5 {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n\\n /**\\n * @notice Gives a function call permission to one single account\\n * @dev this function can be called only from Role Admin or DEFAULT_ADMIN_ROLE\\n * \\t\\tMay emit a {RoleGranted} event.\\n * @param contractAddress address of contract for which call permissions will be granted\\n * @param functionSig signature e.g. \\\"functionName(uint,bool)\\\"\\n */\\n function giveCallPermission(address contractAddress, string calldata functionSig, address accountToPermit) external;\\n\\n /**\\n * @notice Revokes an account's permission to a particular function call\\n * @dev this function can be called only from Role Admin or DEFAULT_ADMIN_ROLE\\n * \\t\\tMay emit a {RoleRevoked} event.\\n * @param contractAddress address of contract for which call permissions will be revoked\\n * @param functionSig signature e.g. \\\"functionName(uint,bool)\\\"\\n */\\n function revokeCallPermission(\\n address contractAddress,\\n string calldata functionSig,\\n address accountToRevoke\\n ) external;\\n\\n /**\\n * @notice Verifies if the given account can call a praticular contract's function\\n * @dev Since the contract is calling itself this function, we can get contracts address with msg.sender\\n * @param account address (eoa or contract) for which call permissions will be checked\\n * @param functionSig signature e.g. \\\"functionName(uint,bool)\\\"\\n * @return false if the user account cannot call the particular contract function\\n *\\n */\\n function isAllowedToCall(address account, string calldata functionSig) external view returns (bool);\\n\\n function hasPermission(\\n address account,\\n address contractAddress,\\n string calldata functionSig\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x3563db4c75f7aa0b8a982bab591907dda192438a2368511b62a9c587a3e54226\"},\"contracts/Comptroller/ComptrollerInterface.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"../Tokens/VTokens/VToken.sol\\\";\\nimport \\\"../Oracle/PriceOracle.sol\\\";\\nimport \\\"../Tokens/VAI/VAIControllerInterface.sol\\\";\\nimport { ComptrollerTypes } from \\\"./ComptrollerStorage.sol\\\";\\n\\ncontract ComptrollerInterface {\\n /// @notice Indicator that this is a Comptroller contract (for inspection)\\n bool public constant isComptroller = true;\\n\\n /*** Assets You Are In ***/\\n\\n function enterMarkets(address[] calldata vTokens) external returns (uint[] memory);\\n\\n function exitMarket(address vToken) external returns (uint);\\n\\n /*** Policy Hooks ***/\\n\\n function mintAllowed(address vToken, address minter, uint mintAmount) external returns (uint);\\n\\n function mintVerify(address vToken, address minter, uint mintAmount, uint mintTokens) external;\\n\\n function redeemAllowed(address vToken, address redeemer, uint redeemTokens) external returns (uint);\\n\\n function redeemVerify(address vToken, address redeemer, uint redeemAmount, uint redeemTokens) external;\\n\\n function borrowAllowed(address vToken, address borrower, uint borrowAmount) external returns (uint);\\n\\n function borrowVerify(address vToken, address borrower, uint borrowAmount) external;\\n\\n function repayBorrowAllowed(\\n address vToken,\\n address payer,\\n address borrower,\\n uint repayAmount\\n ) external returns (uint);\\n\\n function repayBorrowVerify(\\n address vToken,\\n address payer,\\n address borrower,\\n uint repayAmount,\\n uint borrowerIndex\\n ) external;\\n\\n function liquidateBorrowAllowed(\\n address vTokenBorrowed,\\n address vTokenCollateral,\\n address liquidator,\\n address borrower,\\n uint repayAmount\\n ) external returns (uint);\\n\\n function liquidateBorrowVerify(\\n address vTokenBorrowed,\\n address vTokenCollateral,\\n address liquidator,\\n address borrower,\\n uint repayAmount,\\n uint seizeTokens\\n ) external;\\n\\n function seizeAllowed(\\n address vTokenCollateral,\\n address vTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint seizeTokens\\n ) external returns (uint);\\n\\n function seizeVerify(\\n address vTokenCollateral,\\n address vTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint seizeTokens\\n ) external;\\n\\n function transferAllowed(address vToken, address src, address dst, uint transferTokens) external returns (uint);\\n\\n function transferVerify(address vToken, address src, address dst, uint transferTokens) external;\\n\\n /*** Liquidity/Liquidation Calculations ***/\\n\\n function liquidateCalculateSeizeTokens(\\n address vTokenBorrowed,\\n address vTokenCollateral,\\n uint repayAmount\\n ) external view returns (uint, uint);\\n\\n function setMintedVAIOf(address owner, uint amount) external returns (uint);\\n\\n function liquidateVAICalculateSeizeTokens(\\n address vTokenCollateral,\\n uint repayAmount\\n ) external view returns (uint, uint);\\n\\n function getXVSAddress() public view returns (address);\\n\\n function markets(address) external view returns (bool, uint);\\n\\n function oracle() external view returns (PriceOracle);\\n\\n function getAccountLiquidity(address) external view returns (uint, uint, uint);\\n\\n function getAssetsIn(address) external view returns (VToken[] memory);\\n\\n function claimVenus(address) external;\\n\\n function venusAccrued(address) external view returns (uint);\\n\\n function venusSupplySpeeds(address) external view returns (uint);\\n\\n function venusBorrowSpeeds(address) external view returns (uint);\\n\\n function getAllMarkets() external view returns (VToken[] memory);\\n\\n function venusSupplierIndex(address, address) external view returns (uint);\\n\\n function venusInitialIndex() external view returns (uint224);\\n\\n function venusBorrowerIndex(address, address) external view returns (uint);\\n\\n function venusBorrowState(address) external view returns (uint224, uint32);\\n\\n function venusSupplyState(address) external view returns (uint224, uint32);\\n\\n function approvedDelegates(address borrower, address delegate) external view returns (bool);\\n\\n function vaiController() external view returns (VAIControllerInterface);\\n\\n function liquidationIncentiveMantissa() external view returns (uint);\\n\\n function protocolPaused() external view returns (bool);\\n\\n function actionPaused(address market, ComptrollerTypes.Action action) public view returns (bool);\\n\\n function mintedVAIs(address user) external view returns (uint);\\n\\n function vaiMintRate() external view returns (uint);\\n}\\n\\ninterface IVAIVault {\\n function updatePendingRewards() external;\\n}\\n\\ninterface IComptroller {\\n function liquidationIncentiveMantissa() external view returns (uint);\\n\\n /*** Treasury Data ***/\\n function treasuryAddress() external view returns (address);\\n\\n function treasuryPercent() external view returns (uint);\\n}\\n\",\"keccak256\":\"0x4f4965dd8614b455952a2ef186fd8a509affbc56078a4aa8702f46d4c8209793\"},\"contracts/Comptroller/ComptrollerLensInterface.sol\":{\"content\":\"pragma solidity ^0.5.16;\\npragma experimental ABIEncoderV2;\\n\\nimport \\\"../Tokens/VTokens/VToken.sol\\\";\\n\\ninterface ComptrollerLensInterface {\\n function liquidateCalculateSeizeTokens(\\n address comptroller,\\n address vTokenBorrowed,\\n address vTokenCollateral,\\n uint actualRepayAmount\\n ) external view returns (uint, uint);\\n\\n function liquidateVAICalculateSeizeTokens(\\n address comptroller,\\n address vTokenCollateral,\\n uint actualRepayAmount\\n ) external view returns (uint, uint);\\n\\n function getHypotheticalAccountLiquidity(\\n address comptroller,\\n address account,\\n VToken vTokenModify,\\n uint redeemTokens,\\n uint borrowAmount\\n ) external view returns (uint, uint, uint);\\n}\\n\",\"keccak256\":\"0xc824e034221740c1957891547c78a123b595017cf102629454a04d36637e9c4a\"},\"contracts/Comptroller/ComptrollerStorage.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-3-Clause\\n\\npragma solidity ^0.5.16;\\n\\nimport { VToken } from \\\"../Tokens/VTokens/VToken.sol\\\";\\nimport { PriceOracle } from \\\"../Oracle/PriceOracle.sol\\\";\\nimport { VAIControllerInterface } from \\\"../Tokens/VAI/VAIControllerInterface.sol\\\";\\nimport { ComptrollerLensInterface } from \\\"./ComptrollerLensInterface.sol\\\";\\nimport { IPrime } from \\\"../Tokens/Prime/IPrime.sol\\\";\\n\\ninterface ComptrollerTypes {\\n enum Action {\\n MINT,\\n REDEEM,\\n BORROW,\\n REPAY,\\n SEIZE,\\n LIQUIDATE,\\n TRANSFER,\\n ENTER_MARKET,\\n EXIT_MARKET\\n }\\n}\\n\\ncontract UnitrollerAdminStorage {\\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 Unitroller\\n */\\n address public comptrollerImplementation;\\n\\n /**\\n * @notice Pending brains of Unitroller\\n */\\n address public pendingComptrollerImplementation;\\n}\\n\\ncontract ComptrollerV1Storage is ComptrollerTypes, UnitrollerAdminStorage {\\n /**\\n * @notice Oracle which gives the price of any given asset\\n */\\n PriceOracle public oracle;\\n\\n /**\\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\\n */\\n uint256 public closeFactorMantissa;\\n\\n /**\\n * @notice Multiplier representing the discount on collateral that a liquidator receives\\n */\\n uint256 public liquidationIncentiveMantissa;\\n\\n /**\\n * @notice Max number of assets a single account can participate in (borrow or use as collateral)\\n */\\n uint256 public maxAssets;\\n\\n /**\\n * @notice Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\\n */\\n mapping(address => VToken[]) public accountAssets;\\n\\n struct Market {\\n /// @notice Whether or not this market is listed\\n bool isListed;\\n /**\\n * @notice Multiplier representing the most one can borrow against their collateral in this market.\\n * For instance, 0.9 to allow borrowing 90% of collateral value.\\n * Must be between 0 and 1, and stored as a mantissa.\\n */\\n uint256 collateralFactorMantissa;\\n /// @notice Per-market mapping of \\\"accounts in this asset\\\"\\n mapping(address => bool) accountMembership;\\n /// @notice Whether or not this market receives XVS\\n bool isVenus;\\n }\\n\\n /**\\n * @notice Official mapping of vTokens -> Market metadata\\n * @dev Used e.g. to determine if a market is supported\\n */\\n mapping(address => Market) public markets;\\n\\n /**\\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\\n */\\n address public pauseGuardian;\\n\\n /// @notice Whether minting is paused (deprecated, superseded by actionPaused)\\n bool private _mintGuardianPaused;\\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\\n bool private _borrowGuardianPaused;\\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\\n bool internal transferGuardianPaused;\\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\\n bool internal seizeGuardianPaused;\\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\\n mapping(address => bool) internal mintGuardianPaused;\\n /// @notice Whether borrowing is paused (deprecated, superseded by actionPaused)\\n mapping(address => bool) internal borrowGuardianPaused;\\n\\n struct VenusMarketState {\\n /// @notice The market's last updated venusBorrowIndex or venusSupplyIndex\\n uint224 index;\\n /// @notice The block number the index was last updated at\\n uint32 block;\\n }\\n\\n /// @notice A list of all markets\\n VToken[] public allMarkets;\\n\\n /// @notice The rate at which the flywheel distributes XVS, per block\\n uint256 internal venusRate;\\n\\n /// @notice The portion of venusRate that each market currently receives\\n mapping(address => uint256) internal venusSpeeds;\\n\\n /// @notice The Venus market supply state for each market\\n mapping(address => VenusMarketState) public venusSupplyState;\\n\\n /// @notice The Venus market borrow state for each market\\n mapping(address => VenusMarketState) public venusBorrowState;\\n\\n /// @notice The Venus supply index for each market for each supplier as of the last time they accrued XVS\\n mapping(address => mapping(address => uint256)) public venusSupplierIndex;\\n\\n /// @notice The Venus borrow index for each market for each borrower as of the last time they accrued XVS\\n mapping(address => mapping(address => uint256)) public venusBorrowerIndex;\\n\\n /// @notice The XVS accrued but not yet transferred to each user\\n mapping(address => uint256) public venusAccrued;\\n\\n /// @notice The Address of VAIController\\n VAIControllerInterface public vaiController;\\n\\n /// @notice The minted VAI amount to each user\\n mapping(address => uint256) public mintedVAIs;\\n\\n /// @notice VAI Mint Rate as a percentage\\n uint256 public vaiMintRate;\\n\\n /**\\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\\n */\\n bool public mintVAIGuardianPaused;\\n bool public repayVAIGuardianPaused;\\n\\n /**\\n * @notice Pause/Unpause whole protocol actions\\n */\\n bool public protocolPaused;\\n\\n /// @notice The rate at which the flywheel distributes XVS to VAI Minters, per block (deprecated)\\n uint256 private venusVAIRate;\\n}\\n\\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\\n /// @notice The rate at which the flywheel distributes XVS to VAI Vault, per block\\n uint256 public venusVAIVaultRate;\\n\\n // address of VAI Vault\\n address public vaiVaultAddress;\\n\\n // start block of release to VAI Vault\\n uint256 public releaseStartBlock;\\n\\n // minimum release amount to VAI Vault\\n uint256 public minReleaseAmount;\\n}\\n\\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\\n address public borrowCapGuardian;\\n\\n /// @notice Borrow caps enforced by borrowAllowed for each vToken address.\\n mapping(address => uint256) public borrowCaps;\\n}\\n\\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\\n /// @notice Treasury Guardian address\\n address public treasuryGuardian;\\n\\n /// @notice Treasury address\\n address public treasuryAddress;\\n\\n /// @notice Fee percent of accrued interest with decimal 18\\n uint256 public treasuryPercent;\\n}\\n\\ncontract ComptrollerV5Storage is ComptrollerV4Storage {\\n /// @notice The portion of XVS that each contributor receives per block (deprecated)\\n mapping(address => uint256) private venusContributorSpeeds;\\n\\n /// @notice Last block at which a contributor's XVS rewards have been allocated (deprecated)\\n mapping(address => uint256) private lastContributorBlock;\\n}\\n\\ncontract ComptrollerV6Storage is ComptrollerV5Storage {\\n address public liquidatorContract;\\n}\\n\\ncontract ComptrollerV7Storage is ComptrollerV6Storage {\\n ComptrollerLensInterface public comptrollerLens;\\n}\\n\\ncontract ComptrollerV8Storage is ComptrollerV7Storage {\\n /// @notice Supply caps enforced by mintAllowed for each vToken address. Defaults to zero which corresponds to minting notAllowed\\n mapping(address => uint256) public supplyCaps;\\n}\\n\\ncontract ComptrollerV9Storage is ComptrollerV8Storage {\\n /// @notice AccessControlManager address\\n address internal accessControl;\\n\\n /// @notice True if a certain action is paused on a certain market\\n mapping(address => mapping(uint256 => bool)) internal _actionPaused;\\n}\\n\\ncontract ComptrollerV10Storage is ComptrollerV9Storage {\\n /// @notice The rate at which venus is distributed to the corresponding borrow market (per block)\\n mapping(address => uint256) public venusBorrowSpeeds;\\n\\n /// @notice The rate at which venus is distributed to the corresponding supply market (per block)\\n mapping(address => uint256) public venusSupplySpeeds;\\n}\\n\\ncontract ComptrollerV11Storage is ComptrollerV10Storage {\\n /// @notice Whether the delegate is allowed to borrow or redeem on behalf of the user\\n //mapping(address user => mapping (address delegate => bool approved)) public approvedDelegates;\\n mapping(address => mapping(address => bool)) public approvedDelegates;\\n}\\n\\ncontract ComptrollerV12Storage is ComptrollerV11Storage {\\n /// @notice Whether forced liquidation is enabled for all users borrowing in a certain market\\n mapping(address => bool) public isForcedLiquidationEnabled;\\n}\\n\\ncontract ComptrollerV13Storage is ComptrollerV12Storage {\\n struct FacetAddressAndPosition {\\n address facetAddress;\\n uint96 functionSelectorPosition; // position in _facetFunctionSelectors.functionSelectors array\\n }\\n\\n struct FacetFunctionSelectors {\\n bytes4[] functionSelectors;\\n uint256 facetAddressPosition; // position of facetAddress in _facetAddresses array\\n }\\n\\n mapping(bytes4 => FacetAddressAndPosition) internal _selectorToFacetAndPosition;\\n // maps facet addresses to function selectors\\n mapping(address => FacetFunctionSelectors) internal _facetFunctionSelectors;\\n // facet addresses\\n address[] internal _facetAddresses;\\n}\\n\\ncontract ComptrollerV14Storage is ComptrollerV13Storage {\\n /// @notice Prime token address\\n IPrime public prime;\\n}\\n\\ncontract ComptrollerV15Storage is ComptrollerV14Storage {\\n /// @notice Whether forced liquidation is enabled for the borrows of a user in a market\\n mapping(address /* user */ => mapping(address /* market */ => bool)) public isForcedLiquidationEnabledForUser;\\n}\\n\\ncontract ComptrollerV16Storage is ComptrollerV15Storage {\\n /// @notice The XVS token contract address\\n address internal xvs;\\n\\n /// @notice The XVS vToken contract address\\n address internal xvsVToken;\\n}\\n\",\"keccak256\":\"0x06608bb502e91c33fda8c0dd88cc79a49a078fab521bc27d10fc3a69c1da55f4\"},\"contracts/InterestRateModels/InterestRateModel.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\n/**\\n * @title Venus's InterestRateModel Interface\\n * @author Venus\\n */\\ncontract InterestRateModel {\\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\\n bool public constant isInterestRateModel = true;\\n\\n /**\\n * @notice Calculates the current borrow interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amnount of reserves the market has\\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);\\n\\n /**\\n * @notice Calculates the current supply interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amnount of reserves the market has\\n * @param reserveFactorMantissa The current reserve factor the market has\\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint cash,\\n uint borrows,\\n uint reserves,\\n uint reserveFactorMantissa\\n ) external view returns (uint);\\n}\\n\",\"keccak256\":\"0x7896290ed5d98f1b744676c0cf5cb0bc656befdd8a79ae4cd2d9f90d83aaa52d\"},\"contracts/Oracle/PriceOracle.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"../Tokens/VTokens/VToken.sol\\\";\\n\\ncontract PriceOracle {\\n /// @notice Indicator that this is a PriceOracle contract (for inspection)\\n bool public constant isPriceOracle = true;\\n\\n /**\\n * @notice Get the underlying price of a vToken asset\\n * @param vToken The vToken to get the underlying price of\\n * @return The underlying asset price mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function getUnderlyingPrice(VToken vToken) external view returns (uint);\\n}\\n\",\"keccak256\":\"0x0f68d0e07decba8fb9a77df1659170f310b487cc0b650f53ca6aa55ed62b28de\"},\"contracts/Tokens/EIP20Interface.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\n/**\\n * @title BEP 20 Token Standard Interface\\n * https://eips.ethereum.org/EIPS/eip-20\\n */\\ninterface EIP20Interface {\\n function name() external view returns (string memory);\\n\\n function symbol() external view returns (string memory);\\n\\n function decimals() external view returns (uint8);\\n\\n /**\\n * @notice Get the total number of tokens in circulation\\n * @return The supply of tokens\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @notice Gets the balance of the specified address\\n * @param owner The address from which the balance will be retrieved\\n * @return balance\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n * @return success whether or not the transfer succeeded\\n */\\n function transfer(address dst, uint256 amount) external returns (bool success);\\n\\n /**\\n * @notice Transfer `amount` tokens from `src` to `dst`\\n * @param src The address of the source account\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n * @return success whether or not the transfer succeeded\\n */\\n function transferFrom(address src, address dst, uint256 amount) external returns (bool success);\\n\\n /**\\n * @notice Approve `spender` to transfer up to `amount` from `src`\\n * @dev This will overwrite the approval amount for `spender`\\n * @param spender The address of the account which may transfer tokens\\n * @param amount The number of tokens that are approved (-1 means infinite)\\n * @return success whether or not the approval succeeded\\n */\\n function approve(address spender, uint256 amount) external returns (bool success);\\n\\n /**\\n * @notice Get the current allowance from `owner` for `spender`\\n * @param owner The address of the account which owns the tokens to be spent\\n * @param spender The address of the account which may transfer tokens\\n * @return remaining The number of tokens allowed to be spent\\n */\\n function allowance(address owner, address spender) external view returns (uint256 remaining);\\n\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n}\\n\",\"keccak256\":\"0x7e89ffa9c0d432c4db8bd5388ff68e33934dcdb1d038d74bbed3b2fdae3eb532\"},\"contracts/Tokens/EIP20NonStandardInterface.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\n/**\\n * @title EIP20NonStandardInterface\\n * @dev Version of BEP20 with no return values for `transfer` and `transferFrom`\\n * See https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\\n */\\ninterface EIP20NonStandardInterface {\\n /**\\n * @notice Get the total number of tokens in circulation\\n * @return The supply of tokens\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @notice Gets the balance of the specified address\\n * @param owner The address from which the balance will be retrieved\\n * @return balance of the owner\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n ///\\n /// !!!!!!!!!!!!!!\\n /// !!! NOTICE !!! `transfer` does not return a value, in violation of the BEP-20 specification\\n /// !!!!!!!!!!!!!!\\n ///\\n\\n /**\\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n */\\n function transfer(address dst, uint256 amount) external;\\n\\n ///\\n /// !!!!!!!!!!!!!!\\n /// !!! NOTICE !!! `transferFrom` does not return a value, in violation of the BEP-20 specification\\n /// !!!!!!!!!!!!!!\\n ///\\n\\n /**\\n * @notice Transfer `amount` tokens from `src` to `dst`\\n * @param src The address of the source account\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n */\\n function transferFrom(address src, address dst, uint256 amount) external;\\n\\n /**\\n * @notice Approve `spender` to transfer up to `amount` from `src`\\n * @dev This will overwrite the approval amount for `spender`\\n * @param spender The address of the account which may transfer tokens\\n * @param amount The number of tokens that are approved\\n * @return success Whether or not the approval succeeded\\n */\\n function approve(address spender, uint256 amount) external returns (bool success);\\n\\n /**\\n * @notice Get the current allowance from `owner` for `spender`\\n * @param owner The address of the account which owns the tokens to be spent\\n * @param spender The address of the account which may transfer tokens\\n * @return remaining The number of tokens allowed to be spent\\n */\\n function allowance(address owner, address spender) external view returns (uint256 remaining);\\n\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n}\\n\",\"keccak256\":\"0x05a3a7d5ab47de3964c95d706dcc18fe7583b1d064dbb74808c0f2774f347afa\"},\"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\",\"keccak256\":\"0x58861c0c05b8757f1a5d50b107eff479c8680878e6aa51bc93af420caf73f500\"},\"contracts/Tokens/VAI/VAIControllerInterface.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport { VTokenInterface } from \\\"../VTokens/VTokenInterfaces.sol\\\";\\n\\ncontract VAIControllerInterface {\\n function mintVAI(uint256 mintVAIAmount) external returns (uint256);\\n\\n function repayVAI(uint256 amount) external returns (uint256, uint256);\\n\\n function repayVAIBehalf(address borrower, uint256 amount) external returns (uint256, uint256);\\n\\n function liquidateVAI(\\n address borrower,\\n uint256 repayAmount,\\n VTokenInterface vTokenCollateral\\n ) external returns (uint256, uint256);\\n\\n function getMintableVAI(address minter) external view returns (uint256, uint256);\\n\\n function getVAIAddress() external view returns (address);\\n\\n function getVAIRepayAmount(address account) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x1f020ff46cb0efa0ebf563f449fd4d8aa1c8b8ed53c46860d71a08548d7fdfaa\"},\"contracts/Tokens/VTokens/VBep20Delegator.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"./VTokenInterfaces.sol\\\";\\n\\n/**\\n * @title Venus's VBep20Delegator Contract\\n * @notice vTokens which wrap an EIP-20 underlying and delegate to an implementation\\n * @author Venus\\n */\\ncontract VBep20Delegator is VTokenInterface, VBep20Interface, VDelegatorInterface {\\n /**\\n * @notice Construct a new money market\\n * @param underlying_ The address of the underlying asset\\n * @param comptroller_ The address of the comptroller\\n * @param interestRateModel_ The address of the interest rate model\\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\\n * @param name_ BEP-20 name of this token\\n * @param symbol_ BEP-20 symbol of this token\\n * @param decimals_ BEP-20 decimal precision of this token\\n * @param admin_ Address of the administrator of this token\\n * @param implementation_ The address of the implementation the contract delegates to\\n * @param becomeImplementationData The encoded args for becomeImplementation\\n */\\n constructor(\\n address underlying_,\\n ComptrollerInterface comptroller_,\\n InterestRateModel interestRateModel_,\\n uint initialExchangeRateMantissa_,\\n string memory name_,\\n string memory symbol_,\\n uint8 decimals_,\\n address payable admin_,\\n address implementation_,\\n bytes memory becomeImplementationData\\n ) public {\\n // Creator of the contract is admin during initialization\\n admin = msg.sender;\\n\\n // First delegate gets to initialize the delegator (i.e. storage contract)\\n delegateTo(\\n implementation_,\\n abi.encodeWithSignature(\\n \\\"initialize(address,address,address,uint256,string,string,uint8)\\\",\\n underlying_,\\n comptroller_,\\n interestRateModel_,\\n initialExchangeRateMantissa_,\\n name_,\\n symbol_,\\n decimals_\\n )\\n );\\n\\n // New implementations always get set via the settor (post-initialize)\\n _setImplementation(implementation_, false, becomeImplementationData);\\n\\n // Set the proper admin now that initialization is done\\n admin = admin_;\\n }\\n\\n /**\\n * @notice Delegates execution to an implementation contract\\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\\n */\\n function() external payable {\\n require(msg.value == 0, \\\"VBep20Delegator:fallback: cannot send value to fallback\\\");\\n\\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 /**\\n * @notice Sender supplies assets into the market and receives vTokens in exchange\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param mintAmount The amount of the underlying asset to supply\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function mint(uint mintAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"mint(uint256)\\\", mintAmount));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Sender supplies assets into the market and receiver receives vTokens in exchange\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param mintAmount The amount of the underlying asset to supply\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function mintBehalf(address receiver, uint mintAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"mintBehalf(address,uint256)\\\", receiver, mintAmount)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Sender redeems vTokens in exchange for the underlying asset\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param redeemTokens The number of vTokens to redeem into underlying asset\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function redeem(uint redeemTokens) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"redeem(uint256)\\\", redeemTokens));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Sender redeems vTokens in exchange for a specified amount of underlying asset\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param redeemAmount The amount of underlying to redeem\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function redeemUnderlying(uint redeemAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"redeemUnderlying(uint256)\\\", redeemAmount)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Sender borrows assets from the protocol to their own address\\n * @param borrowAmount The amount of the underlying asset to borrow\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function borrow(uint borrowAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"borrow(uint256)\\\", borrowAmount));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Sender repays their own borrow\\n * @param repayAmount The amount to repay\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function repayBorrow(uint repayAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"repayBorrow(uint256)\\\", repayAmount));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Sender repays a borrow belonging to another borrower\\n * @param borrower The account with the debt being payed off\\n * @param repayAmount The amount to repay\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"repayBorrowBehalf(address,uint256)\\\", borrower, repayAmount)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice The sender liquidates the borrowers collateral.\\n * The collateral seized is transferred to the liquidator.\\n * @param borrower The borrower of this vToken to be liquidated\\n * @param vTokenCollateral The market in which to seize collateral from the borrower\\n * @param repayAmount The amount of the underlying borrowed asset to repay\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function liquidateBorrow(\\n address borrower,\\n uint repayAmount,\\n VTokenInterface vTokenCollateral\\n ) external returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"liquidateBorrow(address,uint256,address)\\\", borrower, repayAmount, vTokenCollateral)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n function transfer(address dst, uint amount) external returns (bool) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"transfer(address,uint256)\\\", dst, amount));\\n return abi.decode(data, (bool));\\n }\\n\\n /**\\n * @notice Transfer `amount` tokens from `src` to `dst`\\n * @param src The address of the source account\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n function transferFrom(address src, address dst, uint256 amount) external returns (bool) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"transferFrom(address,address,uint256)\\\", src, dst, amount)\\n );\\n return abi.decode(data, (bool));\\n }\\n\\n /**\\n * @notice Approve `spender` to transfer up to `amount` from `src`\\n * @dev This will overwrite the approval amount for `spender`\\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\\n * @param spender The address of the account which may transfer tokens\\n * @param amount The number of tokens that are approved (-1 means infinite)\\n * @return Whether or not the approval succeeded\\n */\\n function approve(address spender, uint256 amount) external returns (bool) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"approve(address,uint256)\\\", spender, amount)\\n );\\n return abi.decode(data, (bool));\\n }\\n\\n /**\\n * @notice Get the underlying balance of the `owner`\\n * @dev This also accrues interest in a transaction\\n * @param owner The address of the account to query\\n * @return The amount of underlying owned by `owner`\\n */\\n function balanceOfUnderlying(address owner) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"balanceOfUnderlying(address)\\\", owner));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Returns the current total borrows plus accrued interest\\n * @return The total borrows with interest\\n */\\n function totalBorrowsCurrent() external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"totalBorrowsCurrent()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex\\n * @param account The address whose balance should be calculated after updating borrowIndex\\n * @return The calculated balance\\n */\\n function borrowBalanceCurrent(address account) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"borrowBalanceCurrent(address)\\\", account));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Transfers collateral tokens (this market) to the liquidator.\\n * @dev Will fail unless called by another vToken during the process of liquidation.\\n * It's absolutely critical to use msg.sender as the borrowed vToken and not a parameter.\\n * @param liquidator The account receiving seized collateral\\n * @param borrower The account having collateral seized\\n * @param seizeTokens The number of vTokens to seize\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function seize(address liquidator, address borrower, uint seizeTokens) external returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"seize(address,address,uint256)\\\", liquidator, borrower, seizeTokens)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /*** Admin Functions ***/\\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _setPendingAdmin(address payable newPendingAdmin) external returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"_setPendingAdmin(address)\\\", newPendingAdmin)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh\\n * @dev Admin function to accrue interest and set a new reserve factor\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _setReserveFactor(uint newReserveFactorMantissa) external returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"_setReserveFactor(uint256)\\\", newReserveFactorMantissa)\\n );\\n return abi.decode(data, (uint));\\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _acceptAdmin() external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"_acceptAdmin()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Accrues interest and adds reserves by transferring from admin\\n * @param addAmount Amount of reserves to add\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _addReserves(uint addAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"_addReserves(uint256)\\\", addAmount));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Accrues interest and reduces reserves by transferring to admin\\n * @param reduceAmount Amount of reduction to reserves\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _reduceReserves(uint reduceAmount) external returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"_reduceReserves(uint256)\\\", reduceAmount));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Get cash balance of this vToken in the underlying asset\\n * @return The quantity of underlying asset owned by this contract\\n */\\n function getCash() external view returns (uint) {\\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\\\"getCash()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Get the current allowance from `owner` for `spender`\\n * @param owner The address of the account which owns the tokens to be spent\\n * @param spender The address of the account which may transfer tokens\\n * @return The number of tokens allowed to be spent (-1 means infinite)\\n */\\n function allowance(address owner, address spender) external view returns (uint) {\\n bytes memory data = delegateToViewImplementation(\\n abi.encodeWithSignature(\\\"allowance(address,address)\\\", owner, spender)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Get the token balance of the `owner`\\n * @param owner The address of the account to query\\n * @return The number of tokens owned by `owner`\\n */\\n function balanceOf(address owner) external view returns (uint) {\\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\\\"balanceOf(address)\\\", owner));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Get a snapshot of the account's balances and the cached exchange rate\\n * @dev This is used by comptroller to more efficiently perform liquidity checks.\\n * @param account Address of the account to snapshot\\n * @return (possible error, token balance, borrow balance, exchange rate mantissa)\\n */\\n function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) {\\n bytes memory data = delegateToViewImplementation(\\n abi.encodeWithSignature(\\\"getAccountSnapshot(address)\\\", account)\\n );\\n return abi.decode(data, (uint, uint, uint, uint));\\n }\\n\\n /**\\n * @notice Returns the current per-block borrow interest rate for this vToken\\n * @return The borrow interest rate per block, scaled by 1e18\\n */\\n function borrowRatePerBlock() external view returns (uint) {\\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\\\"borrowRatePerBlock()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Returns the current per-block supply interest rate for this vToken\\n * @return The supply interest rate per block, scaled by 1e18\\n */\\n function supplyRatePerBlock() external view returns (uint) {\\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\\\"supplyRatePerBlock()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Called by the admin to update the implementation of the delegator\\n * @param implementation_ The address of the new implementation for delegation\\n * @param allowResign Flag to indicate whether to call _resignImplementation on the old implementation\\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\\n */\\n // @custom:access Only callable by admin\\n function _setImplementation(\\n address implementation_,\\n bool allowResign,\\n bytes memory becomeImplementationData\\n ) public {\\n require(msg.sender == admin, \\\"VBep20Delegator::_setImplementation: Caller must be admin\\\");\\n\\n if (allowResign) {\\n delegateToImplementation(abi.encodeWithSignature(\\\"_resignImplementation()\\\"));\\n }\\n\\n address oldImplementation = implementation;\\n implementation = implementation_;\\n\\n delegateToImplementation(abi.encodeWithSignature(\\\"_becomeImplementation(bytes)\\\", becomeImplementationData));\\n\\n emit NewImplementation(oldImplementation, implementation);\\n }\\n\\n /**\\n * @notice Accrue interest then return the up-to-date exchange rate\\n * @return Calculated exchange rate scaled by 1e18\\n */\\n function exchangeRateCurrent() public returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"exchangeRateCurrent()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Applies accrued interest to total borrows and reserves.\\n * @dev This calculates interest accrued from the last checkpointed block\\n * up to the current block and writes new checkpoint to storage.\\n */\\n function accrueInterest() public returns (uint) {\\n bytes memory data = delegateToImplementation(abi.encodeWithSignature(\\\"accrueInterest()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Sets a new comptroller for the market\\n * @dev Admin function to set a new comptroller\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"_setComptroller(address)\\\", newComptroller)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Accrues interest and updates the interest rate model using `_setInterestRateModelFresh`\\n * @dev Admin function to accrue interest and update the interest rate model\\n * @param newInterestRateModel The new interest rate model to use\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _setInterestRateModel(InterestRateModel newInterestRateModel) public returns (uint) {\\n bytes memory data = delegateToImplementation(\\n abi.encodeWithSignature(\\\"_setInterestRateModel(address)\\\", newInterestRateModel)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Delegates execution to the implementation contract\\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\\n * @param data The raw data to delegatecall\\n * @return The returned bytes from the delegatecall\\n */\\n function delegateToImplementation(bytes memory data) public returns (bytes memory) {\\n return delegateTo(implementation, data);\\n }\\n\\n /**\\n * @notice Delegates execution to an implementation contract\\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\\n * There are an additional 2 prefix uints from the wrapper returndata, which we ignore since we make an extra hop.\\n * @param data The raw data to delegatecall\\n * @return The returned bytes from the delegatecall\\n */\\n function delegateToViewImplementation(bytes memory data) public view returns (bytes memory) {\\n (bool success, bytes memory returnData) = address(this).staticcall(\\n abi.encodeWithSignature(\\\"delegateToImplementation(bytes)\\\", data)\\n );\\n assembly {\\n if eq(success, 0) {\\n revert(add(returnData, 0x20), returndatasize)\\n }\\n }\\n return abi.decode(returnData, (bytes));\\n }\\n\\n /**\\n * @notice Return the borrow balance of account based on stored data\\n * @param account The address whose balance should be calculated\\n * @return The calculated balance\\n */\\n function borrowBalanceStored(address account) public view returns (uint) {\\n bytes memory data = delegateToViewImplementation(\\n abi.encodeWithSignature(\\\"borrowBalanceStored(address)\\\", account)\\n );\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Calculates the exchange rate from the underlying to the VToken\\n * @dev This function does not accrue interest before calculating the exchange rate\\n * @return Calculated exchange rate scaled by 1e18\\n */\\n function exchangeRateStored() public view returns (uint) {\\n bytes memory data = delegateToViewImplementation(abi.encodeWithSignature(\\\"exchangeRateStored()\\\"));\\n return abi.decode(data, (uint));\\n }\\n\\n /**\\n * @notice Internal method to delegate execution to another contract\\n * @dev It returns to the external caller whatever the implementation returns or forwards reverts\\n * @param callee The contract to delegatecall\\n * @param data The raw data to delegatecall\\n * @return The returned bytes from the delegatecall\\n */\\n function delegateTo(address callee, bytes memory data) internal returns (bytes memory) {\\n (bool success, bytes memory returnData) = callee.delegatecall(data);\\n assembly {\\n if eq(success, 0) {\\n revert(add(returnData, 0x20), returndatasize)\\n }\\n }\\n return returnData;\\n }\\n}\\n\",\"keccak256\":\"0xfb7ad07b6ca2171914cef37d02fb97e6e55f4f0935c5c5cba33ab31f3613bce9\"},\"contracts/Tokens/VTokens/VToken.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"../../Comptroller/ComptrollerInterface.sol\\\";\\nimport \\\"../../Utils/ErrorReporter.sol\\\";\\nimport \\\"../../Utils/Exponential.sol\\\";\\nimport \\\"../../Tokens/EIP20Interface.sol\\\";\\nimport \\\"../../Tokens/EIP20NonStandardInterface.sol\\\";\\nimport \\\"../../InterestRateModels/InterestRateModel.sol\\\";\\nimport \\\"./VTokenInterfaces.sol\\\";\\nimport { IAccessControlManagerV5 } from \\\"@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV5.sol\\\";\\n\\n/**\\n * @title Venus's vToken Contract\\n * @notice Abstract base for vTokens\\n * @author Venus\\n */\\ncontract VToken is VTokenInterface, Exponential, TokenErrorReporter {\\n struct MintLocalVars {\\n MathError mathErr;\\n uint exchangeRateMantissa;\\n uint mintTokens;\\n uint totalSupplyNew;\\n uint accountTokensNew;\\n uint actualMintAmount;\\n }\\n\\n struct RedeemLocalVars {\\n MathError mathErr;\\n uint exchangeRateMantissa;\\n uint redeemTokens;\\n uint redeemAmount;\\n uint totalSupplyNew;\\n uint accountTokensNew;\\n }\\n\\n struct BorrowLocalVars {\\n MathError mathErr;\\n uint accountBorrows;\\n uint accountBorrowsNew;\\n uint totalBorrowsNew;\\n }\\n\\n struct RepayBorrowLocalVars {\\n Error err;\\n MathError mathErr;\\n uint repayAmount;\\n uint borrowerIndex;\\n uint accountBorrows;\\n uint accountBorrowsNew;\\n uint totalBorrowsNew;\\n uint actualRepayAmount;\\n }\\n\\n /*** Reentrancy Guard ***/\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n */\\n modifier nonReentrant() {\\n require(_notEntered, \\\"re-entered\\\");\\n _notEntered = false;\\n _;\\n _notEntered = true; // get a gas-refund post-Istanbul\\n }\\n\\n /**\\n * @notice Transfer `amount` tokens from `msg.sender` to `dst`\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n // @custom:event Emits Transfer event\\n function transfer(address dst, uint256 amount) external nonReentrant returns (bool) {\\n return transferTokens(msg.sender, msg.sender, dst, amount) == uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Transfer `amount` tokens from `src` to `dst`\\n * @param src The address of the source account\\n * @param dst The address of the destination account\\n * @param amount The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n // @custom:event Emits Transfer event\\n function transferFrom(address src, address dst, uint256 amount) external nonReentrant returns (bool) {\\n return transferTokens(msg.sender, src, dst, amount) == uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Approve `spender` to transfer up to `amount` from `src`\\n * @dev This will overwrite the approval amount for `spender`\\n * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\\n * @param spender The address of the account which may transfer tokens\\n * @param amount The number of tokens that are approved (-1 means infinite)\\n * @return Whether or not the approval succeeded\\n */\\n // @custom:event Emits Approval event on successful approve\\n function approve(address spender, uint256 amount) external returns (bool) {\\n transferAllowances[msg.sender][spender] = amount;\\n emit Approval(msg.sender, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @notice Get the underlying balance of the `owner`\\n * @dev This also accrues interest in a transaction\\n * @param owner The address of the account to query\\n * @return The amount of underlying owned by `owner`\\n */\\n function balanceOfUnderlying(address owner) external returns (uint) {\\n Exp memory exchangeRate = Exp({ mantissa: exchangeRateCurrent() });\\n (MathError mErr, uint balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]);\\n ensureNoMathError(mErr);\\n return balance;\\n }\\n\\n /**\\n * @notice Returns the current total borrows plus accrued interest\\n * @return The total borrows with interest\\n */\\n function totalBorrowsCurrent() external nonReentrant returns (uint) {\\n require(accrueInterest() == uint(Error.NO_ERROR), \\\"accrue interest failed\\\");\\n return totalBorrows;\\n }\\n\\n /**\\n * @notice Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex\\n * @param account The address whose balance should be calculated after updating borrowIndex\\n * @return The calculated balance\\n */\\n function borrowBalanceCurrent(address account) external nonReentrant returns (uint) {\\n require(accrueInterest() == uint(Error.NO_ERROR), \\\"accrue interest failed\\\");\\n return borrowBalanceStored(account);\\n }\\n\\n /**\\n * @notice Transfers collateral tokens (this market) to the liquidator.\\n * @dev Will fail unless called by another vToken during the process of liquidation.\\n * Its absolutely critical to use msg.sender as the borrowed vToken and not a parameter.\\n * @param liquidator The account receiving seized collateral\\n * @param borrower The account having collateral seized\\n * @param seizeTokens The number of vTokens to seize\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n // @custom:event Emits Transfer event\\n function seize(address liquidator, address borrower, uint seizeTokens) external nonReentrant returns (uint) {\\n return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);\\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n // @custom:event Emits NewPendingAdmin event with old and new admin addresses\\n function _setPendingAdmin(address payable newPendingAdmin) external returns (uint) {\\n // Check caller = admin\\n ensureAdmin(msg.sender);\\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 Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n // @custom:event Emits NewAdmin event on successful acceptance\\n // @custom:event Emits NewPendingAdmin event with null new pending admin\\n function _acceptAdmin() external 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 * @notice accrues interest and sets a new reserve factor for the protocol using `_setReserveFactorFresh`\\n * @dev Governor function to accrue interest and set a new reserve factor\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n // @custom:event Emits NewReserveFactor event\\n function _setReserveFactor(uint newReserveFactorMantissa_) external nonReentrant returns (uint) {\\n ensureAllowed(\\\"_setReserveFactor(uint256)\\\");\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reserve factor change failed.\\n return fail(Error(error), FailureInfo.SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED);\\n }\\n // _setReserveFactorFresh emits reserve-factor-specific logs on errors, so we don't need to.\\n return _setReserveFactorFresh(newReserveFactorMantissa_);\\n }\\n\\n /**\\n * @notice Sets the address of the access control manager of this contract\\n * @dev Admin function to set the access control address\\n * @param newAccessControlManagerAddress New address for the access control\\n * @return uint 0=success, otherwise will revert\\n */\\n function setAccessControlManager(address newAccessControlManagerAddress) external returns (uint) {\\n // Check caller is admin\\n ensureAdmin(msg.sender);\\n\\n ensureNonZeroAddress(newAccessControlManagerAddress);\\n\\n emit NewAccessControlManager(accessControlManager, newAccessControlManagerAddress);\\n accessControlManager = newAccessControlManagerAddress;\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Accrues interest and reduces reserves by transferring to protocol share reserve\\n * @param reduceAmount_ Amount of reduction to reserves\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n // @custom:event Emits ReservesReduced event\\n function _reduceReserves(uint reduceAmount_) external nonReentrant returns (uint) {\\n ensureAllowed(\\\"_reduceReserves(uint256)\\\");\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed.\\n return fail(Error(error), FailureInfo.REDUCE_RESERVES_ACCRUE_INTEREST_FAILED);\\n }\\n\\n // If reserves were reduced in accrueInterest\\n if (reduceReservesBlockNumber == block.number) return (uint(Error.NO_ERROR));\\n // _reduceReservesFresh emits reserve-reduction-specific logs on errors, so we don't need to.\\n return _reduceReservesFresh(reduceAmount_);\\n }\\n\\n /**\\n * @notice Get the current allowance from `owner` for `spender`\\n * @param owner The address of the account which owns the tokens to be spent\\n * @param spender The address of the account which may transfer tokens\\n * @return The number of tokens allowed to be spent (-1 means infinite)\\n */\\n function allowance(address owner, address spender) external view returns (uint256) {\\n return transferAllowances[owner][spender];\\n }\\n\\n /**\\n * @notice Get the token balance of the `owner`\\n * @param owner The address of the account to query\\n * @return The number of tokens owned by `owner`\\n */\\n function balanceOf(address owner) external view returns (uint256) {\\n return accountTokens[owner];\\n }\\n\\n /**\\n * @notice Get a snapshot of the account's balances, and the cached exchange rate\\n * @dev This is used by comptroller to more efficiently perform liquidity checks.\\n * @param account Address of the account to snapshot\\n * @return (possible error, token balance, borrow balance, exchange rate mantissa)\\n */\\n function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) {\\n uint vTokenBalance = accountTokens[account];\\n uint borrowBalance;\\n uint exchangeRateMantissa;\\n\\n MathError mErr;\\n\\n (mErr, borrowBalance) = borrowBalanceStoredInternal(account);\\n if (mErr != MathError.NO_ERROR) {\\n return (uint(Error.MATH_ERROR), 0, 0, 0);\\n }\\n\\n (mErr, exchangeRateMantissa) = exchangeRateStoredInternal();\\n if (mErr != MathError.NO_ERROR) {\\n return (uint(Error.MATH_ERROR), 0, 0, 0);\\n }\\n\\n return (uint(Error.NO_ERROR), vTokenBalance, borrowBalance, exchangeRateMantissa);\\n }\\n\\n /**\\n * @notice Returns the current per-block supply interest rate for this vToken\\n * @return The supply interest rate per block, scaled by 1e18\\n */\\n function supplyRatePerBlock() external view returns (uint) {\\n return interestRateModel.getSupplyRate(getCashPrior(), totalBorrows, totalReserves, reserveFactorMantissa);\\n }\\n\\n /**\\n * @notice Returns the current per-block borrow interest rate for this vToken\\n * @return The borrow interest rate per block, scaled by 1e18\\n */\\n function borrowRatePerBlock() external view returns (uint) {\\n return interestRateModel.getBorrowRate(getCashPrior(), totalBorrows, totalReserves);\\n }\\n\\n /**\\n * @notice Get cash balance of this vToken in the underlying asset\\n * @return The quantity of underlying asset owned by this contract\\n */\\n function getCash() external view returns (uint) {\\n return getCashPrior();\\n }\\n\\n /**\\n * @notice Governance function to set new threshold of block difference after which funds will be sent to the protocol share reserve\\n * @param newReduceReservesBlockDelta_ block difference value\\n */\\n function setReduceReservesBlockDelta(uint256 newReduceReservesBlockDelta_) external {\\n require(newReduceReservesBlockDelta_ > 0, \\\"Invalid Input\\\");\\n ensureAllowed(\\\"setReduceReservesBlockDelta(uint256)\\\");\\n emit NewReduceReservesBlockDelta(reduceReservesBlockDelta, newReduceReservesBlockDelta_);\\n reduceReservesBlockDelta = newReduceReservesBlockDelta_;\\n }\\n\\n /**\\n * @notice Sets protocol share reserve contract address\\n * @param protcolShareReserve_ The address of protocol share reserve contract\\n */\\n function setProtocolShareReserve(address payable protcolShareReserve_) external {\\n // Check caller is admin\\n ensureAdmin(msg.sender);\\n ensureNonZeroAddress(protcolShareReserve_);\\n emit NewProtocolShareReserve(protocolShareReserve, protcolShareReserve_);\\n protocolShareReserve = protcolShareReserve_;\\n }\\n\\n /**\\n * @notice Initialize the money market\\n * @param comptroller_ The address of the Comptroller\\n * @param interestRateModel_ The address of the interest rate model\\n * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\\n * @param name_ EIP-20 name of this token\\n * @param symbol_ EIP-20 symbol of this token\\n * @param decimals_ EIP-20 decimal precision of this token\\n */\\n function initialize(\\n ComptrollerInterface comptroller_,\\n InterestRateModel interestRateModel_,\\n uint initialExchangeRateMantissa_,\\n string memory name_,\\n string memory symbol_,\\n uint8 decimals_\\n ) public {\\n ensureAdmin(msg.sender);\\n require(accrualBlockNumber == 0 && borrowIndex == 0, \\\"market may only be initialized once\\\");\\n\\n // Set initial exchange rate\\n initialExchangeRateMantissa = initialExchangeRateMantissa_;\\n require(initialExchangeRateMantissa > 0, \\\"initial exchange rate must be greater than zero.\\\");\\n\\n // Set the comptroller\\n uint err = _setComptroller(comptroller_);\\n require(err == uint(Error.NO_ERROR), \\\"setting comptroller failed\\\");\\n\\n // Initialize block number and borrow index (block number mocks depend on comptroller being set)\\n accrualBlockNumber = block.number;\\n borrowIndex = mantissaOne;\\n\\n // Set the interest rate model (depends on block number / borrow index)\\n err = _setInterestRateModelFresh(interestRateModel_);\\n require(err == uint(Error.NO_ERROR), \\\"setting interest rate model failed\\\");\\n\\n name = name_;\\n symbol = symbol_;\\n decimals = decimals_;\\n\\n // The counter starts true to prevent changing it from zero to non-zero (i.e. smaller cost/refund)\\n _notEntered = true;\\n }\\n\\n /**\\n * @notice Accrue interest then return the up-to-date exchange rate\\n * @return Calculated exchange rate scaled by 1e18\\n */\\n function exchangeRateCurrent() public nonReentrant returns (uint) {\\n require(accrueInterest() == uint(Error.NO_ERROR), \\\"accrue interest failed\\\");\\n return exchangeRateStored();\\n }\\n\\n /**\\n * @notice Applies accrued interest to total borrows and reserves\\n * @dev This calculates interest accrued from the last checkpointed block\\n * up to the current block and writes new checkpoint to storage and\\n * reduce spread reserves to protocol share reserve\\n * if currentBlock - reduceReservesBlockNumber >= blockDelta\\n */\\n // @custom:event Emits AccrueInterest event\\n function accrueInterest() public returns (uint) {\\n /* Remember the initial block number */\\n uint currentBlockNumber = block.number;\\n uint accrualBlockNumberPrior = accrualBlockNumber;\\n\\n /* Short-circuit accumulating 0 interest */\\n if (accrualBlockNumberPrior == currentBlockNumber) {\\n return uint(Error.NO_ERROR);\\n }\\n\\n /* Read the previous values out of storage */\\n uint cashPrior = getCashPrior();\\n uint borrowsPrior = totalBorrows;\\n uint reservesPrior = totalReserves;\\n uint borrowIndexPrior = borrowIndex;\\n\\n /* Calculate the current borrow interest rate */\\n uint borrowRateMantissa = interestRateModel.getBorrowRate(cashPrior, borrowsPrior, reservesPrior);\\n require(borrowRateMantissa <= borrowRateMaxMantissa, \\\"borrow rate is absurdly high\\\");\\n\\n /* Calculate the number of blocks elapsed since the last accrual */\\n (MathError mathErr, uint blockDelta) = subUInt(currentBlockNumber, accrualBlockNumberPrior);\\n ensureNoMathError(mathErr);\\n\\n /*\\n * Calculate the interest accumulated into borrows and reserves and the new index:\\n * simpleInterestFactor = borrowRate * blockDelta\\n * interestAccumulated = simpleInterestFactor * totalBorrows\\n * totalBorrowsNew = interestAccumulated + totalBorrows\\n * totalReservesNew = interestAccumulated * reserveFactor + totalReserves\\n * borrowIndexNew = simpleInterestFactor * borrowIndex + borrowIndex\\n */\\n\\n Exp memory simpleInterestFactor;\\n uint interestAccumulated;\\n uint totalBorrowsNew;\\n uint totalReservesNew;\\n uint borrowIndexNew;\\n\\n (mathErr, simpleInterestFactor) = mulScalar(Exp({ mantissa: borrowRateMantissa }), blockDelta);\\n if (mathErr != MathError.NO_ERROR) {\\n return\\n failOpaque(\\n Error.MATH_ERROR,\\n FailureInfo.ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\\n uint(mathErr)\\n );\\n }\\n\\n (mathErr, interestAccumulated) = mulScalarTruncate(simpleInterestFactor, borrowsPrior);\\n if (mathErr != MathError.NO_ERROR) {\\n return\\n failOpaque(\\n Error.MATH_ERROR,\\n FailureInfo.ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\\n uint(mathErr)\\n );\\n }\\n\\n (mathErr, totalBorrowsNew) = addUInt(interestAccumulated, borrowsPrior);\\n if (mathErr != MathError.NO_ERROR) {\\n return\\n failOpaque(\\n Error.MATH_ERROR,\\n FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\\n uint(mathErr)\\n );\\n }\\n\\n (mathErr, totalReservesNew) = mulScalarTruncateAddUInt(\\n Exp({ mantissa: reserveFactorMantissa }),\\n interestAccumulated,\\n reservesPrior\\n );\\n if (mathErr != MathError.NO_ERROR) {\\n return\\n failOpaque(\\n Error.MATH_ERROR,\\n FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\\n uint(mathErr)\\n );\\n }\\n\\n (mathErr, borrowIndexNew) = mulScalarTruncateAddUInt(simpleInterestFactor, borrowIndexPrior, borrowIndexPrior);\\n if (mathErr != MathError.NO_ERROR) {\\n return\\n failOpaque(\\n Error.MATH_ERROR,\\n FailureInfo.ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\\n uint(mathErr)\\n );\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /* We write the previously calculated values into storage */\\n accrualBlockNumber = currentBlockNumber;\\n borrowIndex = borrowIndexNew;\\n totalBorrows = totalBorrowsNew;\\n totalReserves = totalReservesNew;\\n\\n (mathErr, blockDelta) = subUInt(currentBlockNumber, reduceReservesBlockNumber);\\n ensureNoMathError(mathErr);\\n if (blockDelta >= reduceReservesBlockDelta) {\\n reduceReservesBlockNumber = currentBlockNumber;\\n if (cashPrior < totalReservesNew) {\\n _reduceReservesFresh(cashPrior);\\n } else {\\n _reduceReservesFresh(totalReservesNew);\\n }\\n }\\n\\n /* We emit an AccrueInterest event */\\n emit AccrueInterest(cashPrior, interestAccumulated, borrowIndexNew, totalBorrowsNew);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets a new comptroller for the market\\n * @dev Admin function to set a new comptroller\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n // @custom:event Emits NewComptroller event\\n function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) {\\n // Check caller is admin\\n ensureAdmin(msg.sender);\\n\\n ComptrollerInterface oldComptroller = comptroller;\\n // Ensure invoke comptroller.isComptroller() returns true\\n require(newComptroller.isComptroller(), \\\"marker method returned false\\\");\\n\\n // Set market's comptroller to newComptroller\\n comptroller = newComptroller;\\n\\n // Emit NewComptroller(oldComptroller, newComptroller)\\n emit NewComptroller(oldComptroller, newComptroller);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Accrues interest and updates the interest rate model using _setInterestRateModelFresh\\n * @dev Governance function to accrue interest and update the interest rate model\\n * @param newInterestRateModel_ The new interest rate model to use\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _setInterestRateModel(InterestRateModel newInterestRateModel_) public returns (uint) {\\n ensureAllowed(\\\"_setInterestRateModel(address)\\\");\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted change of interest rate model failed\\n return fail(Error(error), FailureInfo.SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED);\\n }\\n // _setInterestRateModelFresh emits interest-rate-model-update-specific logs on errors, so we don't need to.\\n return _setInterestRateModelFresh(newInterestRateModel_);\\n }\\n\\n /**\\n * @notice Calculates the exchange rate from the underlying to the VToken\\n * @dev This function does not accrue interest before calculating the exchange rate\\n * @return Calculated exchange rate scaled by 1e18\\n */\\n function exchangeRateStored() public view returns (uint) {\\n (MathError err, uint result) = exchangeRateStoredInternal();\\n ensureNoMathError(err);\\n return result;\\n }\\n\\n /**\\n * @notice Return the borrow balance of account based on stored data\\n * @param account The address whose balance should be calculated\\n * @return The calculated balance\\n */\\n function borrowBalanceStored(address account) public view returns (uint) {\\n (MathError err, uint result) = borrowBalanceStoredInternal(account);\\n ensureNoMathError(err);\\n return result;\\n }\\n\\n /**\\n * @notice Transfers `tokens` tokens from `src` to `dst` by `spender`\\n * @dev Called by both `transfer` and `transferFrom` internally\\n * @param spender The address of the account performing the transfer\\n * @param src The address of the source account\\n * @param dst The address of the destination account\\n * @param tokens The number of tokens to transfer\\n * @return Whether or not the transfer succeeded\\n */\\n function transferTokens(address spender, address src, address dst, uint tokens) internal returns (uint) {\\n /* Fail if transfer not allowed */\\n uint allowed = comptroller.transferAllowed(address(this), src, dst, tokens);\\n if (allowed != 0) {\\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.TRANSFER_COMPTROLLER_REJECTION, allowed);\\n }\\n\\n /* Do not allow self-transfers */\\n if (src == dst) {\\n return fail(Error.BAD_INPUT, FailureInfo.TRANSFER_NOT_ALLOWED);\\n }\\n\\n /* Get the allowance, infinite for the account owner */\\n uint startingAllowance = 0;\\n if (spender == src) {\\n startingAllowance = uint(-1);\\n } else {\\n startingAllowance = transferAllowances[src][spender];\\n }\\n\\n /* Do the calculations, checking for {under,over}flow */\\n MathError mathErr;\\n uint allowanceNew;\\n uint srvTokensNew;\\n uint dstTokensNew;\\n\\n (mathErr, allowanceNew) = subUInt(startingAllowance, tokens);\\n if (mathErr != MathError.NO_ERROR) {\\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ALLOWED);\\n }\\n\\n (mathErr, srvTokensNew) = subUInt(accountTokens[src], tokens);\\n if (mathErr != MathError.NO_ERROR) {\\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ENOUGH);\\n }\\n\\n (mathErr, dstTokensNew) = addUInt(accountTokens[dst], tokens);\\n if (mathErr != MathError.NO_ERROR) {\\n return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_TOO_MUCH);\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n accountTokens[src] = srvTokensNew;\\n accountTokens[dst] = dstTokensNew;\\n\\n /* Eat some of the allowance (if necessary) */\\n if (startingAllowance != uint(-1)) {\\n transferAllowances[src][spender] = allowanceNew;\\n }\\n\\n /* We emit a Transfer event */\\n emit Transfer(src, dst, tokens);\\n\\n comptroller.transferVerify(address(this), src, dst, tokens);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sender supplies assets into the market and receives vTokens in exchange\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param mintAmount The amount of the underlying asset to supply\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\\n */\\n function mintInternal(uint mintAmount) internal nonReentrant returns (uint, uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted mint failed\\n return (fail(Error(error), FailureInfo.MINT_ACCRUE_INTEREST_FAILED), 0);\\n }\\n // mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to\\n return mintFresh(msg.sender, mintAmount);\\n }\\n\\n /**\\n * @notice User supplies assets into the market and receives vTokens in exchange\\n * @dev Assumes interest has already been accrued up to the current block\\n * @param minter The address of the account which is supplying the assets\\n * @param mintAmount The amount of the underlying asset to supply\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\\n */\\n function mintFresh(address minter, uint mintAmount) internal returns (uint, uint) {\\n /* Fail if mint not allowed */\\n uint allowed = comptroller.mintAllowed(address(this), minter, mintAmount);\\n if (allowed != 0) {\\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\\n }\\n\\n /* Verify market's block number equals current block number */\\n if (accrualBlockNumber != block.number) {\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\\n }\\n\\n MintLocalVars memory vars;\\n\\n (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();\\n if (vars.mathErr != MathError.NO_ERROR) {\\n return (failOpaque(Error.MATH_ERROR, FailureInfo.MINT_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr)), 0);\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /*\\n * We call `doTransferIn` for the minter and the mintAmount.\\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\\n * side-effects occurred. The function returns the amount actually transferred,\\n * in case of a fee. On success, the vToken holds an additional `actualMintAmount`\\n * of cash.\\n */\\n vars.actualMintAmount = doTransferIn(minter, mintAmount);\\n\\n /*\\n * We get the current exchange rate and calculate the number of vTokens to be minted:\\n * mintTokens = actualMintAmount / exchangeRate\\n */\\n\\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\\n vars.actualMintAmount,\\n Exp({ mantissa: vars.exchangeRateMantissa })\\n );\\n ensureNoMathError(vars.mathErr);\\n\\n /*\\n * We calculate the new total supply of vTokens and minter token balance, checking for overflow:\\n * totalSupplyNew = totalSupply + mintTokens\\n * accountTokensNew = accountTokens[minter] + mintTokens\\n */\\n (vars.mathErr, vars.totalSupplyNew) = addUInt(totalSupply, vars.mintTokens);\\n ensureNoMathError(vars.mathErr);\\n (vars.mathErr, vars.accountTokensNew) = addUInt(accountTokens[minter], vars.mintTokens);\\n ensureNoMathError(vars.mathErr);\\n\\n /* We write previously calculated values into storage */\\n totalSupply = vars.totalSupplyNew;\\n accountTokens[minter] = vars.accountTokensNew;\\n\\n /* We emit a Mint event, and a Transfer event */\\n emit Mint(minter, vars.actualMintAmount, vars.mintTokens, vars.accountTokensNew);\\n emit Transfer(address(this), minter, vars.mintTokens);\\n\\n /* We call the defense and prime accrue interest hook */\\n comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);\\n\\n return (uint(Error.NO_ERROR), vars.actualMintAmount);\\n }\\n\\n /**\\n * @notice Sender supplies assets into the market and receiver receives vTokens in exchange\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param receiver The address of the account which is receiving the vTokens\\n * @param mintAmount The amount of the underlying asset to supply\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\\n */\\n function mintBehalfInternal(address receiver, uint mintAmount) internal nonReentrant returns (uint, uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted mintBehalf failed\\n return (fail(Error(error), FailureInfo.MINT_ACCRUE_INTEREST_FAILED), 0);\\n }\\n // mintBelahfFresh emits the actual Mint event if successful and logs on errors, so we don't need to\\n return mintBehalfFresh(msg.sender, receiver, mintAmount);\\n }\\n\\n /**\\n * @notice Payer supplies assets into the market and receiver receives vTokens in exchange\\n * @dev Assumes interest has already been accrued up to the current block\\n * @param payer The address of the account which is paying the underlying token\\n * @param receiver The address of the account which is receiving vToken\\n * @param mintAmount The amount of the underlying asset to supply\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.\\n */\\n function mintBehalfFresh(address payer, address receiver, uint mintAmount) internal returns (uint, uint) {\\n ensureNonZeroAddress(receiver);\\n /* Fail if mint not allowed */\\n uint allowed = comptroller.mintAllowed(address(this), receiver, mintAmount);\\n if (allowed != 0) {\\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);\\n }\\n\\n /* Verify market's block number equals current block number */\\n if (accrualBlockNumber != block.number) {\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);\\n }\\n\\n MintLocalVars memory vars;\\n\\n (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();\\n if (vars.mathErr != MathError.NO_ERROR) {\\n return (failOpaque(Error.MATH_ERROR, FailureInfo.MINT_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr)), 0);\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /*\\n * We call `doTransferIn` for the payer and the mintAmount.\\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\\n * `doTransferIn` reverts if anything goes wrong, since we can't be sure if\\n * side-effects occurred. The function returns the amount actually transferred,\\n * in case of a fee. On success, the vToken holds an additional `actualMintAmount`\\n * of cash.\\n */\\n vars.actualMintAmount = doTransferIn(payer, mintAmount);\\n\\n /*\\n * We get the current exchange rate and calculate the number of vTokens to be minted:\\n * mintTokens = actualMintAmount / exchangeRate\\n */\\n\\n (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(\\n vars.actualMintAmount,\\n Exp({ mantissa: vars.exchangeRateMantissa })\\n );\\n ensureNoMathError(vars.mathErr);\\n\\n /*\\n * We calculate the new total supply of vTokens and receiver token balance, checking for overflow:\\n * totalSupplyNew = totalSupply + mintTokens\\n * accountTokensNew = accountTokens[receiver] + mintTokens\\n */\\n (vars.mathErr, vars.totalSupplyNew) = addUInt(totalSupply, vars.mintTokens);\\n ensureNoMathError(vars.mathErr);\\n\\n (vars.mathErr, vars.accountTokensNew) = addUInt(accountTokens[receiver], vars.mintTokens);\\n ensureNoMathError(vars.mathErr);\\n\\n /* We write previously calculated values into storage */\\n totalSupply = vars.totalSupplyNew;\\n accountTokens[receiver] = vars.accountTokensNew;\\n\\n /* We emit a MintBehalf event, and a Transfer event */\\n emit MintBehalf(payer, receiver, vars.actualMintAmount, vars.mintTokens, vars.accountTokensNew);\\n emit Transfer(address(this), receiver, vars.mintTokens);\\n\\n /* We call the defense and prime accrue interest hook */\\n comptroller.mintVerify(address(this), receiver, vars.actualMintAmount, vars.mintTokens);\\n\\n return (uint(Error.NO_ERROR), vars.actualMintAmount);\\n }\\n\\n /**\\n * @notice Redeemer redeems vTokens in exchange for the underlying assets, transferred to the receiver. Redeemer and receiver can be the same\\n * address, or different addresses if the receiver was previously approved by the redeemer as a valid delegate (see MarketFacet.updateDelegate)\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param redeemer The address of the account which is redeeming the tokens\\n * @param receiver The receiver of the tokens\\n * @param redeemTokens The number of vTokens to redeem into underlying\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function redeemInternal(\\n address redeemer,\\n address payable receiver,\\n uint redeemTokens\\n ) internal nonReentrant returns (uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed\\n return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);\\n }\\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\\n return redeemFresh(redeemer, receiver, redeemTokens, 0);\\n }\\n\\n /**\\n * @notice Sender redeems underlying assets on behalf of some other address. This function is only available\\n * for senders, explicitly marked as delegates of the supplier using `comptroller.updateDelegate`\\n * @dev Accrues interest whether or not the operation succeeds, unless reverted\\n * @param redeemer The address of the account which is redeeming the tokens\\n * @param receiver The receiver of the tokens, if called by a delegate\\n * @param redeemAmount The amount of underlying to receive from redeeming vTokens\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function redeemUnderlyingInternal(\\n address redeemer,\\n address payable receiver,\\n uint redeemAmount\\n ) internal nonReentrant returns (uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed\\n return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);\\n }\\n // redeemFresh emits redeem-specific logs on errors, so we don't need to\\n return redeemFresh(redeemer, receiver, 0, redeemAmount);\\n }\\n\\n /**\\n * @notice Redeemer redeems vTokens in exchange for the underlying assets, transferred to the receiver. Redeemer and receiver can be the same\\n * address, or different addresses if the receiver was previously approved by the redeemer as a valid delegate (see MarketFacet.updateDelegate)\\n * @dev Assumes interest has already been accrued up to the current block\\n * @param redeemer The address of the account which is redeeming the tokens\\n * @param receiver The receiver of the tokens\\n * @param redeemTokensIn The number of vTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)\\n * @param redeemAmountIn The number of underlying tokens to receive from redeeming vTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n // solhint-disable-next-line code-complexity\\n function redeemFresh(\\n address redeemer,\\n address payable receiver,\\n uint redeemTokensIn,\\n uint redeemAmountIn\\n ) internal returns (uint) {\\n require(redeemTokensIn == 0 || redeemAmountIn == 0, \\\"one of redeemTokensIn or redeemAmountIn must be zero\\\");\\n\\n RedeemLocalVars memory vars;\\n\\n /* exchangeRate = invoke Exchange Rate Stored() */\\n (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();\\n ensureNoMathError(vars.mathErr);\\n\\n /* If redeemTokensIn > 0: */\\n if (redeemTokensIn > 0) {\\n /*\\n * We calculate the exchange rate and the amount of underlying to be redeemed:\\n * redeemTokens = redeemTokensIn\\n * redeemAmount = redeemTokensIn x exchangeRateCurrent\\n */\\n vars.redeemTokens = redeemTokensIn;\\n\\n (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(\\n Exp({ mantissa: vars.exchangeRateMantissa }),\\n redeemTokensIn\\n );\\n ensureNoMathError(vars.mathErr);\\n } else {\\n /*\\n * We get the current exchange rate and calculate the amount to be redeemed:\\n * redeemTokens = redeemAmountIn / exchangeRate\\n * redeemAmount = redeemAmountIn\\n */\\n\\n (vars.mathErr, vars.redeemTokens) = divScalarByExpTruncate(\\n redeemAmountIn,\\n Exp({ mantissa: vars.exchangeRateMantissa })\\n );\\n ensureNoMathError(vars.mathErr);\\n\\n vars.redeemAmount = redeemAmountIn;\\n }\\n\\n /* Fail if redeem not allowed */\\n uint allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);\\n if (allowed != 0) {\\n revert(\\\"math error\\\");\\n }\\n\\n /* Verify market's block number equals current block number */\\n if (accrualBlockNumber != block.number) {\\n revert(\\\"math error\\\");\\n }\\n\\n /*\\n * We calculate the new total supply and redeemer balance, checking for underflow:\\n * totalSupplyNew = totalSupply - redeemTokens\\n * accountTokensNew = accountTokens[redeemer] - redeemTokens\\n */\\n (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);\\n ensureNoMathError(vars.mathErr);\\n\\n (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);\\n ensureNoMathError(vars.mathErr);\\n\\n /* Fail gracefully if protocol has insufficient cash */\\n if (getCashPrior() < vars.redeemAmount) {\\n revert(\\\"math error\\\");\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /* We write previously calculated values into storage */\\n totalSupply = vars.totalSupplyNew;\\n accountTokens[redeemer] = vars.accountTokensNew;\\n\\n /*\\n * We invoke doTransferOut for the receiver and the redeemAmount.\\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\\n * On success, the vToken has redeemAmount less of cash.\\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\\n */\\n\\n uint feeAmount;\\n uint remainedAmount;\\n if (IComptroller(address(comptroller)).treasuryPercent() != 0) {\\n (vars.mathErr, feeAmount) = mulUInt(\\n vars.redeemAmount,\\n IComptroller(address(comptroller)).treasuryPercent()\\n );\\n ensureNoMathError(vars.mathErr);\\n\\n (vars.mathErr, feeAmount) = divUInt(feeAmount, 1e18);\\n ensureNoMathError(vars.mathErr);\\n\\n (vars.mathErr, remainedAmount) = subUInt(vars.redeemAmount, feeAmount);\\n ensureNoMathError(vars.mathErr);\\n\\n doTransferOut(address(uint160(IComptroller(address(comptroller)).treasuryAddress())), feeAmount);\\n\\n emit RedeemFee(redeemer, feeAmount, vars.redeemTokens);\\n } else {\\n remainedAmount = vars.redeemAmount;\\n }\\n\\n doTransferOut(receiver, remainedAmount);\\n\\n /* We emit a Transfer event, and a Redeem event */\\n emit Transfer(redeemer, address(this), vars.redeemTokens);\\n emit Redeem(redeemer, remainedAmount, vars.redeemTokens, vars.accountTokensNew);\\n\\n /* We call the defense and prime accrue interest hook */\\n comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Receiver gets the borrow on behalf of the borrower address\\n * @param borrower The borrower, on behalf of whom to borrow\\n * @param receiver The account that would receive the funds (can be the same as the borrower)\\n * @param borrowAmount The amount of the underlying asset to borrow\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function borrowInternal(\\n address borrower,\\n address payable receiver,\\n uint borrowAmount\\n ) internal nonReentrant returns (uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed\\n return fail(Error(error), FailureInfo.BORROW_ACCRUE_INTEREST_FAILED);\\n }\\n // borrowFresh emits borrow-specific logs on errors, so we don't need to\\n return borrowFresh(borrower, receiver, borrowAmount);\\n }\\n\\n /**\\n * @notice Receiver gets the borrow on behalf of the borrower address\\n * @dev Before calling this function, ensure that the interest has been accrued\\n * @param borrower The borrower, on behalf of whom to borrow\\n * @param receiver The account that would receive the funds (can be the same as the borrower)\\n * @param borrowAmount The amount of the underlying asset to borrow\\n * @return uint Returns 0 on success, otherwise revert (see ErrorReporter.sol for details).\\n */\\n function borrowFresh(address borrower, address payable receiver, uint borrowAmount) internal returns (uint) {\\n /* Revert if borrow not allowed */\\n uint allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);\\n if (allowed != 0) {\\n revert(\\\"math error\\\");\\n }\\n\\n /* Verify market's block number equals current block number */\\n if (accrualBlockNumber != block.number) {\\n revert(\\\"math error\\\");\\n }\\n\\n /* Revert if protocol has insufficient underlying cash */\\n if (getCashPrior() < borrowAmount) {\\n revert(\\\"math error\\\");\\n }\\n\\n BorrowLocalVars memory vars;\\n\\n /*\\n * We calculate the new borrower and total borrow balances, failing on overflow:\\n * accountBorrowsNew = accountBorrows + borrowAmount\\n * totalBorrowsNew = totalBorrows + borrowAmount\\n */\\n (vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower);\\n ensureNoMathError(vars.mathErr);\\n\\n (vars.mathErr, vars.accountBorrowsNew) = addUInt(vars.accountBorrows, borrowAmount);\\n ensureNoMathError(vars.mathErr);\\n\\n (vars.mathErr, vars.totalBorrowsNew) = addUInt(totalBorrows, borrowAmount);\\n ensureNoMathError(vars.mathErr);\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /* We write the previously calculated values into storage */\\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\\n accountBorrows[borrower].interestIndex = borrowIndex;\\n totalBorrows = vars.totalBorrowsNew;\\n\\n /*\\n * We invoke doTransferOut for the receiver and the borrowAmount.\\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\\n * On success, the vToken borrowAmount less of cash.\\n * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\\n */\\n doTransferOut(receiver, borrowAmount);\\n\\n /* We emit a Borrow event */\\n emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\\n\\n /* We call the defense and prime accrue interest hook */\\n comptroller.borrowVerify(address(this), borrower, borrowAmount);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sender repays their own borrow\\n * @param repayAmount The amount to repay\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\n */\\n function repayBorrowInternal(uint repayAmount) internal nonReentrant returns (uint, uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed\\n return (fail(Error(error), FailureInfo.REPAY_BORROW_ACCRUE_INTEREST_FAILED), 0);\\n }\\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\\n return repayBorrowFresh(msg.sender, msg.sender, repayAmount);\\n }\\n\\n /**\\n * @notice Sender repays a borrow belonging to another borrowing account\\n * @param borrower The account with the debt being payed off\\n * @param repayAmount The amount to repay\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\n */\\n function repayBorrowBehalfInternal(address borrower, uint repayAmount) internal nonReentrant returns (uint, uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed\\n return (fail(Error(error), FailureInfo.REPAY_BEHALF_ACCRUE_INTEREST_FAILED), 0);\\n }\\n // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to\\n return repayBorrowFresh(msg.sender, borrower, repayAmount);\\n }\\n\\n /**\\n * @notice Borrows are repaid by another user (possibly the borrower).\\n * @param payer The account paying off the borrow\\n * @param borrower The account with the debt being payed off\\n * @param repayAmount The amount of undelrying tokens being returned\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\n */\\n function repayBorrowFresh(address payer, address borrower, uint repayAmount) internal returns (uint, uint) {\\n /* Fail if repayBorrow not allowed */\\n uint allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount);\\n if (allowed != 0) {\\n return (\\n failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_BORROW_COMPTROLLER_REJECTION, allowed),\\n 0\\n );\\n }\\n\\n /* Verify market's block number equals current block number */\\n if (accrualBlockNumber != block.number) {\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0);\\n }\\n\\n RepayBorrowLocalVars memory vars;\\n\\n /* We remember the original borrowerIndex for verification purposes */\\n vars.borrowerIndex = accountBorrows[borrower].interestIndex;\\n\\n /* We fetch the amount the borrower owes, with accumulated interest */\\n (vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower);\\n if (vars.mathErr != MathError.NO_ERROR) {\\n return (\\n failOpaque(\\n Error.MATH_ERROR,\\n FailureInfo.REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\n uint(vars.mathErr)\\n ),\\n 0\\n );\\n }\\n\\n /* If repayAmount == -1, repayAmount = accountBorrows */\\n if (repayAmount == uint(-1)) {\\n vars.repayAmount = vars.accountBorrows;\\n } else {\\n vars.repayAmount = repayAmount;\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /*\\n * We call doTransferIn for the payer and the repayAmount\\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\\n * On success, the vToken holds an additional repayAmount of cash.\\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\\n * it returns the amount actually transferred, in case of a fee.\\n */\\n vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount);\\n\\n /*\\n * We calculate the new borrower and total borrow balances, failing on underflow:\\n * accountBorrowsNew = accountBorrows - actualRepayAmount\\n * totalBorrowsNew = totalBorrows - actualRepayAmount\\n */\\n (vars.mathErr, vars.accountBorrowsNew) = subUInt(vars.accountBorrows, vars.actualRepayAmount);\\n ensureNoMathError(vars.mathErr);\\n\\n (vars.mathErr, vars.totalBorrowsNew) = subUInt(totalBorrows, vars.actualRepayAmount);\\n ensureNoMathError(vars.mathErr);\\n\\n /* We write the previously calculated values into storage */\\n accountBorrows[borrower].principal = vars.accountBorrowsNew;\\n accountBorrows[borrower].interestIndex = borrowIndex;\\n totalBorrows = vars.totalBorrowsNew;\\n\\n /* We emit a RepayBorrow event */\\n emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);\\n\\n /* We call the defense and prime accrue interest hook */\\n comptroller.repayBorrowVerify(address(this), payer, borrower, vars.actualRepayAmount, vars.borrowerIndex);\\n\\n return (uint(Error.NO_ERROR), vars.actualRepayAmount);\\n }\\n\\n /**\\n * @notice The sender liquidates the borrowers collateral.\\n * The collateral seized is transferred to the liquidator.\\n * @param borrower The borrower of this vToken to be liquidated\\n * @param vTokenCollateral The market in which to seize collateral from the borrower\\n * @param repayAmount The amount of the underlying borrowed asset to repay\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\n */\\n function liquidateBorrowInternal(\\n address borrower,\\n uint repayAmount,\\n VTokenInterface vTokenCollateral\\n ) internal nonReentrant returns (uint, uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted liquidation failed\\n return (fail(Error(error), FailureInfo.LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED), 0);\\n }\\n\\n error = vTokenCollateral.accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but we still want to log the fact that an attempted liquidation failed\\n return (fail(Error(error), FailureInfo.LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED), 0);\\n }\\n\\n // liquidateBorrowFresh emits borrow-specific logs on errors, so we don't need to\\n return liquidateBorrowFresh(msg.sender, borrower, repayAmount, vTokenCollateral);\\n }\\n\\n /**\\n * @notice The liquidator liquidates the borrowers collateral.\\n * The collateral seized is transferred to the liquidator.\\n * @param borrower The borrower of this vToken to be liquidated\\n * @param liquidator The address repaying the borrow and seizing collateral\\n * @param vTokenCollateral The market in which to seize collateral from the borrower\\n * @param repayAmount The amount of the underlying borrowed asset to repay\\n * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.\\n */\\n // solhint-disable-next-line code-complexity\\n function liquidateBorrowFresh(\\n address liquidator,\\n address borrower,\\n uint repayAmount,\\n VTokenInterface vTokenCollateral\\n ) internal returns (uint, uint) {\\n /* Fail if liquidate not allowed */\\n uint allowed = comptroller.liquidateBorrowAllowed(\\n address(this),\\n address(vTokenCollateral),\\n liquidator,\\n borrower,\\n repayAmount\\n );\\n if (allowed != 0) {\\n return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0);\\n }\\n\\n /* Verify market's block number equals current block number */\\n if (accrualBlockNumber != block.number) {\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0);\\n }\\n\\n /* Verify vTokenCollateral market's block number equals current block number */\\n if (vTokenCollateral.accrualBlockNumber() != block.number) {\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0);\\n }\\n\\n /* Fail if borrower = liquidator */\\n if (borrower == liquidator) {\\n return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0);\\n }\\n\\n /* Fail if repayAmount = 0 */\\n if (repayAmount == 0) {\\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0);\\n }\\n\\n /* Fail if repayAmount = -1 */\\n if (repayAmount == uint(-1)) {\\n return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0);\\n }\\n\\n /* Fail if repayBorrow fails */\\n (uint repayBorrowError, uint actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount);\\n if (repayBorrowError != uint(Error.NO_ERROR)) {\\n return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0);\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /* We calculate the number of collateral tokens that will be seized */\\n (uint amountSeizeError, uint seizeTokens) = comptroller.liquidateCalculateSeizeTokens(\\n address(this),\\n address(vTokenCollateral),\\n actualRepayAmount\\n );\\n require(amountSeizeError == uint(Error.NO_ERROR), \\\"LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED\\\");\\n\\n /* Revert if borrower collateral token balance < seizeTokens */\\n require(vTokenCollateral.balanceOf(borrower) >= seizeTokens, \\\"LIQUIDATE_SEIZE_TOO_MUCH\\\");\\n\\n // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call\\n uint seizeError;\\n if (address(vTokenCollateral) == address(this)) {\\n seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens);\\n } else {\\n seizeError = vTokenCollateral.seize(liquidator, borrower, seizeTokens);\\n }\\n\\n /* Revert if seize tokens fails (since we cannot be sure of side effects) */\\n require(seizeError == uint(Error.NO_ERROR), \\\"token seizure failed\\\");\\n\\n /* We emit a LiquidateBorrow event */\\n emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, address(vTokenCollateral), seizeTokens);\\n\\n /* We call the defense and prime accrue interest hook */\\n comptroller.liquidateBorrowVerify(\\n address(this),\\n address(vTokenCollateral),\\n liquidator,\\n borrower,\\n actualRepayAmount,\\n seizeTokens\\n );\\n\\n return (uint(Error.NO_ERROR), actualRepayAmount);\\n }\\n\\n /**\\n * @notice Transfers collateral tokens (this market) to the liquidator.\\n * @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another vToken.\\n * Its absolutely critical to use msg.sender as the seizer vToken and not a parameter.\\n * @param seizerToken The contract seizing the collateral (i.e. borrowed vToken)\\n * @param liquidator The account receiving seized collateral\\n * @param borrower The account having collateral seized\\n * @param seizeTokens The number of vTokens to seize\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function seizeInternal(\\n address seizerToken,\\n address liquidator,\\n address borrower,\\n uint seizeTokens\\n ) internal returns (uint) {\\n /* Fail if seize not allowed */\\n uint allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);\\n if (allowed != 0) {\\n return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed);\\n }\\n\\n /* Fail if borrower = liquidator */\\n if (borrower == liquidator) {\\n return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER);\\n }\\n\\n MathError mathErr;\\n uint borrowerTokensNew;\\n uint liquidatorTokensNew;\\n\\n /*\\n * We calculate the new borrower and liquidator token balances, failing on underflow/overflow:\\n * borrowerTokensNew = accountTokens[borrower] - seizeTokens\\n * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens\\n */\\n (mathErr, borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);\\n if (mathErr != MathError.NO_ERROR) {\\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint(mathErr));\\n }\\n\\n (mathErr, liquidatorTokensNew) = addUInt(accountTokens[liquidator], seizeTokens);\\n if (mathErr != MathError.NO_ERROR) {\\n return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint(mathErr));\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /* We write the previously calculated values into storage */\\n accountTokens[borrower] = borrowerTokensNew;\\n accountTokens[liquidator] = liquidatorTokensNew;\\n\\n /* Emit a Transfer event */\\n emit Transfer(borrower, liquidator, seizeTokens);\\n\\n /* We call the defense and prime accrue interest hook */\\n comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Sets a new reserve factor for the protocol (requires fresh interest accrual)\\n * @dev Governance function to set a new reserve factor\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _setReserveFactorFresh(uint newReserveFactorMantissa) internal returns (uint) {\\n // Verify market's block number equals current block number\\n if (accrualBlockNumber != block.number) {\\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_RESERVE_FACTOR_FRESH_CHECK);\\n }\\n\\n // Check newReserveFactor \\u2264 maxReserveFactor\\n if (newReserveFactorMantissa > reserveFactorMaxMantissa) {\\n return fail(Error.BAD_INPUT, FailureInfo.SET_RESERVE_FACTOR_BOUNDS_CHECK);\\n }\\n\\n uint oldReserveFactorMantissa = reserveFactorMantissa;\\n reserveFactorMantissa = newReserveFactorMantissa;\\n\\n emit NewReserveFactor(oldReserveFactorMantissa, newReserveFactorMantissa);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice Accrues interest and adds reserves by transferring from `msg.sender`\\n * @param addAmount Amount of addition to reserves\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _addReservesInternal(uint addAmount) internal nonReentrant returns (uint) {\\n uint error = accrueInterest();\\n if (error != uint(Error.NO_ERROR)) {\\n // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed.\\n return fail(Error(error), FailureInfo.ADD_RESERVES_ACCRUE_INTEREST_FAILED);\\n }\\n\\n // _addReservesFresh emits reserve-addition-specific logs on errors, so we don't need to.\\n (error, ) = _addReservesFresh(addAmount);\\n return error;\\n }\\n\\n /**\\n * @notice Add reserves by transferring from caller\\n * @dev Requires fresh interest accrual\\n * @param addAmount Amount of addition to reserves\\n * @return (uint, uint) An error code (0=success, otherwise a failure (see ErrorReporter.sol for details)) and the actual amount added, net token fees\\n */\\n function _addReservesFresh(uint addAmount) internal returns (uint, uint) {\\n // totalReserves + actualAddAmount\\n uint totalReservesNew;\\n uint actualAddAmount;\\n\\n // We fail gracefully unless market's block number equals current block number\\n if (accrualBlockNumber != block.number) {\\n return (fail(Error.MARKET_NOT_FRESH, FailureInfo.ADD_RESERVES_FRESH_CHECK), actualAddAmount);\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n /*\\n * We call doTransferIn for the caller and the addAmount\\n * Note: The vToken must handle variations between BEP-20 and BNB underlying.\\n * On success, the vToken holds an additional addAmount of cash.\\n * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.\\n * it returns the amount actually transferred, in case of a fee.\\n */\\n\\n actualAddAmount = doTransferIn(msg.sender, addAmount);\\n\\n totalReservesNew = totalReserves + actualAddAmount;\\n\\n /* Revert on overflow */\\n require(totalReservesNew >= totalReserves, \\\"add reserves unexpected overflow\\\");\\n\\n // Store reserves[n+1] = reserves[n] + actualAddAmount\\n totalReserves = totalReservesNew;\\n\\n /* Emit NewReserves(admin, actualAddAmount, reserves[n+1]) */\\n emit ReservesAdded(msg.sender, actualAddAmount, totalReservesNew);\\n\\n /* Return (NO_ERROR, actualAddAmount) */\\n return (uint(Error.NO_ERROR), actualAddAmount);\\n }\\n\\n /**\\n * @notice Reduces reserves by transferring to protocol share reserve contract\\n * @dev Requires fresh interest accrual\\n * @param reduceAmount Amount of reduction to reserves\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _reduceReservesFresh(uint reduceAmount) internal returns (uint) {\\n if (reduceAmount == 0) {\\n return uint(Error.NO_ERROR);\\n }\\n\\n // We fail gracefully unless market's block number equals current block number\\n if (accrualBlockNumber != block.number) {\\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDUCE_RESERVES_FRESH_CHECK);\\n }\\n\\n // Fail gracefully if protocol has insufficient underlying cash\\n if (getCashPrior() < reduceAmount) {\\n return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDUCE_RESERVES_CASH_NOT_AVAILABLE);\\n }\\n\\n // Check reduceAmount \\u2264 reserves[n] (totalReserves)\\n if (reduceAmount > totalReserves) {\\n return fail(Error.BAD_INPUT, FailureInfo.REDUCE_RESERVES_VALIDATION);\\n }\\n\\n /////////////////////////\\n // EFFECTS & INTERACTIONS\\n // (No safe failures beyond this point)\\n\\n // totalReserves - reduceAmount\\n uint totalReservesNew = totalReserves - reduceAmount;\\n\\n // Store reserves[n+1] = reserves[n] - reduceAmount\\n totalReserves = totalReservesNew;\\n\\n // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.\\n doTransferOut(protocolShareReserve, reduceAmount);\\n\\n IProtocolShareReserveV5(protocolShareReserve).updateAssetsState(\\n address(comptroller),\\n underlying,\\n IProtocolShareReserveV5.IncomeType.SPREAD\\n );\\n\\n emit ReservesReduced(protocolShareReserve, reduceAmount, totalReservesNew);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /**\\n * @notice updates the interest rate model (requires fresh interest accrual)\\n * @dev Governance function to update the interest rate model\\n * @param newInterestRateModel the new interest rate model to use\\n * @return uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).\\n */\\n function _setInterestRateModelFresh(InterestRateModel newInterestRateModel) internal returns (uint) {\\n // Used to store old model for use in the event that is emitted on success\\n InterestRateModel oldInterestRateModel;\\n // We fail gracefully unless market's block number equals current block number\\n if (accrualBlockNumber != block.number) {\\n return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_INTEREST_RATE_MODEL_FRESH_CHECK);\\n }\\n\\n // Track the market's current interest rate model\\n oldInterestRateModel = interestRateModel;\\n\\n // Ensure invoke newInterestRateModel.isInterestRateModel() returns true\\n require(newInterestRateModel.isInterestRateModel(), \\\"marker method returned false\\\");\\n\\n // Set the interest rate model to newInterestRateModel\\n interestRateModel = newInterestRateModel;\\n\\n // Emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel)\\n emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel);\\n\\n return uint(Error.NO_ERROR);\\n }\\n\\n /*** Safe Token ***/\\n\\n /**\\n * @dev Performs a transfer in, reverting upon failure. Returns the amount actually transferred to the protocol, in case of a fee.\\n * This may revert due to insufficient balance or insufficient allowance.\\n */\\n function doTransferIn(address from, uint amount) internal returns (uint);\\n\\n /**\\n * @dev Performs a transfer out, ideally returning an explanatory error code upon failure rather than reverting.\\n * If caller has not called checked protocol's balance, may revert due to insufficient cash held in the contract.\\n * If caller has checked protocol's balance, and verified it is >= amount, this should not revert in normal conditions.\\n */\\n function doTransferOut(address payable to, uint amount) internal;\\n\\n /**\\n * @notice Return the borrow balance of account based on stored data\\n * @param account The address whose balance should be calculated\\n * @return Tuple of error code and the calculated balance or 0 if error code is non-zero\\n */\\n function borrowBalanceStoredInternal(address account) internal view returns (MathError, uint) {\\n /* Note: we do not assert that the market is up to date */\\n MathError mathErr;\\n uint principalTimesIndex;\\n uint result;\\n\\n /* Get borrowBalance and borrowIndex */\\n BorrowSnapshot storage borrowSnapshot = accountBorrows[account];\\n\\n /* If borrowBalance = 0 then borrowIndex is likely also 0.\\n * Rather than failing the calculation with a division by 0, we immediately return 0 in this case.\\n */\\n if (borrowSnapshot.principal == 0) {\\n return (MathError.NO_ERROR, 0);\\n }\\n\\n /* Calculate new borrow balance using the interest index:\\n * recentBorrowBalance = borrower.borrowBalance * market.borrowIndex / borrower.borrowIndex\\n */\\n (mathErr, principalTimesIndex) = mulUInt(borrowSnapshot.principal, borrowIndex);\\n if (mathErr != MathError.NO_ERROR) {\\n return (mathErr, 0);\\n }\\n\\n (mathErr, result) = divUInt(principalTimesIndex, borrowSnapshot.interestIndex);\\n if (mathErr != MathError.NO_ERROR) {\\n return (mathErr, 0);\\n }\\n\\n return (MathError.NO_ERROR, result);\\n }\\n\\n /**\\n * @notice Calculates the exchange rate from the underlying to the vToken\\n * @dev This function does not accrue interest before calculating the exchange rate\\n * @return Tuple of error code and calculated exchange rate scaled by 1e18\\n */\\n function exchangeRateStoredInternal() internal view returns (MathError, uint) {\\n uint _totalSupply = totalSupply;\\n if (_totalSupply == 0) {\\n /*\\n * If there are no tokens minted:\\n * exchangeRate = initialExchangeRate\\n */\\n return (MathError.NO_ERROR, initialExchangeRateMantissa);\\n } else {\\n /*\\n * Otherwise:\\n * exchangeRate = (totalCash + totalBorrows - totalReserves) / totalSupply\\n */\\n uint totalCash = getCashPrior();\\n uint cashPlusBorrowsMinusReserves;\\n Exp memory exchangeRate;\\n MathError mathErr;\\n\\n (mathErr, cashPlusBorrowsMinusReserves) = addThenSubUInt(totalCash, totalBorrows, totalReserves);\\n if (mathErr != MathError.NO_ERROR) {\\n return (mathErr, 0);\\n }\\n\\n (mathErr, exchangeRate) = getExp(cashPlusBorrowsMinusReserves, _totalSupply);\\n if (mathErr != MathError.NO_ERROR) {\\n return (mathErr, 0);\\n }\\n\\n return (MathError.NO_ERROR, exchangeRate.mantissa);\\n }\\n }\\n\\n function ensureAllowed(string memory functionSig) private view {\\n require(\\n IAccessControlManagerV5(accessControlManager).isAllowedToCall(msg.sender, functionSig),\\n \\\"access denied\\\"\\n );\\n }\\n\\n function ensureAdmin(address caller_) private view {\\n require(caller_ == admin, \\\"Unauthorized\\\");\\n }\\n\\n function ensureNoMathError(MathError mErr) private pure {\\n require(mErr == MathError.NO_ERROR, \\\"math error\\\");\\n }\\n\\n function ensureNonZeroAddress(address address_) private pure {\\n require(address_ != address(0), \\\"zero address\\\");\\n }\\n\\n /*** Safe Token ***/\\n\\n /**\\n * @notice Gets balance of this contract in terms of the underlying\\n * @dev This excludes the value of the current message, if any\\n * @return The quantity of underlying owned by this contract\\n */\\n function getCashPrior() internal view returns (uint);\\n}\\n\",\"keccak256\":\"0xfdbcdbd6cab4aeba2c06f39adbfbd8e42a3e50d02aed628c2d76b97659d84b68\"},\"contracts/Tokens/VTokens/VTokenInterfaces.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"../../Comptroller/ComptrollerInterface.sol\\\";\\nimport \\\"../../InterestRateModels/InterestRateModel.sol\\\";\\n\\ninterface IProtocolShareReserveV5 {\\n enum IncomeType {\\n SPREAD,\\n LIQUIDATION\\n }\\n\\n function updateAssetsState(address comptroller, address asset, IncomeType kind) external;\\n}\\n\\ncontract VTokenStorageBase {\\n /**\\n * @notice Container for borrow balance information\\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\\n */\\n struct BorrowSnapshot {\\n uint principal;\\n uint interestIndex;\\n }\\n\\n /**\\n * @dev Guard variable for re-entrancy checks\\n */\\n bool internal _notEntered;\\n\\n /**\\n * @notice EIP-20 token name for this token\\n */\\n string public name;\\n\\n /**\\n * @notice EIP-20 token symbol for this token\\n */\\n string public symbol;\\n\\n /**\\n * @notice EIP-20 token decimals for this token\\n */\\n uint8 public decimals;\\n\\n /**\\n * @notice Maximum borrow rate that can ever be applied (.0005% / block)\\n */\\n\\n uint internal constant borrowRateMaxMantissa = 0.0005e16;\\n\\n /**\\n * @notice Maximum fraction of interest that can be set aside for reserves\\n */\\n uint internal constant reserveFactorMaxMantissa = 1e18;\\n\\n /**\\n * @notice Administrator for this contract\\n */\\n address payable public admin;\\n\\n /**\\n * @notice Pending administrator for this contract\\n */\\n address payable public pendingAdmin;\\n\\n /**\\n * @notice Contract which oversees inter-vToken operations\\n */\\n ComptrollerInterface public comptroller;\\n\\n /**\\n * @notice Model which tells what the current interest rate should be\\n */\\n InterestRateModel public interestRateModel;\\n\\n /**\\n * @notice Initial exchange rate used when minting the first VTokens (used when totalSupply = 0)\\n */\\n uint internal initialExchangeRateMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for reserves\\n */\\n uint public reserveFactorMantissa;\\n\\n /**\\n * @notice Block number that interest was last accrued at\\n */\\n uint public accrualBlockNumber;\\n\\n /**\\n * @notice Accumulator of the total earned interest rate since the opening of the market\\n */\\n uint public borrowIndex;\\n\\n /**\\n * @notice Total amount of outstanding borrows of the underlying in this market\\n */\\n uint public totalBorrows;\\n\\n /**\\n * @notice Total amount of reserves of the underlying held in this market\\n */\\n uint public totalReserves;\\n\\n /**\\n * @notice Total number of tokens in circulation\\n */\\n uint public totalSupply;\\n\\n /**\\n * @notice Official record of token balances for each account\\n */\\n mapping(address => uint) internal accountTokens;\\n\\n /**\\n * @notice Approved token transfer amounts on behalf of others\\n */\\n mapping(address => mapping(address => uint)) internal transferAllowances;\\n\\n /**\\n * @notice Mapping of account addresses to outstanding borrow balances\\n */\\n mapping(address => BorrowSnapshot) internal accountBorrows;\\n\\n /**\\n * @notice Underlying asset for this VToken\\n */\\n address public underlying;\\n\\n /**\\n * @notice Implementation address for this contract\\n */\\n address public implementation;\\n\\n /**\\n * @notice delta block after which reserves will be reduced\\n */\\n uint public reduceReservesBlockDelta;\\n\\n /**\\n * @notice last block number at which reserves were reduced\\n */\\n uint public reduceReservesBlockNumber;\\n\\n /**\\n * @notice address of protocol share reserve contract\\n */\\n address payable public protocolShareReserve;\\n\\n /**\\n * @notice address of accessControlManager\\n */\\n\\n address public accessControlManager;\\n}\\n\\ncontract VTokenStorage is VTokenStorageBase {\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\\ncontract VTokenInterface is VTokenStorage {\\n /**\\n * @notice Indicator that this is a vToken contract (for inspection)\\n */\\n bool public constant isVToken = true;\\n\\n /*** Market Events ***/\\n\\n /**\\n * @notice Event emitted when interest is accrued\\n */\\n event AccrueInterest(uint cashPrior, uint interestAccumulated, uint borrowIndex, uint totalBorrows);\\n\\n /**\\n * @notice Event emitted when tokens are minted\\n */\\n event Mint(address minter, uint mintAmount, uint mintTokens, uint256 totalSupply);\\n\\n /**\\n * @notice Event emitted when tokens are minted behalf by payer to receiver\\n */\\n event MintBehalf(address payer, address receiver, uint mintAmount, uint mintTokens, uint256 totalSupply);\\n\\n /**\\n * @notice Event emitted when tokens are redeemed\\n */\\n event Redeem(address redeemer, uint redeemAmount, uint redeemTokens, uint256 totalSupply);\\n\\n /**\\n * @notice Event emitted when tokens are redeemed and fee is transferred\\n */\\n event RedeemFee(address redeemer, uint feeAmount, uint redeemTokens);\\n\\n /**\\n * @notice Event emitted when underlying is borrowed\\n */\\n event Borrow(address borrower, uint borrowAmount, uint accountBorrows, uint totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is repaid\\n */\\n event RepayBorrow(address payer, address borrower, uint repayAmount, uint accountBorrows, uint totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is liquidated\\n */\\n event LiquidateBorrow(\\n address liquidator,\\n address borrower,\\n uint repayAmount,\\n address vTokenCollateral,\\n uint seizeTokens\\n );\\n\\n /*** Admin Events ***/\\n\\n /**\\n * @notice Event emitted when pendingAdmin is changed\\n */\\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\\n\\n /**\\n * @notice Event emitted when pendingAdmin is accepted, which means admin has been updated\\n */\\n event NewAdmin(address oldAdmin, address newAdmin);\\n\\n /**\\n * @notice Event emitted when comptroller is changed\\n */\\n event NewComptroller(ComptrollerInterface oldComptroller, ComptrollerInterface newComptroller);\\n\\n /**\\n * @notice Event emitted when interestRateModel is changed\\n */\\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\\n\\n /**\\n * @notice Event emitted when the reserve factor is changed\\n */\\n event NewReserveFactor(uint oldReserveFactorMantissa, uint newReserveFactorMantissa);\\n\\n /**\\n * @notice Event emitted when the reserves are added\\n */\\n event ReservesAdded(address benefactor, uint addAmount, uint newTotalReserves);\\n\\n /**\\n * @notice Event emitted when the reserves are reduced\\n */\\n event ReservesReduced(address protocolShareReserve, uint reduceAmount, uint newTotalReserves);\\n\\n /**\\n * @notice EIP20 Transfer event\\n */\\n event Transfer(address indexed from, address indexed to, uint amount);\\n\\n /**\\n * @notice EIP20 Approval event\\n */\\n event Approval(address indexed owner, address indexed spender, uint amount);\\n\\n /**\\n * @notice Event emitted when block delta for reduce reserves get updated\\n */\\n event NewReduceReservesBlockDelta(uint256 oldReduceReservesBlockDelta, uint256 newReduceReservesBlockDelta);\\n\\n /**\\n * @notice Event emitted when address of ProtocolShareReserve contract get updated\\n */\\n event NewProtocolShareReserve(address indexed oldProtocolShareReserve, address indexed newProtocolShareReserve);\\n\\n /**\\n * @notice Failure event\\n */\\n event Failure(uint error, uint info, uint detail);\\n\\n /// @notice Emitted when access control address is changed by admin\\n event NewAccessControlManager(address oldAccessControlAddress, address newAccessControlAddress);\\n\\n /*** User Interface ***/\\n\\n function transfer(address dst, uint amount) external returns (bool);\\n\\n function transferFrom(address src, address dst, uint amount) external returns (bool);\\n\\n function approve(address spender, uint amount) external returns (bool);\\n\\n function balanceOfUnderlying(address owner) external returns (uint);\\n\\n function totalBorrowsCurrent() external returns (uint);\\n\\n function borrowBalanceCurrent(address account) external returns (uint);\\n\\n function seize(address liquidator, address borrower, uint seizeTokens) external returns (uint);\\n\\n /*** Admin Function ***/\\n function _setPendingAdmin(address payable newPendingAdmin) external returns (uint);\\n\\n /*** Admin Function ***/\\n function _acceptAdmin() external returns (uint);\\n\\n /*** Admin Function ***/\\n function _setReserveFactor(uint newReserveFactorMantissa) external returns (uint);\\n\\n /*** Admin Function ***/\\n function _reduceReserves(uint reduceAmount) external returns (uint);\\n\\n function balanceOf(address owner) external view returns (uint);\\n\\n function allowance(address owner, address spender) external view returns (uint);\\n\\n function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint);\\n\\n function borrowRatePerBlock() external view returns (uint);\\n\\n function supplyRatePerBlock() external view returns (uint);\\n\\n function getCash() external view returns (uint);\\n\\n function exchangeRateCurrent() public returns (uint);\\n\\n function accrueInterest() public returns (uint);\\n\\n /*** Admin Function ***/\\n function _setComptroller(ComptrollerInterface newComptroller) public returns (uint);\\n\\n /*** Admin Function ***/\\n function _setInterestRateModel(InterestRateModel newInterestRateModel) public returns (uint);\\n\\n function borrowBalanceStored(address account) public view returns (uint);\\n\\n function exchangeRateStored() public view returns (uint);\\n}\\n\\ncontract VBep20Interface {\\n /*** User Interface ***/\\n\\n function mint(uint mintAmount) external returns (uint);\\n\\n function mintBehalf(address receiver, uint mintAmount) external returns (uint);\\n\\n function redeem(uint redeemTokens) external returns (uint);\\n\\n function redeemUnderlying(uint redeemAmount) external returns (uint);\\n\\n function borrow(uint borrowAmount) external returns (uint);\\n\\n function repayBorrow(uint repayAmount) external returns (uint);\\n\\n function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint);\\n\\n function liquidateBorrow(\\n address borrower,\\n uint repayAmount,\\n VTokenInterface vTokenCollateral\\n ) external returns (uint);\\n\\n /*** Admin Functions ***/\\n\\n function _addReserves(uint addAmount) external returns (uint);\\n}\\n\\ncontract VDelegatorInterface {\\n /**\\n * @notice Emitted when implementation is changed\\n */\\n event NewImplementation(address oldImplementation, address newImplementation);\\n\\n /**\\n * @notice Called by the admin to update the implementation of the delegator\\n * @param implementation_ The address of the new implementation for delegation\\n * @param allowResign Flag to indicate whether to call _resignImplementation on the old implementation\\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\\n */\\n function _setImplementation(\\n address implementation_,\\n bool allowResign,\\n bytes memory becomeImplementationData\\n ) public;\\n}\\n\\ncontract VDelegateInterface {\\n /**\\n * @notice Called by the delegator on a delegate to initialize it for duty\\n * @dev Should revert if any issues arise which make it unfit for delegation\\n * @param data The encoded bytes data for any initialization\\n */\\n function _becomeImplementation(bytes memory data) public;\\n\\n /**\\n * @notice Called by the delegator on a delegate to forfeit its responsibility\\n */\\n function _resignImplementation() public;\\n}\\n\",\"keccak256\":\"0x2f12533847458414b423cc85677489709d772bec4e48933ae983d6861202a41b\"},\"contracts/Utils/CarefulMath.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\n/**\\n * @title Careful Math\\n * @author Venus\\n * @notice Derived from OpenZeppelin's SafeMath library\\n * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol\\n */\\ncontract CarefulMath {\\n /**\\n * @dev Possible error codes that we can return\\n */\\n enum MathError {\\n NO_ERROR,\\n DIVISION_BY_ZERO,\\n INTEGER_OVERFLOW,\\n INTEGER_UNDERFLOW\\n }\\n\\n /**\\n * @dev Multiplies two numbers, returns an error on overflow.\\n */\\n function mulUInt(uint a, uint b) internal pure returns (MathError, uint) {\\n if (a == 0) {\\n return (MathError.NO_ERROR, 0);\\n }\\n\\n uint c = a * b;\\n\\n if (c / a != b) {\\n return (MathError.INTEGER_OVERFLOW, 0);\\n } else {\\n return (MathError.NO_ERROR, c);\\n }\\n }\\n\\n /**\\n * @dev Integer division of two numbers, truncating the quotient.\\n */\\n function divUInt(uint a, uint b) internal pure returns (MathError, uint) {\\n if (b == 0) {\\n return (MathError.DIVISION_BY_ZERO, 0);\\n }\\n\\n return (MathError.NO_ERROR, a / b);\\n }\\n\\n /**\\n * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).\\n */\\n function subUInt(uint a, uint b) internal pure returns (MathError, uint) {\\n if (b <= a) {\\n return (MathError.NO_ERROR, a - b);\\n } else {\\n return (MathError.INTEGER_UNDERFLOW, 0);\\n }\\n }\\n\\n /**\\n * @dev Adds two numbers, returns an error on overflow.\\n */\\n function addUInt(uint a, uint b) internal pure returns (MathError, uint) {\\n uint c = a + b;\\n\\n if (c >= a) {\\n return (MathError.NO_ERROR, c);\\n } else {\\n return (MathError.INTEGER_OVERFLOW, 0);\\n }\\n }\\n\\n /**\\n * @dev add a and b and then subtract c\\n */\\n function addThenSubUInt(uint a, uint b, uint c) internal pure returns (MathError, uint) {\\n (MathError err0, uint sum) = addUInt(a, b);\\n\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, 0);\\n }\\n\\n return subUInt(sum, c);\\n }\\n}\\n\",\"keccak256\":\"0x5bd84fb723641b98d0559272323b90ce42595f025af89cfb214d8c064c9ee3c3\"},\"contracts/Utils/ErrorReporter.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\ncontract ComptrollerErrorReporter {\\n enum Error {\\n NO_ERROR,\\n UNAUTHORIZED,\\n COMPTROLLER_MISMATCH,\\n INSUFFICIENT_SHORTFALL,\\n INSUFFICIENT_LIQUIDITY,\\n INVALID_CLOSE_FACTOR,\\n INVALID_COLLATERAL_FACTOR,\\n INVALID_LIQUIDATION_INCENTIVE,\\n MARKET_NOT_ENTERED, // no longer possible\\n MARKET_NOT_LISTED,\\n MARKET_ALREADY_LISTED,\\n MATH_ERROR,\\n NONZERO_BORROW_BALANCE,\\n PRICE_ERROR,\\n REJECTION,\\n SNAPSHOT_ERROR,\\n TOO_MANY_ASSETS,\\n TOO_MUCH_REPAY,\\n INSUFFICIENT_BALANCE_FOR_VAI,\\n MARKET_NOT_COLLATERAL\\n }\\n\\n enum FailureInfo {\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\\n EXIT_MARKET_BALANCE_OWED,\\n EXIT_MARKET_REJECTION,\\n SET_CLOSE_FACTOR_OWNER_CHECK,\\n SET_CLOSE_FACTOR_VALIDATION,\\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\\n SET_COLLATERAL_FACTOR_NO_EXISTS,\\n SET_COLLATERAL_FACTOR_VALIDATION,\\n SET_COLLATERAL_FACTOR_WITHOUT_PRICE,\\n SET_IMPLEMENTATION_OWNER_CHECK,\\n SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,\\n SET_LIQUIDATION_INCENTIVE_VALIDATION,\\n SET_MAX_ASSETS_OWNER_CHECK,\\n SET_PENDING_ADMIN_OWNER_CHECK,\\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\\n SET_PRICE_ORACLE_OWNER_CHECK,\\n SUPPORT_MARKET_EXISTS,\\n SUPPORT_MARKET_OWNER_CHECK,\\n SET_PAUSE_GUARDIAN_OWNER_CHECK,\\n SET_VAI_MINT_RATE_CHECK,\\n SET_VAICONTROLLER_OWNER_CHECK,\\n SET_MINTED_VAI_REJECTION,\\n SET_TREASURY_OWNER_CHECK,\\n UNLIST_MARKET_NOT_LISTED\\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\\ncontract TokenErrorReporter {\\n enum Error {\\n NO_ERROR,\\n UNAUTHORIZED,\\n BAD_INPUT,\\n COMPTROLLER_REJECTION,\\n COMPTROLLER_CALCULATION_ERROR,\\n INTEREST_RATE_MODEL_ERROR,\\n INVALID_ACCOUNT_PAIR,\\n INVALID_CLOSE_AMOUNT_REQUESTED,\\n INVALID_COLLATERAL_FACTOR,\\n MATH_ERROR,\\n MARKET_NOT_FRESH,\\n MARKET_NOT_LISTED,\\n TOKEN_INSUFFICIENT_ALLOWANCE,\\n TOKEN_INSUFFICIENT_BALANCE,\\n TOKEN_INSUFFICIENT_CASH,\\n TOKEN_TRANSFER_IN_FAILED,\\n TOKEN_TRANSFER_OUT_FAILED,\\n TOKEN_PRICE_ERROR\\n }\\n\\n /*\\n * Note: FailureInfo (but not Error) is kept in alphabetical order\\n * This is because FailureInfo grows significantly faster, and\\n * the order of Error has some meaning, while the order of FailureInfo\\n * is entirely arbitrary.\\n */\\n enum FailureInfo {\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\n ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,\\n ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,\\n ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,\\n ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,\\n BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\n BORROW_ACCRUE_INTEREST_FAILED,\\n BORROW_CASH_NOT_AVAILABLE,\\n BORROW_FRESHNESS_CHECK,\\n BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\\n BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\n BORROW_MARKET_NOT_LISTED,\\n BORROW_COMPTROLLER_REJECTION,\\n LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\\n LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\\n LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\\n LIQUIDATE_COMPTROLLER_REJECTION,\\n LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\\n LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\\n LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\\n LIQUIDATE_FRESHNESS_CHECK,\\n LIQUIDATE_LIQUIDATOR_IS_BORROWER,\\n LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\\n LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\\n LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\\n LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\\n LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\\n LIQUIDATE_SEIZE_TOO_MUCH,\\n MINT_ACCRUE_INTEREST_FAILED,\\n MINT_COMPTROLLER_REJECTION,\\n MINT_EXCHANGE_CALCULATION_FAILED,\\n MINT_EXCHANGE_RATE_READ_FAILED,\\n MINT_FRESHNESS_CHECK,\\n MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\\n MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\\n MINT_TRANSFER_IN_FAILED,\\n MINT_TRANSFER_IN_NOT_POSSIBLE,\\n REDEEM_ACCRUE_INTEREST_FAILED,\\n REDEEM_COMPTROLLER_REJECTION,\\n REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,\\n REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,\\n REDEEM_EXCHANGE_RATE_READ_FAILED,\\n REDEEM_FRESHNESS_CHECK,\\n REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,\\n REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,\\n REDEEM_TRANSFER_OUT_NOT_POSSIBLE,\\n REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,\\n REDUCE_RESERVES_ADMIN_CHECK,\\n REDUCE_RESERVES_CASH_NOT_AVAILABLE,\\n REDUCE_RESERVES_FRESH_CHECK,\\n REDUCE_RESERVES_VALIDATION,\\n REPAY_BEHALF_ACCRUE_INTEREST_FAILED,\\n REPAY_BORROW_ACCRUE_INTEREST_FAILED,\\n REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_COMPTROLLER_REJECTION,\\n REPAY_BORROW_FRESHNESS_CHECK,\\n REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,\\n REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,\\n SET_COLLATERAL_FACTOR_OWNER_CHECK,\\n SET_COLLATERAL_FACTOR_VALIDATION,\\n SET_COMPTROLLER_OWNER_CHECK,\\n SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,\\n SET_INTEREST_RATE_MODEL_FRESH_CHECK,\\n SET_INTEREST_RATE_MODEL_OWNER_CHECK,\\n SET_MAX_ASSETS_OWNER_CHECK,\\n SET_ORACLE_MARKET_NOT_LISTED,\\n SET_PENDING_ADMIN_OWNER_CHECK,\\n SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,\\n SET_RESERVE_FACTOR_ADMIN_CHECK,\\n SET_RESERVE_FACTOR_FRESH_CHECK,\\n SET_RESERVE_FACTOR_BOUNDS_CHECK,\\n TRANSFER_COMPTROLLER_REJECTION,\\n TRANSFER_NOT_ALLOWED,\\n TRANSFER_NOT_ENOUGH,\\n TRANSFER_TOO_MUCH,\\n ADD_RESERVES_ACCRUE_INTEREST_FAILED,\\n ADD_RESERVES_FRESH_CHECK,\\n ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE,\\n TOKEN_GET_UNDERLYING_PRICE_ERROR,\\n REPAY_VAI_COMPTROLLER_REJECTION,\\n REPAY_VAI_FRESHNESS_CHECK,\\n VAI_MINT_EXCHANGE_CALCULATION_FAILED,\\n SFT_MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED\\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\\ncontract VAIControllerErrorReporter {\\n enum Error {\\n NO_ERROR,\\n UNAUTHORIZED, // The sender is not authorized to perform this action.\\n REJECTION, // The action would violate the comptroller, vaicontroller policy.\\n SNAPSHOT_ERROR, // The comptroller could not get the account borrows and exchange rate from the market.\\n PRICE_ERROR, // The comptroller could not obtain a required price of an asset.\\n MATH_ERROR, // A math calculation error occurred.\\n INSUFFICIENT_BALANCE_FOR_VAI // Caller does not have sufficient balance to mint VAI.\\n }\\n\\n enum FailureInfo {\\n SET_PENDING_ADMIN_OWNER_CHECK,\\n SET_PENDING_IMPLEMENTATION_OWNER_CHECK,\\n SET_COMPTROLLER_OWNER_CHECK,\\n ACCEPT_ADMIN_PENDING_ADMIN_CHECK,\\n ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,\\n VAI_MINT_REJECTION,\\n VAI_BURN_REJECTION,\\n VAI_LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,\\n VAI_LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,\\n VAI_LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,\\n VAI_LIQUIDATE_COMPTROLLER_REJECTION,\\n VAI_LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,\\n VAI_LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,\\n VAI_LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,\\n VAI_LIQUIDATE_FRESHNESS_CHECK,\\n VAI_LIQUIDATE_LIQUIDATOR_IS_BORROWER,\\n VAI_LIQUIDATE_REPAY_BORROW_FRESH_FAILED,\\n VAI_LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,\\n VAI_LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,\\n VAI_LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,\\n VAI_LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,\\n VAI_LIQUIDATE_SEIZE_TOO_MUCH,\\n MINT_FEE_CALCULATION_FAILED,\\n SET_TREASURY_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\",\"keccak256\":\"0x4f5a41ef380336395706659e2b8f315870dcf3d617ea6f81104424500b15b1ef\"},\"contracts/Utils/Exponential.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"./CarefulMath.sol\\\";\\nimport \\\"./ExponentialNoError.sol\\\";\\n\\n/**\\n * @title Exponential module for storing fixed-precision decimals\\n * @author Venus\\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\\n * `Exp({mantissa: 5100000000000000000})`.\\n */\\ncontract Exponential is CarefulMath, ExponentialNoError {\\n /**\\n * @dev Creates an exponential from numerator and denominator values.\\n * Note: Returns an error if (`num` * 10e18) > MAX_INT,\\n * or if `denom` is zero.\\n */\\n function getExp(uint num, uint denom) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint scaledNumerator) = mulUInt(num, expScale);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n (MathError err1, uint rational) = divUInt(scaledNumerator, denom);\\n if (err1 != MathError.NO_ERROR) {\\n return (err1, Exp({ mantissa: 0 }));\\n }\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: rational }));\\n }\\n\\n /**\\n * @dev Adds two exponentials, returning a new exponential.\\n */\\n function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n (MathError error, uint result) = addUInt(a.mantissa, b.mantissa);\\n\\n return (error, Exp({ mantissa: result }));\\n }\\n\\n /**\\n * @dev Subtracts two exponentials, returning a new exponential.\\n */\\n function subExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n (MathError error, uint result) = subUInt(a.mantissa, b.mantissa);\\n\\n return (error, Exp({ mantissa: result }));\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, returning a new Exp.\\n */\\n function mulScalar(Exp memory a, uint scalar) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint scaledMantissa) = mulUInt(a.mantissa, scalar);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: scaledMantissa }));\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\\n */\\n function mulScalarTruncate(Exp memory a, uint scalar) internal pure returns (MathError, uint) {\\n (MathError err, Exp memory product) = mulScalar(a, scalar);\\n if (err != MathError.NO_ERROR) {\\n return (err, 0);\\n }\\n\\n return (MathError.NO_ERROR, truncate(product));\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\\n */\\n function mulScalarTruncateAddUInt(Exp memory a, uint scalar, uint addend) internal pure returns (MathError, uint) {\\n (MathError err, Exp memory product) = mulScalar(a, scalar);\\n if (err != MathError.NO_ERROR) {\\n return (err, 0);\\n }\\n\\n return addUInt(truncate(product), addend);\\n }\\n\\n /**\\n * @dev Divide an Exp by a scalar, returning a new Exp.\\n */\\n function divScalar(Exp memory a, uint scalar) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint descaledMantissa) = divUInt(a.mantissa, scalar);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: descaledMantissa }));\\n }\\n\\n /**\\n * @dev Divide a scalar by an Exp, returning a new Exp.\\n */\\n function divScalarByExp(uint scalar, Exp memory divisor) internal pure returns (MathError, Exp memory) {\\n /*\\n We are doing this as:\\n getExp(mulUInt(expScale, scalar), divisor.mantissa)\\n\\n How it works:\\n Exp = a / b;\\n Scalar = s;\\n `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale`\\n */\\n (MathError err0, uint numerator) = mulUInt(expScale, scalar);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n return getExp(numerator, divisor.mantissa);\\n }\\n\\n /**\\n * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer.\\n */\\n function divScalarByExpTruncate(uint scalar, Exp memory divisor) internal pure returns (MathError, uint) {\\n (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);\\n if (err != MathError.NO_ERROR) {\\n return (err, 0);\\n }\\n\\n return (MathError.NO_ERROR, truncate(fraction));\\n }\\n\\n /**\\n * @dev Multiplies two exponentials, returning a new exponential.\\n */\\n function mulExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n (MathError err0, uint doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);\\n if (err0 != MathError.NO_ERROR) {\\n return (err0, Exp({ mantissa: 0 }));\\n }\\n\\n // We add half the scale before dividing so that we get rounding instead of truncation.\\n // See \\\"Listing 6\\\" and text above it at https://accu.org/index.php/journals/1717\\n // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.\\n (MathError err1, uint doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct);\\n if (err1 != MathError.NO_ERROR) {\\n return (err1, Exp({ mantissa: 0 }));\\n }\\n\\n (MathError err2, uint product) = divUInt(doubleScaledProductWithHalfScale, expScale);\\n // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero.\\n assert(err2 == MathError.NO_ERROR);\\n\\n return (MathError.NO_ERROR, Exp({ mantissa: product }));\\n }\\n\\n /**\\n * @dev Multiplies two exponentials given their mantissas, returning a new exponential.\\n */\\n function mulExp(uint a, uint b) internal pure returns (MathError, Exp memory) {\\n return mulExp(Exp({ mantissa: a }), Exp({ mantissa: b }));\\n }\\n\\n /**\\n * @dev Multiplies three exponentials, returning a new exponential.\\n */\\n function mulExp3(Exp memory a, Exp memory b, Exp memory c) internal pure returns (MathError, Exp memory) {\\n (MathError err, Exp memory ab) = mulExp(a, b);\\n if (err != MathError.NO_ERROR) {\\n return (err, ab);\\n }\\n return mulExp(ab, c);\\n }\\n\\n /**\\n * @dev Divides two exponentials, returning a new exponential.\\n * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,\\n * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)\\n */\\n function divExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) {\\n return getExp(a.mantissa, b.mantissa);\\n }\\n}\\n\",\"keccak256\":\"0x92a68e9f6de3a70b103aa0ddb68faa8e60c443b1268e03853d5054171fe8e290\"},\"contracts/Utils/ExponentialNoError.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\n/**\\n * @title Exponential module for storing fixed-precision decimals\\n * @author Compound\\n * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.\\n * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:\\n * `Exp({mantissa: 5100000000000000000})`.\\n */\\ncontract ExponentialNoError {\\n uint internal constant expScale = 1e18;\\n uint internal constant doubleScale = 1e36;\\n uint internal constant halfExpScale = expScale / 2;\\n uint internal constant mantissaOne = expScale;\\n\\n struct Exp {\\n uint mantissa;\\n }\\n\\n struct Double {\\n uint mantissa;\\n }\\n\\n /**\\n * @dev Truncates the given exp to a whole number value.\\n * For example, truncate(Exp{mantissa: 15 * expScale}) = 15\\n */\\n function truncate(Exp memory exp) internal pure returns (uint) {\\n // Note: We are not using careful math here as we're performing a division that cannot fail\\n return exp.mantissa / expScale;\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.\\n */\\n function mul_ScalarTruncate(Exp memory a, uint scalar) internal pure returns (uint) {\\n Exp memory product = mul_(a, scalar);\\n return truncate(product);\\n }\\n\\n /**\\n * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.\\n */\\n function mul_ScalarTruncateAddUInt(Exp memory a, uint scalar, uint addend) internal pure returns (uint) {\\n Exp memory product = mul_(a, scalar);\\n return add_(truncate(product), addend);\\n }\\n\\n /**\\n * @dev Checks if first Exp is less than second Exp.\\n */\\n function lessThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\n return left.mantissa < right.mantissa;\\n }\\n\\n /**\\n * @dev Checks if left Exp <= right Exp.\\n */\\n function lessThanOrEqualExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\n return left.mantissa <= right.mantissa;\\n }\\n\\n /**\\n * @dev Checks if left Exp > right Exp.\\n */\\n function greaterThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {\\n return left.mantissa > right.mantissa;\\n }\\n\\n /**\\n * @dev returns true if Exp is exactly zero\\n */\\n function isZeroExp(Exp memory value) internal pure returns (bool) {\\n return value.mantissa == 0;\\n }\\n\\n function safe224(uint n, string memory errorMessage) internal pure returns (uint224) {\\n require(n < 2 ** 224, errorMessage);\\n return uint224(n);\\n }\\n\\n function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {\\n require(n < 2 ** 32, errorMessage);\\n return uint32(n);\\n }\\n\\n function add_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: add_(a.mantissa, b.mantissa) });\\n }\\n\\n function add_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: add_(a.mantissa, b.mantissa) });\\n }\\n\\n function add_(uint a, uint b) internal pure returns (uint) {\\n return add_(a, b, \\\"addition overflow\\\");\\n }\\n\\n function add_(uint a, uint b, string memory errorMessage) internal pure returns (uint) {\\n uint c = a + b;\\n require(c >= a, errorMessage);\\n return c;\\n }\\n\\n function sub_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: sub_(a.mantissa, b.mantissa) });\\n }\\n\\n function sub_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: sub_(a.mantissa, b.mantissa) });\\n }\\n\\n function sub_(uint a, uint b) internal pure returns (uint) {\\n return sub_(a, b, \\\"subtraction underflow\\\");\\n }\\n\\n function sub_(uint a, uint b, string memory errorMessage) internal pure returns (uint) {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n\\n function mul_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: mul_(a.mantissa, b.mantissa) / expScale });\\n }\\n\\n function mul_(Exp memory a, uint b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: mul_(a.mantissa, b) });\\n }\\n\\n function mul_(uint a, Exp memory b) internal pure returns (uint) {\\n return mul_(a, b.mantissa) / expScale;\\n }\\n\\n function mul_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: mul_(a.mantissa, b.mantissa) / doubleScale });\\n }\\n\\n function mul_(Double memory a, uint b) internal pure returns (Double memory) {\\n return Double({ mantissa: mul_(a.mantissa, b) });\\n }\\n\\n function mul_(uint a, Double memory b) internal pure returns (uint) {\\n return mul_(a, b.mantissa) / doubleScale;\\n }\\n\\n function mul_(uint a, uint b) internal pure returns (uint) {\\n return mul_(a, b, \\\"multiplication overflow\\\");\\n }\\n\\n function mul_(uint a, uint b, string memory errorMessage) internal pure returns (uint) {\\n if (a == 0 || b == 0) {\\n return 0;\\n }\\n uint c = a * b;\\n require(c / a == b, errorMessage);\\n return c;\\n }\\n\\n function div_(Exp memory a, Exp memory b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: div_(mul_(a.mantissa, expScale), b.mantissa) });\\n }\\n\\n function div_(Exp memory a, uint b) internal pure returns (Exp memory) {\\n return Exp({ mantissa: div_(a.mantissa, b) });\\n }\\n\\n function div_(uint a, Exp memory b) internal pure returns (uint) {\\n return div_(mul_(a, expScale), b.mantissa);\\n }\\n\\n function div_(Double memory a, Double memory b) internal pure returns (Double memory) {\\n return Double({ mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa) });\\n }\\n\\n function div_(Double memory a, uint b) internal pure returns (Double memory) {\\n return Double({ mantissa: div_(a.mantissa, b) });\\n }\\n\\n function div_(uint a, Double memory b) internal pure returns (uint) {\\n return div_(mul_(a, doubleScale), b.mantissa);\\n }\\n\\n function div_(uint a, uint b) internal pure returns (uint) {\\n return div_(a, b, \\\"divide by zero\\\");\\n }\\n\\n function div_(uint a, uint b, string memory errorMessage) internal pure returns (uint) {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n\\n function fraction(uint a, uint b) internal pure returns (Double memory) {\\n return Double({ mantissa: div_(mul_(a, doubleScale), b) });\\n }\\n}\\n\",\"keccak256\":\"0x237e63d9ad2bf232d70f854b8867a465913cab4d2033d295ec7736bf618ca302\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620026af380380620026af83398181016040526101408110156200003857600080fd5b81516020830151604080850151606086015160808701805193519597949692959194919392820192846401000000008211156200007457600080fd5b9083019060208201858111156200008a57600080fd5b8251640100000000811182820188101715620000a557600080fd5b82525081516020918201929091019080838360005b83811015620000d4578181015183820152602001620000ba565b50505050905090810190601f168015620001025780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200012657600080fd5b9083019060208201858111156200013c57600080fd5b82516401000000008111828201881017156200015757600080fd5b82525081516020918201929091019080838360005b83811015620001865781810151838201526020016200016c565b50505050905090810190601f168015620001b45780820380516001836020036101000a031916815260200191505b50604081815260208301519083015160608401516080909401805192969195919284640100000000821115620001e957600080fd5b908301906020820185811115620001ff57600080fd5b82516401000000008111828201881017156200021a57600080fd5b82525081516020918201929091019080838360005b83811015620002495781810151838201526020016200022f565b50505050905090810190601f168015620002775780820380516001836020036101000a031916815260200191505b5060405250505033600360016101000a8154816001600160a01b0302191690836001600160a01b0316021790555062000424828b8b8b8b8b8b8b60405160240180886001600160a01b03166001600160a01b03168152602001876001600160a01b03166001600160a01b03168152602001866001600160a01b03166001600160a01b0316815260200185815260200180602001806020018460ff1660ff168152602001838103835286818151815260200191508051906020019080838360005b838110156200035157818101518382015260200162000337565b50505050905090810190601f1680156200037f5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015620003b45781810151838201526020016200039a565b50505050905090810190601f168015620003e25780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03908116631a31d46560e01b17909152909a50620004721698505050505050505050565b506200043c826000836001600160e01b036200053916565b5050600380546001600160a01b0390921661010002610100600160a81b0319909216919091179055506200071a95505050505050565b606060006060846001600160a01b0316846040518082805190602001908083835b60208310620004b45780518252601f19909201916020918201910162000493565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811462000516576040519150601f19603f3d011682016040523d82523d6000602084013e6200051b565b606091505b5091509150600082141562000531573d60208201fd5b949350505050565b60035461010090046001600160a01b03163314620005895760405162461bcd60e51b8152600401808060200182810382526039815260200180620026766039913960400191505060405180910390fd5b8115620005cb576040805160048152602481019091526020810180516001600160e01b0390811663153ab50560e01b17909152620005c99190620006f016565b505b601280546001600160a01b038581166001600160a01b03198316179092556040516020602482018181528551604484015285519490931693620006a1938693909283926064909201919085019080838360005b83811015620006385781810151838201526020016200061e565b50505050905090810190601f168015620006665780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03908116630adccee560e31b17909152909350620006f016915050565b50601254604080516001600160a01b038085168252909216602083015280517fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a9281900390910190a150505050565b60125460609062000714906001600160a01b0316836001600160e01b036200047216565b92915050565b611f4c806200072a6000396000f3fe6080604052600436106103505760003560e01c806373acee98116101c6578063bd6d894d116100f7578063e9c714f211610095578063f5e3c4621161006f578063f5e3c46214610db4578063f851a44014610df7578063f8f9da2814610e0c578063fca7820b14610e2157610350565b8063e9c714f214610d57578063f2b3abbd14610d6c578063f3fdb15a14610d9f57610350565b8063d1109c2f116100d1578063d1109c2f14610cc8578063db006a7514610cdd578063dd62ed3e14610d07578063e9a44fd914610d4257610350565b8063bd6d894d14610c30578063c37f68e214610c45578063c5ebeaec14610c9e57610350565b8063a9059cbb11610164578063ae9d70b01161013e578063ae9d70b014610b90578063b2a02ff114610ba5578063b4a0bdf314610be8578063b71d1a0c14610bfd57610350565b8063a9059cbb14610b2d578063aa5af0fd14610b66578063ae96f14114610b7b57610350565b806395d89b41116101a057806395d89b4114610aa657806395dd919314610abb578063a0712d6814610aee578063a6afed9514610b1857610350565b806373acee9814610a52578063852a12e314610a675780638f840ddd14610a9157610350565b80633af9e669116102a0578063555bcc401161023e578063601a0bf111610218578063601a0bf1146109cb5780636c540baf146109f55780636f307dc314610a0a57806370a0823114610a1f57610350565b8063555bcc40146108d75780635c60da1b146109a15780635fe3b567146109b657610350565b80633e9410101161027a5780633e941010146107b45780634487152f146107de5780634576b5db1461088f57806347bd3718146108c257610350565b80633af9e669146107575780633b1d21a21461078a5780633d9ea3a11461079f57610350565b806318160ddd1161030d57806323b872dd116102e757806323b872dd1461067f5780632608f818146106c257806326782247146106fb578063313ce5671461072c57610350565b806318160ddd1461061c578063182df0f51461063157806323323e031461064657610350565b806306fdde03146104105780630933c1ed1461049a578063095ea7b31461054b5780630e75270214610598578063173b9904146105d457806317bfdfbc146105e9575b341561038d5760405162461bcd60e51b8152600401808060200182810382526037815260200180611ee16037913960400191505060405180910390fd5b6012546040516000916001600160a01b031690829036908083838082843760405192019450600093509091505080830381855af49150503d80600081146103f0576040519150601f19603f3d011682016040523d82523d6000602084013e6103f5565b606091505b505090506040513d6000823e81801561040c573d82f35b3d82fd5b34801561041c57600080fd5b50610425610e4b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561045f578181015183820152602001610447565b50505050905090810190601f16801561048c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104a657600080fd5b50610425600480360360208110156104bd57600080fd5b810190602081018135600160201b8111156104d757600080fd5b8201836020820111156104e957600080fd5b803590602001918460018302840111600160201b8311171561050a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610ed8945050505050565b34801561055757600080fd5b506105846004803603604081101561056e57600080fd5b506001600160a01b038135169060200135610ef7565b604080519115158252519081900360200190f35b3480156105a457600080fd5b506105c2600480360360208110156105bb57600080fd5b5035610f6e565b60408051918252519081900360200190f35b3480156105e057600080fd5b506105c2610fd5565b3480156105f557600080fd5b506105c26004803603602081101561060c57600080fd5b50356001600160a01b0316610fdb565b34801561062857600080fd5b506105c261102d565b34801561063d57600080fd5b506105c2611033565b34801561065257600080fd5b506105c26004803603604081101561066957600080fd5b506001600160a01b03813516906020013561108a565b34801561068b57600080fd5b50610584600480360360608110156106a257600080fd5b506001600160a01b038135811691602081013590911690604001356110e0565b3480156106ce57600080fd5b506105c2600480360360408110156106e557600080fd5b506001600160a01b038135169060200135611160565b34801561070757600080fd5b506107106111b6565b604080516001600160a01b039092168252519081900360200190f35b34801561073857600080fd5b506107416111c5565b6040805160ff9092168252519081900360200190f35b34801561076357600080fd5b506105c26004803603602081101561077a57600080fd5b50356001600160a01b03166111ce565b34801561079657600080fd5b506105c2611220565b3480156107ab57600080fd5b50610584611258565b3480156107c057600080fd5b506105c2600480360360208110156107d757600080fd5b503561125d565b3480156107ea57600080fd5b506104256004803603602081101561080157600080fd5b810190602081018135600160201b81111561081b57600080fd5b82018360208201111561082d57600080fd5b803590602001918460018302840111600160201b8311171561084e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506112a4945050505050565b34801561089b57600080fd5b506105c2600480360360208110156108b257600080fd5b50356001600160a01b03166114c3565b3480156108ce57600080fd5b506105c2611515565b3480156108e357600080fd5b5061099f600480360360608110156108fa57600080fd5b6001600160a01b03823516916020810135151591810190606081016040820135600160201b81111561092b57600080fd5b82018360208201111561093d57600080fd5b803590602001918460018302840111600160201b8311171561095e57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061151b945050505050565b005b3480156109ad57600080fd5b506107106116be565b3480156109c257600080fd5b506107106116cd565b3480156109d757600080fd5b506105c2600480360360208110156109ee57600080fd5b50356116dc565b348015610a0157600080fd5b506105c2611723565b348015610a1657600080fd5b50610710611729565b348015610a2b57600080fd5b506105c260048036036020811015610a4257600080fd5b50356001600160a01b0316611738565b348015610a5e57600080fd5b506105c261178a565b348015610a7357600080fd5b506105c260048036036020811015610a8a57600080fd5b50356117c2565b348015610a9d57600080fd5b506105c2611809565b348015610ab257600080fd5b5061042561180f565b348015610ac757600080fd5b506105c260048036036020811015610ade57600080fd5b50356001600160a01b0316611867565b348015610afa57600080fd5b506105c260048036036020811015610b1157600080fd5b50356118b9565b348015610b2457600080fd5b506105c2611900565b348015610b3957600080fd5b5061058460048036036040811015610b5057600080fd5b506001600160a01b038135169060200135611938565b348015610b7257600080fd5b506105c261198e565b348015610b8757600080fd5b506105c2611994565b348015610b9c57600080fd5b506105c261199a565b348015610bb157600080fd5b506105c260048036036060811015610bc857600080fd5b506001600160a01b038135811691602081013590911690604001356119d2565b348015610bf457600080fd5b50610710611a30565b348015610c0957600080fd5b506105c260048036036020811015610c2057600080fd5b50356001600160a01b0316611a3f565b348015610c3c57600080fd5b506105c2611a91565b348015610c5157600080fd5b50610c7860048036036020811015610c6857600080fd5b50356001600160a01b0316611ac9565b604080519485526020850193909352838301919091526060830152519081900360800190f35b348015610caa57600080fd5b506105c260048036036020811015610cc157600080fd5b5035611b5b565b348015610cd457600080fd5b506105c2611ba2565b348015610ce957600080fd5b506105c260048036036020811015610d0057600080fd5b5035611ba8565b348015610d1357600080fd5b506105c260048036036040811015610d2a57600080fd5b506001600160a01b0381358116916020013516611bef565b348015610d4e57600080fd5b50610710611c49565b348015610d6357600080fd5b506105c2611c58565b348015610d7857600080fd5b506105c260048036036020811015610d8f57600080fd5b50356001600160a01b0316611c90565b348015610dab57600080fd5b50610710611ce2565b348015610dc057600080fd5b506105c260048036036060811015610dd757600080fd5b506001600160a01b03813581169160208101359160409091013516611cf1565b348015610e0357600080fd5b50610710611d52565b348015610e1857600080fd5b506105c2611d66565b348015610e2d57600080fd5b506105c260048036036020811015610e4457600080fd5b5035611d9e565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610ed05780601f10610ea557610100808354040283529160200191610ed0565b820191906000526020600020905b815481529060010190602001808311610eb357829003601f168201915b505050505081565b601254606090610ef1906001600160a01b031683611de5565b92915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052600090606090610f4d90610ed8565b9050808060200190516020811015610f6457600080fd5b5051949350505050565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663073a938160e11b179052600090606090610fb590610ed8565b9050808060200190516020811015610fcc57600080fd5b50519392505050565b60085481565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166305eff7ef60e21b179052600090606090610fb590610ed8565b600d5481565b6040805160048152602481019091526020810180516001600160e01b031663182df0f560e01b17905260009060609061106b906112a4565b905080806020019051602081101561108257600080fd5b505191505090565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b03166323323e0360e01b179052600090606090610f4d90610ed8565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905260009060609061113e90610ed8565b905080806020019051602081101561115557600080fd5b505195945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b03166304c11f0360e31b179052600090606090610f4d90610ed8565b6004546001600160a01b031681565b60035460ff1681565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316633af9e66960e01b179052600090606090610fb590610ed8565b6040805160048152602481019091526020810180516001600160e01b0316631d8e90d160e11b17905260009060609061106b906112a4565b600181565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b03166303e9410160e41b179052600090606090610fb590610ed8565b606060006060306001600160a01b0316846040516024018080602001828103825283818151815260200191508051906020019080838360005b838110156112f55781810151838201526020016112dd565b50505050905090810190601f1680156113225780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b0316630933c1ed60e01b178152905182519295509350839250908083835b6020831061137d5780518252601f19909201916020918201910161135e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d80600081146113dd576040519150601f19603f3d011682016040523d82523d6000602084013e6113e2565b606091505b509150915060008214156113f7573d60208201fd5b80806020019051602081101561140c57600080fd5b8101908080516040519392919084600160201b82111561142b57600080fd5b90830190602082018581111561144057600080fd5b8251600160201b81118282018810171561145957600080fd5b82525081516020918201929091019080838360005b8381101561148657818101518382015260200161146e565b50505050905090810190601f1680156114b35780820380516001836020036101000a031916815260200191505b5060405250505092505050919050565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316634576b5db60e01b179052600090606090610fb590610ed8565b600b5481565b60035461010090046001600160a01b031633146115695760405162461bcd60e51b8152600401808060200182810382526039815260200180611ea86039913960400191505060405180910390fd5b81156115a3576040805160048152602481019091526020810180516001600160e01b031663153ab50560e01b1790526115a190610ed8565b505b601280546001600160a01b038581166001600160a01b0319831617909255604051602060248201818152855160448401528551949093169361166f938693909283926064909201919085019080838360005b8381101561160d5781810151838201526020016115f5565b50505050905090810190601f16801561163a5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b0316630adccee560e31b1790529250610ed8915050565b50601254604080516001600160a01b038085168252909216602083015280517fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a9281900390910190a150505050565b6012546001600160a01b031681565b6005546001600160a01b031681565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663601a0bf160e01b179052600090606090610fb590610ed8565b60095481565b6011546001600160a01b031681565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166370a0823160e01b179052600090606090610fb5906112a4565b6040805160048152602481019091526020810180516001600160e01b0316630e759dd360e31b17905260009060609061106b90610ed8565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663852a12e360e01b179052600090606090610fb590610ed8565b600c5481565b6002805460408051602060018416156101000260001901909316849004601f81018490048402820184019092528181529291830182828015610ed05780601f10610ea557610100808354040283529160200191610ed0565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166395dd919360e01b179052600090606090610fb5906112a4565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663140e25ad60e31b179052600090606090610fb590610ed8565b6040805160048152602481019091526020810180516001600160e01b031663a6afed9560e01b17905260009060609061106b90610ed8565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052600090606090610f4d90610ed8565b600a5481565b60145481565b6040805160048152602481019091526020810180516001600160e01b0316630ae9d70b60e41b17905260009060609061106b906112a4565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b031663b2a02ff160e01b17905260009060609061113e90610ed8565b6016546001600160a01b031681565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316632dc7468360e21b179052600090606090610fb590610ed8565b6040805160048152602481019091526020810180516001600160e01b031663bd6d894d60e01b17905260009060609061106b90610ed8565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166361bfb47160e11b179052600090819081908190606090611b21906112a4565b9050808060200190516080811015611b3857600080fd5b508051602082015160408301516060909301519199909850919650945092505050565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663317afabb60e21b179052600090606090610fb590610ed8565b60135481565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663db006a7560e01b179052600090606090610fb590610ed8565b604080516001600160a01b03808516602483015283166044808301919091528251808303909101815260649091019091526020810180516001600160e01b0316636eb1769f60e11b179052600090606090610f4d906112a4565b6015546001600160a01b031681565b6040805160048152602481019091526020810180516001600160e01b03166374e38a7960e11b17905260009060609061106b90610ed8565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b031663f2b3abbd60e01b179052600090606090610fb590610ed8565b6006546001600160a01b031681565b604080516001600160a01b0380861660248301526044820185905283166064808301919091528251808303909101815260849091019091526020810180516001600160e01b0316637af1e23160e11b17905260009060609061113e90610ed8565b60035461010090046001600160a01b031681565b6040805160048152602481019091526020810180516001600160e01b0316631f1f3b4560e31b17905260009060609061106b906112a4565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663fca7820b60e01b179052600090606090610fb590610ed8565b606060006060846001600160a01b0316846040518082805190602001908083835b60208310611e255780518252601f199092019160209182019101611e06565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114611e85576040519150601f19603f3d011682016040523d82523d6000602084013e611e8a565b606091505b50915091506000821415611e9f573d60208201fd5b94935050505056fe56426570323044656c656761746f723a3a5f736574496d706c656d656e746174696f6e3a2043616c6c6572206d7573742062652061646d696e56426570323044656c656761746f723a66616c6c6261636b3a2063616e6e6f742073656e642076616c756520746f2066616c6c6261636ba265627a7a72315820313cbbc168c63eea8616b08cf5101539115d66fbf45db7e777f5526a7041422464736f6c6343000510003256426570323044656c656761746f723a3a5f736574496d706c656d656e746174696f6e3a2043616c6c6572206d7573742062652061646d696e", + "deployedBytecode": "0x6080604052600436106103505760003560e01c806373acee98116101c6578063bd6d894d116100f7578063e9c714f211610095578063f5e3c4621161006f578063f5e3c46214610db4578063f851a44014610df7578063f8f9da2814610e0c578063fca7820b14610e2157610350565b8063e9c714f214610d57578063f2b3abbd14610d6c578063f3fdb15a14610d9f57610350565b8063d1109c2f116100d1578063d1109c2f14610cc8578063db006a7514610cdd578063dd62ed3e14610d07578063e9a44fd914610d4257610350565b8063bd6d894d14610c30578063c37f68e214610c45578063c5ebeaec14610c9e57610350565b8063a9059cbb11610164578063ae9d70b01161013e578063ae9d70b014610b90578063b2a02ff114610ba5578063b4a0bdf314610be8578063b71d1a0c14610bfd57610350565b8063a9059cbb14610b2d578063aa5af0fd14610b66578063ae96f14114610b7b57610350565b806395d89b41116101a057806395d89b4114610aa657806395dd919314610abb578063a0712d6814610aee578063a6afed9514610b1857610350565b806373acee9814610a52578063852a12e314610a675780638f840ddd14610a9157610350565b80633af9e669116102a0578063555bcc401161023e578063601a0bf111610218578063601a0bf1146109cb5780636c540baf146109f55780636f307dc314610a0a57806370a0823114610a1f57610350565b8063555bcc40146108d75780635c60da1b146109a15780635fe3b567146109b657610350565b80633e9410101161027a5780633e941010146107b45780634487152f146107de5780634576b5db1461088f57806347bd3718146108c257610350565b80633af9e669146107575780633b1d21a21461078a5780633d9ea3a11461079f57610350565b806318160ddd1161030d57806323b872dd116102e757806323b872dd1461067f5780632608f818146106c257806326782247146106fb578063313ce5671461072c57610350565b806318160ddd1461061c578063182df0f51461063157806323323e031461064657610350565b806306fdde03146104105780630933c1ed1461049a578063095ea7b31461054b5780630e75270214610598578063173b9904146105d457806317bfdfbc146105e9575b341561038d5760405162461bcd60e51b8152600401808060200182810382526037815260200180611ee16037913960400191505060405180910390fd5b6012546040516000916001600160a01b031690829036908083838082843760405192019450600093509091505080830381855af49150503d80600081146103f0576040519150601f19603f3d011682016040523d82523d6000602084013e6103f5565b606091505b505090506040513d6000823e81801561040c573d82f35b3d82fd5b34801561041c57600080fd5b50610425610e4b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561045f578181015183820152602001610447565b50505050905090810190601f16801561048c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104a657600080fd5b50610425600480360360208110156104bd57600080fd5b810190602081018135600160201b8111156104d757600080fd5b8201836020820111156104e957600080fd5b803590602001918460018302840111600160201b8311171561050a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610ed8945050505050565b34801561055757600080fd5b506105846004803603604081101561056e57600080fd5b506001600160a01b038135169060200135610ef7565b604080519115158252519081900360200190f35b3480156105a457600080fd5b506105c2600480360360208110156105bb57600080fd5b5035610f6e565b60408051918252519081900360200190f35b3480156105e057600080fd5b506105c2610fd5565b3480156105f557600080fd5b506105c26004803603602081101561060c57600080fd5b50356001600160a01b0316610fdb565b34801561062857600080fd5b506105c261102d565b34801561063d57600080fd5b506105c2611033565b34801561065257600080fd5b506105c26004803603604081101561066957600080fd5b506001600160a01b03813516906020013561108a565b34801561068b57600080fd5b50610584600480360360608110156106a257600080fd5b506001600160a01b038135811691602081013590911690604001356110e0565b3480156106ce57600080fd5b506105c2600480360360408110156106e557600080fd5b506001600160a01b038135169060200135611160565b34801561070757600080fd5b506107106111b6565b604080516001600160a01b039092168252519081900360200190f35b34801561073857600080fd5b506107416111c5565b6040805160ff9092168252519081900360200190f35b34801561076357600080fd5b506105c26004803603602081101561077a57600080fd5b50356001600160a01b03166111ce565b34801561079657600080fd5b506105c2611220565b3480156107ab57600080fd5b50610584611258565b3480156107c057600080fd5b506105c2600480360360208110156107d757600080fd5b503561125d565b3480156107ea57600080fd5b506104256004803603602081101561080157600080fd5b810190602081018135600160201b81111561081b57600080fd5b82018360208201111561082d57600080fd5b803590602001918460018302840111600160201b8311171561084e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506112a4945050505050565b34801561089b57600080fd5b506105c2600480360360208110156108b257600080fd5b50356001600160a01b03166114c3565b3480156108ce57600080fd5b506105c2611515565b3480156108e357600080fd5b5061099f600480360360608110156108fa57600080fd5b6001600160a01b03823516916020810135151591810190606081016040820135600160201b81111561092b57600080fd5b82018360208201111561093d57600080fd5b803590602001918460018302840111600160201b8311171561095e57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061151b945050505050565b005b3480156109ad57600080fd5b506107106116be565b3480156109c257600080fd5b506107106116cd565b3480156109d757600080fd5b506105c2600480360360208110156109ee57600080fd5b50356116dc565b348015610a0157600080fd5b506105c2611723565b348015610a1657600080fd5b50610710611729565b348015610a2b57600080fd5b506105c260048036036020811015610a4257600080fd5b50356001600160a01b0316611738565b348015610a5e57600080fd5b506105c261178a565b348015610a7357600080fd5b506105c260048036036020811015610a8a57600080fd5b50356117c2565b348015610a9d57600080fd5b506105c2611809565b348015610ab257600080fd5b5061042561180f565b348015610ac757600080fd5b506105c260048036036020811015610ade57600080fd5b50356001600160a01b0316611867565b348015610afa57600080fd5b506105c260048036036020811015610b1157600080fd5b50356118b9565b348015610b2457600080fd5b506105c2611900565b348015610b3957600080fd5b5061058460048036036040811015610b5057600080fd5b506001600160a01b038135169060200135611938565b348015610b7257600080fd5b506105c261198e565b348015610b8757600080fd5b506105c2611994565b348015610b9c57600080fd5b506105c261199a565b348015610bb157600080fd5b506105c260048036036060811015610bc857600080fd5b506001600160a01b038135811691602081013590911690604001356119d2565b348015610bf457600080fd5b50610710611a30565b348015610c0957600080fd5b506105c260048036036020811015610c2057600080fd5b50356001600160a01b0316611a3f565b348015610c3c57600080fd5b506105c2611a91565b348015610c5157600080fd5b50610c7860048036036020811015610c6857600080fd5b50356001600160a01b0316611ac9565b604080519485526020850193909352838301919091526060830152519081900360800190f35b348015610caa57600080fd5b506105c260048036036020811015610cc157600080fd5b5035611b5b565b348015610cd457600080fd5b506105c2611ba2565b348015610ce957600080fd5b506105c260048036036020811015610d0057600080fd5b5035611ba8565b348015610d1357600080fd5b506105c260048036036040811015610d2a57600080fd5b506001600160a01b0381358116916020013516611bef565b348015610d4e57600080fd5b50610710611c49565b348015610d6357600080fd5b506105c2611c58565b348015610d7857600080fd5b506105c260048036036020811015610d8f57600080fd5b50356001600160a01b0316611c90565b348015610dab57600080fd5b50610710611ce2565b348015610dc057600080fd5b506105c260048036036060811015610dd757600080fd5b506001600160a01b03813581169160208101359160409091013516611cf1565b348015610e0357600080fd5b50610710611d52565b348015610e1857600080fd5b506105c2611d66565b348015610e2d57600080fd5b506105c260048036036020811015610e4457600080fd5b5035611d9e565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610ed05780601f10610ea557610100808354040283529160200191610ed0565b820191906000526020600020905b815481529060010190602001808311610eb357829003601f168201915b505050505081565b601254606090610ef1906001600160a01b031683611de5565b92915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052600090606090610f4d90610ed8565b9050808060200190516020811015610f6457600080fd5b5051949350505050565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663073a938160e11b179052600090606090610fb590610ed8565b9050808060200190516020811015610fcc57600080fd5b50519392505050565b60085481565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166305eff7ef60e21b179052600090606090610fb590610ed8565b600d5481565b6040805160048152602481019091526020810180516001600160e01b031663182df0f560e01b17905260009060609061106b906112a4565b905080806020019051602081101561108257600080fd5b505191505090565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b03166323323e0360e01b179052600090606090610f4d90610ed8565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905260009060609061113e90610ed8565b905080806020019051602081101561115557600080fd5b505195945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b03166304c11f0360e31b179052600090606090610f4d90610ed8565b6004546001600160a01b031681565b60035460ff1681565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316633af9e66960e01b179052600090606090610fb590610ed8565b6040805160048152602481019091526020810180516001600160e01b0316631d8e90d160e11b17905260009060609061106b906112a4565b600181565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b03166303e9410160e41b179052600090606090610fb590610ed8565b606060006060306001600160a01b0316846040516024018080602001828103825283818151815260200191508051906020019080838360005b838110156112f55781810151838201526020016112dd565b50505050905090810190601f1680156113225780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b0316630933c1ed60e01b178152905182519295509350839250908083835b6020831061137d5780518252601f19909201916020918201910161135e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d80600081146113dd576040519150601f19603f3d011682016040523d82523d6000602084013e6113e2565b606091505b509150915060008214156113f7573d60208201fd5b80806020019051602081101561140c57600080fd5b8101908080516040519392919084600160201b82111561142b57600080fd5b90830190602082018581111561144057600080fd5b8251600160201b81118282018810171561145957600080fd5b82525081516020918201929091019080838360005b8381101561148657818101518382015260200161146e565b50505050905090810190601f1680156114b35780820380516001836020036101000a031916815260200191505b5060405250505092505050919050565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316634576b5db60e01b179052600090606090610fb590610ed8565b600b5481565b60035461010090046001600160a01b031633146115695760405162461bcd60e51b8152600401808060200182810382526039815260200180611ea86039913960400191505060405180910390fd5b81156115a3576040805160048152602481019091526020810180516001600160e01b031663153ab50560e01b1790526115a190610ed8565b505b601280546001600160a01b038581166001600160a01b0319831617909255604051602060248201818152855160448401528551949093169361166f938693909283926064909201919085019080838360005b8381101561160d5781810151838201526020016115f5565b50505050905090810190601f16801561163a5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b0316630adccee560e31b1790529250610ed8915050565b50601254604080516001600160a01b038085168252909216602083015280517fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a9281900390910190a150505050565b6012546001600160a01b031681565b6005546001600160a01b031681565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663601a0bf160e01b179052600090606090610fb590610ed8565b60095481565b6011546001600160a01b031681565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166370a0823160e01b179052600090606090610fb5906112a4565b6040805160048152602481019091526020810180516001600160e01b0316630e759dd360e31b17905260009060609061106b90610ed8565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663852a12e360e01b179052600090606090610fb590610ed8565b600c5481565b6002805460408051602060018416156101000260001901909316849004601f81018490048402820184019092528181529291830182828015610ed05780601f10610ea557610100808354040283529160200191610ed0565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166395dd919360e01b179052600090606090610fb5906112a4565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663140e25ad60e31b179052600090606090610fb590610ed8565b6040805160048152602481019091526020810180516001600160e01b031663a6afed9560e01b17905260009060609061106b90610ed8565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052600090606090610f4d90610ed8565b600a5481565b60145481565b6040805160048152602481019091526020810180516001600160e01b0316630ae9d70b60e41b17905260009060609061106b906112a4565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b031663b2a02ff160e01b17905260009060609061113e90610ed8565b6016546001600160a01b031681565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316632dc7468360e21b179052600090606090610fb590610ed8565b6040805160048152602481019091526020810180516001600160e01b031663bd6d894d60e01b17905260009060609061106b90610ed8565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b03166361bfb47160e11b179052600090819081908190606090611b21906112a4565b9050808060200190516080811015611b3857600080fd5b508051602082015160408301516060909301519199909850919650945092505050565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663317afabb60e21b179052600090606090610fb590610ed8565b60135481565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663db006a7560e01b179052600090606090610fb590610ed8565b604080516001600160a01b03808516602483015283166044808301919091528251808303909101815260649091019091526020810180516001600160e01b0316636eb1769f60e11b179052600090606090610f4d906112a4565b6015546001600160a01b031681565b6040805160048152602481019091526020810180516001600160e01b03166374e38a7960e11b17905260009060609061106b90610ed8565b604080516001600160a01b0383166024808301919091528251808303909101815260449091019091526020810180516001600160e01b031663f2b3abbd60e01b179052600090606090610fb590610ed8565b6006546001600160a01b031681565b604080516001600160a01b0380861660248301526044820185905283166064808301919091528251808303909101815260849091019091526020810180516001600160e01b0316637af1e23160e11b17905260009060609061113e90610ed8565b60035461010090046001600160a01b031681565b6040805160048152602481019091526020810180516001600160e01b0316631f1f3b4560e31b17905260009060609061106b906112a4565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b031663fca7820b60e01b179052600090606090610fb590610ed8565b606060006060846001600160a01b0316846040518082805190602001908083835b60208310611e255780518252601f199092019160209182019101611e06565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114611e85576040519150601f19603f3d011682016040523d82523d6000602084013e611e8a565b606091505b50915091506000821415611e9f573d60208201fd5b94935050505056fe56426570323044656c656761746f723a3a5f736574496d706c656d656e746174696f6e3a2043616c6c6572206d7573742062652061646d696e56426570323044656c656761746f723a66616c6c6261636b3a2063616e6e6f742073656e642076616c756520746f2066616c6c6261636ba265627a7a72315820313cbbc168c63eea8616b08cf5101539115d66fbf45db7e777f5526a7041422464736f6c63430005100032", + "devdoc": { + "author": "Venus", + "methods": { + "_acceptAdmin()": { + "details": "Admin function for pending admin to accept role and update admin", + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "_addReserves(uint256)": { + "params": { + "addAmount": "Amount of reserves to add" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "_reduceReserves(uint256)": { + "params": { + "reduceAmount": "Amount of reduction to reserves" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "_setComptroller(address)": { + "details": "Admin function to set a new comptroller", + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "_setImplementation(address,bool,bytes)": { + "params": { + "allowResign": "Flag to indicate whether to call _resignImplementation on the old implementation", + "becomeImplementationData": "The encoded bytes data to be passed to _becomeImplementation", + "implementation_": "The address of the new implementation for delegation" + } + }, + "_setInterestRateModel(address)": { + "details": "Admin function to accrue interest and update the interest rate model", + "params": { + "newInterestRateModel": "The new interest rate model to use" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "_setPendingAdmin(address)": { + "details": "Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.", + "params": { + "newPendingAdmin": "New pending admin." + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "_setReserveFactor(uint256)": { + "details": "Admin function to accrue interest and set a new reserve factor", + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "accrueInterest()": { + "details": "This calculates interest accrued from the last checkpointed block up to the current block and writes new checkpoint to storage." + }, + "allowance(address,address)": { + "params": { + "owner": "The address of the account which owns the tokens to be spent", + "spender": "The address of the account which may transfer tokens" + }, + "return": "The number of tokens allowed to be spent (-1 means infinite)" + }, + "approve(address,uint256)": { + "details": "This will overwrite the approval amount for `spender` and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)", + "params": { + "amount": "The number of tokens that are approved (-1 means infinite)", + "spender": "The address of the account which may transfer tokens" + }, + "return": "Whether or not the approval succeeded" + }, + "balanceOf(address)": { + "params": { + "owner": "The address of the account to query" + }, + "return": "The number of tokens owned by `owner`" + }, + "balanceOfUnderlying(address)": { + "details": "This also accrues interest in a transaction", + "params": { + "owner": "The address of the account to query" + }, + "return": "The amount of underlying owned by `owner`" + }, + "borrow(uint256)": { + "params": { + "borrowAmount": "The amount of the underlying asset to borrow" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "borrowBalanceCurrent(address)": { + "params": { + "account": "The address whose balance should be calculated after updating borrowIndex" + }, + "return": "The calculated balance" + }, + "borrowBalanceStored(address)": { + "params": { + "account": "The address whose balance should be calculated" + }, + "return": "The calculated balance" + }, + "borrowRatePerBlock()": { + "return": "The borrow interest rate per block, scaled by 1e18" + }, + "constructor": { + "params": { + "admin_": "Address of the administrator of this token", + "becomeImplementationData": "The encoded args for becomeImplementation", + "comptroller_": "The address of the comptroller", + "decimals_": "BEP-20 decimal precision of this token", + "implementation_": "The address of the implementation the contract delegates to", + "initialExchangeRateMantissa_": "The initial exchange rate, scaled by 1e18", + "interestRateModel_": "The address of the interest rate model", + "name_": "BEP-20 name of this token", + "symbol_": "BEP-20 symbol of this token", + "underlying_": "The address of the underlying asset" + } + }, + "delegateToImplementation(bytes)": { + "details": "It returns to the external caller whatever the implementation returns or forwards reverts", + "params": { + "data": "The raw data to delegatecall" + }, + "return": "The returned bytes from the delegatecall" + }, + "delegateToViewImplementation(bytes)": { + "details": "It returns to the external caller whatever the implementation returns or forwards reverts There are an additional 2 prefix uints from the wrapper returndata, which we ignore since we make an extra hop.", + "params": { + "data": "The raw data to delegatecall" + }, + "return": "The returned bytes from the delegatecall" + }, + "exchangeRateCurrent()": { + "return": "Calculated exchange rate scaled by 1e18" + }, + "exchangeRateStored()": { + "details": "This function does not accrue interest before calculating the exchange rate", + "return": "Calculated exchange rate scaled by 1e18" + }, + "getAccountSnapshot(address)": { + "details": "This is used by comptroller to more efficiently perform liquidity checks.", + "params": { + "account": "Address of the account to snapshot" + }, + "return": "(possible error, token balance, borrow balance, exchange rate mantissa)" + }, + "getCash()": { + "return": "The quantity of underlying asset owned by this contract" + }, + "liquidateBorrow(address,uint256,address)": { + "params": { + "borrower": "The borrower of this vToken to be liquidated", + "repayAmount": "The amount of the underlying borrowed asset to repay", + "vTokenCollateral": "The market in which to seize collateral from the borrower" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "mint(uint256)": { + "details": "Accrues interest whether or not the operation succeeds, unless reverted", + "params": { + "mintAmount": "The amount of the underlying asset to supply" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "mintBehalf(address,uint256)": { + "details": "Accrues interest whether or not the operation succeeds, unless reverted", + "params": { + "mintAmount": "The amount of the underlying asset to supply" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "redeem(uint256)": { + "details": "Accrues interest whether or not the operation succeeds, unless reverted", + "params": { + "redeemTokens": "The number of vTokens to redeem into underlying asset" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "redeemUnderlying(uint256)": { + "details": "Accrues interest whether or not the operation succeeds, unless reverted", + "params": { + "redeemAmount": "The amount of underlying to redeem" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "repayBorrow(uint256)": { + "params": { + "repayAmount": "The amount to repay" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "repayBorrowBehalf(address,uint256)": { + "params": { + "borrower": "The account with the debt being payed off", + "repayAmount": "The amount to repay" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "seize(address,address,uint256)": { + "details": "Will fail unless called by another vToken during the process of liquidation. It's absolutely critical to use msg.sender as the borrowed vToken and not a parameter.", + "params": { + "borrower": "The account having collateral seized", + "liquidator": "The account receiving seized collateral", + "seizeTokens": "The number of vTokens to seize" + }, + "return": "uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details)." + }, + "supplyRatePerBlock()": { + "return": "The supply interest rate per block, scaled by 1e18" + }, + "totalBorrowsCurrent()": { + "return": "The total borrows with interest" + }, + "transfer(address,uint256)": { + "params": { + "amount": "The number of tokens to transfer", + "dst": "The address of the destination account" + }, + "return": "Whether or not the transfer succeeded" + }, + "transferFrom(address,address,uint256)": { + "params": { + "amount": "The number of tokens to transfer", + "dst": "The address of the destination account", + "src": "The address of the source account" + }, + "return": "Whether or not the transfer succeeded" + } + }, + "title": "Venus's VBep20Delegator Contract" + }, + "userdoc": { + "methods": { + "_acceptAdmin()": { + "notice": "Accepts transfer of admin rights. `msg.sender` must be pendingAdmin" + }, + "_addReserves(uint256)": { + "notice": "Accrues interest and adds reserves by transferring from admin" + }, + "_reduceReserves(uint256)": { + "notice": "Accrues interest and reduces reserves by transferring to admin" + }, + "_setComptroller(address)": { + "notice": "Sets a new comptroller for the market" + }, + "_setImplementation(address,bool,bytes)": { + "notice": "Called by the admin to update the implementation of the delegator" + }, + "_setInterestRateModel(address)": { + "notice": "Accrues interest and updates the interest rate model using `_setInterestRateModelFresh`" + }, + "_setPendingAdmin(address)": { + "notice": "Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer." + }, + "_setReserveFactor(uint256)": { + "notice": "Accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh" + }, + "accrueInterest()": { + "notice": "Applies accrued interest to total borrows and reserves." + }, + "allowance(address,address)": { + "notice": "Get the current allowance from `owner` for `spender`" + }, + "approve(address,uint256)": { + "notice": "Approve `spender` to transfer up to `amount` from `src`" + }, + "balanceOf(address)": { + "notice": "Get the token balance of the `owner`" + }, + "balanceOfUnderlying(address)": { + "notice": "Get the underlying balance of the `owner`" + }, + "borrow(uint256)": { + "notice": "Sender borrows assets from the protocol to their own address" + }, + "borrowBalanceCurrent(address)": { + "notice": "Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex" + }, + "borrowBalanceStored(address)": { + "notice": "Return the borrow balance of account based on stored data" + }, + "borrowRatePerBlock()": { + "notice": "Returns the current per-block borrow interest rate for this vToken" + }, + "constructor": "Construct a new money market", + "delegateToImplementation(bytes)": { + "notice": "Delegates execution to the implementation contract" + }, + "delegateToViewImplementation(bytes)": { + "notice": "Delegates execution to an implementation contract" + }, + "exchangeRateCurrent()": { + "notice": "Accrue interest then return the up-to-date exchange rate" + }, + "exchangeRateStored()": { + "notice": "Calculates the exchange rate from the underlying to the VToken" + }, + "getAccountSnapshot(address)": { + "notice": "Get a snapshot of the account's balances and the cached exchange rate" + }, + "getCash()": { + "notice": "Get cash balance of this vToken in the underlying asset" + }, + "liquidateBorrow(address,uint256,address)": { + "notice": "The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator." + }, + "mint(uint256)": { + "notice": "Sender supplies assets into the market and receives vTokens in exchange" + }, + "mintBehalf(address,uint256)": { + "notice": "Sender supplies assets into the market and receiver receives vTokens in exchange" + }, + "redeem(uint256)": { + "notice": "Sender redeems vTokens in exchange for the underlying asset" + }, + "redeemUnderlying(uint256)": { + "notice": "Sender redeems vTokens in exchange for a specified amount of underlying asset" + }, + "repayBorrow(uint256)": { + "notice": "Sender repays their own borrow" + }, + "repayBorrowBehalf(address,uint256)": { + "notice": "Sender repays a borrow belonging to another borrower" + }, + "seize(address,address,uint256)": { + "notice": "Transfers collateral tokens (this market) to the liquidator." + }, + "supplyRatePerBlock()": { + "notice": "Returns the current per-block supply interest rate for this vToken" + }, + "totalBorrowsCurrent()": { + "notice": "Returns the current total borrows plus accrued interest" + }, + "transfer(address,uint256)": { + "notice": "Transfer `amount` tokens from `msg.sender` to `dst`" + }, + "transferFrom(address,address,uint256)": { + "notice": "Transfer `amount` tokens from `src` to `dst`" + } + }, + "notice": "vTokens which wrap an EIP-20 underlying and delegate to an implementation" + }, + "storageLayout": { + "storage": [ + { + "astId": 23508, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "_notEntered", + "offset": 0, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 23510, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "name", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 23512, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "symbol", + "offset": 0, + "slot": "2", + "type": "t_string_storage" + }, + { + "astId": 23514, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "decimals", + "offset": 0, + "slot": "3", + "type": "t_uint8" + }, + { + "astId": 23522, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "admin", + "offset": 1, + "slot": "3", + "type": "t_address_payable" + }, + { + "astId": 23524, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "pendingAdmin", + "offset": 0, + "slot": "4", + "type": "t_address_payable" + }, + { + "astId": 23526, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "comptroller", + "offset": 0, + "slot": "5", + "type": "t_contract(ComptrollerInterface)2406" + }, + { + "astId": 23528, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "interestRateModel", + "offset": 0, + "slot": "6", + "type": "t_contract(InterestRateModel)9296" + }, + { + "astId": 23530, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "initialExchangeRateMantissa", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 23532, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "reserveFactorMantissa", + "offset": 0, + "slot": "8", + "type": "t_uint256" + }, + { + "astId": 23534, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "accrualBlockNumber", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 23536, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "borrowIndex", + "offset": 0, + "slot": "10", + "type": "t_uint256" + }, + { + "astId": 23538, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "totalBorrows", + "offset": 0, + "slot": "11", + "type": "t_uint256" + }, + { + "astId": 23540, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "totalReserves", + "offset": 0, + "slot": "12", + "type": "t_uint256" + }, + { + "astId": 23542, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "totalSupply", + "offset": 0, + "slot": "13", + "type": "t_uint256" + }, + { + "astId": 23546, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "accountTokens", + "offset": 0, + "slot": "14", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 23552, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "transferAllowances", + "offset": 0, + "slot": "15", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 23556, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "accountBorrows", + "offset": 0, + "slot": "16", + "type": "t_mapping(t_address,t_struct(BorrowSnapshot)23506_storage)" + }, + { + "astId": 23558, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "underlying", + "offset": 0, + "slot": "17", + "type": "t_address" + }, + { + "astId": 23560, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "implementation", + "offset": 0, + "slot": "18", + "type": "t_address" + }, + { + "astId": 23562, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "reduceReservesBlockDelta", + "offset": 0, + "slot": "19", + "type": "t_uint256" + }, + { + "astId": 23564, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "reduceReservesBlockNumber", + "offset": 0, + "slot": "20", + "type": "t_uint256" + }, + { + "astId": 23566, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "protocolShareReserve", + "offset": 0, + "slot": "21", + "type": "t_address_payable" + }, + { + "astId": 23568, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "accessControlManager", + "offset": 0, + "slot": "22", + "type": "t_address" + }, + { + "astId": 23575, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "__gap", + "offset": 0, + "slot": "23", + "type": "t_array(t_uint256)50_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_address_payable": { + "encoding": "inplace", + "label": "address payable", + "numberOfBytes": "20" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(ComptrollerInterface)2406": { + "encoding": "inplace", + "label": "contract ComptrollerInterface", + "numberOfBytes": "20" + }, + "t_contract(InterestRateModel)9296": { + "encoding": "inplace", + "label": "contract InterestRateModel", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_struct(BorrowSnapshot)23506_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct VTokenStorageBase.BorrowSnapshot)", + "numberOfBytes": "32", + "value": "t_struct(BorrowSnapshot)23506_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(BorrowSnapshot)23506_storage": { + "encoding": "inplace", + "label": "struct VTokenStorageBase.BorrowSnapshot", + "members": [ + { + "astId": 23503, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "principal", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 23505, + "contract": "contracts/Tokens/VTokens/VBep20Delegator.sol:VBep20Delegator", + "label": "interestIndex", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} diff --git a/helpers/deploymentConfig.ts b/helpers/deploymentConfig.ts index b36ca7d22..6a13cd2f2 100644 --- a/helpers/deploymentConfig.ts +++ b/helpers/deploymentConfig.ts @@ -186,7 +186,7 @@ export const getGlobalConfig: () => Promise = async () => { collateralFactor: convertToUnit("0.5", 18), reserveFactor: convertToUnit("0.25", 18), initialSupply: convertToUnit(5_000, 18), - supplyCap: convertToUnit(3_000_000, 18), + supplyCap: convertToUnit(2_000_000, 18), borrowCap: convertToUnit(1_000_000, 18), vTokenReceiver: vTreasuryAddress, }, @@ -199,6 +199,11 @@ export const getGlobalConfig: () => Promise = async () => { symbol: "FDUSD", tokenAddress: "0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409", }, + { + isMock: false, + symbol: "TWT", + tokenAddress: "0x4B0F1812e5Df2A09796481Ff14017e6005508003", + }, ], marketsConfig: [ { @@ -219,37 +224,19 @@ export const getGlobalConfig: () => Promise = async () => { vTokenReceiver: vTreasuryAddress, }, { - name: "Venus DOGE", - asset: "DOGE", - symbol: "vDOGE", - rateModel: InterestRateModels.JumpRate.toString(), - baseRatePerYear: "0", - multiplierPerYear: convertToUnit("0.06875", 18), - jumpMultiplierPerYear: convertToUnit("2.5", 18), - kink_: convertToUnit("0.8", 18), - collateralFactor: convertToUnit("0.75", 18), - liquidationThreshold: convertToUnit("0.8", 18), - reserveFactor: convertToUnit("0.1", 18), - initialSupply: convertToUnit(9000, 18), - supplyCap: convertToUnit(5_500_000, 18), - borrowCap: convertToUnit(4_400_000, 18), - vTokenReceiver: vTreasuryAddress, - }, - { - name: "Venus USDT", - asset: "USDT", - symbol: "vUSDT", + name: "Venus TWT", + asset: "TWT", + symbol: "vTWT", rateModel: InterestRateModels.JumpRate.toString(), - baseRatePerYear: "0", - multiplierPerYear: convertToUnit("0.1", 18), - jumpMultiplierPerYear: convertToUnit("2.5", 18), - kink_: convertToUnit("0.8", 18), - collateralFactor: convertToUnit("0.75", 18), - liquidationThreshold: convertToUnit("0.8", 18), - reserveFactor: convertToUnit("0.1", 18), - initialSupply: convertToUnit(9000, 18), - supplyCap: convertToUnit(5_500_000, 18), - borrowCap: convertToUnit(4_400_000, 18), + baseRatePerYear: convertToUnit("0.02", 18), + multiplierPerYear: convertToUnit("0.2", 18), + jumpMultiplierPerYear: convertToUnit("3", 18), + kink_: convertToUnit("0.5", 18), + collateralFactor: convertToUnit("0.5", 18), + reserveFactor: convertToUnit("0.25", 18), + initialSupply: convertToUnit(4_401, 18), + supplyCap: convertToUnit(2_000_000, 18), + borrowCap: convertToUnit(1_000_000, 18), vTokenReceiver: vTreasuryAddress, }, ], From fd40785c87b98c1147631e134e587f6916e14017 Mon Sep 17 00:00:00 2001 From: GitGuru7 Date: Wed, 16 Oct 2024 14:09:24 +0000 Subject: [PATCH 5/5] feat: updating deployment files --- deployments/bscmainnet.json | 24361 +++++++++++++----------- deployments/bscmainnet_addresses.json | 2 + 2 files changed, 13150 insertions(+), 11213 deletions(-) diff --git a/deployments/bscmainnet.json b/deployments/bscmainnet.json index a7acf3853..3894ab08c 100644 --- a/deployments/bscmainnet.json +++ b/deployments/bscmainnet.json @@ -9258,6 +9258,257 @@ } ] }, + "JumpRateModel_base200bps_slope2000bps_jump30000bps_kink5000bps": { + "address": "0x2dE4739a9C68B02B54C0d8323752551d724b3cc2", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "baseRatePerYear", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "multiplierPerYear", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "jumpMultiplierPerYear", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink_", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "baseRatePerBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "multiplierPerBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "jumpMultiplierPerBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "kink", + "type": "uint256" + } + ], + "name": "NewInterestParams", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "baseRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "blocksPerYear", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "cash", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrows", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserves", + "type": "uint256" + } + ], + "name": "getBorrowRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "cash", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrows", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveFactorMantissa", + "type": "uint256" + } + ], + "name": "getSupplyRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isInterestRateModel", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "jumpMultiplierPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "kink", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "multiplierPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "cash", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrows", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserves", + "type": "uint256" + } + ], + "name": "utilizationRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ] + }, "LINK": { "address": "0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD", "abi": [ @@ -60872,7 +61123,1566 @@ "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount", + "type": "uint256" + } + ], + "name": "_reduceReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "_setComptroller", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "_setInterestRateModel", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "newPendingAdmin", + "type": "address" + } + ], + "name": "_setPendingAdmin", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "_setReserveFactor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOfUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "borrowBalanceCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "borrowBalanceStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptroller", + "outputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAccountSnapshot", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [ + { + "internalType": "contract InterestRateModel", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isVToken", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "internalType": "contract VTokenInterface", + "name": "vTokenCollateral", + "type": "address" + } + ], + "name": "liquidateBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + } + ], + "name": "redeemUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrowBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "cashPrior", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "interestAccumulated", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "info", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "detail", + "type": "uint256" + } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + } + ], + "name": "MintBehalf", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlAddress", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldPendingAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPendingAdmin", + "type": "address" + } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReserveFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "benefactor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "protocolShareReserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + } + ], + "name": "_addReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "reduceAmount_", "type": "uint256" } ], @@ -60888,6 +62698,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -60909,37 +62728,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -60981,7 +62775,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -60997,6 +62791,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -61200,24 +63009,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -61226,18 +63031,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -61247,12 +63052,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -61260,41 +63065,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -61397,6 +63190,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -61535,6 +63413,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -61577,6 +63470,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -61670,6 +63593,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -61831,9 +63817,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vADA": { + "address": "0x9A0AF7FDb2065Ce470D72664DE73cAE409dA28Ec", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -62007,12 +64049,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -62024,35 +64060,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -62060,18 +64078,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -62080,36 +64098,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -62150,44 +64149,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -62227,42 +64188,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -62331,7 +64261,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -62375,6 +64305,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -62411,27 +64346,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -62447,15 +64367,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -62477,12 +64388,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -62524,7 +64460,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -62540,21 +64476,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -62757,32 +64678,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -62843,6 +64738,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -62939,91 +64876,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -63106,32 +64958,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -63162,21 +64988,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -63219,36 +65030,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -63342,69 +65123,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -63566,65 +65284,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vADA": { - "address": "0x9A0AF7FDb2065Ce470D72664DE73cAE409dA28Ec", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -63798,6 +65460,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -63809,17 +65477,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -63827,18 +65513,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -63847,17 +65533,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -63898,6 +65603,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -63937,11 +65680,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -64010,7 +65784,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -64054,11 +65828,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -64095,12 +65864,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -64116,6 +65900,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -64137,37 +65930,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -64209,7 +65977,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -64225,6 +65993,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -64428,24 +66211,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -64454,18 +66233,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -64475,12 +66254,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -64488,41 +66267,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -64625,6 +66392,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -64707,6 +66559,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -64737,6 +66615,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -64779,6 +66672,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -64872,6 +66795,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -65033,9 +67019,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vBCH": { + "address": "0x5F0388EBc2B94FA8E123F404b79cCF5f40b29176", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -65209,12 +67251,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -65226,35 +67262,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -65262,18 +67280,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -65282,36 +67300,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -65352,44 +67351,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -65429,42 +67390,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -65533,7 +67463,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -65577,6 +67507,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -65613,27 +67548,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -65649,15 +67569,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -65679,12 +67590,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -65726,7 +67662,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -65742,21 +67678,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -65959,32 +67880,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -66045,6 +67940,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -66141,91 +68078,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -66308,32 +68160,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -66364,21 +68190,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -66421,36 +68232,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -66544,69 +68325,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -66768,65 +68486,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vBCH": { - "address": "0x5F0388EBc2B94FA8E123F404b79cCF5f40b29176", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -67000,6 +68662,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -67011,17 +68679,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -67029,18 +68715,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -67049,17 +68735,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -67100,6 +68805,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -67139,11 +68882,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -67212,7 +68986,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -67256,11 +69030,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -67297,12 +69066,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -67318,6 +69102,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -67339,37 +69132,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -67411,7 +69179,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -67427,6 +69195,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -67630,24 +69413,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -67656,18 +69435,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -67677,12 +69456,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -67690,41 +69469,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -67827,6 +69594,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -67909,6 +69761,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -67939,6 +69817,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -67981,6 +69874,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -68074,6 +69997,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -68235,9 +70221,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vBETH": { + "address": "0x972207A639CC1B374B893cc33Fa251b55CEB7c07", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -68411,12 +70453,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -68428,35 +70464,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -68464,18 +70482,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -68484,36 +70502,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -68554,44 +70553,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -68631,42 +70592,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -68735,7 +70665,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -68779,6 +70709,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -68815,27 +70750,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -68851,15 +70771,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -68881,12 +70792,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -68928,7 +70864,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -68944,21 +70880,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -69161,32 +71082,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -69247,6 +71142,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -69343,91 +71280,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -69510,32 +71362,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -69566,21 +71392,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -69623,36 +71434,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -69746,69 +71527,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -69970,65 +71688,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vBETH": { - "address": "0x972207A639CC1B374B893cc33Fa251b55CEB7c07", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -70202,6 +71864,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -70213,17 +71881,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -70231,18 +71917,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -70251,17 +71937,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -70302,6 +72007,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -70341,11 +72084,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -70414,7 +72188,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -70458,11 +72232,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -70499,12 +72268,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -70520,6 +72304,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -70541,37 +72334,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -70613,7 +72381,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -70629,6 +72397,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -70832,24 +72615,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -70858,18 +72637,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -70879,12 +72658,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -70892,41 +72671,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -71029,6 +72796,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -71111,6 +72963,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -71141,6 +73019,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -71183,6 +73076,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -71276,6 +73199,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -71437,9 +73423,50 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vBNB": { + "address": "0xA07c5b74C9B40447a954e1466938b865b6BBea36", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -71613,73 +73640,11 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "payer", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" - } - ], - "name": "MintBehalf", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", - "type": "address" - } - ], - "name": "NewAccessControlManager", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -71756,44 +73721,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -71833,42 +73760,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -71937,7 +73833,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -71982,30 +73878,14 @@ "type": "event" }, { - "constant": false, - "inputs": [], - "name": "_acceptAdmin", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" + "payable": true, + "stateMutability": "payable", + "type": "fallback" }, { "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "addAmount", - "type": "uint256" - } - ], - "name": "_addReserves", + "inputs": [], + "name": "_acceptAdmin", "outputs": [ { "internalType": "uint256", @@ -72017,27 +73897,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -72053,15 +73918,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -72088,7 +73944,7 @@ "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -72130,7 +73986,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -72146,21 +74002,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -72363,32 +74204,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -72530,66 +74345,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "implementation", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -72669,73 +74424,24 @@ "type": "address" }, { - "internalType": "uint256", - "name": "repayAmount", - "type": "uint256" - }, - { - "internalType": "contract VTokenInterface", + "internalType": "contract VToken", "name": "vTokenCollateral", "type": "address" } ], "name": "liquidateBorrow", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", + "outputs": [], + "payable": true, + "stateMutability": "payable", "type": "function" }, { "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], + "inputs": [], "name": "mint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", + "outputs": [], + "payable": true, + "stateMutability": "payable", "type": "function" }, { @@ -72768,21 +74474,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -72825,55 +74516,13 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "repayAmount", - "type": "uint256" - } - ], + "inputs": [], "name": "repayBorrow", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", + "outputs": [], + "payable": true, + "stateMutability": "payable", "type": "function" }, { @@ -72883,23 +74532,12 @@ "internalType": "address", "name": "borrower", "type": "address" - }, - { - "internalType": "uint256", - "name": "repayAmount", - "type": "uint256" } ], "name": "repayBorrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", + "outputs": [], + "payable": true, + "stateMutability": "payable", "type": "function" }, { @@ -72948,69 +74586,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -73157,29 +74732,19 @@ "payable": false, "stateMutability": "nonpayable", "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" } ] }, - "vBNB": { - "address": "0xA07c5b74C9B40447a954e1466938b865b6BBea36", + "vBTC": { + "address": "0x882C173bC7Ff3b7786CA16dfeD3DFFfb9Ee7847B", "abi": [ { "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, { "internalType": "contract ComptrollerInterface", "name": "comptroller_", @@ -73214,6 +74779,16 @@ "internalType": "address payable", "name": "admin_", "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" } ], "payable": false, @@ -73432,6 +75007,25 @@ "name": "NewComptroller", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldImplementation", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "NewImplementation", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -73646,6 +75240,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + } + ], + "name": "_addReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -73688,6 +75303,31 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -74013,6 +75653,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -74095,43 +75777,18 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, + "constant": true, + "inputs": [], + "name": "implementation", + "outputs": [ { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", + "internalType": "address", + "name": "", "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" } ], - "name": "initialize", - "outputs": [], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { @@ -74173,24 +75830,47 @@ "type": "address" }, { - "internalType": "contract VToken", + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "internalType": "contract VTokenInterface", "name": "vTokenCollateral", "type": "address" } ], "name": "liquidateBorrow", - "outputs": [], - "payable": true, - "stateMutability": "payable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", "type": "function" }, { "constant": false, - "inputs": [], + "inputs": [ + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], "name": "mint", - "outputs": [], - "payable": true, - "stateMutability": "payable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", "type": "function" }, { @@ -74267,11 +75947,23 @@ }, { "constant": false, - "inputs": [], + "inputs": [ + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], "name": "repayBorrow", - "outputs": [], - "payable": true, - "stateMutability": "payable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", "type": "function" }, { @@ -74281,12 +75973,23 @@ "internalType": "address", "name": "borrower", "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" } ], "name": "repayBorrowBehalf", - "outputs": [], - "payable": true, - "stateMutability": "payable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", "type": "function" }, { @@ -74481,66 +76184,25 @@ "payable": false, "stateMutability": "nonpayable", "type": "function" - } - ] - }, - "vBTC": { - "address": "0x882C173bC7Ff3b7786CA16dfeD3DFFfb9Ee7847B", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [ { "internalType": "address", - "name": "implementation_", + "name": "", "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" } ], "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, @@ -74713,6 +76375,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -74724,17 +76392,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -74742,18 +76428,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -74762,17 +76448,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -74813,6 +76518,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -74852,11 +76595,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -74925,7 +76699,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -74969,11 +76743,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -75010,12 +76779,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -75031,6 +76815,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -75052,37 +76845,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -75124,7 +76892,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -75140,6 +76908,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -75343,24 +77126,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -75369,18 +77148,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -75390,12 +77169,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -75403,41 +77182,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -75540,6 +77307,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -75622,6 +77474,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -75652,6 +77530,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -75694,6 +77587,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -75787,6 +77710,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -75948,9 +77934,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vBUSD": { + "address": "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -76124,12 +78166,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -76141,35 +78177,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -76177,18 +78195,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -76197,36 +78215,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -76267,44 +78266,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -76344,42 +78305,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -76448,7 +78378,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -76492,6 +78422,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -76528,27 +78463,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -76564,15 +78484,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -76594,12 +78505,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -76641,7 +78577,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -76657,21 +78593,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -76874,32 +78795,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -76960,6 +78855,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -77056,91 +78993,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -77223,32 +79075,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -77279,21 +79105,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -77336,36 +79147,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -77459,69 +79240,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -77683,65 +79401,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vBUSD": { - "address": "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -77915,6 +79577,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -77926,17 +79594,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -77944,18 +79630,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -77964,17 +79650,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -78015,6 +79720,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -78054,11 +79797,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -78127,7 +79901,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -78171,11 +79945,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -78212,12 +79981,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -78233,6 +80017,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -78254,37 +80047,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -78326,7 +80094,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -78342,6 +80110,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -78545,24 +80328,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -78571,18 +80350,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -78592,12 +80371,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -78605,41 +80384,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -78742,6 +80509,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -78824,6 +80676,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -78854,6 +80732,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -78896,6 +80789,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -78989,6 +80912,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -79150,9 +81136,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vCAKE": { + "address": "0x86aC3974e2BD0d60825230fa6F355fF11409df5c", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -79326,12 +81368,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -79363,12 +81399,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "MintBehalf", @@ -79380,17 +81410,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAccessControlAddress", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAccessControlAddress", + "name": "newAdmin", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewAdmin", "type": "event" }, { @@ -79398,18 +81428,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAdmin", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAdmin", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAdmin", + "name": "NewComptroller", "type": "event" }, { @@ -79417,18 +81447,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldImplementation", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -79469,44 +81499,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -79546,12 +81538,6 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", @@ -79650,7 +81636,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -79694,6 +81680,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -79730,27 +81721,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -79766,15 +81742,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -79796,12 +81763,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -79843,7 +81835,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -79859,21 +81851,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -80076,32 +82053,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -80162,6 +82113,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -80258,91 +82251,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -80481,21 +82389,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -80538,36 +82431,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -80661,69 +82524,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -80885,65 +82685,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vCAKE": { - "address": "0x86aC3974e2BD0d60825230fa6F355fF11409df5c", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -81117,6 +82861,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -81148,6 +82898,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "MintBehalf", @@ -81159,17 +82915,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewAdmin", + "name": "NewAccessControlManager", "type": "event" }, { @@ -81177,18 +82933,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAdmin", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAdmin", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAdmin", "type": "event" }, { @@ -81196,18 +82952,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldImplementation", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newImplementation", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewImplementation", + "name": "NewComptroller", "type": "event" }, { @@ -81248,6 +83004,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -81287,6 +83081,12 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", @@ -81385,7 +83185,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -81429,11 +83229,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -81470,12 +83265,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -81491,6 +83301,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -81512,37 +83331,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -81584,7 +83378,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -81600,6 +83394,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -81803,24 +83612,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -81829,18 +83634,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -81850,12 +83655,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -81863,41 +83668,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -82000,6 +83793,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -82138,6 +84016,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -82180,6 +84073,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -82273,6 +84196,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -82434,9 +84420,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vDAI": { + "address": "0x334b3eCB4DCa3593BCCC3c7EBD1A1C1d1780FBF1", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -82610,12 +84652,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -82627,35 +84663,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -82663,18 +84681,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -82683,36 +84701,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -82753,44 +84752,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -82830,42 +84791,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -82934,7 +84864,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -82978,6 +84908,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -83014,27 +84949,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -83050,15 +84970,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -83080,12 +84991,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -83127,7 +85063,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -83143,21 +85079,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -83360,32 +85281,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -83446,6 +85341,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -83542,91 +85479,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -83709,32 +85561,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -83765,21 +85591,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -83822,36 +85633,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -83945,69 +85726,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -84169,65 +85887,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vDAI": { - "address": "0x334b3eCB4DCa3593BCCC3c7EBD1A1C1d1780FBF1", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -84401,6 +86063,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -84412,17 +86080,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -84430,18 +86116,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -84450,17 +86136,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -84501,6 +86206,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -84540,11 +86283,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -84613,7 +86387,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -84657,11 +86431,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -84698,12 +86467,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -84719,6 +86503,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -84740,37 +86533,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -84812,7 +86580,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -84828,6 +86596,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -85031,24 +86814,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -85057,18 +86836,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -85078,12 +86857,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -85091,41 +86870,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -85228,6 +86995,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -85310,6 +87162,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -85340,6 +87218,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -85382,6 +87275,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -85475,6 +87398,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -85636,9 +87622,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vDOGE": { + "address": "0xec3422Ef92B2fb59e84c8B02Ba73F1fE84Ed8D71", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -85812,12 +87854,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -85829,35 +87865,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -85865,18 +87883,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -85885,36 +87903,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -85955,44 +87954,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -86032,12 +87993,6 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", @@ -86136,7 +88091,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -86180,6 +88135,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -86216,27 +88176,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -86252,15 +88197,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -86282,12 +88218,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -86329,7 +88290,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -86345,21 +88306,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -86562,32 +88508,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -86648,6 +88568,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -86744,91 +88706,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -86911,32 +88788,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -86967,21 +88818,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -87024,36 +88860,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -87147,69 +88953,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -87371,65 +89114,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vDOGE": { - "address": "0xec3422Ef92B2fb59e84c8B02Ba73F1fE84Ed8D71", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -87603,6 +89290,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -87614,17 +89307,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -87632,18 +89343,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -87652,17 +89363,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -87703,6 +89433,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -87742,6 +89510,12 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", @@ -87840,7 +89614,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -87884,11 +89658,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -87925,12 +89694,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -87946,6 +89730,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -87967,37 +89760,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -88039,7 +89807,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -88055,6 +89823,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -88258,24 +90041,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -88284,18 +90063,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -88305,12 +90084,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -88318,41 +90097,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -88455,6 +90222,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -88537,6 +90389,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -88567,6 +90445,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -88609,6 +90502,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -88702,6 +90625,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -88863,9 +90849,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vDOT": { + "address": "0x1610bc33319e9398de5f57B33a5b184c806aD217", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -89039,12 +91081,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -89056,35 +91092,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -89092,18 +91110,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -89112,36 +91130,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -89182,44 +91181,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -89259,42 +91220,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -89363,7 +91293,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -89407,6 +91337,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -89443,27 +91378,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -89479,15 +91399,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -89509,12 +91420,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -89556,7 +91492,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -89572,21 +91508,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -89789,32 +91710,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -89875,6 +91770,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -89971,91 +91908,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -90138,32 +91990,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -90194,21 +92020,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -90251,36 +92062,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -90374,69 +92155,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -90598,65 +92316,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vDOT": { - "address": "0x1610bc33319e9398de5f57B33a5b184c806aD217", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -90830,6 +92492,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -90841,17 +92509,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -90859,18 +92545,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -90879,17 +92565,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -90930,6 +92635,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -90969,11 +92712,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -91042,7 +92816,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -91086,11 +92860,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -91127,12 +92896,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -91148,6 +92932,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -91169,37 +92962,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -91241,7 +93009,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -91257,6 +93025,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -91460,24 +93243,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -91486,18 +93265,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -91507,12 +93286,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -91520,41 +93299,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -91657,6 +93424,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -91739,6 +93591,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -91769,6 +93647,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -91811,6 +93704,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -91904,6 +93827,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -92065,9 +94051,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vETH": { + "address": "0xf508fCD89b8bd15579dc79A6827cB4686A3592c8", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -92241,12 +94283,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -92258,35 +94294,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -92294,18 +94312,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -92314,36 +94332,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -92384,44 +94383,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -92461,42 +94422,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -92565,7 +94495,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -92609,6 +94539,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -92645,27 +94580,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -92681,15 +94601,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -92711,12 +94622,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -92758,7 +94694,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -92774,21 +94710,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -92991,32 +94912,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -93077,6 +94972,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -93173,91 +95110,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -93340,32 +95192,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -93396,21 +95222,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -93453,36 +95264,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -93576,69 +95357,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -93800,65 +95518,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vETH": { - "address": "0xf508fCD89b8bd15579dc79A6827cB4686A3592c8", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -94032,6 +95694,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -94043,17 +95711,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -94061,18 +95747,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -94081,17 +95767,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -94132,6 +95837,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -94171,11 +95914,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -94244,7 +96018,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -94288,11 +96062,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -94329,12 +96098,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -94350,6 +96134,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -94371,37 +96164,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -94443,7 +96211,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -94459,6 +96227,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -94662,24 +96445,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -94688,18 +96467,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -94709,12 +96488,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -94722,41 +96501,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -94859,6 +96626,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -94941,6 +96793,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -94971,6 +96849,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -95013,6 +96906,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -95106,6 +97029,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -95267,9 +97253,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vFDUSD": { + "address": "0xC4eF4229FEc74Ccfe17B2bdeF7715fAC740BA0ba", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -95451,7 +97493,44 @@ "type": "uint256" } ], - "name": "Mint", + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + } + ], + "name": "MintBehalf", "type": "event" }, { @@ -95460,35 +97539,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAccessControlAddress", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAccessControlManager", "type": "event" }, { @@ -95497,17 +97558,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAccessControlAddress", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAccessControlAddress", + "name": "newAdmin", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewAdmin", "type": "event" }, { @@ -95515,18 +97576,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAdmin", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAdmin", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAdmin", + "name": "NewComptroller", "type": "event" }, { @@ -95534,18 +97595,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldImplementation", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -95811,6 +97872,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -95847,27 +97913,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -95883,15 +97934,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -95913,12 +97955,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -95960,7 +98027,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -96193,32 +98260,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -96279,6 +98320,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -96375,91 +98458,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -96778,69 +98776,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -97002,65 +98937,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vFDUSD": { - "address": "0xC4eF4229FEc74Ccfe17B2bdeF7715fAC740BA0ba", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -97339,25 +99218,6 @@ "name": "NewComptroller", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "oldImplementation", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "NewImplementation", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -97621,11 +99481,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -97662,12 +99517,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -97683,6 +99553,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -97704,37 +99583,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -97776,7 +99630,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -98010,24 +99864,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -98036,18 +99886,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -98057,12 +99907,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -98070,41 +99920,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -98207,6 +100045,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -98525,6 +100448,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -98686,9 +100672,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vFIL": { + "address": "0xf91d58b5aE142DAcC749f58A49FCBac340Cb0343", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -98862,12 +100904,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -98879,35 +100915,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -98915,18 +100933,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -98935,36 +100953,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -99005,44 +101004,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -99082,42 +101043,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -99186,7 +101116,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -99230,6 +101160,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -99266,27 +101201,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -99302,15 +101222,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -99332,12 +101243,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -99379,7 +101315,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -99395,21 +101331,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -99612,32 +101533,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -99698,6 +101593,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -99794,91 +101731,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -99961,32 +101813,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -100017,21 +101843,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -100074,36 +101885,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -100197,69 +101978,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -100421,65 +102139,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vFIL": { - "address": "0xf91d58b5aE142DAcC749f58A49FCBac340Cb0343", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -100653,6 +102315,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -100664,17 +102332,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -100682,18 +102368,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -100702,17 +102388,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -100753,6 +102458,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -100792,11 +102535,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -100865,7 +102639,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -100909,11 +102683,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -100950,12 +102719,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -100971,6 +102755,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -100992,37 +102785,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -101064,7 +102832,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -101080,6 +102848,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -101283,24 +103066,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -101309,18 +103088,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -101330,12 +103109,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -101343,41 +103122,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -101480,6 +103247,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -101562,6 +103414,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -101592,6 +103470,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -101634,6 +103527,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -101727,6 +103650,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -101888,9 +103874,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vLINK": { + "address": "0x650b940a1033B8A1b1873f78730FcFC73ec11f1f", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -102064,12 +104106,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -102081,35 +104117,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -102117,18 +104135,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -102137,36 +104155,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -102207,44 +104206,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -102284,42 +104245,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -102388,7 +104318,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -102432,6 +104362,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -102468,27 +104403,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -102504,15 +104424,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -102534,12 +104445,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -102581,7 +104517,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -102597,21 +104533,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -102814,32 +104735,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -102900,6 +104795,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -102996,91 +104933,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -103163,32 +105015,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -103219,21 +105045,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -103276,36 +105087,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -103399,69 +105180,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -103623,65 +105341,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vLINK": { - "address": "0x650b940a1033B8A1b1873f78730FcFC73ec11f1f", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -103855,6 +105517,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -103866,17 +105534,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -103884,18 +105570,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -103904,17 +105590,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -103955,6 +105660,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -103994,11 +105737,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -104067,7 +105841,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -104111,11 +105885,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -104152,12 +105921,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -104173,6 +105957,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -104194,37 +105987,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -104266,7 +106034,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -104282,6 +106050,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -104485,24 +106268,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -104511,18 +106290,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -104532,12 +106311,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -104545,41 +106324,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -104682,6 +106449,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -104764,6 +106616,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -104794,6 +106672,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -104836,6 +106729,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -104929,6 +106852,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -105090,9 +107076,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vLTC": { + "address": "0x57A5297F2cB2c0AaC9D554660acd6D385Ab50c6B", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -105266,12 +107308,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -105283,35 +107319,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -105319,18 +107337,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -105339,36 +107357,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -105409,44 +107408,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -105486,42 +107447,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -105590,7 +107520,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -105634,6 +107564,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -105670,27 +107605,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -105706,15 +107626,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -105736,12 +107647,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -105783,7 +107719,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -105799,21 +107735,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -106016,32 +107937,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -106102,6 +107997,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -106198,91 +108135,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -106365,32 +108217,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -106421,21 +108247,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -106478,36 +108289,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -106601,69 +108382,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -106825,65 +108543,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vLTC": { - "address": "0x57A5297F2cB2c0AaC9D554660acd6D385Ab50c6B", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -107057,6 +108719,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -107068,17 +108736,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -107086,18 +108772,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -107106,17 +108792,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -107157,6 +108862,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -107196,11 +108939,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -107269,7 +109043,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -107313,11 +109087,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -107354,12 +109123,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -107375,6 +109159,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -107396,37 +109189,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -107468,7 +109236,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -107484,6 +109252,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -107687,24 +109470,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -107713,18 +109492,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -107734,12 +109513,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -107747,41 +109526,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -107884,6 +109651,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -107966,6 +109818,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -107996,6 +109874,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -108038,6 +109931,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -108131,6 +110054,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -108292,9 +110278,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vLUNA": { + "address": "0xb91A659E88B51474767CD97EF3196A3e7cEDD2c8", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -108468,12 +110510,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -108505,12 +110541,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "MintBehalf", @@ -108522,17 +110552,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAccessControlAddress", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAccessControlAddress", + "name": "newAdmin", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewAdmin", "type": "event" }, { @@ -108540,18 +110570,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAdmin", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAdmin", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAdmin", + "name": "NewComptroller", "type": "event" }, { @@ -108559,18 +110589,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldImplementation", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -108611,44 +110641,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -108688,12 +110680,6 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", @@ -108792,7 +110778,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -108836,6 +110822,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -108872,27 +110863,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -108908,15 +110884,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -108938,12 +110905,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -108985,7 +110977,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -109001,21 +110993,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -109218,32 +111195,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -109304,6 +111255,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -109400,91 +111393,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -109623,21 +111531,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -109680,36 +111573,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -109803,69 +111666,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -110027,65 +111827,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vLUNA": { - "address": "0xb91A659E88B51474767CD97EF3196A3e7cEDD2c8", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -110264,37 +112008,6 @@ "name": "Mint", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "payer", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - } - ], - "name": "MintBehalf", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -110333,25 +112046,6 @@ "name": "NewComptroller", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "oldImplementation", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "NewImplementation", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -110571,11 +112265,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -110612,6 +112301,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -110633,6 +112337,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -110654,31 +112367,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -111004,48 +112692,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [], @@ -111142,6 +112788,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -111224,32 +112955,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -111576,9 +113281,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vMATIC": { + "address": "0x5c9476FcD6a4F9a3654139721c949c2233bBbBc8", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -111757,6 +113518,37 @@ "name": "Mint", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + } + ], + "name": "MintBehalf", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -111795,6 +113587,25 @@ "name": "NewComptroller", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldImplementation", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "NewImplementation", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -112014,6 +113825,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -112050,21 +113866,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -112086,15 +113887,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -112116,6 +113908,31 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -112441,6 +114258,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -112537,91 +114396,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -112704,6 +114478,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -113030,65 +114830,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vMATIC": { - "address": "0x5c9476FcD6a4F9a3654139721c949c2233bBbBc8", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -113262,6 +115006,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -113293,6 +115043,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "MintBehalf", @@ -113304,17 +115060,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewAdmin", + "name": "NewAccessControlManager", "type": "event" }, { @@ -113322,18 +115078,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAdmin", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAdmin", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAdmin", "type": "event" }, { @@ -113341,18 +115097,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldImplementation", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newImplementation", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewImplementation", + "name": "NewComptroller", "type": "event" }, { @@ -113393,6 +115149,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -113432,6 +115226,12 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", @@ -113530,7 +115330,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -113574,11 +115374,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -113615,12 +115410,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -113636,6 +115446,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -113657,37 +115476,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -113729,7 +115523,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -113745,6 +115539,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -113948,24 +115757,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -113974,18 +115779,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -113995,12 +115800,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -114008,41 +115813,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -114145,6 +115938,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -114283,6 +116161,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -114325,6 +116218,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -114418,6 +116341,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -114579,9 +116565,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vSXP": { + "address": "0x2fF3d0F6990a40261c66E1ff2017aCBc282EB6d0", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -114755,12 +116797,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -114772,35 +116808,17 @@ { "indexed": false, "internalType": "address", - "name": "payer", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "receiver", + "name": "newAdmin", "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], - "name": "MintBehalf", + "name": "NewAdmin", "type": "event" }, { @@ -114808,18 +116826,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAccessControlAddress", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewComptroller", "type": "event" }, { @@ -114828,36 +116846,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldImplementation", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -114898,44 +116897,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -114975,42 +116936,11 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "RedeemFee", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -115079,7 +117009,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -115123,6 +117053,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -115159,27 +117094,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -115195,15 +117115,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -115225,12 +117136,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -115272,7 +117208,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -115288,21 +117224,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -115505,32 +117426,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -115591,6 +117486,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -115687,91 +117624,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -115854,32 +117706,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "mintBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -115910,21 +117736,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -115967,36 +117778,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -116090,69 +117871,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -116314,65 +118032,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vSXP": { - "address": "0x2fF3d0F6990a40261c66E1ff2017aCBc282EB6d0", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -116546,6 +118208,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -116557,17 +118225,35 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "payer", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "receiver", "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], - "name": "NewAdmin", + "name": "MintBehalf", "type": "event" }, { @@ -116575,18 +118261,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAccessControlManager", "type": "event" }, { @@ -116595,17 +118281,36 @@ { "indexed": false, "internalType": "address", - "name": "oldImplementation", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newImplementation", + "name": "newAdmin", "type": "address" } ], - "name": "NewImplementation", + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", "type": "event" }, { @@ -116646,6 +118351,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -116685,11 +118428,42 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "RedeemFee", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -116758,7 +118532,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -116802,11 +118576,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -116843,12 +118612,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -116864,6 +118648,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -116885,37 +118678,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -116957,7 +118725,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -116973,6 +118741,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -117176,24 +118959,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -117202,18 +118981,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -117223,12 +119002,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -117236,41 +119015,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -117373,6 +119140,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -117455,6 +119307,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -117485,6 +119363,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -117527,6 +119420,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -117620,6 +119543,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -117781,9 +119767,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vTRX": { + "address": "0xC5D3466aA484B040eE977073fcF337f2c00071c1", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -117957,12 +119999,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -117994,12 +120030,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "MintBehalf", @@ -118011,17 +120041,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAccessControlAddress", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAccessControlAddress", + "name": "newAdmin", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewAdmin", "type": "event" }, { @@ -118029,18 +120059,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAdmin", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAdmin", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAdmin", + "name": "NewComptroller", "type": "event" }, { @@ -118048,18 +120078,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldImplementation", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -118100,44 +120130,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -118177,12 +120169,6 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", @@ -118281,7 +120267,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -118325,6 +120311,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -118361,27 +120352,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -118397,15 +120373,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -118427,12 +120394,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -118474,7 +120466,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -118490,21 +120482,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -118707,32 +120684,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -118793,6 +120744,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -118889,91 +120882,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -119112,21 +121020,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -119169,36 +121062,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -119292,69 +121155,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -119516,65 +121316,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vTRX": { - "address": "0xC5D3466aA484B040eE977073fcF337f2c00071c1", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -119748,6 +121492,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -119779,6 +121529,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "MintBehalf", @@ -119790,17 +121546,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewAdmin", + "name": "NewAccessControlManager", "type": "event" }, { @@ -119808,18 +121564,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAdmin", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAdmin", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAdmin", "type": "event" }, { @@ -119827,18 +121583,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldImplementation", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newImplementation", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewImplementation", + "name": "NewComptroller", "type": "event" }, { @@ -119879,6 +121635,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -119918,6 +121712,12 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", @@ -120016,7 +121816,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -120060,11 +121860,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -120101,12 +121896,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -120122,6 +121932,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -120143,37 +121962,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -120215,7 +122009,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -120231,6 +122025,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -120434,24 +122243,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -120460,18 +122265,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -120481,12 +122286,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -120494,41 +122299,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -120631,6 +122424,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -120769,6 +122647,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -120811,6 +122704,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -120904,6 +122827,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -121065,9 +123051,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vTRXOLD": { + "address": "0x61eDcFe8Dd6bA3c891CB9bEc2dc7657B3B422E93", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -121241,12 +123283,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -121278,12 +123314,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "MintBehalf", @@ -121295,17 +123325,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAccessControlAddress", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAccessControlAddress", + "name": "newAdmin", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewAdmin", "type": "event" }, { @@ -121313,18 +123343,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAdmin", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAdmin", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAdmin", + "name": "NewComptroller", "type": "event" }, { @@ -121332,18 +123362,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldImplementation", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -121384,44 +123414,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -121461,12 +123453,6 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", @@ -121565,7 +123551,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -121609,6 +123595,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -121645,27 +123636,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -121681,15 +123657,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -121711,12 +123678,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -121758,7 +123750,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -121774,21 +123766,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -121991,32 +123968,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -122077,6 +124028,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -122173,91 +124166,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -122396,21 +124304,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -122453,36 +124346,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -122576,69 +124439,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -122800,65 +124600,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vTRXOLD": { - "address": "0x61eDcFe8Dd6bA3c891CB9bEc2dc7657B3B422E93", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -123032,6 +124776,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -123063,6 +124813,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "MintBehalf", @@ -123074,17 +124830,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewAdmin", + "name": "NewAccessControlManager", "type": "event" }, { @@ -123092,18 +124848,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAdmin", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAdmin", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAdmin", "type": "event" }, { @@ -123111,18 +124867,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldImplementation", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newImplementation", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewImplementation", + "name": "NewComptroller", "type": "event" }, { @@ -123163,6 +124919,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -123202,6 +124996,12 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", @@ -123300,7 +125100,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -123344,11 +125144,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -123385,12 +125180,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -123406,6 +125216,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -123427,37 +125246,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -123499,7 +125293,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -123515,6 +125309,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -123718,24 +125527,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -123744,18 +125549,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -123765,12 +125570,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -123778,41 +125583,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -123915,6 +125708,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -124053,6 +125931,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -124095,6 +125988,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -124188,6 +126111,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -124349,9 +126335,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vTUSD": { + "address": "0xBf762cd5991cA1DCdDaC9ae5C638F5B5Dc3Bee6E", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -124525,12 +126567,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -124562,12 +126598,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "MintBehalf", @@ -124579,17 +126609,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAccessControlAddress", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAccessControlAddress", + "name": "newAdmin", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewAdmin", "type": "event" }, { @@ -124597,18 +126627,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAdmin", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAdmin", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAdmin", + "name": "NewComptroller", "type": "event" }, { @@ -124616,18 +126646,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldImplementation", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -124668,44 +126698,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -124745,12 +126737,6 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", @@ -124849,7 +126835,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -124893,6 +126879,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -124929,27 +126920,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -124965,15 +126941,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -124995,12 +126962,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -125042,7 +127034,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -125058,21 +127050,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -125275,32 +127252,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -125361,6 +127312,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -125457,91 +127450,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -125680,21 +127588,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -125737,36 +127630,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -125860,69 +127723,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -126084,65 +127884,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vTUSD": { - "address": "0xBf762cd5991cA1DCdDaC9ae5C638F5B5Dc3Bee6E", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -126316,6 +128060,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -126347,6 +128097,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "MintBehalf", @@ -126358,17 +128114,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewAdmin", + "name": "NewAccessControlManager", "type": "event" }, { @@ -126376,18 +128132,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAdmin", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAdmin", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAdmin", "type": "event" }, { @@ -126395,18 +128151,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldImplementation", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newImplementation", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewImplementation", + "name": "NewComptroller", "type": "event" }, { @@ -126447,6 +128203,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -126486,6 +128280,12 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", @@ -126584,7 +128384,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -126628,11 +128428,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -126669,12 +128464,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -126690,6 +128500,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -126711,37 +128530,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -126783,7 +128577,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -126799,6 +128593,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -127002,24 +128811,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -127028,18 +128833,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -127049,12 +128854,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -127062,41 +128867,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -127199,6 +128992,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -127337,6 +129215,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -127379,6 +129272,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -127472,6 +129395,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -127633,9 +129619,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vTUSDOLD": { + "address": "0x08CEB3F4a7ed3500cA0982bcd0FC7816688084c3", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -127809,12 +129851,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Mint", @@ -127846,12 +129882,6 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "MintBehalf", @@ -127863,17 +129893,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAccessControlAddress", + "name": "oldAdmin", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAccessControlAddress", + "name": "newAdmin", "type": "address" } ], - "name": "NewAccessControlManager", + "name": "NewAdmin", "type": "event" }, { @@ -127881,18 +129911,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldAdmin", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newAdmin", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewAdmin", + "name": "NewComptroller", "type": "event" }, { @@ -127900,18 +129930,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldImplementation", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newImplementation", "type": "address" } ], - "name": "NewComptroller", + "name": "NewImplementation", "type": "event" }, { @@ -127952,44 +129982,6 @@ "name": "NewPendingAdmin", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "NewProtocolShareReserve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReduceReservesBlockDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReduceReservesBlockDelta", - "type": "uint256" - } - ], - "name": "NewReduceReservesBlockDelta", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -128029,12 +130021,6 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" } ], "name": "Redeem", @@ -128133,7 +130119,7 @@ { "indexed": false, "internalType": "address", - "name": "protocolShareReserve", + "name": "admin", "type": "address" }, { @@ -128177,6 +130163,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -128213,27 +130204,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -128249,15 +130225,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -128279,12 +130246,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -128326,7 +130318,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -128342,21 +130334,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -128559,32 +130536,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -128645,6 +130596,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -128741,91 +130734,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -128964,21 +130872,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -129021,36 +130914,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reduceReservesBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ @@ -129144,69 +131007,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -129368,65 +131168,9 @@ "payable": false, "stateMutability": "view", "type": "function" - } - ] - }, - "vTUSDOLD": { - "address": "0x08CEB3F4a7ed3500cA0982bcd0FC7816688084c3", - "abi": [ + }, { - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - }, - { - "internalType": "address payable", - "name": "admin_", - "type": "address" - }, - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], + "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -129600,6 +131344,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Mint", @@ -129631,6 +131381,12 @@ "internalType": "uint256", "name": "mintTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "MintBehalf", @@ -129642,17 +131398,17 @@ { "indexed": false, "internalType": "address", - "name": "oldAdmin", + "name": "oldAccessControlAddress", "type": "address" }, { "indexed": false, "internalType": "address", - "name": "newAdmin", + "name": "newAccessControlAddress", "type": "address" } ], - "name": "NewAdmin", + "name": "NewAccessControlManager", "type": "event" }, { @@ -129660,18 +131416,18 @@ "inputs": [ { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", + "internalType": "address", + "name": "oldAdmin", "type": "address" }, { "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", + "internalType": "address", + "name": "newAdmin", "type": "address" } ], - "name": "NewComptroller", + "name": "NewAdmin", "type": "event" }, { @@ -129679,18 +131435,18 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "oldImplementation", + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", "type": "address" }, { "indexed": false, - "internalType": "address", - "name": "newImplementation", + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", "type": "address" } ], - "name": "NewImplementation", + "name": "NewComptroller", "type": "event" }, { @@ -129731,6 +131487,44 @@ "name": "NewPendingAdmin", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -129770,6 +131564,12 @@ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" } ], "name": "Redeem", @@ -129868,7 +131668,7 @@ { "indexed": false, "internalType": "address", - "name": "admin", + "name": "protocolShareReserve", "type": "address" }, { @@ -129912,11 +131712,6 @@ "name": "Transfer", "type": "event" }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, { "constant": false, "inputs": [], @@ -129953,12 +131748,27 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "_becomeImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount", + "name": "reduceAmount_", "type": "uint256" } ], @@ -129974,6 +131784,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "_resignImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -129995,37 +131814,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "implementation_", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowResign", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "becomeImplementationData", - "type": "bytes" - } - ], - "name": "_setImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", + "name": "newInterestRateModel_", "type": "address" } ], @@ -130067,7 +131861,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa", + "name": "newReserveFactorMantissa_", "type": "uint256" } ], @@ -130083,6 +131877,21 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -130286,24 +132095,20 @@ "type": "function" }, { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [ + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "borrowAmount", "type": "uint256" } ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", + "name": "borrowBehalf", "outputs": [ { "internalType": "uint256", @@ -130312,18 +132117,18 @@ } ], "payable": false, - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], - "name": "comptroller", + "name": "borrowIndex", "outputs": [ { - "internalType": "contract ComptrollerInterface", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "payable": false, @@ -130333,12 +132138,12 @@ { "constant": true, "inputs": [], - "name": "decimals", + "name": "borrowRatePerBlock", "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" + "type": "uint256" } ], "payable": false, @@ -130346,41 +132151,29 @@ "type": "function" }, { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToImplementation", + "constant": true, + "inputs": [], + "name": "comptroller", "outputs": [ { - "internalType": "bytes", + "internalType": "contract ComptrollerInterface", "name": "", - "type": "bytes" + "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "constant": true, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "delegateToViewImplementation", + "inputs": [], + "name": "decimals", "outputs": [ { - "internalType": "bytes", + "internalType": "uint8", "name": "", - "type": "bytes" + "type": "uint8" } ], "payable": false, @@ -130483,6 +132276,91 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -130621,6 +132499,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -130663,6 +132556,36 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -130756,6 +132679,69 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlManagerAddress", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "protcolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newReduceReservesBlockDelta_", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [], @@ -130917,9 +132903,65 @@ "payable": false, "stateMutability": "view", "type": "function" - }, + } + ] + }, + "vTWT": { + "address": "0x4d41a36D04D97785bcEA57b057C412b278e6Edcc", + "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" @@ -131198,6 +133240,25 @@ "name": "NewComptroller", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldImplementation", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "NewImplementation", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -131461,6 +133522,11 @@ "name": "Transfer", "type": "event" }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, { "constant": false, "inputs": [], @@ -131497,27 +133563,12 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "_becomeImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ { "internalType": "uint256", - "name": "reduceAmount_", + "name": "reduceAmount", "type": "uint256" } ], @@ -131533,15 +133584,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "_resignImplementation", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": false, "inputs": [ @@ -131563,12 +133605,37 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowResign", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "becomeImplementationData", + "type": "bytes" + } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ { "internalType": "contract InterestRateModel", - "name": "newInterestRateModel_", + "name": "newInterestRateModel", "type": "address" } ], @@ -131610,7 +133677,7 @@ "inputs": [ { "internalType": "uint256", - "name": "newReserveFactorMantissa_", + "name": "newReserveFactorMantissa", "type": "uint256" } ], @@ -131843,32 +133910,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "name": "borrowBehalf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -131929,6 +133970,48 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateToViewImplementation", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [], @@ -132025,91 +134108,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "underlying_", - "type": "address" - }, - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract ComptrollerInterface", - "name": "comptroller_", - "type": "address" - }, - { - "internalType": "contract InterestRateModel", - "name": "interestRateModel_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "initialExchangeRateMantissa_", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -132428,69 +134426,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "newAccessControlManagerAddress", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "protcolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "newReduceReservesBlockDelta_", - "type": "uint256" - } - ], - "name": "setReduceReservesBlockDelta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], diff --git a/deployments/bscmainnet_addresses.json b/deployments/bscmainnet_addresses.json index f15eb5137..1db6ec58c 100644 --- a/deployments/bscmainnet_addresses.json +++ b/deployments/bscmainnet_addresses.json @@ -27,6 +27,7 @@ "JumpRateModel_base0bps_slope750bps_jump50000bps_kink8000bps": "0xdEf4b9462223c9a44E61d217a145063C7836FD7B", "JumpRateModel_base0bps_slope875bps_jump25000bps_kink8000bps": "0xBe4609d972FdEBAa9DC870F4A957F40C301bEb1D", "JumpRateModel_base0bps_slope875bps_jump50000bps_kink8000bps": "0xE19C14171C2aC6CA63E008133e4B0D8571164BA3", + "JumpRateModel_base200bps_slope2000bps_jump30000bps_kink5000bps": "0x2dE4739a9C68B02B54C0d8323752551d724b3cc2", "LINK": "0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD", "LTC": "0x4338665CBB7B2485A8855A139b75D5e34AB0DB94", "LUNA": "0x156ab3346823B651294766e23e6Cf87254d68962", @@ -126,6 +127,7 @@ "vTRXOLD": "0x61eDcFe8Dd6bA3c891CB9bEc2dc7657B3B422E93", "vTUSD": "0xBf762cd5991cA1DCdDaC9ae5C638F5B5Dc3Bee6E", "vTUSDOLD": "0x08CEB3F4a7ed3500cA0982bcd0FC7816688084c3", + "vTWT": "0x4d41a36D04D97785bcEA57b057C412b278e6Edcc", "vUSDC": "0xecA88125a5ADbe82614ffC12D0DB554E2e2867C8", "vUSDT": "0xfD5840Cd36d94D7229439859C0112a4185BC0255", "vUST": "0x78366446547D062f45b4C0f320cDaa6d710D87bb",