├── config.env ├── .gitignore ├── utils ├── functions.js ├── actions.js └── lendingPoolConfig.js ├── docker-compose.yml ├── db ├── connectDB.js └── createTables.js ├── tasks ├── getUserInfo.js └── getCusdPrice.js ├── README.md ├── package.json ├── abi ├── LendingPoolDataProvider.json ├── LendingPoolAddressesProvider.json ├── AToken.json ├── LendingPool.json └── LendingPoolCore.json └── automaticBot └── mainMonitoring.js /config.env: -------------------------------------------------------------------------------- 1 | ENV=test 2 | MYSQL_HOST=localhost 3 | MYSQL_DATABASE=blockchain 4 | MYSQL_USER=db_user 5 | MYSQL_PASSWORD=kjwq294+alTqsVVs 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | build/ 3 | dist/ 4 | .idea 5 | .vscode 6 | .prettierrc 7 | coverage/ 8 | database/ 9 | QA.txt 10 | config.env 11 | 12 | thegraph/subgraph.yaml 13 | -------------------------------------------------------------------------------- /utils/functions.js: -------------------------------------------------------------------------------- 1 | const Promise = require('bluebird'); 2 | 3 | const retry = async (fun, tries = 5) => { 4 | try { 5 | return await fun(); 6 | } catch (err) { 7 | if (tries == 0) throw err; 8 | await Promise.delay(1000); 9 | return retry(fun, tries - 1); 10 | } 11 | }; 12 | 13 | exports.retry = retry; 14 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | services: 3 | mysql: 4 | image: mysql:5.7.32 5 | ports: 6 | - 3306:3306 7 | volumes: 8 | - db_data:/var/lib/mysql 9 | environment: 10 | MYSQL_ROOT_PASSWORD: JWd2e13IUH+aLda2 11 | MYSQL_DATABASE: blockchain 12 | MYSQL_USER: db_user 13 | MYSQL_PASSWORD: kjwq294+alTqsVVs 14 | restart: always 15 | 16 | volumes: 17 | db_data: {} -------------------------------------------------------------------------------- /db/connectDB.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config({ path: './config.env' }); 2 | const mysql = require("mysql"); 3 | const util = require("util"); 4 | const con = mysql.createConnection({ 5 | host: process.env.MYSQL_HOST, 6 | user: process.env.MYSQL_USER, 7 | password: process.env.MYSQL_PASSWORD, 8 | database: process.env.MYSQL_DATABASE, 9 | multipleStatements: true, 10 | }); 11 | 12 | exports.con = con; 13 | exports.query = util.promisify(con.query).bind(con); 14 | -------------------------------------------------------------------------------- /tasks/getUserInfo.js: -------------------------------------------------------------------------------- 1 | // Console logs all information about current user 2 | 3 | // utils 4 | const { 5 | configureLending, 6 | configureReserve, 7 | } = require("../utils/lendingPoolConfig"); 8 | const { retry } = require("../utils/functions"); 9 | const { getUserReserved, getUserData } = require("../utils/actions"); 10 | 11 | // Execute from terminal 12 | async function execute(...params) { 13 | const { lendingPool } = await configureLending(...params); 14 | 15 | const { reserveCusd, reserveCelo } = await configureReserve(); 16 | // Actual User Data 17 | const userData = await getUserData(params[0], lendingPool); 18 | const userReservedData = await getUserReserved(params[0], lendingPool, null, { 19 | reserveCelo, 20 | reserveCusd, 21 | }); 22 | console.log( 23 | "______________________________User info______________________________" 24 | ); 25 | console.table(userData); 26 | console.log( 27 | "______________________________User reserved Data______________________________" 28 | ); 29 | console.table(userReservedData); 30 | } 31 | 32 | execute(...process.argv.slice(2).map((arg) => arg.toLowerCase())); 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Moola-liquidation 2 | 3 | Moola-liquidation is a test project for writing automatic liqudations. 4 | 5 | ## Installation 6 | 7 | Use the package manager [npm](https://www.npmjs.com/) to install all necessary modules. 8 | 9 | ```bash 10 | npm install 11 | ``` 12 | 13 | ## Deploy locally 14 | 15 | Bring database up (you will need Docker installed) __(important step before running project)__ 16 | 17 | ```bash 18 | npm run up 19 | ``` 20 | Create empty tables for database __(important step before running project)__ 21 | 22 | ```bash 23 | npm run init 24 | ``` 25 | 26 | Stop database in safe mode (keep data untill next launch) 27 | 28 | ```bash 29 | npm run down 30 | ``` 31 | 32 | Fresh database (full database restart) 33 | 34 | ```bash 35 | npm run clear 36 | ``` 37 | 38 | ## Run the automatic liquidation 39 | 40 | Run following command from the root project directory 41 | 42 | ```bash 43 | npm start 44 | ``` 45 | 46 | ## Configure user who will be liquidate others 47 | 48 | In the root directory of project find file called config.env and pass your values 49 | 50 | Without the private key, automated liquidation will be turned off. 51 | 52 | ```bash 53 | USER_ADDRESS={YOUR_ADDRESS} 54 | USER_PRIVATE_KEY={YOUR_PRIVATE_KEY} 55 | ``` -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "moola-liquidation-bot", 3 | "version": "1.0.0", 4 | "description": "Moola liquidation for Celo blockchain", 5 | "main": "index.js", 6 | "directories": { 7 | "doc": "docs", 8 | "test": "test" 9 | }, 10 | "scripts": { 11 | "start": "node automaticBot/mainMonitoring.js", 12 | "up": "docker-compose --env-file .env.local up -d", 13 | "init": "node db/createTables.js", 14 | "down": "docker-compose --env-file .env.local down", 15 | "clear": "docker-compose --env-file .env.local down -v" 16 | }, 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/moolamarket/liquidation-bot" 20 | }, 21 | "keywords": [ 22 | "aave", 23 | "moola", 24 | "celo" 25 | ], 26 | "author": "Oleksii Matiiasevych ", 27 | "license": "ISC", 28 | "bugs": { 29 | "url": "https://github.com/moolamarket/moola/issues" 30 | }, 31 | "homepage": "https://github.com/moolamarket/moola#readme", 32 | "dependencies": { 33 | "@openzeppelin/contracts": "2.4.0", 34 | "bignumber.js": "^9.0.1", 35 | "bluebird": "^3.7.2", 36 | "colors": "^1.4.0", 37 | "dotenv": "^8.2.0", 38 | "mysql": "^2.18.1", 39 | "truffle": "^5.1.50" 40 | }, 41 | "devDependencies": { 42 | "@celo/contractkit": "^1.0.1" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tasks/getCusdPrice.js: -------------------------------------------------------------------------------- 1 | // Get current cusd price from blockchain anf store in DB 2 | const Promise = require("bluebird"); 3 | const colors = require("colors"); 4 | require("dotenv").config({ path: "./config.env" }); 5 | const ENV = process.env.ENV.toLowerCase() === "main" ? "main" : "test"; 6 | const DB_PREFIX = ENV === "main" ? "" : "TEST_"; 7 | 8 | // utils 9 | const { con, query } = require("../db/connectDB"); 10 | const { print, configureLending } = require("../utils/lendingPoolConfig"); 11 | const { retry } = require("../utils/functions"); 12 | 13 | // Get current cusd price of 1 celo 14 | async function getCusdPrice() { 15 | const { kit } = await configureLending(...process.argv); 16 | const oneGold = kit.web3.utils.toWei("1", "ether"); 17 | const exchange = await retry(() => kit.contracts.getExchange()); 18 | 19 | const amountOfcUsd = await retry(() => exchange.quoteGoldSell(oneGold)); 20 | return print(amountOfcUsd); 21 | } 22 | 23 | async function updateCusdPrice(id, cUsd) { 24 | await query( 25 | `INSERT INTO ${DB_PREFIX}cusdPrice (id, price) VALUES('${id}', '${cUsd}') ON DUPLICATE KEY UPDATE price = '${cUsd}'` 26 | ); 27 | } 28 | 29 | // Execute from terminal 30 | async function execute() { 31 | const oldcUsd = await getCusdPrice(); 32 | await updateCusdPrice(1, oldcUsd); 33 | 34 | console.log('Waiting for new Cusd price to compare with old one...'.yellow); 35 | await Promise.delay(10000); 36 | const newCusd = await getCusdPrice(); 37 | await updateCusdPrice(2, newCusd); 38 | console.log(`Old Cusd price -> ${oldcUsd}`.bgCyan) 39 | console.log(`New Cusd price -> ${newCusd}`.bgCyan) 40 | con.end(); 41 | } 42 | 43 | execute(); 44 | -------------------------------------------------------------------------------- /db/createTables.js: -------------------------------------------------------------------------------- 1 | const { con, query } = require("./connectDB"); 2 | 3 | async function tableCusd(prefix = '') { 4 | const sql = `CREATE table ${prefix}cusdPrice ( 5 | id INT NOT NULL, 6 | price text, 7 | PRIMARY KEY (id) 8 | );`; 9 | await query(sql); 10 | } 11 | 12 | async function tableEvents(prefix = '') { 13 | const sql = `CREATE table ${prefix}events ( 14 | event text 15 | );`; 16 | await query(sql); 17 | } 18 | 19 | async function tableBlockNumber(prefix = '') { 20 | const sql = `CREATE table ${prefix}eventsBlockNumber ( 21 | id INT NOT NULL, 22 | blockNumber text, 23 | PRIMARY KEY (id) 24 | );`; 25 | await query(sql); 26 | } 27 | 28 | async function tableUserDebtsOrderedList(prefix = '') { 29 | const sql = `CREATE table ${prefix}userDebtsOrderedList ( 30 | DepositedCelo text, 31 | BorrowedCelo text, 32 | DebtCelo text, 33 | DepositedCusd text, 34 | BorrowedCusd text, 35 | DebtCusd text, 36 | user VARCHAR(42), 37 | TotalLiquidity text, 38 | TotalCollateral text, 39 | TotalBorrow text, 40 | AvailableBorrow text, 41 | TotalFees text, 42 | LiquidationThreshold text, 43 | LoanToValue text, 44 | healthFactor text, 45 | status VARCHAR(4), 46 | PRIMARY KEY (user) 47 | );`; 48 | await query(sql); 49 | } 50 | 51 | async function createTables() { 52 | await tableCusd(); 53 | await tableEvents(); 54 | await tableBlockNumber(); 55 | await tableUserDebtsOrderedList(); 56 | await tableCusd('TEST_'); 57 | await tableEvents('TEST_'); 58 | await tableBlockNumber('TEST_'); 59 | await tableUserDebtsOrderedList('TEST_'); 60 | con.end(); 61 | } 62 | 63 | createTables(); 64 | -------------------------------------------------------------------------------- /utils/actions.js: -------------------------------------------------------------------------------- 1 | // utils 2 | const { print } = require("../utils/lendingPoolConfig"); 3 | const { retry } = require("../utils/functions"); 4 | const BigNumber = require("bignumber.js"); 5 | 6 | // get user account data 7 | exports.getUserData = async function ( 8 | user, 9 | lendingPool, 10 | lendingPoolDataProvider 11 | ) { 12 | try { 13 | data = await retry(() => 14 | lendingPool.methods.getUserAccountData(user).call() 15 | ); 16 | } catch (err) { 17 | data = await retry(() => 18 | lendingPoolDataProvider.methods.calculateUserGlobalData(user).call() 19 | ); 20 | data.availableBorrowsETH = 0; 21 | } 22 | 23 | const parsedData = { 24 | TotalLiquidity: print(data.totalLiquidityETH || data.totalLiquidityBalanceETH), 25 | TotalCollateral: print(data.totalCollateralETH || data.totalCollateralBalanceETH), 26 | TotalBorrow: print(data.totalBorrowsETH || data.totalBorrowBalanceETH), 27 | TotalFees: print(data.totalFeesETH), 28 | AvailableBorrow: print(data.availableBorrowsETH), 29 | LiquidationThreshold: `${data.currentLiquidationThreshold}%`, 30 | LoanToValue: `${data.ltv || data.currentLtv}%`, 31 | healthFactor: print(data.healthFactor), 32 | }; 33 | 34 | return parsedData; 35 | }; 36 | 37 | // Get user reserved data 38 | exports.getUserReserved = async function ( 39 | user, 40 | lendingPool, 41 | currency 42 | ) { 43 | const { reserveCusd, reserveCelo } = currency; 44 | const dataCelo = await retry(() => 45 | lendingPool.methods.getUserReserveData(reserveCelo, user).call() 46 | ); 47 | 48 | const dataCusd = await retry(() => 49 | lendingPool.methods.getUserReserveData(reserveCusd, user).call() 50 | ); 51 | 52 | const parsedDataCelo = { 53 | DepositedCelo: print(dataCelo.currentATokenBalance), 54 | BorrowedCelo: print(dataCelo.principalBorrowBalance), 55 | DebtCelo: print(dataCelo.currentBorrowBalance), 56 | // IsCollateral: dataCelo.usageAsCollateralEnabled, 57 | }; 58 | 59 | const parsedDataCusd = { 60 | DepositedCusd: print(dataCusd.currentATokenBalance), 61 | BorrowedCusd: print(dataCusd.principalBorrowBalance), 62 | DebtCusd: print(dataCusd.currentBorrowBalance), 63 | // IsCollateral: dataCusd.usageAsCollateralEnabled, 64 | }; 65 | return { ...parsedDataCelo, ...parsedDataCusd, user }; 66 | }; 67 | -------------------------------------------------------------------------------- /utils/lendingPoolConfig.js: -------------------------------------------------------------------------------- 1 | const { newKit } = require("@celo/contractkit"); 2 | const LendingPoolAddressesProvider = require("../abi/LendingPoolAddressesProvider.json"); 3 | const LendingPool = require("../abi/LendingPool.json"); 4 | const LendingPoolDataProvider = require("../abi/LendingPoolDataProvider.json"); 5 | const LendingPoolCore = require("../abi/LendingPoolCore.json"); 6 | // const AToken = require("../abi/AToken.json"); 7 | const BigNumber = require("bignumber.js"); 8 | const Promise = require("bluebird"); 9 | // utils 10 | const { retry } = require("./functions"); 11 | 12 | const INTEREST_RATE = { 13 | NONE: 0, 14 | STABLE: 1, 15 | VARIABLE: 2, 16 | 1: "STABLE", 17 | 2: "VARIABLE", 18 | 0: "NONE", 19 | }; 20 | 21 | const ether = "1000000000000000000"; 22 | const ray = "1000000000000000000000000000"; 23 | const maxUint256 = 24 | "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; 25 | 26 | function BN(num) { 27 | return new BigNumber(num); 28 | } 29 | 30 | function print(num) { 31 | return BN(num).dividedBy(ether).toFixed(); 32 | } 33 | function printRay(num) { 34 | return BN(num).dividedBy(ray).toFixed(); 35 | } 36 | 37 | function printRayRate(num) { 38 | return BN(num).dividedBy(ray).multipliedBy(BN(100)).toFixed(2) + "%"; 39 | } 40 | 41 | let kit; 42 | let addressProvider; 43 | 44 | // Set server fro kit -> test/main 45 | async function configureKit(env) { 46 | if (env === "main") { 47 | console.log("You are using main forno server now!"); 48 | kit = newKit("https://forno.celo.org"); 49 | addressProvider = new kit.web3.eth.Contract( 50 | LendingPoolAddressesProvider, 51 | "0x7AAaD5a5fa74Aec83b74C2a098FBC86E17Ce4aEA" 52 | ); 53 | } else { 54 | console.log("You are using testing forno server now!"); 55 | kit = newKit("https://alfajores-forno.celo-testnet.org"); 56 | addressProvider = new kit.web3.eth.Contract( 57 | LendingPoolAddressesProvider, 58 | "0x6EAE47ccEFF3c3Ac94971704ccd25C7820121483" 59 | ); 60 | } 61 | } 62 | 63 | async function configureLending(env) { 64 | await configureKit(env); 65 | 66 | const web3 = kit.web3; 67 | const eth = web3.eth; 68 | 69 | lendingPool = new eth.Contract( 70 | LendingPool, 71 | await retry(() => addressProvider.methods.getLendingPool().call()) 72 | ); 73 | 74 | lendingPoolDataProvider = new eth.Contract( 75 | LendingPoolDataProvider, 76 | await retry(() => 77 | addressProvider.methods.getLendingPoolDataProvider().call() 78 | ) 79 | ); 80 | 81 | lendingPoolCore = new eth.Contract( 82 | LendingPoolCore, 83 | await addressProvider.methods.getLendingPoolCore().call() 84 | ); 85 | 86 | return { 87 | lendingPool, 88 | lendingPoolDataProvider, 89 | addressProvider, 90 | lendingPoolCore, 91 | web3, 92 | eth, 93 | kit, 94 | }; 95 | } 96 | 97 | // Configure Celo/Cusd 98 | async function configureReserve() { 99 | const cUSD = await retry(() => kit.contracts.getStableToken()); 100 | const CELO = await retry(() => kit.contracts.getGoldToken()); 101 | reserveCelo = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"; 102 | reserveCusd = cUSD.address; 103 | 104 | return { reserveCelo, reserveCusd, cUSD, CELO }; 105 | } 106 | 107 | // Values 108 | exports.INTEREST_RATE = INTEREST_RATE; 109 | exports.ether = ether; 110 | exports.ray = ray; 111 | exports.maxUint256 = maxUint256; 112 | 113 | // Functions 114 | exports.BN = BN; 115 | exports.print = print; 116 | exports.printRay = printRay; 117 | exports.printRayRate = printRayRate; 118 | // lendingpool enteties 119 | exports.configureLending = configureLending; 120 | exports.configureReserve = configureReserve; 121 | -------------------------------------------------------------------------------- /abi/LendingPoolDataProvider.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": true, 4 | "inputs": [], 5 | "name": "DATA_PROVIDER_REVISION", 6 | "outputs": [ 7 | { 8 | "internalType": "uint256", 9 | "name": "", 10 | "type": "uint256" 11 | } 12 | ], 13 | "payable": false, 14 | "stateMutability": "view", 15 | "type": "function" 16 | }, 17 | { 18 | "constant": true, 19 | "inputs": [], 20 | "name": "HEALTH_FACTOR_LIQUIDATION_THRESHOLD", 21 | "outputs": [ 22 | { 23 | "internalType": "uint256", 24 | "name": "", 25 | "type": "uint256" 26 | } 27 | ], 28 | "payable": false, 29 | "stateMutability": "view", 30 | "type": "function" 31 | }, 32 | { 33 | "constant": true, 34 | "inputs": [], 35 | "name": "addressesProvider", 36 | "outputs": [ 37 | { 38 | "internalType": "contract LendingPoolAddressesProvider", 39 | "name": "", 40 | "type": "address" 41 | } 42 | ], 43 | "payable": false, 44 | "stateMutability": "view", 45 | "type": "function" 46 | }, 47 | { 48 | "constant": true, 49 | "inputs": [ 50 | { 51 | "internalType": "address", 52 | "name": "_reserve", 53 | "type": "address" 54 | }, 55 | { 56 | "internalType": "address", 57 | "name": "_user", 58 | "type": "address" 59 | }, 60 | { 61 | "internalType": "uint256", 62 | "name": "_amount", 63 | "type": "uint256" 64 | } 65 | ], 66 | "name": "balanceDecreaseAllowed", 67 | "outputs": [ 68 | { 69 | "internalType": "bool", 70 | "name": "", 71 | "type": "bool" 72 | } 73 | ], 74 | "payable": false, 75 | "stateMutability": "view", 76 | "type": "function" 77 | }, 78 | { 79 | "constant": true, 80 | "inputs": [ 81 | { 82 | "internalType": "address", 83 | "name": "_reserve", 84 | "type": "address" 85 | }, 86 | { 87 | "internalType": "uint256", 88 | "name": "_amount", 89 | "type": "uint256" 90 | }, 91 | { 92 | "internalType": "uint256", 93 | "name": "_fee", 94 | "type": "uint256" 95 | }, 96 | { 97 | "internalType": "uint256", 98 | "name": "_userCurrentBorrowBalanceTH", 99 | "type": "uint256" 100 | }, 101 | { 102 | "internalType": "uint256", 103 | "name": "_userCurrentFeesETH", 104 | "type": "uint256" 105 | }, 106 | { 107 | "internalType": "uint256", 108 | "name": "_userCurrentLtv", 109 | "type": "uint256" 110 | } 111 | ], 112 | "name": "calculateCollateralNeededInETH", 113 | "outputs": [ 114 | { 115 | "internalType": "uint256", 116 | "name": "", 117 | "type": "uint256" 118 | } 119 | ], 120 | "payable": false, 121 | "stateMutability": "view", 122 | "type": "function" 123 | }, 124 | { 125 | "constant": true, 126 | "inputs": [ 127 | { 128 | "internalType": "address", 129 | "name": "_user", 130 | "type": "address" 131 | } 132 | ], 133 | "name": "calculateUserGlobalData", 134 | "outputs": [ 135 | { 136 | "internalType": "uint256", 137 | "name": "totalLiquidityBalanceETH", 138 | "type": "uint256" 139 | }, 140 | { 141 | "internalType": "uint256", 142 | "name": "totalCollateralBalanceETH", 143 | "type": "uint256" 144 | }, 145 | { 146 | "internalType": "uint256", 147 | "name": "totalBorrowBalanceETH", 148 | "type": "uint256" 149 | }, 150 | { 151 | "internalType": "uint256", 152 | "name": "totalFeesETH", 153 | "type": "uint256" 154 | }, 155 | { 156 | "internalType": "uint256", 157 | "name": "currentLtv", 158 | "type": "uint256" 159 | }, 160 | { 161 | "internalType": "uint256", 162 | "name": "currentLiquidationThreshold", 163 | "type": "uint256" 164 | }, 165 | { 166 | "internalType": "uint256", 167 | "name": "healthFactor", 168 | "type": "uint256" 169 | }, 170 | { 171 | "internalType": "bool", 172 | "name": "healthFactorBelowThreshold", 173 | "type": "bool" 174 | } 175 | ], 176 | "payable": false, 177 | "stateMutability": "view", 178 | "type": "function" 179 | }, 180 | { 181 | "constant": true, 182 | "inputs": [], 183 | "name": "core", 184 | "outputs": [ 185 | { 186 | "internalType": "contract LendingPoolCore", 187 | "name": "", 188 | "type": "address" 189 | } 190 | ], 191 | "payable": false, 192 | "stateMutability": "view", 193 | "type": "function" 194 | }, 195 | { 196 | "constant": true, 197 | "inputs": [], 198 | "name": "getHealthFactorLiquidationThreshold", 199 | "outputs": [ 200 | { 201 | "internalType": "uint256", 202 | "name": "", 203 | "type": "uint256" 204 | } 205 | ], 206 | "payable": false, 207 | "stateMutability": "pure", 208 | "type": "function" 209 | }, 210 | { 211 | "constant": true, 212 | "inputs": [ 213 | { 214 | "internalType": "address", 215 | "name": "_reserve", 216 | "type": "address" 217 | } 218 | ], 219 | "name": "getReserveConfigurationData", 220 | "outputs": [ 221 | { 222 | "internalType": "uint256", 223 | "name": "ltv", 224 | "type": "uint256" 225 | }, 226 | { 227 | "internalType": "uint256", 228 | "name": "liquidationThreshold", 229 | "type": "uint256" 230 | }, 231 | { 232 | "internalType": "uint256", 233 | "name": "liquidationBonus", 234 | "type": "uint256" 235 | }, 236 | { 237 | "internalType": "address", 238 | "name": "rateStrategyAddress", 239 | "type": "address" 240 | }, 241 | { 242 | "internalType": "bool", 243 | "name": "usageAsCollateralEnabled", 244 | "type": "bool" 245 | }, 246 | { 247 | "internalType": "bool", 248 | "name": "borrowingEnabled", 249 | "type": "bool" 250 | }, 251 | { 252 | "internalType": "bool", 253 | "name": "stableBorrowRateEnabled", 254 | "type": "bool" 255 | }, 256 | { 257 | "internalType": "bool", 258 | "name": "isActive", 259 | "type": "bool" 260 | } 261 | ], 262 | "payable": false, 263 | "stateMutability": "view", 264 | "type": "function" 265 | }, 266 | { 267 | "constant": true, 268 | "inputs": [ 269 | { 270 | "internalType": "address", 271 | "name": "_reserve", 272 | "type": "address" 273 | } 274 | ], 275 | "name": "getReserveData", 276 | "outputs": [ 277 | { 278 | "internalType": "uint256", 279 | "name": "totalLiquidity", 280 | "type": "uint256" 281 | }, 282 | { 283 | "internalType": "uint256", 284 | "name": "availableLiquidity", 285 | "type": "uint256" 286 | }, 287 | { 288 | "internalType": "uint256", 289 | "name": "totalBorrowsStable", 290 | "type": "uint256" 291 | }, 292 | { 293 | "internalType": "uint256", 294 | "name": "totalBorrowsVariable", 295 | "type": "uint256" 296 | }, 297 | { 298 | "internalType": "uint256", 299 | "name": "liquidityRate", 300 | "type": "uint256" 301 | }, 302 | { 303 | "internalType": "uint256", 304 | "name": "variableBorrowRate", 305 | "type": "uint256" 306 | }, 307 | { 308 | "internalType": "uint256", 309 | "name": "stableBorrowRate", 310 | "type": "uint256" 311 | }, 312 | { 313 | "internalType": "uint256", 314 | "name": "averageStableBorrowRate", 315 | "type": "uint256" 316 | }, 317 | { 318 | "internalType": "uint256", 319 | "name": "utilizationRate", 320 | "type": "uint256" 321 | }, 322 | { 323 | "internalType": "uint256", 324 | "name": "liquidityIndex", 325 | "type": "uint256" 326 | }, 327 | { 328 | "internalType": "uint256", 329 | "name": "variableBorrowIndex", 330 | "type": "uint256" 331 | }, 332 | { 333 | "internalType": "address", 334 | "name": "aTokenAddress", 335 | "type": "address" 336 | }, 337 | { 338 | "internalType": "uint40", 339 | "name": "lastUpdateTimestamp", 340 | "type": "uint40" 341 | } 342 | ], 343 | "payable": false, 344 | "stateMutability": "view", 345 | "type": "function" 346 | }, 347 | { 348 | "constant": true, 349 | "inputs": [ 350 | { 351 | "internalType": "address", 352 | "name": "_user", 353 | "type": "address" 354 | } 355 | ], 356 | "name": "getUserAccountData", 357 | "outputs": [ 358 | { 359 | "internalType": "uint256", 360 | "name": "totalLiquidityETH", 361 | "type": "uint256" 362 | }, 363 | { 364 | "internalType": "uint256", 365 | "name": "totalCollateralETH", 366 | "type": "uint256" 367 | }, 368 | { 369 | "internalType": "uint256", 370 | "name": "totalBorrowsETH", 371 | "type": "uint256" 372 | }, 373 | { 374 | "internalType": "uint256", 375 | "name": "totalFeesETH", 376 | "type": "uint256" 377 | }, 378 | { 379 | "internalType": "uint256", 380 | "name": "availableBorrowsETH", 381 | "type": "uint256" 382 | }, 383 | { 384 | "internalType": "uint256", 385 | "name": "currentLiquidationThreshold", 386 | "type": "uint256" 387 | }, 388 | { 389 | "internalType": "uint256", 390 | "name": "ltv", 391 | "type": "uint256" 392 | }, 393 | { 394 | "internalType": "uint256", 395 | "name": "healthFactor", 396 | "type": "uint256" 397 | } 398 | ], 399 | "payable": false, 400 | "stateMutability": "view", 401 | "type": "function" 402 | }, 403 | { 404 | "constant": true, 405 | "inputs": [ 406 | { 407 | "internalType": "address", 408 | "name": "_reserve", 409 | "type": "address" 410 | }, 411 | { 412 | "internalType": "address", 413 | "name": "_user", 414 | "type": "address" 415 | } 416 | ], 417 | "name": "getUserReserveData", 418 | "outputs": [ 419 | { 420 | "internalType": "uint256", 421 | "name": "currentATokenBalance", 422 | "type": "uint256" 423 | }, 424 | { 425 | "internalType": "uint256", 426 | "name": "currentBorrowBalance", 427 | "type": "uint256" 428 | }, 429 | { 430 | "internalType": "uint256", 431 | "name": "principalBorrowBalance", 432 | "type": "uint256" 433 | }, 434 | { 435 | "internalType": "uint256", 436 | "name": "borrowRateMode", 437 | "type": "uint256" 438 | }, 439 | { 440 | "internalType": "uint256", 441 | "name": "borrowRate", 442 | "type": "uint256" 443 | }, 444 | { 445 | "internalType": "uint256", 446 | "name": "liquidityRate", 447 | "type": "uint256" 448 | }, 449 | { 450 | "internalType": "uint256", 451 | "name": "originationFee", 452 | "type": "uint256" 453 | }, 454 | { 455 | "internalType": "uint256", 456 | "name": "variableBorrowIndex", 457 | "type": "uint256" 458 | }, 459 | { 460 | "internalType": "uint256", 461 | "name": "lastUpdateTimestamp", 462 | "type": "uint256" 463 | }, 464 | { 465 | "internalType": "bool", 466 | "name": "usageAsCollateralEnabled", 467 | "type": "bool" 468 | } 469 | ], 470 | "payable": false, 471 | "stateMutability": "view", 472 | "type": "function" 473 | }, 474 | { 475 | "constant": false, 476 | "inputs": [ 477 | { 478 | "internalType": "contract LendingPoolAddressesProvider", 479 | "name": "_addressesProvider", 480 | "type": "address" 481 | } 482 | ], 483 | "name": "initialize", 484 | "outputs": [], 485 | "payable": false, 486 | "stateMutability": "nonpayable", 487 | "type": "function" 488 | } 489 | ] -------------------------------------------------------------------------------- /abi/LendingPoolAddressesProvider.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "newAddress", 9 | "type": "address" 10 | } 11 | ], 12 | "name": "EthereumAddressUpdated", 13 | "type": "event" 14 | }, 15 | { 16 | "anonymous": false, 17 | "inputs": [ 18 | { 19 | "indexed": true, 20 | "internalType": "address", 21 | "name": "newAddress", 22 | "type": "address" 23 | } 24 | ], 25 | "name": "FeeProviderUpdated", 26 | "type": "event" 27 | }, 28 | { 29 | "anonymous": false, 30 | "inputs": [ 31 | { 32 | "indexed": true, 33 | "internalType": "address", 34 | "name": "newAddress", 35 | "type": "address" 36 | } 37 | ], 38 | "name": "LendingPoolConfiguratorUpdated", 39 | "type": "event" 40 | }, 41 | { 42 | "anonymous": false, 43 | "inputs": [ 44 | { 45 | "indexed": true, 46 | "internalType": "address", 47 | "name": "newAddress", 48 | "type": "address" 49 | } 50 | ], 51 | "name": "LendingPoolCoreUpdated", 52 | "type": "event" 53 | }, 54 | { 55 | "anonymous": false, 56 | "inputs": [ 57 | { 58 | "indexed": true, 59 | "internalType": "address", 60 | "name": "newAddress", 61 | "type": "address" 62 | } 63 | ], 64 | "name": "LendingPoolDataProviderUpdated", 65 | "type": "event" 66 | }, 67 | { 68 | "anonymous": false, 69 | "inputs": [ 70 | { 71 | "indexed": true, 72 | "internalType": "address", 73 | "name": "newAddress", 74 | "type": "address" 75 | } 76 | ], 77 | "name": "LendingPoolLiquidationManagerUpdated", 78 | "type": "event" 79 | }, 80 | { 81 | "anonymous": false, 82 | "inputs": [ 83 | { 84 | "indexed": true, 85 | "internalType": "address", 86 | "name": "newAddress", 87 | "type": "address" 88 | } 89 | ], 90 | "name": "LendingPoolManagerUpdated", 91 | "type": "event" 92 | }, 93 | { 94 | "anonymous": false, 95 | "inputs": [ 96 | { 97 | "indexed": true, 98 | "internalType": "address", 99 | "name": "newAddress", 100 | "type": "address" 101 | } 102 | ], 103 | "name": "LendingPoolParametersProviderUpdated", 104 | "type": "event" 105 | }, 106 | { 107 | "anonymous": false, 108 | "inputs": [ 109 | { 110 | "indexed": true, 111 | "internalType": "address", 112 | "name": "newAddress", 113 | "type": "address" 114 | } 115 | ], 116 | "name": "LendingPoolUpdated", 117 | "type": "event" 118 | }, 119 | { 120 | "anonymous": false, 121 | "inputs": [ 122 | { 123 | "indexed": true, 124 | "internalType": "address", 125 | "name": "newAddress", 126 | "type": "address" 127 | } 128 | ], 129 | "name": "LendingRateOracleUpdated", 130 | "type": "event" 131 | }, 132 | { 133 | "anonymous": false, 134 | "inputs": [ 135 | { 136 | "indexed": true, 137 | "internalType": "address", 138 | "name": "previousOwner", 139 | "type": "address" 140 | }, 141 | { 142 | "indexed": true, 143 | "internalType": "address", 144 | "name": "newOwner", 145 | "type": "address" 146 | } 147 | ], 148 | "name": "OwnershipTransferred", 149 | "type": "event" 150 | }, 151 | { 152 | "anonymous": false, 153 | "inputs": [ 154 | { 155 | "indexed": true, 156 | "internalType": "address", 157 | "name": "newAddress", 158 | "type": "address" 159 | } 160 | ], 161 | "name": "PriceOracleUpdated", 162 | "type": "event" 163 | }, 164 | { 165 | "anonymous": false, 166 | "inputs": [ 167 | { 168 | "indexed": false, 169 | "internalType": "bytes32", 170 | "name": "id", 171 | "type": "bytes32" 172 | }, 173 | { 174 | "indexed": true, 175 | "internalType": "address", 176 | "name": "newAddress", 177 | "type": "address" 178 | } 179 | ], 180 | "name": "ProxyCreated", 181 | "type": "event" 182 | }, 183 | { 184 | "anonymous": false, 185 | "inputs": [ 186 | { 187 | "indexed": true, 188 | "internalType": "address", 189 | "name": "newAddress", 190 | "type": "address" 191 | } 192 | ], 193 | "name": "TokenDistributorUpdated", 194 | "type": "event" 195 | }, 196 | { 197 | "constant": true, 198 | "inputs": [ 199 | { 200 | "internalType": "bytes32", 201 | "name": "_key", 202 | "type": "bytes32" 203 | } 204 | ], 205 | "name": "getAddress", 206 | "outputs": [ 207 | { 208 | "internalType": "address", 209 | "name": "", 210 | "type": "address" 211 | } 212 | ], 213 | "payable": false, 214 | "stateMutability": "view", 215 | "type": "function" 216 | }, 217 | { 218 | "constant": true, 219 | "inputs": [], 220 | "name": "isOwner", 221 | "outputs": [ 222 | { 223 | "internalType": "bool", 224 | "name": "", 225 | "type": "bool" 226 | } 227 | ], 228 | "payable": false, 229 | "stateMutability": "view", 230 | "type": "function" 231 | }, 232 | { 233 | "constant": true, 234 | "inputs": [], 235 | "name": "owner", 236 | "outputs": [ 237 | { 238 | "internalType": "address", 239 | "name": "", 240 | "type": "address" 241 | } 242 | ], 243 | "payable": false, 244 | "stateMutability": "view", 245 | "type": "function" 246 | }, 247 | { 248 | "constant": false, 249 | "inputs": [], 250 | "name": "renounceOwnership", 251 | "outputs": [], 252 | "payable": false, 253 | "stateMutability": "nonpayable", 254 | "type": "function" 255 | }, 256 | { 257 | "constant": false, 258 | "inputs": [ 259 | { 260 | "internalType": "address", 261 | "name": "newOwner", 262 | "type": "address" 263 | } 264 | ], 265 | "name": "transferOwnership", 266 | "outputs": [], 267 | "payable": false, 268 | "stateMutability": "nonpayable", 269 | "type": "function" 270 | }, 271 | { 272 | "constant": true, 273 | "inputs": [], 274 | "name": "getLendingPool", 275 | "outputs": [ 276 | { 277 | "internalType": "address", 278 | "name": "", 279 | "type": "address" 280 | } 281 | ], 282 | "payable": false, 283 | "stateMutability": "view", 284 | "type": "function" 285 | }, 286 | { 287 | "constant": false, 288 | "inputs": [ 289 | { 290 | "internalType": "address", 291 | "name": "_pool", 292 | "type": "address" 293 | } 294 | ], 295 | "name": "setLendingPoolImpl", 296 | "outputs": [], 297 | "payable": false, 298 | "stateMutability": "nonpayable", 299 | "type": "function" 300 | }, 301 | { 302 | "constant": true, 303 | "inputs": [], 304 | "name": "getLendingPoolCore", 305 | "outputs": [ 306 | { 307 | "internalType": "address payable", 308 | "name": "", 309 | "type": "address" 310 | } 311 | ], 312 | "payable": false, 313 | "stateMutability": "view", 314 | "type": "function" 315 | }, 316 | { 317 | "constant": false, 318 | "inputs": [ 319 | { 320 | "internalType": "address", 321 | "name": "_lendingPoolCore", 322 | "type": "address" 323 | } 324 | ], 325 | "name": "setLendingPoolCoreImpl", 326 | "outputs": [], 327 | "payable": false, 328 | "stateMutability": "nonpayable", 329 | "type": "function" 330 | }, 331 | { 332 | "constant": true, 333 | "inputs": [], 334 | "name": "getLendingPoolConfigurator", 335 | "outputs": [ 336 | { 337 | "internalType": "address", 338 | "name": "", 339 | "type": "address" 340 | } 341 | ], 342 | "payable": false, 343 | "stateMutability": "view", 344 | "type": "function" 345 | }, 346 | { 347 | "constant": false, 348 | "inputs": [ 349 | { 350 | "internalType": "address", 351 | "name": "_configurator", 352 | "type": "address" 353 | } 354 | ], 355 | "name": "setLendingPoolConfiguratorImpl", 356 | "outputs": [], 357 | "payable": false, 358 | "stateMutability": "nonpayable", 359 | "type": "function" 360 | }, 361 | { 362 | "constant": true, 363 | "inputs": [], 364 | "name": "getLendingPoolDataProvider", 365 | "outputs": [ 366 | { 367 | "internalType": "address", 368 | "name": "", 369 | "type": "address" 370 | } 371 | ], 372 | "payable": false, 373 | "stateMutability": "view", 374 | "type": "function" 375 | }, 376 | { 377 | "constant": false, 378 | "inputs": [ 379 | { 380 | "internalType": "address", 381 | "name": "_provider", 382 | "type": "address" 383 | } 384 | ], 385 | "name": "setLendingPoolDataProviderImpl", 386 | "outputs": [], 387 | "payable": false, 388 | "stateMutability": "nonpayable", 389 | "type": "function" 390 | }, 391 | { 392 | "constant": true, 393 | "inputs": [], 394 | "name": "getLendingPoolParametersProvider", 395 | "outputs": [ 396 | { 397 | "internalType": "address", 398 | "name": "", 399 | "type": "address" 400 | } 401 | ], 402 | "payable": false, 403 | "stateMutability": "view", 404 | "type": "function" 405 | }, 406 | { 407 | "constant": false, 408 | "inputs": [ 409 | { 410 | "internalType": "address", 411 | "name": "_parametersProvider", 412 | "type": "address" 413 | } 414 | ], 415 | "name": "setLendingPoolParametersProviderImpl", 416 | "outputs": [], 417 | "payable": false, 418 | "stateMutability": "nonpayable", 419 | "type": "function" 420 | }, 421 | { 422 | "constant": true, 423 | "inputs": [], 424 | "name": "getFeeProvider", 425 | "outputs": [ 426 | { 427 | "internalType": "address", 428 | "name": "", 429 | "type": "address" 430 | } 431 | ], 432 | "payable": false, 433 | "stateMutability": "view", 434 | "type": "function" 435 | }, 436 | { 437 | "constant": false, 438 | "inputs": [ 439 | { 440 | "internalType": "address", 441 | "name": "_feeProvider", 442 | "type": "address" 443 | } 444 | ], 445 | "name": "setFeeProviderImpl", 446 | "outputs": [], 447 | "payable": false, 448 | "stateMutability": "nonpayable", 449 | "type": "function" 450 | }, 451 | { 452 | "constant": true, 453 | "inputs": [], 454 | "name": "getLendingPoolLiquidationManager", 455 | "outputs": [ 456 | { 457 | "internalType": "address", 458 | "name": "", 459 | "type": "address" 460 | } 461 | ], 462 | "payable": false, 463 | "stateMutability": "view", 464 | "type": "function" 465 | }, 466 | { 467 | "constant": false, 468 | "inputs": [ 469 | { 470 | "internalType": "address", 471 | "name": "_manager", 472 | "type": "address" 473 | } 474 | ], 475 | "name": "setLendingPoolLiquidationManager", 476 | "outputs": [], 477 | "payable": false, 478 | "stateMutability": "nonpayable", 479 | "type": "function" 480 | }, 481 | { 482 | "constant": true, 483 | "inputs": [], 484 | "name": "getLendingPoolManager", 485 | "outputs": [ 486 | { 487 | "internalType": "address", 488 | "name": "", 489 | "type": "address" 490 | } 491 | ], 492 | "payable": false, 493 | "stateMutability": "view", 494 | "type": "function" 495 | }, 496 | { 497 | "constant": false, 498 | "inputs": [ 499 | { 500 | "internalType": "address", 501 | "name": "_lendingPoolManager", 502 | "type": "address" 503 | } 504 | ], 505 | "name": "setLendingPoolManager", 506 | "outputs": [], 507 | "payable": false, 508 | "stateMutability": "nonpayable", 509 | "type": "function" 510 | }, 511 | { 512 | "constant": true, 513 | "inputs": [], 514 | "name": "getPriceOracle", 515 | "outputs": [ 516 | { 517 | "internalType": "address", 518 | "name": "", 519 | "type": "address" 520 | } 521 | ], 522 | "payable": false, 523 | "stateMutability": "view", 524 | "type": "function" 525 | }, 526 | { 527 | "constant": false, 528 | "inputs": [ 529 | { 530 | "internalType": "address", 531 | "name": "_priceOracle", 532 | "type": "address" 533 | } 534 | ], 535 | "name": "setPriceOracle", 536 | "outputs": [], 537 | "payable": false, 538 | "stateMutability": "nonpayable", 539 | "type": "function" 540 | }, 541 | { 542 | "constant": true, 543 | "inputs": [], 544 | "name": "getLendingRateOracle", 545 | "outputs": [ 546 | { 547 | "internalType": "address", 548 | "name": "", 549 | "type": "address" 550 | } 551 | ], 552 | "payable": false, 553 | "stateMutability": "view", 554 | "type": "function" 555 | }, 556 | { 557 | "constant": false, 558 | "inputs": [ 559 | { 560 | "internalType": "address", 561 | "name": "_lendingRateOracle", 562 | "type": "address" 563 | } 564 | ], 565 | "name": "setLendingRateOracle", 566 | "outputs": [], 567 | "payable": false, 568 | "stateMutability": "nonpayable", 569 | "type": "function" 570 | }, 571 | { 572 | "constant": true, 573 | "inputs": [], 574 | "name": "getTokenDistributor", 575 | "outputs": [ 576 | { 577 | "internalType": "address", 578 | "name": "", 579 | "type": "address" 580 | } 581 | ], 582 | "payable": false, 583 | "stateMutability": "view", 584 | "type": "function" 585 | }, 586 | { 587 | "constant": false, 588 | "inputs": [ 589 | { 590 | "internalType": "address", 591 | "name": "_tokenDistributor", 592 | "type": "address" 593 | } 594 | ], 595 | "name": "setTokenDistributor", 596 | "outputs": [], 597 | "payable": false, 598 | "stateMutability": "nonpayable", 599 | "type": "function" 600 | } 601 | ] -------------------------------------------------------------------------------- /automaticBot/mainMonitoring.js: -------------------------------------------------------------------------------- 1 | const Promise = require('bluebird'); 2 | const colors = require('colors'); 3 | require('dotenv').config({ path: './config.env' }); 4 | 5 | const { 6 | configureLending, 7 | configureReserve, 8 | BN, 9 | print, 10 | maxUint256, 11 | } = require('../utils/lendingPoolConfig'); 12 | const { getUserReserved, getUserData } = require('../utils/actions'); 13 | const { retry } = require('../utils/functions'); 14 | const { con, query } = require('../db/connectDB'); 15 | const USER_ADDRESS = process.env.USER_ADDRESS; 16 | const USER_PRIVATE_KEY = process.env.USER_PRIVATE_KEY; 17 | const ENV = process.env.ENV.toLowerCase() === 'main' ? 'main' : 'test'; 18 | const DB_PREFIX = ENV === 'main' ? '' : 'TEST_'; 19 | const SECOND = 1000; 20 | 21 | // Global variables 22 | let lendingPool, 23 | lendingPoolDataProvider, 24 | lendingPoolCore, 25 | kit, 26 | web3, 27 | CELO, 28 | cUSD, 29 | reserveCelo, 30 | reserveCusd, 31 | exchange; 32 | 33 | async function logBalances() { 34 | const celoBalance = await retry(() => CELO.balanceOf(USER_ADDRESS)); 35 | const cusdBalance = await retry(() => cUSD.balanceOf(USER_ADDRESS)); 36 | console.log(`CELO: ${print(celoBalance)}`.yellow); 37 | console.log(`CUSD: ${print(cusdBalance)}`.yellow); 38 | } 39 | 40 | // Get all [events] from Db ✔ 41 | async function getEvents() { 42 | const res = await query(`SELECT * FROM ${DB_PREFIX}events`); 43 | 44 | return res.map((el) => { 45 | return JSON.parse(el.event); 46 | }); 47 | } 48 | 49 | // Get all [users] from Db ✔ 50 | async function getUsers() { 51 | const res = await query(`SELECT user FROM ${DB_PREFIX}userDebtsOrderedList`); 52 | return res.map((row) => row.user); 53 | } 54 | 55 | // Get all [users] with UC status from Db ✔ 56 | async function getUCUsers() { 57 | const res = await query( 58 | `SELECT user FROM ${DB_PREFIX}userDebtsOrderedList where Status = 'UC'` 59 | ); 60 | 61 | return res.map((row) => row.user); 62 | } 63 | 64 | // Get latest Cusd price from blockchain 65 | async function getCusdPrice() { 66 | const oneCelo = kit.web3.utils.toWei('1'); 67 | const exchange = await retry(() => kit.contracts.getExchange()); 68 | 69 | const amountOfcUsd = await retry(() => exchange.quoteGoldSell(oneCelo)); 70 | return print(amountOfcUsd); 71 | } 72 | 73 | // Update Cusd pruce in DB 74 | async function cusdPriceQuery(id, cUsd) { 75 | await query( 76 | `INSERT INTO ${DB_PREFIX}cusdPrice (id, price) VALUES('${id}', '${cUsd}') ON DUPLICATE KEY UPDATE price = '${cUsd}'` 77 | ); 78 | } 79 | 80 | // Compare Cusd prices from Db 81 | async function compareCusdPrices() { 82 | const res = await query(`select price from ${DB_PREFIX}cusdPrice`); 83 | const [oldCusd, newCusd] = res.map((row) => row.price); 84 | 85 | // Compares old and new prices by 10% 86 | return BN(oldCusd).minus(BN(newCusd)).gte(BN(oldCusd).times(10).div(100)) 87 | ? true 88 | : false; 89 | } 90 | 91 | // Extract specific event from [events] ✔ 92 | function extractSpecificEvent(events, type) { 93 | return events.filter((event) => event.event === type); 94 | } 95 | 96 | // Get only unique users ✔ 97 | function getUniqueUsers(events) { 98 | return [...new Set(events.map((event) => event.returnValues._user))]; 99 | } 100 | 101 | // Get info about users ~~~ 102 | async function getUsersInformation(users) { 103 | const usersInfo = []; 104 | 105 | for (let i = 0; i < users.length; i++) { 106 | const user = users[i]; 107 | const reserveInfo = await getUserReserved(user, lendingPool, { 108 | reserveCelo, 109 | reserveCusd, 110 | }); 111 | const accountInfo = await getUserData( 112 | user, 113 | lendingPool, 114 | lendingPoolDataProvider 115 | ); 116 | 117 | if ( 118 | BN(accountInfo.healthFactor).gt('1.25') || 119 | BN(accountInfo.healthFactor).eq('0') || 120 | BN(accountInfo.TotalBorrow).lte('0.1') || 121 | BN(accountInfo.TotalCollateral).lte('0.1') 122 | ) { 123 | accountInfo.status = 'OK'; 124 | } else { 125 | accountInfo.status = 'RISK'; 126 | if (BN(accountInfo.healthFactor).lt('1')) { 127 | accountInfo.status = 'UC'; 128 | } 129 | } 130 | 131 | if (reserveInfo || accountInfo) { 132 | usersInfo.push({ ...reserveInfo, ...accountInfo, user }); 133 | } 134 | } 135 | 136 | return usersInfo; 137 | } 138 | 139 | // Save user info in DB ✔ 140 | async function saveUserInfoInDb(user) { 141 | await query( 142 | `INSERT INTO ${DB_PREFIX}userDebtsOrderedList SET ? ON DUPLICATE KEY UPDATE 143 | DepositedCelo = '${user.DepositedCelo}', 144 | BorrowedCelo = '${user.BorrowedCelo}', 145 | DebtCelo = '${user.DebtCelo}', 146 | DepositedCusd = '${user.DepositedCusd}', 147 | BorrowedCusd = '${user.BorrowedCusd}', 148 | DebtCusd = '${user.DebtCusd}', 149 | TotalLiquidity = '${user.TotalLiquidity}', 150 | TotalCollateral = '${user.TotalCollateral}', 151 | TotalBorrow = '${user.TotalBorrow}', 152 | LiquidationThreshold = '${user.LiquidationThreshold}', 153 | LoanToValue = '${user.LoanToValue}', 154 | healthFactor = '${user.healthFactor}', 155 | status = '${user.status}', 156 | user = '${user.user}'`, 157 | user 158 | ); 159 | } 160 | 161 | // Remove all old events ✔ 162 | async function clearTableInDb(table) { 163 | await query(`DELETE FROM ${DB_PREFIX}${table}`); 164 | } 165 | 166 | // Get latest block number from Db ✔ 167 | async function getBlockNumber() { 168 | const res = await query( 169 | `SELECT blockNumber FROM ${DB_PREFIX}eventsBlockNumber WHERE id = 1` 170 | ); 171 | 172 | return res.length === 0 ? 0 : parseInt(res[0].blockNumber); 173 | } 174 | 175 | // Save new events in Db ✔ 176 | async function saveEventsToDb(in_events) { 177 | const events = in_events.map((el) => { 178 | el = [JSON.stringify(el)]; 179 | return el; 180 | }); 181 | 182 | await query(`INSERT INTO ${DB_PREFIX}events (event) VALUES ?`, [events]); 183 | } 184 | 185 | // Get latest events from blockchain and store them in Db ~ 186 | async function getLatestEvents() { 187 | const fromBlock = await getBlockNumber(); 188 | const toBlock = await retry(() => web3.eth.getBlockNumber()); 189 | 190 | // Get all new events 191 | const events = await retry(() => 192 | lendingPool.getPastEvents('allEvents', { 193 | fromBlock, 194 | toBlock, 195 | }) 196 | ); 197 | 198 | // Update blockNumber in DB 199 | await query( 200 | `INSERT INTO ${DB_PREFIX}eventsBlockNumber (id, blockNumber) VALUES('1', ${toBlock}) ON DUPLICATE KEY UPDATE blockNumber = '${toBlock}'` 201 | ); 202 | 203 | // Check for new events inside blockchain 204 | if (events.length === 0) return; 205 | 206 | // If there are new events, insert them in DB 207 | await saveEventsToDb(events); 208 | } 209 | 210 | // Liquidation Call ~~ 211 | async function liquidate(_reserve, _target_address, _address, _mToken) { 212 | // if invalid currency 213 | if (_reserve !== 'celo' && _reserve !== 'cusd') { 214 | return console.log(`${_reserve} -> Invalid currency!`.red); 215 | } 216 | 217 | // Get data from args 218 | const collateral = _reserve === 'celo' ? reserveCusd : reserveCelo; 219 | const reserve = _reserve === 'celo' ? reserveCelo : reserveCusd; 220 | const token = _reserve === 'celo' ? CELO : cUSD; 221 | const collateralToken = _reserve === 'celo' ? cUSD : CELO; 222 | let value = 0; 223 | 224 | console.log( 225 | `Start liquidation of address -> ${_target_address}`.green + 226 | ` in ${_reserve}`.cyan 227 | ); 228 | 229 | // Get user healthFactor 230 | const { healthFactor } = await getUserData( 231 | _target_address, 232 | lendingPool, 233 | lendingPoolDataProvider 234 | ); 235 | 236 | // Check for HF 237 | if (BN(healthFactor).gte(1)) { 238 | return console.log(`User's HF is greater than 1!`.yellow); 239 | } 240 | 241 | // Get User borrowed currencies 242 | const { BorrowedCelo, BorrowedCusd, DepositedCelo, DepositedCusd } = await getUserReserved( 243 | _target_address, 244 | lendingPool, 245 | { 246 | reserveCelo, 247 | reserveCusd, 248 | } 249 | ); 250 | 251 | // Our reserve balance before liquidation 252 | const balance = await retry(() => token.balanceOf(_address)); 253 | // Our collateral balance before liquidation 254 | const colBalance = await retry(() => collateralToken.balanceOf(_address)); 255 | 256 | let amount = balance; 257 | if (_reserve === 'celo') { 258 | amount = balance.minus(web3.utils.toWei('1')); // leave 1 CELO available. 259 | } 260 | if (amount.lte(0)) { 261 | return console.log(`Not enough ${_reserve} to spend for liquidation!`.red); 262 | } 263 | 264 | amount = amount.toFixed(0); 265 | 266 | if (_reserve === 'cusd' && BN(BorrowedCusd).gte('0.5') && BN(DepositedCelo).gte('0.1')) { 267 | } else if (_reserve === 'celo' && BN(BorrowedCelo).gte('0.1') && BN(DepositedCusd).gte('0.5')) { 268 | value = amount; 269 | } else { 270 | return console.log(`User borrowed too little of ${_reserve} or doesn't have much collateral left!`.red); 271 | } 272 | 273 | try { 274 | await retry( 275 | () => 276 | lendingPool.methods 277 | .liquidationCall( 278 | collateral, 279 | reserve, 280 | _target_address, 281 | amount, 282 | _mToken 283 | ) 284 | .estimateGas({ from: _address, gas: 2000000, value }), 285 | 2 286 | ); 287 | } catch (err) { 288 | console.log('Cannot Liquidate'.red, err.message); 289 | return; 290 | } 291 | 292 | await logBalances(); 293 | console.log( 294 | 'Liquidate'.green, 295 | ( 296 | await lendingPool.methods 297 | .liquidationCall(collateral, reserve, _target_address, amount, _mToken) 298 | .send({ from: _address, gas: 2000000, value }) 299 | ).transactionHash 300 | ); 301 | 302 | // exchange logic 303 | const newBalance = await retry(() => token.balanceOf(_address)); // reserve 304 | const newColBalance = await retry(() => collateralToken.balanceOf(_address)); // collateral 305 | // How much reserve we have spent 306 | const spent = balance.minus(newBalance); 307 | // How much collateral we have got 308 | const received = newColBalance.minus(colBalance); 309 | 310 | if (spent.lt(0) || received.lt(0)) { 311 | console.log(`Bad liquidation result. Spent: ${print(spent)}, Received: ${print(received)}`.red); 312 | await logBalances(); 313 | return; 314 | } else { 315 | console.log(`Liquidated ${_reserve}. Spent: ${print(spent)} ${_reserve}, Received: ${print(received)} collateral.`.green); 316 | } 317 | 318 | // Exchange collateral to cover our spends and make profit. 319 | await exchangeCollateral(_address, received, spent, _reserve); 320 | } 321 | 322 | // Exchange cusd/CELO from pledge 323 | async function exchangeCollateral(_address, received, spent, _reserve) { 324 | // If reserve === cusd 325 | if (_reserve === 'celo') { 326 | // console.log("quoteUsdSell...".yellow); 327 | const celoAmount = await retry(() => exchange.quoteUsdSell(received)); 328 | 329 | // Check if quote is greater than amount 330 | if (spent.gt(celoAmount)) { 331 | console.log( 332 | `Cannot be exchanged! Quote is less than amount to exchange. Spent: ${print(spent)}, quote: ${print(celoAmount)}`.red 333 | ); 334 | return; 335 | } 336 | // console.log("Exchanging dollars...".yellow); 337 | const sellTx = await exchange 338 | .sellDollar(received, celoAmount.times('0.99').toFixed(0)) 339 | .send({ from: _address, gas: 2000000 }); 340 | 341 | const sellReceipt = await retry(() => sellTx.waitReceipt()); 342 | console.log(`Exchange ${sellReceipt.transactionHash}`.green); 343 | } else if (_reserve === 'cusd') { 344 | // console.log("quoteGoldSell...".yellow); 345 | const usdAmount = await retry(() => exchange.quoteGoldSell(received)); 346 | 347 | // Check if quote is greater than amount 348 | if (spent.gt(usdAmount)) { 349 | return console.log( 350 | `Cannot be exchanged! Quote is less than amount spent. Spent: ${print(spent)}, quote: ${print(usdAmount)}`.red 351 | ); 352 | } 353 | 354 | // console.log("Exchanging for cusd...".yellow); 355 | const sellTx = await exchange 356 | .sellGold(received, usdAmount.times('0.99').toFixed(0)) 357 | .send({ from: _address, gas: 2000000 }); 358 | 359 | const sellReceipt = await retry(() => sellTx.waitReceipt()); 360 | console.log(`Exchange ${sellReceipt.transactionHash}`.green); 361 | } else { 362 | console.log(`Cannot exchange, invalid reserve: ${_reserve}`.red); 363 | } 364 | await logBalances(); 365 | } 366 | 367 | // Liquidation process for CELO/Cusd ~~~ 368 | async function liquidationProcess(users, reserve = 'celo') { 369 | for (let user of users) { 370 | await liquidate(reserve, user, USER_ADDRESS, false); 371 | } 372 | if (users.length > 0) { 373 | console.log( 374 | `Done with Liquidation for ${reserve.toUpperCase()}`.cyan 375 | ); 376 | } 377 | } 378 | 379 | function now() { 380 | return Date.now(); 381 | } 382 | 383 | // main automatic system monitoring ✔ 384 | async function monitor(lastExistingRun = 0) { 385 | // Get cusd price 386 | const cusdPrice = await getCusdPrice(); 387 | await cusdPriceQuery(1, cusdPrice); 388 | 389 | // Get latest events relying on blockNumber from DB then save them to DB 390 | await getLatestEvents(); 391 | 392 | // get latest events from Db 393 | const events = await getEvents(); 394 | 395 | // extract only borrow events 396 | const borrowEvents = extractSpecificEvent(events, 'Borrow'); 397 | 398 | // extract unique users from that borrow events 399 | const users = getUniqueUsers(borrowEvents); 400 | 401 | // get info for each user 402 | const usersInformation = await getUsersInformation(users); 403 | 404 | // store ordered list of users in Db (for borrow events) 405 | for (let user of usersInformation) { 406 | await saveUserInfoInDb(user); 407 | } 408 | 409 | // clear old events in DB 410 | await clearTableInDb('events'); 411 | 412 | // Update users every X hr 413 | if ((now() - lastExistingRun) > 600 * SECOND || (await compareCusdPrices())) { 414 | await monitorExisting(); 415 | lastExistingRun = now(); 416 | } 417 | 418 | // Get users with UC status from DB 419 | const usersWithUC = await getUCUsers(); 420 | 421 | // Liquidate if private key given 422 | if (USER_PRIVATE_KEY) { 423 | // Liquidate each user in CELO/Cusd 424 | await liquidationProcess(usersWithUC, 'cusd'); 425 | await liquidationProcess(usersWithUC, 'celo'); 426 | const usersWithUCInformation = await getUsersInformation(usersWithUC); 427 | for (let user of usersWithUCInformation) { 428 | await saveUserInfoInDb(user); 429 | } 430 | } 431 | 432 | console.log('Wait 60s for the next check!'.yellow); 433 | 434 | // Get latest events after X seconds and call itself 435 | await Promise.delay(60 * SECOND); 436 | 437 | // Get new cusd price for comparimg with the old one 438 | const newCusdPrice = await getCusdPrice(); 439 | await cusdPriceQuery(2, newCusdPrice); 440 | 441 | // Call itself again 442 | await monitor(lastExistingRun); 443 | } 444 | 445 | // Update prev users from Db 446 | async function monitorExisting() { 447 | const allUsersFromDB = await getUsers(); 448 | 449 | const usersInformation = await getUsersInformation(allUsersFromDB); 450 | for (let user of usersInformation) { 451 | if (user.status === 'UC' || user.status === 'RISK') { 452 | console.log(`${user.user} ${user.healthFactor} ${user.status}`.red); 453 | } 454 | await saveUserInfoInDb(user); 455 | } 456 | console.log('Refreshed users data!'.cyan); 457 | } 458 | 459 | // Infinity monitoring 460 | async function execute() { 461 | const lending = await configureLending(ENV); 462 | const currency = await configureReserve(); 463 | 464 | lendingPool = lending.lendingPool; 465 | lendingPoolDataProvider = lending.lendingPoolDataProvider; 466 | lendingPoolCore = lending.lendingPoolCore; 467 | kit = lending.kit; 468 | web3 = lending.web3; 469 | cUSD = currency.cUSD; 470 | CELO = currency.CELO; 471 | reserveCelo = currency.reserveCelo; 472 | reserveCusd = currency.reserveCusd; 473 | 474 | if (USER_PRIVATE_KEY) { 475 | console.log( 476 | `Automated liquidation turned on from address ${USER_ADDRESS}`.cyan 477 | ); 478 | await logBalances(); 479 | // Add private key 480 | kit.addAccount(USER_PRIVATE_KEY); 481 | 482 | let allowance = await retry(() => cUSD.allowance( 483 | USER_ADDRESS, 484 | lendingPoolCore.options.address 485 | )); 486 | if (allowance.lt(BN(maxUint256).div(2))) { 487 | console.log( 488 | 'Approve'.green, 489 | ( 490 | await ( 491 | await cUSD 492 | .approve(lendingPoolCore.options.address, maxUint256) 493 | .send({ from: USER_ADDRESS, gas: 2000000 }) 494 | ).receiptFuture.promise 495 | ).transactionHash 496 | ); 497 | } 498 | 499 | // Configure method for exchanging pledge 500 | exchange = await retry(() => kit.contracts.getExchange()); 501 | 502 | allowance = await retry(() => cUSD.allowance( 503 | USER_ADDRESS, 504 | exchange.address 505 | )); 506 | if (allowance.lt(BN(maxUint256).div(2))) { 507 | console.log( 508 | 'Approve Cusd'.green, 509 | ( 510 | await ( 511 | await cUSD 512 | .approve(exchange.address, maxUint256) 513 | .send({ from: USER_ADDRESS, gas: 2000000 }) 514 | ).receiptFuture.promise 515 | ).transactionHash 516 | ); 517 | } 518 | 519 | allowance = await retry(() => CELO.allowance( 520 | USER_ADDRESS, 521 | exchange.address 522 | )); 523 | if (allowance.lt(BN(maxUint256).div(2))) { 524 | console.log( 525 | 'Approve CELO'.green, 526 | ( 527 | await ( 528 | await CELO.approve(exchange.address, maxUint256).send({ 529 | from: USER_ADDRESS, 530 | gas: 2000000, 531 | }) 532 | ).receiptFuture.promise 533 | ).transactionHash 534 | ); 535 | } 536 | } else { 537 | console.log(`Automated liquidation turned off`.red); 538 | } 539 | 540 | await monitor(0); 541 | 542 | if (USER_PRIVATE_KEY) { 543 | console.log( 544 | 'Revoke approve'.yellow, 545 | ( 546 | await ( 547 | await cUSD 548 | .approve(lendingPoolCore.options.address, 0) 549 | .send({ from: USER_ADDRESS, gas: 2000000 }) 550 | ).receiptFuture.promise 551 | ).transactionHash 552 | ); 553 | console.log( 554 | 'Revoke approve Cusd'.yellow, 555 | ( 556 | await ( 557 | await cUSD 558 | .approve(exchange.address, 0) 559 | .send({ from: USER_ADDRESS, gas: 2000000 }) 560 | ).receiptFuture.promise 561 | ).transactionHash 562 | ); 563 | console.log( 564 | 'Revoke approve CELO'.yellow, 565 | ( 566 | await ( 567 | await CELO.approve(exchange.address, 0).send({ 568 | from: USER_ADDRESS, 569 | gas: 2000000, 570 | }) 571 | ).receiptFuture.promise 572 | ).transactionHash 573 | ); 574 | } 575 | } 576 | 577 | execute(); 578 | -------------------------------------------------------------------------------- /abi/AToken.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "contract LendingPoolAddressesProvider", 6 | "name": "_addressesProvider", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "_underlyingAsset", 12 | "type": "address" 13 | }, 14 | { 15 | "internalType": "uint8", 16 | "name": "_underlyingAssetDecimals", 17 | "type": "uint8" 18 | }, 19 | { 20 | "internalType": "string", 21 | "name": "_name", 22 | "type": "string" 23 | }, 24 | { 25 | "internalType": "string", 26 | "name": "_symbol", 27 | "type": "string" 28 | } 29 | ], 30 | "payable": false, 31 | "stateMutability": "nonpayable", 32 | "type": "constructor" 33 | }, 34 | { 35 | "anonymous": false, 36 | "inputs": [ 37 | { 38 | "indexed": true, 39 | "internalType": "address", 40 | "name": "owner", 41 | "type": "address" 42 | }, 43 | { 44 | "indexed": true, 45 | "internalType": "address", 46 | "name": "spender", 47 | "type": "address" 48 | }, 49 | { 50 | "indexed": false, 51 | "internalType": "uint256", 52 | "name": "value", 53 | "type": "uint256" 54 | } 55 | ], 56 | "name": "Approval", 57 | "type": "event" 58 | }, 59 | { 60 | "anonymous": false, 61 | "inputs": [ 62 | { 63 | "indexed": true, 64 | "internalType": "address", 65 | "name": "_from", 66 | "type": "address" 67 | }, 68 | { 69 | "indexed": true, 70 | "internalType": "address", 71 | "name": "_to", 72 | "type": "address" 73 | }, 74 | { 75 | "indexed": false, 76 | "internalType": "uint256", 77 | "name": "_value", 78 | "type": "uint256" 79 | }, 80 | { 81 | "indexed": false, 82 | "internalType": "uint256", 83 | "name": "_fromBalanceIncrease", 84 | "type": "uint256" 85 | }, 86 | { 87 | "indexed": false, 88 | "internalType": "uint256", 89 | "name": "_toBalanceIncrease", 90 | "type": "uint256" 91 | }, 92 | { 93 | "indexed": false, 94 | "internalType": "uint256", 95 | "name": "_fromIndex", 96 | "type": "uint256" 97 | }, 98 | { 99 | "indexed": false, 100 | "internalType": "uint256", 101 | "name": "_toIndex", 102 | "type": "uint256" 103 | } 104 | ], 105 | "name": "BalanceTransfer", 106 | "type": "event" 107 | }, 108 | { 109 | "anonymous": false, 110 | "inputs": [ 111 | { 112 | "indexed": true, 113 | "internalType": "address", 114 | "name": "_from", 115 | "type": "address" 116 | }, 117 | { 118 | "indexed": false, 119 | "internalType": "uint256", 120 | "name": "_value", 121 | "type": "uint256" 122 | }, 123 | { 124 | "indexed": false, 125 | "internalType": "uint256", 126 | "name": "_fromBalanceIncrease", 127 | "type": "uint256" 128 | }, 129 | { 130 | "indexed": false, 131 | "internalType": "uint256", 132 | "name": "_fromIndex", 133 | "type": "uint256" 134 | } 135 | ], 136 | "name": "BurnOnLiquidation", 137 | "type": "event" 138 | }, 139 | { 140 | "anonymous": false, 141 | "inputs": [ 142 | { 143 | "indexed": true, 144 | "internalType": "address", 145 | "name": "_from", 146 | "type": "address" 147 | }, 148 | { 149 | "indexed": true, 150 | "internalType": "address", 151 | "name": "_to", 152 | "type": "address" 153 | } 154 | ], 155 | "name": "InterestRedirectionAllowanceChanged", 156 | "type": "event" 157 | }, 158 | { 159 | "anonymous": false, 160 | "inputs": [ 161 | { 162 | "indexed": true, 163 | "internalType": "address", 164 | "name": "_from", 165 | "type": "address" 166 | }, 167 | { 168 | "indexed": true, 169 | "internalType": "address", 170 | "name": "_to", 171 | "type": "address" 172 | }, 173 | { 174 | "indexed": false, 175 | "internalType": "uint256", 176 | "name": "_redirectedBalance", 177 | "type": "uint256" 178 | }, 179 | { 180 | "indexed": false, 181 | "internalType": "uint256", 182 | "name": "_fromBalanceIncrease", 183 | "type": "uint256" 184 | }, 185 | { 186 | "indexed": false, 187 | "internalType": "uint256", 188 | "name": "_fromIndex", 189 | "type": "uint256" 190 | } 191 | ], 192 | "name": "InterestStreamRedirected", 193 | "type": "event" 194 | }, 195 | { 196 | "anonymous": false, 197 | "inputs": [ 198 | { 199 | "indexed": true, 200 | "internalType": "address", 201 | "name": "_from", 202 | "type": "address" 203 | }, 204 | { 205 | "indexed": false, 206 | "internalType": "uint256", 207 | "name": "_value", 208 | "type": "uint256" 209 | }, 210 | { 211 | "indexed": false, 212 | "internalType": "uint256", 213 | "name": "_fromBalanceIncrease", 214 | "type": "uint256" 215 | }, 216 | { 217 | "indexed": false, 218 | "internalType": "uint256", 219 | "name": "_fromIndex", 220 | "type": "uint256" 221 | } 222 | ], 223 | "name": "MintOnDeposit", 224 | "type": "event" 225 | }, 226 | { 227 | "anonymous": false, 228 | "inputs": [ 229 | { 230 | "indexed": true, 231 | "internalType": "address", 232 | "name": "_from", 233 | "type": "address" 234 | }, 235 | { 236 | "indexed": false, 237 | "internalType": "uint256", 238 | "name": "_value", 239 | "type": "uint256" 240 | }, 241 | { 242 | "indexed": false, 243 | "internalType": "uint256", 244 | "name": "_fromBalanceIncrease", 245 | "type": "uint256" 246 | }, 247 | { 248 | "indexed": false, 249 | "internalType": "uint256", 250 | "name": "_fromIndex", 251 | "type": "uint256" 252 | } 253 | ], 254 | "name": "Redeem", 255 | "type": "event" 256 | }, 257 | { 258 | "anonymous": false, 259 | "inputs": [ 260 | { 261 | "indexed": true, 262 | "internalType": "address", 263 | "name": "_targetAddress", 264 | "type": "address" 265 | }, 266 | { 267 | "indexed": false, 268 | "internalType": "uint256", 269 | "name": "_targetBalanceIncrease", 270 | "type": "uint256" 271 | }, 272 | { 273 | "indexed": false, 274 | "internalType": "uint256", 275 | "name": "_targetIndex", 276 | "type": "uint256" 277 | }, 278 | { 279 | "indexed": false, 280 | "internalType": "uint256", 281 | "name": "_redirectedBalanceAdded", 282 | "type": "uint256" 283 | }, 284 | { 285 | "indexed": false, 286 | "internalType": "uint256", 287 | "name": "_redirectedBalanceRemoved", 288 | "type": "uint256" 289 | } 290 | ], 291 | "name": "RedirectedBalanceUpdated", 292 | "type": "event" 293 | }, 294 | { 295 | "anonymous": false, 296 | "inputs": [ 297 | { 298 | "indexed": true, 299 | "internalType": "address", 300 | "name": "from", 301 | "type": "address" 302 | }, 303 | { 304 | "indexed": true, 305 | "internalType": "address", 306 | "name": "to", 307 | "type": "address" 308 | }, 309 | { 310 | "indexed": false, 311 | "internalType": "uint256", 312 | "name": "value", 313 | "type": "uint256" 314 | } 315 | ], 316 | "name": "Transfer", 317 | "type": "event" 318 | }, 319 | { 320 | "constant": true, 321 | "inputs": [], 322 | "name": "UINT_MAX_VALUE", 323 | "outputs": [ 324 | { 325 | "internalType": "uint256", 326 | "name": "", 327 | "type": "uint256" 328 | } 329 | ], 330 | "payable": false, 331 | "stateMutability": "view", 332 | "type": "function" 333 | }, 334 | { 335 | "constant": true, 336 | "inputs": [ 337 | { 338 | "internalType": "address", 339 | "name": "owner", 340 | "type": "address" 341 | }, 342 | { 343 | "internalType": "address", 344 | "name": "spender", 345 | "type": "address" 346 | } 347 | ], 348 | "name": "allowance", 349 | "outputs": [ 350 | { 351 | "internalType": "uint256", 352 | "name": "", 353 | "type": "uint256" 354 | } 355 | ], 356 | "payable": false, 357 | "stateMutability": "view", 358 | "type": "function" 359 | }, 360 | { 361 | "constant": false, 362 | "inputs": [ 363 | { 364 | "internalType": "address", 365 | "name": "spender", 366 | "type": "address" 367 | }, 368 | { 369 | "internalType": "uint256", 370 | "name": "value", 371 | "type": "uint256" 372 | } 373 | ], 374 | "name": "approve", 375 | "outputs": [ 376 | { 377 | "internalType": "bool", 378 | "name": "", 379 | "type": "bool" 380 | } 381 | ], 382 | "payable": false, 383 | "stateMutability": "nonpayable", 384 | "type": "function" 385 | }, 386 | { 387 | "constant": true, 388 | "inputs": [], 389 | "name": "decimals", 390 | "outputs": [ 391 | { 392 | "internalType": "uint8", 393 | "name": "", 394 | "type": "uint8" 395 | } 396 | ], 397 | "payable": false, 398 | "stateMutability": "view", 399 | "type": "function" 400 | }, 401 | { 402 | "constant": false, 403 | "inputs": [ 404 | { 405 | "internalType": "address", 406 | "name": "spender", 407 | "type": "address" 408 | }, 409 | { 410 | "internalType": "uint256", 411 | "name": "subtractedValue", 412 | "type": "uint256" 413 | } 414 | ], 415 | "name": "decreaseAllowance", 416 | "outputs": [ 417 | { 418 | "internalType": "bool", 419 | "name": "", 420 | "type": "bool" 421 | } 422 | ], 423 | "payable": false, 424 | "stateMutability": "nonpayable", 425 | "type": "function" 426 | }, 427 | { 428 | "constant": false, 429 | "inputs": [ 430 | { 431 | "internalType": "address", 432 | "name": "spender", 433 | "type": "address" 434 | }, 435 | { 436 | "internalType": "uint256", 437 | "name": "addedValue", 438 | "type": "uint256" 439 | } 440 | ], 441 | "name": "increaseAllowance", 442 | "outputs": [ 443 | { 444 | "internalType": "bool", 445 | "name": "", 446 | "type": "bool" 447 | } 448 | ], 449 | "payable": false, 450 | "stateMutability": "nonpayable", 451 | "type": "function" 452 | }, 453 | { 454 | "constant": true, 455 | "inputs": [], 456 | "name": "name", 457 | "outputs": [ 458 | { 459 | "internalType": "string", 460 | "name": "", 461 | "type": "string" 462 | } 463 | ], 464 | "payable": false, 465 | "stateMutability": "view", 466 | "type": "function" 467 | }, 468 | { 469 | "constant": true, 470 | "inputs": [], 471 | "name": "symbol", 472 | "outputs": [ 473 | { 474 | "internalType": "string", 475 | "name": "", 476 | "type": "string" 477 | } 478 | ], 479 | "payable": false, 480 | "stateMutability": "view", 481 | "type": "function" 482 | }, 483 | { 484 | "constant": false, 485 | "inputs": [ 486 | { 487 | "internalType": "address", 488 | "name": "recipient", 489 | "type": "address" 490 | }, 491 | { 492 | "internalType": "uint256", 493 | "name": "amount", 494 | "type": "uint256" 495 | } 496 | ], 497 | "name": "transfer", 498 | "outputs": [ 499 | { 500 | "internalType": "bool", 501 | "name": "", 502 | "type": "bool" 503 | } 504 | ], 505 | "payable": false, 506 | "stateMutability": "nonpayable", 507 | "type": "function" 508 | }, 509 | { 510 | "constant": false, 511 | "inputs": [ 512 | { 513 | "internalType": "address", 514 | "name": "sender", 515 | "type": "address" 516 | }, 517 | { 518 | "internalType": "address", 519 | "name": "recipient", 520 | "type": "address" 521 | }, 522 | { 523 | "internalType": "uint256", 524 | "name": "amount", 525 | "type": "uint256" 526 | } 527 | ], 528 | "name": "transferFrom", 529 | "outputs": [ 530 | { 531 | "internalType": "bool", 532 | "name": "", 533 | "type": "bool" 534 | } 535 | ], 536 | "payable": false, 537 | "stateMutability": "nonpayable", 538 | "type": "function" 539 | }, 540 | { 541 | "constant": true, 542 | "inputs": [], 543 | "name": "underlyingAssetAddress", 544 | "outputs": [ 545 | { 546 | "internalType": "address", 547 | "name": "", 548 | "type": "address" 549 | } 550 | ], 551 | "payable": false, 552 | "stateMutability": "view", 553 | "type": "function" 554 | }, 555 | { 556 | "constant": false, 557 | "inputs": [ 558 | { 559 | "internalType": "address", 560 | "name": "_to", 561 | "type": "address" 562 | } 563 | ], 564 | "name": "redirectInterestStream", 565 | "outputs": [], 566 | "payable": false, 567 | "stateMutability": "nonpayable", 568 | "type": "function" 569 | }, 570 | { 571 | "constant": false, 572 | "inputs": [ 573 | { 574 | "internalType": "address", 575 | "name": "_from", 576 | "type": "address" 577 | }, 578 | { 579 | "internalType": "address", 580 | "name": "_to", 581 | "type": "address" 582 | } 583 | ], 584 | "name": "redirectInterestStreamOf", 585 | "outputs": [], 586 | "payable": false, 587 | "stateMutability": "nonpayable", 588 | "type": "function" 589 | }, 590 | { 591 | "constant": false, 592 | "inputs": [ 593 | { 594 | "internalType": "address", 595 | "name": "_to", 596 | "type": "address" 597 | } 598 | ], 599 | "name": "allowInterestRedirectionTo", 600 | "outputs": [], 601 | "payable": false, 602 | "stateMutability": "nonpayable", 603 | "type": "function" 604 | }, 605 | { 606 | "constant": false, 607 | "inputs": [ 608 | { 609 | "internalType": "uint256", 610 | "name": "_amount", 611 | "type": "uint256" 612 | } 613 | ], 614 | "name": "redeem", 615 | "outputs": [], 616 | "payable": false, 617 | "stateMutability": "nonpayable", 618 | "type": "function" 619 | }, 620 | { 621 | "constant": false, 622 | "inputs": [ 623 | { 624 | "internalType": "address", 625 | "name": "_account", 626 | "type": "address" 627 | }, 628 | { 629 | "internalType": "uint256", 630 | "name": "_amount", 631 | "type": "uint256" 632 | } 633 | ], 634 | "name": "mintOnDeposit", 635 | "outputs": [], 636 | "payable": false, 637 | "stateMutability": "nonpayable", 638 | "type": "function" 639 | }, 640 | { 641 | "constant": false, 642 | "inputs": [ 643 | { 644 | "internalType": "address", 645 | "name": "_account", 646 | "type": "address" 647 | }, 648 | { 649 | "internalType": "uint256", 650 | "name": "_value", 651 | "type": "uint256" 652 | } 653 | ], 654 | "name": "burnOnLiquidation", 655 | "outputs": [], 656 | "payable": false, 657 | "stateMutability": "nonpayable", 658 | "type": "function" 659 | }, 660 | { 661 | "constant": false, 662 | "inputs": [ 663 | { 664 | "internalType": "address", 665 | "name": "_from", 666 | "type": "address" 667 | }, 668 | { 669 | "internalType": "address", 670 | "name": "_to", 671 | "type": "address" 672 | }, 673 | { 674 | "internalType": "uint256", 675 | "name": "_value", 676 | "type": "uint256" 677 | } 678 | ], 679 | "name": "transferOnLiquidation", 680 | "outputs": [], 681 | "payable": false, 682 | "stateMutability": "nonpayable", 683 | "type": "function" 684 | }, 685 | { 686 | "constant": true, 687 | "inputs": [ 688 | { 689 | "internalType": "address", 690 | "name": "_user", 691 | "type": "address" 692 | } 693 | ], 694 | "name": "balanceOf", 695 | "outputs": [ 696 | { 697 | "internalType": "uint256", 698 | "name": "", 699 | "type": "uint256" 700 | } 701 | ], 702 | "payable": false, 703 | "stateMutability": "view", 704 | "type": "function" 705 | }, 706 | { 707 | "constant": true, 708 | "inputs": [ 709 | { 710 | "internalType": "address", 711 | "name": "_user", 712 | "type": "address" 713 | } 714 | ], 715 | "name": "principalBalanceOf", 716 | "outputs": [ 717 | { 718 | "internalType": "uint256", 719 | "name": "", 720 | "type": "uint256" 721 | } 722 | ], 723 | "payable": false, 724 | "stateMutability": "view", 725 | "type": "function" 726 | }, 727 | { 728 | "constant": true, 729 | "inputs": [], 730 | "name": "totalSupply", 731 | "outputs": [ 732 | { 733 | "internalType": "uint256", 734 | "name": "", 735 | "type": "uint256" 736 | } 737 | ], 738 | "payable": false, 739 | "stateMutability": "view", 740 | "type": "function" 741 | }, 742 | { 743 | "constant": true, 744 | "inputs": [ 745 | { 746 | "internalType": "address", 747 | "name": "_user", 748 | "type": "address" 749 | }, 750 | { 751 | "internalType": "uint256", 752 | "name": "_amount", 753 | "type": "uint256" 754 | } 755 | ], 756 | "name": "isTransferAllowed", 757 | "outputs": [ 758 | { 759 | "internalType": "bool", 760 | "name": "", 761 | "type": "bool" 762 | } 763 | ], 764 | "payable": false, 765 | "stateMutability": "view", 766 | "type": "function" 767 | }, 768 | { 769 | "constant": true, 770 | "inputs": [ 771 | { 772 | "internalType": "address", 773 | "name": "_user", 774 | "type": "address" 775 | } 776 | ], 777 | "name": "getUserIndex", 778 | "outputs": [ 779 | { 780 | "internalType": "uint256", 781 | "name": "", 782 | "type": "uint256" 783 | } 784 | ], 785 | "payable": false, 786 | "stateMutability": "view", 787 | "type": "function" 788 | }, 789 | { 790 | "constant": true, 791 | "inputs": [ 792 | { 793 | "internalType": "address", 794 | "name": "_user", 795 | "type": "address" 796 | } 797 | ], 798 | "name": "getInterestRedirectionAddress", 799 | "outputs": [ 800 | { 801 | "internalType": "address", 802 | "name": "", 803 | "type": "address" 804 | } 805 | ], 806 | "payable": false, 807 | "stateMutability": "view", 808 | "type": "function" 809 | }, 810 | { 811 | "constant": true, 812 | "inputs": [ 813 | { 814 | "internalType": "address", 815 | "name": "_user", 816 | "type": "address" 817 | } 818 | ], 819 | "name": "getRedirectedBalance", 820 | "outputs": [ 821 | { 822 | "internalType": "uint256", 823 | "name": "", 824 | "type": "uint256" 825 | } 826 | ], 827 | "payable": false, 828 | "stateMutability": "view", 829 | "type": "function" 830 | } 831 | ] -------------------------------------------------------------------------------- /abi/LendingPool.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "_reserve", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "_user", 15 | "type": "address" 16 | }, 17 | { 18 | "indexed": false, 19 | "internalType": "uint256", 20 | "name": "_amount", 21 | "type": "uint256" 22 | }, 23 | { 24 | "indexed": false, 25 | "internalType": "uint256", 26 | "name": "_borrowRateMode", 27 | "type": "uint256" 28 | }, 29 | { 30 | "indexed": false, 31 | "internalType": "uint256", 32 | "name": "_borrowRate", 33 | "type": "uint256" 34 | }, 35 | { 36 | "indexed": false, 37 | "internalType": "uint256", 38 | "name": "_originationFee", 39 | "type": "uint256" 40 | }, 41 | { 42 | "indexed": false, 43 | "internalType": "uint256", 44 | "name": "_borrowBalanceIncrease", 45 | "type": "uint256" 46 | }, 47 | { 48 | "indexed": true, 49 | "internalType": "uint16", 50 | "name": "_referral", 51 | "type": "uint16" 52 | }, 53 | { 54 | "indexed": false, 55 | "internalType": "uint256", 56 | "name": "_timestamp", 57 | "type": "uint256" 58 | } 59 | ], 60 | "name": "Borrow", 61 | "type": "event" 62 | }, 63 | { 64 | "anonymous": false, 65 | "inputs": [ 66 | { 67 | "indexed": true, 68 | "internalType": "address", 69 | "name": "_reserve", 70 | "type": "address" 71 | }, 72 | { 73 | "indexed": true, 74 | "internalType": "address", 75 | "name": "_user", 76 | "type": "address" 77 | }, 78 | { 79 | "indexed": false, 80 | "internalType": "uint256", 81 | "name": "_amount", 82 | "type": "uint256" 83 | }, 84 | { 85 | "indexed": true, 86 | "internalType": "uint16", 87 | "name": "_referral", 88 | "type": "uint16" 89 | }, 90 | { 91 | "indexed": false, 92 | "internalType": "uint256", 93 | "name": "_timestamp", 94 | "type": "uint256" 95 | } 96 | ], 97 | "name": "Deposit", 98 | "type": "event" 99 | }, 100 | { 101 | "anonymous": false, 102 | "inputs": [ 103 | { 104 | "indexed": true, 105 | "internalType": "address", 106 | "name": "_target", 107 | "type": "address" 108 | }, 109 | { 110 | "indexed": true, 111 | "internalType": "address", 112 | "name": "_reserve", 113 | "type": "address" 114 | }, 115 | { 116 | "indexed": false, 117 | "internalType": "uint256", 118 | "name": "_amount", 119 | "type": "uint256" 120 | }, 121 | { 122 | "indexed": false, 123 | "internalType": "uint256", 124 | "name": "_totalFee", 125 | "type": "uint256" 126 | }, 127 | { 128 | "indexed": false, 129 | "internalType": "uint256", 130 | "name": "_protocolFee", 131 | "type": "uint256" 132 | }, 133 | { 134 | "indexed": false, 135 | "internalType": "uint256", 136 | "name": "_timestamp", 137 | "type": "uint256" 138 | } 139 | ], 140 | "name": "FlashLoan", 141 | "type": "event" 142 | }, 143 | { 144 | "anonymous": false, 145 | "inputs": [ 146 | { 147 | "indexed": true, 148 | "internalType": "address", 149 | "name": "_collateral", 150 | "type": "address" 151 | }, 152 | { 153 | "indexed": true, 154 | "internalType": "address", 155 | "name": "_reserve", 156 | "type": "address" 157 | }, 158 | { 159 | "indexed": true, 160 | "internalType": "address", 161 | "name": "_user", 162 | "type": "address" 163 | }, 164 | { 165 | "indexed": false, 166 | "internalType": "uint256", 167 | "name": "_purchaseAmount", 168 | "type": "uint256" 169 | }, 170 | { 171 | "indexed": false, 172 | "internalType": "uint256", 173 | "name": "_liquidatedCollateralAmount", 174 | "type": "uint256" 175 | }, 176 | { 177 | "indexed": false, 178 | "internalType": "uint256", 179 | "name": "_accruedBorrowInterest", 180 | "type": "uint256" 181 | }, 182 | { 183 | "indexed": false, 184 | "internalType": "address", 185 | "name": "_liquidator", 186 | "type": "address" 187 | }, 188 | { 189 | "indexed": false, 190 | "internalType": "bool", 191 | "name": "_receiveAToken", 192 | "type": "bool" 193 | }, 194 | { 195 | "indexed": false, 196 | "internalType": "uint256", 197 | "name": "_timestamp", 198 | "type": "uint256" 199 | } 200 | ], 201 | "name": "LiquidationCall", 202 | "type": "event" 203 | }, 204 | { 205 | "anonymous": false, 206 | "inputs": [ 207 | { 208 | "indexed": true, 209 | "internalType": "address", 210 | "name": "_collateral", 211 | "type": "address" 212 | }, 213 | { 214 | "indexed": true, 215 | "internalType": "address", 216 | "name": "_reserve", 217 | "type": "address" 218 | }, 219 | { 220 | "indexed": true, 221 | "internalType": "address", 222 | "name": "_user", 223 | "type": "address" 224 | }, 225 | { 226 | "indexed": false, 227 | "internalType": "uint256", 228 | "name": "_feeLiquidated", 229 | "type": "uint256" 230 | }, 231 | { 232 | "indexed": false, 233 | "internalType": "uint256", 234 | "name": "_liquidatedCollateralForFee", 235 | "type": "uint256" 236 | }, 237 | { 238 | "indexed": false, 239 | "internalType": "uint256", 240 | "name": "_timestamp", 241 | "type": "uint256" 242 | } 243 | ], 244 | "name": "OriginationFeeLiquidated", 245 | "type": "event" 246 | }, 247 | { 248 | "anonymous": false, 249 | "inputs": [ 250 | { 251 | "indexed": true, 252 | "internalType": "address", 253 | "name": "_reserve", 254 | "type": "address" 255 | }, 256 | { 257 | "indexed": true, 258 | "internalType": "address", 259 | "name": "_user", 260 | "type": "address" 261 | }, 262 | { 263 | "indexed": false, 264 | "internalType": "uint256", 265 | "name": "_newStableRate", 266 | "type": "uint256" 267 | }, 268 | { 269 | "indexed": false, 270 | "internalType": "uint256", 271 | "name": "_borrowBalanceIncrease", 272 | "type": "uint256" 273 | }, 274 | { 275 | "indexed": false, 276 | "internalType": "uint256", 277 | "name": "_timestamp", 278 | "type": "uint256" 279 | } 280 | ], 281 | "name": "RebalanceStableBorrowRate", 282 | "type": "event" 283 | }, 284 | { 285 | "anonymous": false, 286 | "inputs": [ 287 | { 288 | "indexed": true, 289 | "internalType": "address", 290 | "name": "_reserve", 291 | "type": "address" 292 | }, 293 | { 294 | "indexed": true, 295 | "internalType": "address", 296 | "name": "_user", 297 | "type": "address" 298 | }, 299 | { 300 | "indexed": false, 301 | "internalType": "uint256", 302 | "name": "_amount", 303 | "type": "uint256" 304 | }, 305 | { 306 | "indexed": false, 307 | "internalType": "uint256", 308 | "name": "_timestamp", 309 | "type": "uint256" 310 | } 311 | ], 312 | "name": "RedeemUnderlying", 313 | "type": "event" 314 | }, 315 | { 316 | "anonymous": false, 317 | "inputs": [ 318 | { 319 | "indexed": true, 320 | "internalType": "address", 321 | "name": "_reserve", 322 | "type": "address" 323 | }, 324 | { 325 | "indexed": true, 326 | "internalType": "address", 327 | "name": "_user", 328 | "type": "address" 329 | }, 330 | { 331 | "indexed": true, 332 | "internalType": "address", 333 | "name": "_repayer", 334 | "type": "address" 335 | }, 336 | { 337 | "indexed": false, 338 | "internalType": "uint256", 339 | "name": "_amountMinusFees", 340 | "type": "uint256" 341 | }, 342 | { 343 | "indexed": false, 344 | "internalType": "uint256", 345 | "name": "_fees", 346 | "type": "uint256" 347 | }, 348 | { 349 | "indexed": false, 350 | "internalType": "uint256", 351 | "name": "_borrowBalanceIncrease", 352 | "type": "uint256" 353 | }, 354 | { 355 | "indexed": false, 356 | "internalType": "uint256", 357 | "name": "_timestamp", 358 | "type": "uint256" 359 | } 360 | ], 361 | "name": "Repay", 362 | "type": "event" 363 | }, 364 | { 365 | "anonymous": false, 366 | "inputs": [ 367 | { 368 | "indexed": true, 369 | "internalType": "address", 370 | "name": "_reserve", 371 | "type": "address" 372 | }, 373 | { 374 | "indexed": true, 375 | "internalType": "address", 376 | "name": "_user", 377 | "type": "address" 378 | } 379 | ], 380 | "name": "ReserveUsedAsCollateralDisabled", 381 | "type": "event" 382 | }, 383 | { 384 | "anonymous": false, 385 | "inputs": [ 386 | { 387 | "indexed": true, 388 | "internalType": "address", 389 | "name": "_reserve", 390 | "type": "address" 391 | }, 392 | { 393 | "indexed": true, 394 | "internalType": "address", 395 | "name": "_user", 396 | "type": "address" 397 | } 398 | ], 399 | "name": "ReserveUsedAsCollateralEnabled", 400 | "type": "event" 401 | }, 402 | { 403 | "anonymous": false, 404 | "inputs": [ 405 | { 406 | "indexed": true, 407 | "internalType": "address", 408 | "name": "_reserve", 409 | "type": "address" 410 | }, 411 | { 412 | "indexed": true, 413 | "internalType": "address", 414 | "name": "_user", 415 | "type": "address" 416 | }, 417 | { 418 | "indexed": false, 419 | "internalType": "uint256", 420 | "name": "_newRateMode", 421 | "type": "uint256" 422 | }, 423 | { 424 | "indexed": false, 425 | "internalType": "uint256", 426 | "name": "_newRate", 427 | "type": "uint256" 428 | }, 429 | { 430 | "indexed": false, 431 | "internalType": "uint256", 432 | "name": "_borrowBalanceIncrease", 433 | "type": "uint256" 434 | }, 435 | { 436 | "indexed": false, 437 | "internalType": "uint256", 438 | "name": "_timestamp", 439 | "type": "uint256" 440 | } 441 | ], 442 | "name": "Swap", 443 | "type": "event" 444 | }, 445 | { 446 | "constant": true, 447 | "inputs": [], 448 | "name": "LENDINGPOOL_REVISION", 449 | "outputs": [ 450 | { 451 | "internalType": "uint256", 452 | "name": "", 453 | "type": "uint256" 454 | } 455 | ], 456 | "payable": false, 457 | "stateMutability": "view", 458 | "type": "function" 459 | }, 460 | { 461 | "constant": true, 462 | "inputs": [], 463 | "name": "UINT_MAX_VALUE", 464 | "outputs": [ 465 | { 466 | "internalType": "uint256", 467 | "name": "", 468 | "type": "uint256" 469 | } 470 | ], 471 | "payable": false, 472 | "stateMutability": "view", 473 | "type": "function" 474 | }, 475 | { 476 | "constant": true, 477 | "inputs": [], 478 | "name": "addressesProvider", 479 | "outputs": [ 480 | { 481 | "internalType": "contract LendingPoolAddressesProvider", 482 | "name": "", 483 | "type": "address" 484 | } 485 | ], 486 | "payable": false, 487 | "stateMutability": "view", 488 | "type": "function" 489 | }, 490 | { 491 | "constant": true, 492 | "inputs": [], 493 | "name": "core", 494 | "outputs": [ 495 | { 496 | "internalType": "contract LendingPoolCore", 497 | "name": "", 498 | "type": "address" 499 | } 500 | ], 501 | "payable": false, 502 | "stateMutability": "view", 503 | "type": "function" 504 | }, 505 | { 506 | "constant": true, 507 | "inputs": [], 508 | "name": "dataProvider", 509 | "outputs": [ 510 | { 511 | "internalType": "contract LendingPoolDataProvider", 512 | "name": "", 513 | "type": "address" 514 | } 515 | ], 516 | "payable": false, 517 | "stateMutability": "view", 518 | "type": "function" 519 | }, 520 | { 521 | "constant": true, 522 | "inputs": [], 523 | "name": "parametersProvider", 524 | "outputs": [ 525 | { 526 | "internalType": "contract LendingPoolParametersProvider", 527 | "name": "", 528 | "type": "address" 529 | } 530 | ], 531 | "payable": false, 532 | "stateMutability": "view", 533 | "type": "function" 534 | }, 535 | { 536 | "constant": false, 537 | "inputs": [ 538 | { 539 | "internalType": "contract LendingPoolAddressesProvider", 540 | "name": "_addressesProvider", 541 | "type": "address" 542 | } 543 | ], 544 | "name": "initialize", 545 | "outputs": [], 546 | "payable": false, 547 | "stateMutability": "nonpayable", 548 | "type": "function" 549 | }, 550 | { 551 | "constant": false, 552 | "inputs": [ 553 | { 554 | "internalType": "address", 555 | "name": "_reserve", 556 | "type": "address" 557 | }, 558 | { 559 | "internalType": "uint256", 560 | "name": "_amount", 561 | "type": "uint256" 562 | }, 563 | { 564 | "internalType": "uint16", 565 | "name": "_referralCode", 566 | "type": "uint16" 567 | } 568 | ], 569 | "name": "deposit", 570 | "outputs": [], 571 | "payable": true, 572 | "stateMutability": "payable", 573 | "type": "function" 574 | }, 575 | { 576 | "constant": false, 577 | "inputs": [ 578 | { 579 | "internalType": "address", 580 | "name": "_reserve", 581 | "type": "address" 582 | }, 583 | { 584 | "internalType": "address payable", 585 | "name": "_user", 586 | "type": "address" 587 | }, 588 | { 589 | "internalType": "uint256", 590 | "name": "_amount", 591 | "type": "uint256" 592 | }, 593 | { 594 | "internalType": "uint256", 595 | "name": "_aTokenBalanceAfterRedeem", 596 | "type": "uint256" 597 | } 598 | ], 599 | "name": "redeemUnderlying", 600 | "outputs": [], 601 | "payable": false, 602 | "stateMutability": "nonpayable", 603 | "type": "function" 604 | }, 605 | { 606 | "constant": false, 607 | "inputs": [ 608 | { 609 | "internalType": "address", 610 | "name": "_reserve", 611 | "type": "address" 612 | }, 613 | { 614 | "internalType": "uint256", 615 | "name": "_amount", 616 | "type": "uint256" 617 | }, 618 | { 619 | "internalType": "uint256", 620 | "name": "_interestRateMode", 621 | "type": "uint256" 622 | }, 623 | { 624 | "internalType": "uint16", 625 | "name": "_referralCode", 626 | "type": "uint16" 627 | } 628 | ], 629 | "name": "borrow", 630 | "outputs": [], 631 | "payable": false, 632 | "stateMutability": "nonpayable", 633 | "type": "function" 634 | }, 635 | { 636 | "constant": false, 637 | "inputs": [ 638 | { 639 | "internalType": "address", 640 | "name": "_reserve", 641 | "type": "address" 642 | }, 643 | { 644 | "internalType": "uint256", 645 | "name": "_amount", 646 | "type": "uint256" 647 | }, 648 | { 649 | "internalType": "address payable", 650 | "name": "_onBehalfOf", 651 | "type": "address" 652 | } 653 | ], 654 | "name": "repay", 655 | "outputs": [], 656 | "payable": true, 657 | "stateMutability": "payable", 658 | "type": "function" 659 | }, 660 | { 661 | "constant": false, 662 | "inputs": [ 663 | { 664 | "internalType": "address", 665 | "name": "_reserve", 666 | "type": "address" 667 | } 668 | ], 669 | "name": "swapBorrowRateMode", 670 | "outputs": [], 671 | "payable": false, 672 | "stateMutability": "nonpayable", 673 | "type": "function" 674 | }, 675 | { 676 | "constant": false, 677 | "inputs": [ 678 | { 679 | "internalType": "address", 680 | "name": "_reserve", 681 | "type": "address" 682 | }, 683 | { 684 | "internalType": "address", 685 | "name": "_user", 686 | "type": "address" 687 | } 688 | ], 689 | "name": "rebalanceStableBorrowRate", 690 | "outputs": [], 691 | "payable": false, 692 | "stateMutability": "nonpayable", 693 | "type": "function" 694 | }, 695 | { 696 | "constant": false, 697 | "inputs": [ 698 | { 699 | "internalType": "address", 700 | "name": "_reserve", 701 | "type": "address" 702 | }, 703 | { 704 | "internalType": "bool", 705 | "name": "_useAsCollateral", 706 | "type": "bool" 707 | } 708 | ], 709 | "name": "setUserUseReserveAsCollateral", 710 | "outputs": [], 711 | "payable": false, 712 | "stateMutability": "nonpayable", 713 | "type": "function" 714 | }, 715 | { 716 | "constant": false, 717 | "inputs": [ 718 | { 719 | "internalType": "address", 720 | "name": "_collateral", 721 | "type": "address" 722 | }, 723 | { 724 | "internalType": "address", 725 | "name": "_reserve", 726 | "type": "address" 727 | }, 728 | { 729 | "internalType": "address", 730 | "name": "_user", 731 | "type": "address" 732 | }, 733 | { 734 | "internalType": "uint256", 735 | "name": "_purchaseAmount", 736 | "type": "uint256" 737 | }, 738 | { 739 | "internalType": "bool", 740 | "name": "_receiveAToken", 741 | "type": "bool" 742 | } 743 | ], 744 | "name": "liquidationCall", 745 | "outputs": [], 746 | "payable": true, 747 | "stateMutability": "payable", 748 | "type": "function" 749 | }, 750 | { 751 | "constant": false, 752 | "inputs": [ 753 | { 754 | "internalType": "address", 755 | "name": "_receiver", 756 | "type": "address" 757 | }, 758 | { 759 | "internalType": "address", 760 | "name": "_reserve", 761 | "type": "address" 762 | }, 763 | { 764 | "internalType": "uint256", 765 | "name": "_amount", 766 | "type": "uint256" 767 | }, 768 | { 769 | "internalType": "bytes", 770 | "name": "_params", 771 | "type": "bytes" 772 | } 773 | ], 774 | "name": "flashLoan", 775 | "outputs": [], 776 | "payable": false, 777 | "stateMutability": "nonpayable", 778 | "type": "function" 779 | }, 780 | { 781 | "constant": true, 782 | "inputs": [ 783 | { 784 | "internalType": "address", 785 | "name": "_reserve", 786 | "type": "address" 787 | } 788 | ], 789 | "name": "getReserveConfigurationData", 790 | "outputs": [ 791 | { 792 | "internalType": "uint256", 793 | "name": "ltv", 794 | "type": "uint256" 795 | }, 796 | { 797 | "internalType": "uint256", 798 | "name": "liquidationThreshold", 799 | "type": "uint256" 800 | }, 801 | { 802 | "internalType": "uint256", 803 | "name": "liquidationBonus", 804 | "type": "uint256" 805 | }, 806 | { 807 | "internalType": "address", 808 | "name": "interestRateStrategyAddress", 809 | "type": "address" 810 | }, 811 | { 812 | "internalType": "bool", 813 | "name": "usageAsCollateralEnabled", 814 | "type": "bool" 815 | }, 816 | { 817 | "internalType": "bool", 818 | "name": "borrowingEnabled", 819 | "type": "bool" 820 | }, 821 | { 822 | "internalType": "bool", 823 | "name": "stableBorrowRateEnabled", 824 | "type": "bool" 825 | }, 826 | { 827 | "internalType": "bool", 828 | "name": "isActive", 829 | "type": "bool" 830 | } 831 | ], 832 | "payable": false, 833 | "stateMutability": "view", 834 | "type": "function" 835 | }, 836 | { 837 | "constant": true, 838 | "inputs": [ 839 | { 840 | "internalType": "address", 841 | "name": "_reserve", 842 | "type": "address" 843 | } 844 | ], 845 | "name": "getReserveData", 846 | "outputs": [ 847 | { 848 | "internalType": "uint256", 849 | "name": "totalLiquidity", 850 | "type": "uint256" 851 | }, 852 | { 853 | "internalType": "uint256", 854 | "name": "availableLiquidity", 855 | "type": "uint256" 856 | }, 857 | { 858 | "internalType": "uint256", 859 | "name": "totalBorrowsStable", 860 | "type": "uint256" 861 | }, 862 | { 863 | "internalType": "uint256", 864 | "name": "totalBorrowsVariable", 865 | "type": "uint256" 866 | }, 867 | { 868 | "internalType": "uint256", 869 | "name": "liquidityRate", 870 | "type": "uint256" 871 | }, 872 | { 873 | "internalType": "uint256", 874 | "name": "variableBorrowRate", 875 | "type": "uint256" 876 | }, 877 | { 878 | "internalType": "uint256", 879 | "name": "stableBorrowRate", 880 | "type": "uint256" 881 | }, 882 | { 883 | "internalType": "uint256", 884 | "name": "averageStableBorrowRate", 885 | "type": "uint256" 886 | }, 887 | { 888 | "internalType": "uint256", 889 | "name": "utilizationRate", 890 | "type": "uint256" 891 | }, 892 | { 893 | "internalType": "uint256", 894 | "name": "liquidityIndex", 895 | "type": "uint256" 896 | }, 897 | { 898 | "internalType": "uint256", 899 | "name": "variableBorrowIndex", 900 | "type": "uint256" 901 | }, 902 | { 903 | "internalType": "address", 904 | "name": "aTokenAddress", 905 | "type": "address" 906 | }, 907 | { 908 | "internalType": "uint40", 909 | "name": "lastUpdateTimestamp", 910 | "type": "uint40" 911 | } 912 | ], 913 | "payable": false, 914 | "stateMutability": "view", 915 | "type": "function" 916 | }, 917 | { 918 | "constant": true, 919 | "inputs": [ 920 | { 921 | "internalType": "address", 922 | "name": "_user", 923 | "type": "address" 924 | } 925 | ], 926 | "name": "getUserAccountData", 927 | "outputs": [ 928 | { 929 | "internalType": "uint256", 930 | "name": "totalLiquidityETH", 931 | "type": "uint256" 932 | }, 933 | { 934 | "internalType": "uint256", 935 | "name": "totalCollateralETH", 936 | "type": "uint256" 937 | }, 938 | { 939 | "internalType": "uint256", 940 | "name": "totalBorrowsETH", 941 | "type": "uint256" 942 | }, 943 | { 944 | "internalType": "uint256", 945 | "name": "totalFeesETH", 946 | "type": "uint256" 947 | }, 948 | { 949 | "internalType": "uint256", 950 | "name": "availableBorrowsETH", 951 | "type": "uint256" 952 | }, 953 | { 954 | "internalType": "uint256", 955 | "name": "currentLiquidationThreshold", 956 | "type": "uint256" 957 | }, 958 | { 959 | "internalType": "uint256", 960 | "name": "ltv", 961 | "type": "uint256" 962 | }, 963 | { 964 | "internalType": "uint256", 965 | "name": "healthFactor", 966 | "type": "uint256" 967 | } 968 | ], 969 | "payable": false, 970 | "stateMutability": "view", 971 | "type": "function" 972 | }, 973 | { 974 | "constant": true, 975 | "inputs": [ 976 | { 977 | "internalType": "address", 978 | "name": "_reserve", 979 | "type": "address" 980 | }, 981 | { 982 | "internalType": "address", 983 | "name": "_user", 984 | "type": "address" 985 | } 986 | ], 987 | "name": "getUserReserveData", 988 | "outputs": [ 989 | { 990 | "internalType": "uint256", 991 | "name": "currentATokenBalance", 992 | "type": "uint256" 993 | }, 994 | { 995 | "internalType": "uint256", 996 | "name": "currentBorrowBalance", 997 | "type": "uint256" 998 | }, 999 | { 1000 | "internalType": "uint256", 1001 | "name": "principalBorrowBalance", 1002 | "type": "uint256" 1003 | }, 1004 | { 1005 | "internalType": "uint256", 1006 | "name": "borrowRateMode", 1007 | "type": "uint256" 1008 | }, 1009 | { 1010 | "internalType": "uint256", 1011 | "name": "borrowRate", 1012 | "type": "uint256" 1013 | }, 1014 | { 1015 | "internalType": "uint256", 1016 | "name": "liquidityRate", 1017 | "type": "uint256" 1018 | }, 1019 | { 1020 | "internalType": "uint256", 1021 | "name": "originationFee", 1022 | "type": "uint256" 1023 | }, 1024 | { 1025 | "internalType": "uint256", 1026 | "name": "variableBorrowIndex", 1027 | "type": "uint256" 1028 | }, 1029 | { 1030 | "internalType": "uint256", 1031 | "name": "lastUpdateTimestamp", 1032 | "type": "uint256" 1033 | }, 1034 | { 1035 | "internalType": "bool", 1036 | "name": "usageAsCollateralEnabled", 1037 | "type": "bool" 1038 | } 1039 | ], 1040 | "payable": false, 1041 | "stateMutability": "view", 1042 | "type": "function" 1043 | }, 1044 | { 1045 | "constant": true, 1046 | "inputs": [], 1047 | "name": "getReserves", 1048 | "outputs": [ 1049 | { 1050 | "internalType": "address[]", 1051 | "name": "", 1052 | "type": "address[]" 1053 | } 1054 | ], 1055 | "payable": false, 1056 | "stateMutability": "view", 1057 | "type": "function" 1058 | } 1059 | ] -------------------------------------------------------------------------------- /abi/LendingPoolCore.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "reserve", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": false, 13 | "internalType": "uint256", 14 | "name": "liquidityRate", 15 | "type": "uint256" 16 | }, 17 | { 18 | "indexed": false, 19 | "internalType": "uint256", 20 | "name": "stableBorrowRate", 21 | "type": "uint256" 22 | }, 23 | { 24 | "indexed": false, 25 | "internalType": "uint256", 26 | "name": "variableBorrowRate", 27 | "type": "uint256" 28 | }, 29 | { 30 | "indexed": false, 31 | "internalType": "uint256", 32 | "name": "liquidityIndex", 33 | "type": "uint256" 34 | }, 35 | { 36 | "indexed": false, 37 | "internalType": "uint256", 38 | "name": "variableBorrowIndex", 39 | "type": "uint256" 40 | } 41 | ], 42 | "name": "ReserveUpdated", 43 | "type": "event" 44 | }, 45 | { 46 | "payable": true, 47 | "stateMutability": "payable", 48 | "type": "fallback" 49 | }, 50 | { 51 | "constant": true, 52 | "inputs": [], 53 | "name": "CORE_REVISION", 54 | "outputs": [ 55 | { 56 | "internalType": "uint256", 57 | "name": "", 58 | "type": "uint256" 59 | } 60 | ], 61 | "payable": false, 62 | "stateMutability": "view", 63 | "type": "function" 64 | }, 65 | { 66 | "constant": true, 67 | "inputs": [], 68 | "name": "addressesProvider", 69 | "outputs": [ 70 | { 71 | "internalType": "contract LendingPoolAddressesProvider", 72 | "name": "", 73 | "type": "address" 74 | } 75 | ], 76 | "payable": false, 77 | "stateMutability": "view", 78 | "type": "function" 79 | }, 80 | { 81 | "constant": true, 82 | "inputs": [], 83 | "name": "lendingPoolAddress", 84 | "outputs": [ 85 | { 86 | "internalType": "address", 87 | "name": "", 88 | "type": "address" 89 | } 90 | ], 91 | "payable": false, 92 | "stateMutability": "view", 93 | "type": "function" 94 | }, 95 | { 96 | "constant": true, 97 | "inputs": [ 98 | { 99 | "internalType": "uint256", 100 | "name": "", 101 | "type": "uint256" 102 | } 103 | ], 104 | "name": "reservesList", 105 | "outputs": [ 106 | { 107 | "internalType": "address", 108 | "name": "", 109 | "type": "address" 110 | } 111 | ], 112 | "payable": false, 113 | "stateMutability": "view", 114 | "type": "function" 115 | }, 116 | { 117 | "constant": false, 118 | "inputs": [ 119 | { 120 | "internalType": "contract LendingPoolAddressesProvider", 121 | "name": "_addressesProvider", 122 | "type": "address" 123 | } 124 | ], 125 | "name": "initialize", 126 | "outputs": [], 127 | "payable": false, 128 | "stateMutability": "nonpayable", 129 | "type": "function" 130 | }, 131 | { 132 | "constant": false, 133 | "inputs": [ 134 | { 135 | "internalType": "address", 136 | "name": "_reserve", 137 | "type": "address" 138 | }, 139 | { 140 | "internalType": "address", 141 | "name": "_user", 142 | "type": "address" 143 | }, 144 | { 145 | "internalType": "uint256", 146 | "name": "_amount", 147 | "type": "uint256" 148 | }, 149 | { 150 | "internalType": "bool", 151 | "name": "_isFirstDeposit", 152 | "type": "bool" 153 | } 154 | ], 155 | "name": "updateStateOnDeposit", 156 | "outputs": [], 157 | "payable": false, 158 | "stateMutability": "nonpayable", 159 | "type": "function" 160 | }, 161 | { 162 | "constant": false, 163 | "inputs": [ 164 | { 165 | "internalType": "address", 166 | "name": "_reserve", 167 | "type": "address" 168 | }, 169 | { 170 | "internalType": "address", 171 | "name": "_user", 172 | "type": "address" 173 | }, 174 | { 175 | "internalType": "uint256", 176 | "name": "_amountRedeemed", 177 | "type": "uint256" 178 | }, 179 | { 180 | "internalType": "bool", 181 | "name": "_userRedeemedEverything", 182 | "type": "bool" 183 | } 184 | ], 185 | "name": "updateStateOnRedeem", 186 | "outputs": [], 187 | "payable": false, 188 | "stateMutability": "nonpayable", 189 | "type": "function" 190 | }, 191 | { 192 | "constant": false, 193 | "inputs": [ 194 | { 195 | "internalType": "address", 196 | "name": "_reserve", 197 | "type": "address" 198 | }, 199 | { 200 | "internalType": "uint256", 201 | "name": "_availableLiquidityBefore", 202 | "type": "uint256" 203 | }, 204 | { 205 | "internalType": "uint256", 206 | "name": "_income", 207 | "type": "uint256" 208 | }, 209 | { 210 | "internalType": "uint256", 211 | "name": "_protocolFee", 212 | "type": "uint256" 213 | } 214 | ], 215 | "name": "updateStateOnFlashLoan", 216 | "outputs": [], 217 | "payable": false, 218 | "stateMutability": "nonpayable", 219 | "type": "function" 220 | }, 221 | { 222 | "constant": false, 223 | "inputs": [ 224 | { 225 | "internalType": "address", 226 | "name": "_reserve", 227 | "type": "address" 228 | }, 229 | { 230 | "internalType": "address", 231 | "name": "_user", 232 | "type": "address" 233 | }, 234 | { 235 | "internalType": "uint256", 236 | "name": "_amountBorrowed", 237 | "type": "uint256" 238 | }, 239 | { 240 | "internalType": "uint256", 241 | "name": "_borrowFee", 242 | "type": "uint256" 243 | }, 244 | { 245 | "internalType": "enum CoreLibrary.InterestRateMode", 246 | "name": "_rateMode", 247 | "type": "uint8" 248 | } 249 | ], 250 | "name": "updateStateOnBorrow", 251 | "outputs": [ 252 | { 253 | "internalType": "uint256", 254 | "name": "", 255 | "type": "uint256" 256 | }, 257 | { 258 | "internalType": "uint256", 259 | "name": "", 260 | "type": "uint256" 261 | } 262 | ], 263 | "payable": false, 264 | "stateMutability": "nonpayable", 265 | "type": "function" 266 | }, 267 | { 268 | "constant": false, 269 | "inputs": [ 270 | { 271 | "internalType": "address", 272 | "name": "_reserve", 273 | "type": "address" 274 | }, 275 | { 276 | "internalType": "address", 277 | "name": "_user", 278 | "type": "address" 279 | }, 280 | { 281 | "internalType": "uint256", 282 | "name": "_paybackAmountMinusFees", 283 | "type": "uint256" 284 | }, 285 | { 286 | "internalType": "uint256", 287 | "name": "_originationFeeRepaid", 288 | "type": "uint256" 289 | }, 290 | { 291 | "internalType": "uint256", 292 | "name": "_balanceIncrease", 293 | "type": "uint256" 294 | }, 295 | { 296 | "internalType": "bool", 297 | "name": "_repaidWholeLoan", 298 | "type": "bool" 299 | } 300 | ], 301 | "name": "updateStateOnRepay", 302 | "outputs": [], 303 | "payable": false, 304 | "stateMutability": "nonpayable", 305 | "type": "function" 306 | }, 307 | { 308 | "constant": false, 309 | "inputs": [ 310 | { 311 | "internalType": "address", 312 | "name": "_reserve", 313 | "type": "address" 314 | }, 315 | { 316 | "internalType": "address", 317 | "name": "_user", 318 | "type": "address" 319 | }, 320 | { 321 | "internalType": "uint256", 322 | "name": "_principalBorrowBalance", 323 | "type": "uint256" 324 | }, 325 | { 326 | "internalType": "uint256", 327 | "name": "_compoundedBorrowBalance", 328 | "type": "uint256" 329 | }, 330 | { 331 | "internalType": "uint256", 332 | "name": "_balanceIncrease", 333 | "type": "uint256" 334 | }, 335 | { 336 | "internalType": "enum CoreLibrary.InterestRateMode", 337 | "name": "_currentRateMode", 338 | "type": "uint8" 339 | } 340 | ], 341 | "name": "updateStateOnSwapRate", 342 | "outputs": [ 343 | { 344 | "internalType": "enum CoreLibrary.InterestRateMode", 345 | "name": "", 346 | "type": "uint8" 347 | }, 348 | { 349 | "internalType": "uint256", 350 | "name": "", 351 | "type": "uint256" 352 | } 353 | ], 354 | "payable": false, 355 | "stateMutability": "nonpayable", 356 | "type": "function" 357 | }, 358 | { 359 | "constant": false, 360 | "inputs": [ 361 | { 362 | "internalType": "address", 363 | "name": "_principalReserve", 364 | "type": "address" 365 | }, 366 | { 367 | "internalType": "address", 368 | "name": "_collateralReserve", 369 | "type": "address" 370 | }, 371 | { 372 | "internalType": "address", 373 | "name": "_user", 374 | "type": "address" 375 | }, 376 | { 377 | "internalType": "uint256", 378 | "name": "_amountToLiquidate", 379 | "type": "uint256" 380 | }, 381 | { 382 | "internalType": "uint256", 383 | "name": "_collateralToLiquidate", 384 | "type": "uint256" 385 | }, 386 | { 387 | "internalType": "uint256", 388 | "name": "_feeLiquidated", 389 | "type": "uint256" 390 | }, 391 | { 392 | "internalType": "uint256", 393 | "name": "_liquidatedCollateralForFee", 394 | "type": "uint256" 395 | }, 396 | { 397 | "internalType": "uint256", 398 | "name": "_balanceIncrease", 399 | "type": "uint256" 400 | }, 401 | { 402 | "internalType": "bool", 403 | "name": "_liquidatorReceivesAToken", 404 | "type": "bool" 405 | } 406 | ], 407 | "name": "updateStateOnLiquidation", 408 | "outputs": [], 409 | "payable": false, 410 | "stateMutability": "nonpayable", 411 | "type": "function" 412 | }, 413 | { 414 | "constant": false, 415 | "inputs": [ 416 | { 417 | "internalType": "address", 418 | "name": "_reserve", 419 | "type": "address" 420 | }, 421 | { 422 | "internalType": "address", 423 | "name": "_user", 424 | "type": "address" 425 | }, 426 | { 427 | "internalType": "uint256", 428 | "name": "_balanceIncrease", 429 | "type": "uint256" 430 | } 431 | ], 432 | "name": "updateStateOnRebalance", 433 | "outputs": [ 434 | { 435 | "internalType": "uint256", 436 | "name": "", 437 | "type": "uint256" 438 | } 439 | ], 440 | "payable": false, 441 | "stateMutability": "nonpayable", 442 | "type": "function" 443 | }, 444 | { 445 | "constant": false, 446 | "inputs": [ 447 | { 448 | "internalType": "address", 449 | "name": "_reserve", 450 | "type": "address" 451 | }, 452 | { 453 | "internalType": "address", 454 | "name": "_user", 455 | "type": "address" 456 | }, 457 | { 458 | "internalType": "bool", 459 | "name": "_useAsCollateral", 460 | "type": "bool" 461 | } 462 | ], 463 | "name": "setUserUseReserveAsCollateral", 464 | "outputs": [], 465 | "payable": false, 466 | "stateMutability": "nonpayable", 467 | "type": "function" 468 | }, 469 | { 470 | "constant": false, 471 | "inputs": [ 472 | { 473 | "internalType": "address", 474 | "name": "_reserve", 475 | "type": "address" 476 | }, 477 | { 478 | "internalType": "address payable", 479 | "name": "_user", 480 | "type": "address" 481 | }, 482 | { 483 | "internalType": "uint256", 484 | "name": "_amount", 485 | "type": "uint256" 486 | } 487 | ], 488 | "name": "transferToUser", 489 | "outputs": [], 490 | "payable": false, 491 | "stateMutability": "nonpayable", 492 | "type": "function" 493 | }, 494 | { 495 | "constant": false, 496 | "inputs": [ 497 | { 498 | "internalType": "address", 499 | "name": "_token", 500 | "type": "address" 501 | }, 502 | { 503 | "internalType": "address", 504 | "name": "_user", 505 | "type": "address" 506 | }, 507 | { 508 | "internalType": "uint256", 509 | "name": "_amount", 510 | "type": "uint256" 511 | }, 512 | { 513 | "internalType": "address", 514 | "name": "_destination", 515 | "type": "address" 516 | } 517 | ], 518 | "name": "transferToFeeCollectionAddress", 519 | "outputs": [], 520 | "payable": true, 521 | "stateMutability": "payable", 522 | "type": "function" 523 | }, 524 | { 525 | "constant": false, 526 | "inputs": [ 527 | { 528 | "internalType": "address", 529 | "name": "_token", 530 | "type": "address" 531 | }, 532 | { 533 | "internalType": "uint256", 534 | "name": "_amount", 535 | "type": "uint256" 536 | }, 537 | { 538 | "internalType": "address", 539 | "name": "_destination", 540 | "type": "address" 541 | } 542 | ], 543 | "name": "liquidateFee", 544 | "outputs": [], 545 | "payable": true, 546 | "stateMutability": "payable", 547 | "type": "function" 548 | }, 549 | { 550 | "constant": false, 551 | "inputs": [ 552 | { 553 | "internalType": "address", 554 | "name": "_reserve", 555 | "type": "address" 556 | }, 557 | { 558 | "internalType": "address payable", 559 | "name": "_user", 560 | "type": "address" 561 | }, 562 | { 563 | "internalType": "uint256", 564 | "name": "_amount", 565 | "type": "uint256" 566 | } 567 | ], 568 | "name": "transferToReserve", 569 | "outputs": [], 570 | "payable": true, 571 | "stateMutability": "payable", 572 | "type": "function" 573 | }, 574 | { 575 | "constant": true, 576 | "inputs": [ 577 | { 578 | "internalType": "address", 579 | "name": "_reserve", 580 | "type": "address" 581 | }, 582 | { 583 | "internalType": "address", 584 | "name": "_user", 585 | "type": "address" 586 | } 587 | ], 588 | "name": "getUserBasicReserveData", 589 | "outputs": [ 590 | { 591 | "internalType": "uint256", 592 | "name": "", 593 | "type": "uint256" 594 | }, 595 | { 596 | "internalType": "uint256", 597 | "name": "", 598 | "type": "uint256" 599 | }, 600 | { 601 | "internalType": "uint256", 602 | "name": "", 603 | "type": "uint256" 604 | }, 605 | { 606 | "internalType": "bool", 607 | "name": "", 608 | "type": "bool" 609 | } 610 | ], 611 | "payable": false, 612 | "stateMutability": "view", 613 | "type": "function" 614 | }, 615 | { 616 | "constant": true, 617 | "inputs": [ 618 | { 619 | "internalType": "address", 620 | "name": "_reserve", 621 | "type": "address" 622 | }, 623 | { 624 | "internalType": "address", 625 | "name": "_user", 626 | "type": "address" 627 | }, 628 | { 629 | "internalType": "uint256", 630 | "name": "_amount", 631 | "type": "uint256" 632 | } 633 | ], 634 | "name": "isUserAllowedToBorrowAtStable", 635 | "outputs": [ 636 | { 637 | "internalType": "bool", 638 | "name": "", 639 | "type": "bool" 640 | } 641 | ], 642 | "payable": false, 643 | "stateMutability": "view", 644 | "type": "function" 645 | }, 646 | { 647 | "constant": true, 648 | "inputs": [ 649 | { 650 | "internalType": "address", 651 | "name": "_reserve", 652 | "type": "address" 653 | }, 654 | { 655 | "internalType": "address", 656 | "name": "_user", 657 | "type": "address" 658 | } 659 | ], 660 | "name": "getUserUnderlyingAssetBalance", 661 | "outputs": [ 662 | { 663 | "internalType": "uint256", 664 | "name": "", 665 | "type": "uint256" 666 | } 667 | ], 668 | "payable": false, 669 | "stateMutability": "view", 670 | "type": "function" 671 | }, 672 | { 673 | "constant": true, 674 | "inputs": [ 675 | { 676 | "internalType": "address", 677 | "name": "_reserve", 678 | "type": "address" 679 | } 680 | ], 681 | "name": "getReserveInterestRateStrategyAddress", 682 | "outputs": [ 683 | { 684 | "internalType": "address", 685 | "name": "", 686 | "type": "address" 687 | } 688 | ], 689 | "payable": false, 690 | "stateMutability": "view", 691 | "type": "function" 692 | }, 693 | { 694 | "constant": true, 695 | "inputs": [ 696 | { 697 | "internalType": "address", 698 | "name": "_reserve", 699 | "type": "address" 700 | } 701 | ], 702 | "name": "getReserveATokenAddress", 703 | "outputs": [ 704 | { 705 | "internalType": "address", 706 | "name": "", 707 | "type": "address" 708 | } 709 | ], 710 | "payable": false, 711 | "stateMutability": "view", 712 | "type": "function" 713 | }, 714 | { 715 | "constant": true, 716 | "inputs": [ 717 | { 718 | "internalType": "address", 719 | "name": "_reserve", 720 | "type": "address" 721 | } 722 | ], 723 | "name": "getReserveAvailableLiquidity", 724 | "outputs": [ 725 | { 726 | "internalType": "uint256", 727 | "name": "", 728 | "type": "uint256" 729 | } 730 | ], 731 | "payable": false, 732 | "stateMutability": "view", 733 | "type": "function" 734 | }, 735 | { 736 | "constant": true, 737 | "inputs": [ 738 | { 739 | "internalType": "address", 740 | "name": "_reserve", 741 | "type": "address" 742 | } 743 | ], 744 | "name": "getReserveTotalLiquidity", 745 | "outputs": [ 746 | { 747 | "internalType": "uint256", 748 | "name": "", 749 | "type": "uint256" 750 | } 751 | ], 752 | "payable": false, 753 | "stateMutability": "view", 754 | "type": "function" 755 | }, 756 | { 757 | "constant": true, 758 | "inputs": [ 759 | { 760 | "internalType": "address", 761 | "name": "_reserve", 762 | "type": "address" 763 | } 764 | ], 765 | "name": "getReserveNormalizedIncome", 766 | "outputs": [ 767 | { 768 | "internalType": "uint256", 769 | "name": "", 770 | "type": "uint256" 771 | } 772 | ], 773 | "payable": false, 774 | "stateMutability": "view", 775 | "type": "function" 776 | }, 777 | { 778 | "constant": true, 779 | "inputs": [ 780 | { 781 | "internalType": "address", 782 | "name": "_reserve", 783 | "type": "address" 784 | } 785 | ], 786 | "name": "getReserveTotalBorrows", 787 | "outputs": [ 788 | { 789 | "internalType": "uint256", 790 | "name": "", 791 | "type": "uint256" 792 | } 793 | ], 794 | "payable": false, 795 | "stateMutability": "view", 796 | "type": "function" 797 | }, 798 | { 799 | "constant": true, 800 | "inputs": [ 801 | { 802 | "internalType": "address", 803 | "name": "_reserve", 804 | "type": "address" 805 | } 806 | ], 807 | "name": "getReserveTotalBorrowsStable", 808 | "outputs": [ 809 | { 810 | "internalType": "uint256", 811 | "name": "", 812 | "type": "uint256" 813 | } 814 | ], 815 | "payable": false, 816 | "stateMutability": "view", 817 | "type": "function" 818 | }, 819 | { 820 | "constant": true, 821 | "inputs": [ 822 | { 823 | "internalType": "address", 824 | "name": "_reserve", 825 | "type": "address" 826 | } 827 | ], 828 | "name": "getReserveTotalBorrowsVariable", 829 | "outputs": [ 830 | { 831 | "internalType": "uint256", 832 | "name": "", 833 | "type": "uint256" 834 | } 835 | ], 836 | "payable": false, 837 | "stateMutability": "view", 838 | "type": "function" 839 | }, 840 | { 841 | "constant": true, 842 | "inputs": [ 843 | { 844 | "internalType": "address", 845 | "name": "_reserve", 846 | "type": "address" 847 | } 848 | ], 849 | "name": "getReserveLiquidationThreshold", 850 | "outputs": [ 851 | { 852 | "internalType": "uint256", 853 | "name": "", 854 | "type": "uint256" 855 | } 856 | ], 857 | "payable": false, 858 | "stateMutability": "view", 859 | "type": "function" 860 | }, 861 | { 862 | "constant": true, 863 | "inputs": [ 864 | { 865 | "internalType": "address", 866 | "name": "_reserve", 867 | "type": "address" 868 | } 869 | ], 870 | "name": "getReserveLiquidationBonus", 871 | "outputs": [ 872 | { 873 | "internalType": "uint256", 874 | "name": "", 875 | "type": "uint256" 876 | } 877 | ], 878 | "payable": false, 879 | "stateMutability": "view", 880 | "type": "function" 881 | }, 882 | { 883 | "constant": true, 884 | "inputs": [ 885 | { 886 | "internalType": "address", 887 | "name": "_reserve", 888 | "type": "address" 889 | } 890 | ], 891 | "name": "getReserveCurrentVariableBorrowRate", 892 | "outputs": [ 893 | { 894 | "internalType": "uint256", 895 | "name": "", 896 | "type": "uint256" 897 | } 898 | ], 899 | "payable": false, 900 | "stateMutability": "view", 901 | "type": "function" 902 | }, 903 | { 904 | "constant": true, 905 | "inputs": [ 906 | { 907 | "internalType": "address", 908 | "name": "_reserve", 909 | "type": "address" 910 | } 911 | ], 912 | "name": "getReserveCurrentStableBorrowRate", 913 | "outputs": [ 914 | { 915 | "internalType": "uint256", 916 | "name": "", 917 | "type": "uint256" 918 | } 919 | ], 920 | "payable": false, 921 | "stateMutability": "view", 922 | "type": "function" 923 | }, 924 | { 925 | "constant": true, 926 | "inputs": [ 927 | { 928 | "internalType": "address", 929 | "name": "_reserve", 930 | "type": "address" 931 | } 932 | ], 933 | "name": "getReserveCurrentAverageStableBorrowRate", 934 | "outputs": [ 935 | { 936 | "internalType": "uint256", 937 | "name": "", 938 | "type": "uint256" 939 | } 940 | ], 941 | "payable": false, 942 | "stateMutability": "view", 943 | "type": "function" 944 | }, 945 | { 946 | "constant": true, 947 | "inputs": [ 948 | { 949 | "internalType": "address", 950 | "name": "_reserve", 951 | "type": "address" 952 | } 953 | ], 954 | "name": "getReserveCurrentLiquidityRate", 955 | "outputs": [ 956 | { 957 | "internalType": "uint256", 958 | "name": "", 959 | "type": "uint256" 960 | } 961 | ], 962 | "payable": false, 963 | "stateMutability": "view", 964 | "type": "function" 965 | }, 966 | { 967 | "constant": true, 968 | "inputs": [ 969 | { 970 | "internalType": "address", 971 | "name": "_reserve", 972 | "type": "address" 973 | } 974 | ], 975 | "name": "getReserveLiquidityCumulativeIndex", 976 | "outputs": [ 977 | { 978 | "internalType": "uint256", 979 | "name": "", 980 | "type": "uint256" 981 | } 982 | ], 983 | "payable": false, 984 | "stateMutability": "view", 985 | "type": "function" 986 | }, 987 | { 988 | "constant": true, 989 | "inputs": [ 990 | { 991 | "internalType": "address", 992 | "name": "_reserve", 993 | "type": "address" 994 | } 995 | ], 996 | "name": "getReserveVariableBorrowsCumulativeIndex", 997 | "outputs": [ 998 | { 999 | "internalType": "uint256", 1000 | "name": "", 1001 | "type": "uint256" 1002 | } 1003 | ], 1004 | "payable": false, 1005 | "stateMutability": "view", 1006 | "type": "function" 1007 | }, 1008 | { 1009 | "constant": true, 1010 | "inputs": [ 1011 | { 1012 | "internalType": "address", 1013 | "name": "_reserve", 1014 | "type": "address" 1015 | } 1016 | ], 1017 | "name": "getReserveConfiguration", 1018 | "outputs": [ 1019 | { 1020 | "internalType": "uint256", 1021 | "name": "", 1022 | "type": "uint256" 1023 | }, 1024 | { 1025 | "internalType": "uint256", 1026 | "name": "", 1027 | "type": "uint256" 1028 | }, 1029 | { 1030 | "internalType": "uint256", 1031 | "name": "", 1032 | "type": "uint256" 1033 | }, 1034 | { 1035 | "internalType": "bool", 1036 | "name": "", 1037 | "type": "bool" 1038 | } 1039 | ], 1040 | "payable": false, 1041 | "stateMutability": "view", 1042 | "type": "function" 1043 | }, 1044 | { 1045 | "constant": true, 1046 | "inputs": [ 1047 | { 1048 | "internalType": "address", 1049 | "name": "_reserve", 1050 | "type": "address" 1051 | } 1052 | ], 1053 | "name": "getReserveDecimals", 1054 | "outputs": [ 1055 | { 1056 | "internalType": "uint256", 1057 | "name": "", 1058 | "type": "uint256" 1059 | } 1060 | ], 1061 | "payable": false, 1062 | "stateMutability": "view", 1063 | "type": "function" 1064 | }, 1065 | { 1066 | "constant": true, 1067 | "inputs": [ 1068 | { 1069 | "internalType": "address", 1070 | "name": "_reserve", 1071 | "type": "address" 1072 | } 1073 | ], 1074 | "name": "isReserveBorrowingEnabled", 1075 | "outputs": [ 1076 | { 1077 | "internalType": "bool", 1078 | "name": "", 1079 | "type": "bool" 1080 | } 1081 | ], 1082 | "payable": false, 1083 | "stateMutability": "view", 1084 | "type": "function" 1085 | }, 1086 | { 1087 | "constant": true, 1088 | "inputs": [ 1089 | { 1090 | "internalType": "address", 1091 | "name": "_reserve", 1092 | "type": "address" 1093 | } 1094 | ], 1095 | "name": "isReserveUsageAsCollateralEnabled", 1096 | "outputs": [ 1097 | { 1098 | "internalType": "bool", 1099 | "name": "", 1100 | "type": "bool" 1101 | } 1102 | ], 1103 | "payable": false, 1104 | "stateMutability": "view", 1105 | "type": "function" 1106 | }, 1107 | { 1108 | "constant": true, 1109 | "inputs": [ 1110 | { 1111 | "internalType": "address", 1112 | "name": "_reserve", 1113 | "type": "address" 1114 | } 1115 | ], 1116 | "name": "getReserveIsStableBorrowRateEnabled", 1117 | "outputs": [ 1118 | { 1119 | "internalType": "bool", 1120 | "name": "", 1121 | "type": "bool" 1122 | } 1123 | ], 1124 | "payable": false, 1125 | "stateMutability": "view", 1126 | "type": "function" 1127 | }, 1128 | { 1129 | "constant": true, 1130 | "inputs": [ 1131 | { 1132 | "internalType": "address", 1133 | "name": "_reserve", 1134 | "type": "address" 1135 | } 1136 | ], 1137 | "name": "getReserveIsActive", 1138 | "outputs": [ 1139 | { 1140 | "internalType": "bool", 1141 | "name": "", 1142 | "type": "bool" 1143 | } 1144 | ], 1145 | "payable": false, 1146 | "stateMutability": "view", 1147 | "type": "function" 1148 | }, 1149 | { 1150 | "constant": true, 1151 | "inputs": [ 1152 | { 1153 | "internalType": "address", 1154 | "name": "_reserve", 1155 | "type": "address" 1156 | } 1157 | ], 1158 | "name": "getReserveIsFreezed", 1159 | "outputs": [ 1160 | { 1161 | "internalType": "bool", 1162 | "name": "", 1163 | "type": "bool" 1164 | } 1165 | ], 1166 | "payable": false, 1167 | "stateMutability": "view", 1168 | "type": "function" 1169 | }, 1170 | { 1171 | "constant": true, 1172 | "inputs": [ 1173 | { 1174 | "internalType": "address", 1175 | "name": "_reserve", 1176 | "type": "address" 1177 | } 1178 | ], 1179 | "name": "getReserveLastUpdate", 1180 | "outputs": [ 1181 | { 1182 | "internalType": "uint40", 1183 | "name": "timestamp", 1184 | "type": "uint40" 1185 | } 1186 | ], 1187 | "payable": false, 1188 | "stateMutability": "view", 1189 | "type": "function" 1190 | }, 1191 | { 1192 | "constant": true, 1193 | "inputs": [ 1194 | { 1195 | "internalType": "address", 1196 | "name": "_reserve", 1197 | "type": "address" 1198 | } 1199 | ], 1200 | "name": "getReserveUtilizationRate", 1201 | "outputs": [ 1202 | { 1203 | "internalType": "uint256", 1204 | "name": "", 1205 | "type": "uint256" 1206 | } 1207 | ], 1208 | "payable": false, 1209 | "stateMutability": "view", 1210 | "type": "function" 1211 | }, 1212 | { 1213 | "constant": true, 1214 | "inputs": [], 1215 | "name": "getReserves", 1216 | "outputs": [ 1217 | { 1218 | "internalType": "address[]", 1219 | "name": "", 1220 | "type": "address[]" 1221 | } 1222 | ], 1223 | "payable": false, 1224 | "stateMutability": "view", 1225 | "type": "function" 1226 | }, 1227 | { 1228 | "constant": true, 1229 | "inputs": [ 1230 | { 1231 | "internalType": "address", 1232 | "name": "_reserve", 1233 | "type": "address" 1234 | }, 1235 | { 1236 | "internalType": "address", 1237 | "name": "_user", 1238 | "type": "address" 1239 | } 1240 | ], 1241 | "name": "isUserUseReserveAsCollateralEnabled", 1242 | "outputs": [ 1243 | { 1244 | "internalType": "bool", 1245 | "name": "", 1246 | "type": "bool" 1247 | } 1248 | ], 1249 | "payable": false, 1250 | "stateMutability": "view", 1251 | "type": "function" 1252 | }, 1253 | { 1254 | "constant": true, 1255 | "inputs": [ 1256 | { 1257 | "internalType": "address", 1258 | "name": "_reserve", 1259 | "type": "address" 1260 | }, 1261 | { 1262 | "internalType": "address", 1263 | "name": "_user", 1264 | "type": "address" 1265 | } 1266 | ], 1267 | "name": "getUserOriginationFee", 1268 | "outputs": [ 1269 | { 1270 | "internalType": "uint256", 1271 | "name": "", 1272 | "type": "uint256" 1273 | } 1274 | ], 1275 | "payable": false, 1276 | "stateMutability": "view", 1277 | "type": "function" 1278 | }, 1279 | { 1280 | "constant": true, 1281 | "inputs": [ 1282 | { 1283 | "internalType": "address", 1284 | "name": "_reserve", 1285 | "type": "address" 1286 | }, 1287 | { 1288 | "internalType": "address", 1289 | "name": "_user", 1290 | "type": "address" 1291 | } 1292 | ], 1293 | "name": "getUserCurrentBorrowRateMode", 1294 | "outputs": [ 1295 | { 1296 | "internalType": "enum CoreLibrary.InterestRateMode", 1297 | "name": "", 1298 | "type": "uint8" 1299 | } 1300 | ], 1301 | "payable": false, 1302 | "stateMutability": "view", 1303 | "type": "function" 1304 | }, 1305 | { 1306 | "constant": true, 1307 | "inputs": [ 1308 | { 1309 | "internalType": "address", 1310 | "name": "_reserve", 1311 | "type": "address" 1312 | }, 1313 | { 1314 | "internalType": "address", 1315 | "name": "_user", 1316 | "type": "address" 1317 | } 1318 | ], 1319 | "name": "getUserCurrentStableBorrowRate", 1320 | "outputs": [ 1321 | { 1322 | "internalType": "uint256", 1323 | "name": "", 1324 | "type": "uint256" 1325 | } 1326 | ], 1327 | "payable": false, 1328 | "stateMutability": "view", 1329 | "type": "function" 1330 | }, 1331 | { 1332 | "constant": true, 1333 | "inputs": [ 1334 | { 1335 | "internalType": "address", 1336 | "name": "_reserve", 1337 | "type": "address" 1338 | }, 1339 | { 1340 | "internalType": "address", 1341 | "name": "_user", 1342 | "type": "address" 1343 | } 1344 | ], 1345 | "name": "getUserBorrowBalances", 1346 | "outputs": [ 1347 | { 1348 | "internalType": "uint256", 1349 | "name": "", 1350 | "type": "uint256" 1351 | }, 1352 | { 1353 | "internalType": "uint256", 1354 | "name": "", 1355 | "type": "uint256" 1356 | }, 1357 | { 1358 | "internalType": "uint256", 1359 | "name": "", 1360 | "type": "uint256" 1361 | } 1362 | ], 1363 | "payable": false, 1364 | "stateMutability": "view", 1365 | "type": "function" 1366 | }, 1367 | { 1368 | "constant": true, 1369 | "inputs": [ 1370 | { 1371 | "internalType": "address", 1372 | "name": "_reserve", 1373 | "type": "address" 1374 | }, 1375 | { 1376 | "internalType": "address", 1377 | "name": "_user", 1378 | "type": "address" 1379 | } 1380 | ], 1381 | "name": "getUserVariableBorrowCumulativeIndex", 1382 | "outputs": [ 1383 | { 1384 | "internalType": "uint256", 1385 | "name": "", 1386 | "type": "uint256" 1387 | } 1388 | ], 1389 | "payable": false, 1390 | "stateMutability": "view", 1391 | "type": "function" 1392 | }, 1393 | { 1394 | "constant": true, 1395 | "inputs": [ 1396 | { 1397 | "internalType": "address", 1398 | "name": "_reserve", 1399 | "type": "address" 1400 | }, 1401 | { 1402 | "internalType": "address", 1403 | "name": "_user", 1404 | "type": "address" 1405 | } 1406 | ], 1407 | "name": "getUserLastUpdate", 1408 | "outputs": [ 1409 | { 1410 | "internalType": "uint256", 1411 | "name": "timestamp", 1412 | "type": "uint256" 1413 | } 1414 | ], 1415 | "payable": false, 1416 | "stateMutability": "view", 1417 | "type": "function" 1418 | }, 1419 | { 1420 | "constant": false, 1421 | "inputs": [], 1422 | "name": "refreshConfiguration", 1423 | "outputs": [], 1424 | "payable": false, 1425 | "stateMutability": "nonpayable", 1426 | "type": "function" 1427 | }, 1428 | { 1429 | "constant": false, 1430 | "inputs": [ 1431 | { 1432 | "internalType": "address", 1433 | "name": "_reserve", 1434 | "type": "address" 1435 | }, 1436 | { 1437 | "internalType": "address", 1438 | "name": "_aTokenAddress", 1439 | "type": "address" 1440 | }, 1441 | { 1442 | "internalType": "uint256", 1443 | "name": "_decimals", 1444 | "type": "uint256" 1445 | }, 1446 | { 1447 | "internalType": "address", 1448 | "name": "_interestRateStrategyAddress", 1449 | "type": "address" 1450 | } 1451 | ], 1452 | "name": "initReserve", 1453 | "outputs": [], 1454 | "payable": false, 1455 | "stateMutability": "nonpayable", 1456 | "type": "function" 1457 | }, 1458 | { 1459 | "constant": false, 1460 | "inputs": [ 1461 | { 1462 | "internalType": "address", 1463 | "name": "_reserve", 1464 | "type": "address" 1465 | }, 1466 | { 1467 | "internalType": "address", 1468 | "name": "_rateStrategyAddress", 1469 | "type": "address" 1470 | } 1471 | ], 1472 | "name": "setReserveInterestRateStrategyAddress", 1473 | "outputs": [], 1474 | "payable": false, 1475 | "stateMutability": "nonpayable", 1476 | "type": "function" 1477 | }, 1478 | { 1479 | "constant": false, 1480 | "inputs": [ 1481 | { 1482 | "internalType": "address", 1483 | "name": "_reserve", 1484 | "type": "address" 1485 | }, 1486 | { 1487 | "internalType": "bool", 1488 | "name": "_stableBorrowRateEnabled", 1489 | "type": "bool" 1490 | } 1491 | ], 1492 | "name": "enableBorrowingOnReserve", 1493 | "outputs": [], 1494 | "payable": false, 1495 | "stateMutability": "nonpayable", 1496 | "type": "function" 1497 | }, 1498 | { 1499 | "constant": false, 1500 | "inputs": [ 1501 | { 1502 | "internalType": "address", 1503 | "name": "_reserve", 1504 | "type": "address" 1505 | } 1506 | ], 1507 | "name": "disableBorrowingOnReserve", 1508 | "outputs": [], 1509 | "payable": false, 1510 | "stateMutability": "nonpayable", 1511 | "type": "function" 1512 | }, 1513 | { 1514 | "constant": false, 1515 | "inputs": [ 1516 | { 1517 | "internalType": "address", 1518 | "name": "_reserve", 1519 | "type": "address" 1520 | }, 1521 | { 1522 | "internalType": "uint256", 1523 | "name": "_baseLTVasCollateral", 1524 | "type": "uint256" 1525 | }, 1526 | { 1527 | "internalType": "uint256", 1528 | "name": "_liquidationThreshold", 1529 | "type": "uint256" 1530 | }, 1531 | { 1532 | "internalType": "uint256", 1533 | "name": "_liquidationBonus", 1534 | "type": "uint256" 1535 | } 1536 | ], 1537 | "name": "enableReserveAsCollateral", 1538 | "outputs": [], 1539 | "payable": false, 1540 | "stateMutability": "nonpayable", 1541 | "type": "function" 1542 | }, 1543 | { 1544 | "constant": false, 1545 | "inputs": [ 1546 | { 1547 | "internalType": "address", 1548 | "name": "_reserve", 1549 | "type": "address" 1550 | } 1551 | ], 1552 | "name": "disableReserveAsCollateral", 1553 | "outputs": [], 1554 | "payable": false, 1555 | "stateMutability": "nonpayable", 1556 | "type": "function" 1557 | }, 1558 | { 1559 | "constant": false, 1560 | "inputs": [ 1561 | { 1562 | "internalType": "address", 1563 | "name": "_reserve", 1564 | "type": "address" 1565 | } 1566 | ], 1567 | "name": "enableReserveStableBorrowRate", 1568 | "outputs": [], 1569 | "payable": false, 1570 | "stateMutability": "nonpayable", 1571 | "type": "function" 1572 | }, 1573 | { 1574 | "constant": false, 1575 | "inputs": [ 1576 | { 1577 | "internalType": "address", 1578 | "name": "_reserve", 1579 | "type": "address" 1580 | } 1581 | ], 1582 | "name": "disableReserveStableBorrowRate", 1583 | "outputs": [], 1584 | "payable": false, 1585 | "stateMutability": "nonpayable", 1586 | "type": "function" 1587 | }, 1588 | { 1589 | "constant": false, 1590 | "inputs": [ 1591 | { 1592 | "internalType": "address", 1593 | "name": "_reserve", 1594 | "type": "address" 1595 | } 1596 | ], 1597 | "name": "activateReserve", 1598 | "outputs": [], 1599 | "payable": false, 1600 | "stateMutability": "nonpayable", 1601 | "type": "function" 1602 | }, 1603 | { 1604 | "constant": false, 1605 | "inputs": [ 1606 | { 1607 | "internalType": "address", 1608 | "name": "_reserve", 1609 | "type": "address" 1610 | } 1611 | ], 1612 | "name": "deactivateReserve", 1613 | "outputs": [], 1614 | "payable": false, 1615 | "stateMutability": "nonpayable", 1616 | "type": "function" 1617 | }, 1618 | { 1619 | "constant": false, 1620 | "inputs": [ 1621 | { 1622 | "internalType": "address", 1623 | "name": "_reserve", 1624 | "type": "address" 1625 | } 1626 | ], 1627 | "name": "freezeReserve", 1628 | "outputs": [], 1629 | "payable": false, 1630 | "stateMutability": "nonpayable", 1631 | "type": "function" 1632 | }, 1633 | { 1634 | "constant": false, 1635 | "inputs": [ 1636 | { 1637 | "internalType": "address", 1638 | "name": "_reserve", 1639 | "type": "address" 1640 | } 1641 | ], 1642 | "name": "unfreezeReserve", 1643 | "outputs": [], 1644 | "payable": false, 1645 | "stateMutability": "nonpayable", 1646 | "type": "function" 1647 | }, 1648 | { 1649 | "constant": false, 1650 | "inputs": [ 1651 | { 1652 | "internalType": "address", 1653 | "name": "_reserve", 1654 | "type": "address" 1655 | }, 1656 | { 1657 | "internalType": "uint256", 1658 | "name": "_ltv", 1659 | "type": "uint256" 1660 | } 1661 | ], 1662 | "name": "setReserveBaseLTVasCollateral", 1663 | "outputs": [], 1664 | "payable": false, 1665 | "stateMutability": "nonpayable", 1666 | "type": "function" 1667 | }, 1668 | { 1669 | "constant": false, 1670 | "inputs": [ 1671 | { 1672 | "internalType": "address", 1673 | "name": "_reserve", 1674 | "type": "address" 1675 | }, 1676 | { 1677 | "internalType": "uint256", 1678 | "name": "_threshold", 1679 | "type": "uint256" 1680 | } 1681 | ], 1682 | "name": "setReserveLiquidationThreshold", 1683 | "outputs": [], 1684 | "payable": false, 1685 | "stateMutability": "nonpayable", 1686 | "type": "function" 1687 | }, 1688 | { 1689 | "constant": false, 1690 | "inputs": [ 1691 | { 1692 | "internalType": "address", 1693 | "name": "_reserve", 1694 | "type": "address" 1695 | }, 1696 | { 1697 | "internalType": "uint256", 1698 | "name": "_bonus", 1699 | "type": "uint256" 1700 | } 1701 | ], 1702 | "name": "setReserveLiquidationBonus", 1703 | "outputs": [], 1704 | "payable": false, 1705 | "stateMutability": "nonpayable", 1706 | "type": "function" 1707 | }, 1708 | { 1709 | "constant": false, 1710 | "inputs": [ 1711 | { 1712 | "internalType": "address", 1713 | "name": "_reserve", 1714 | "type": "address" 1715 | }, 1716 | { 1717 | "internalType": "uint256", 1718 | "name": "_decimals", 1719 | "type": "uint256" 1720 | } 1721 | ], 1722 | "name": "setReserveDecimals", 1723 | "outputs": [], 1724 | "payable": false, 1725 | "stateMutability": "nonpayable", 1726 | "type": "function" 1727 | } 1728 | ] --------------------------------------------------------------------------------