Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*
this bot assumes you've already enabled borrowing on compound.finance,
that you already approved transfers on behalf of DAI and USDC
(can do here https://chiragkhatri.me/compound-liquidator), and that you have
DAI and USDC on your Ether address, while having nothing lent or borrowed yet.
Author: Jarett Dunn jare@coindexlabs.com
*/
let request = require('request-promise')
const CoinbasePro = require('coinbase-pro');
const publicClient = new CoinbasePro.PublicClient();
const Web3 = require('web3')
const httpProvider = "http://localhost:8545"
var web3 = new Web3(new Web3.providers.HttpProvider(httpProvider));
//coinbase credscom
const key = '';
const secret = '';
const passphrase = '';
const privateKey = "";
const address = "";
const web3Pass = ""
var state = 'none'
let SdkManager = require('@radarrelay/sdk').SdkManager
let EventName = require('@radarrelay/sdk').EventName
let WebsocketRequestTopic = require('@radarrelay/types').WebsocketRequestTopic
let UserOrderType = require('@radarrelay/types').UserOrderType
try {
web3.eth.personal.unlockAccount(address, web3Pass, 505000);
} catch (err) {
console.log(err)
}
async function setupRadar() {
const rr = SdkManager.Setup({
radarRestEndpoint: 'https://api.kovan.radarrelay.com/v2',
radarWebsocketEndpoint: 'wss://ws.kovan.radarrelay.com/v2',
rpcUrl: 'http://localhost:8545',
});
// --------------------------------
// Listen to loading progress
rr.events.on(EventName.Loading, data => {
process.stdout.write('....');
if (data.progress === 100) {
process.stdout.write('🚀');
}
});
// Initialize the SDK
await SdkManager.InitializeAsync(rr);
const usdcDaiMarket = await rr.markets.getAsync('USDC-DAI');
let curEthBal = await rr.account.getEthBalanceAsync();
let curUsdcBal = await rr.account.getTokenBalanceAsync(usdcDaiMarket.baseTokenAddress);
console.log(curEthBal)
console.log(curUsdcBal)
const receipt = await rr.account.setUnlimitedTokenAllowanceAsync(usdcDaiMarket.quoteTokenAddress, {
transactionOpts: {}, //gasPrice: new BigNumber(1) },
awaitTransactionMined: true
});
const subscription = usdcDaiMarket.subscribe(WebsocketRequestTopic.BOOK, (mssg => {
console.log(mssg)
}));
}
setupRadar()
const apiURI = 'https://api.pro.coinbase.com';
const authedClient = new CoinbasePro.AuthenticatedClient(
key,
secret,
passphrase,
apiURI
);
let daidep
let usdcdep
async function getDeps() {
let depositAddressParams = {
currency: 'DAI',
};
authedClient.depositCrypto(depositAddressParams, function(e, r, d) {
daidep = (d.address)
});
depositAddressParams = {
currency: 'USDC',
};
authedClient.depositCrypto(depositAddressParams, function(e, r, d) {
usdcdep = (d.address)
});
}
getDeps()
setInterval(function() {
getDeps()
}, 500 * 1000)
let daiBal
let usdcBal
setInterval(function() {
authedClient.getAccounts(function(e, r, d) {
for (var a in d) {
if (d[a].currency == 'DAI') {
daiBal = parseFloat(d[a].balance)
}
if (d[a].currency == 'USDC') {
usdcBal = parseFloat(d[a].balance)
}
}
});
}, 10000);
//create account
// console.log(web3.eth.accounts.create(web3.utils.randomHex(32)));
web3.eth.accounts.wallet.add({
privateKey: privateKey,
address: address
});
try {
web3.eth.personal.unlockAccount(address, web3Pass, 505000);
} catch (err) {
console.log(err)
}
setInterval(function() {
try {
web3.eth.personal.unlockAccount(address, web3Pass, 505000);
} catch (err) {
console.log(err)
}
getEth()
}, 500000)
let ethusd = 180
async function getEth() {
try {
let resp = request('https://api.coinmarketcap.com/v1/ticker/ethereum/?convert=USD', function(e, r, d) {
try {
d = JSON.parse(d)
ethusd = d[0].price_usd
} catch (err) {
ethusd = 180
}
})
} catch (err) {}
}
let compounds = {}
let compounds2 = {}
let ddexes = {}
let etheth;
//dai-usdc
async function compoundPrices() {
try {
let resp = request("https://api.compound.finance/api/v2/ctoken", function(e, r, d) {
d = JSON.parse(d)
for (var cToken in d.cToken) {
compounds[d.cToken[cToken].underlying_symbol] = {
'id': d.cToken[cToken].underlying_symbol,
'name': d.cToken[cToken].name,
'price': d.cToken[cToken].underlying_price.value
}
}
setTimeout(function() {
prevstate = state
if (compounds['DAI'].price * ethusd / (compounds['USDC'].price * ethusd) > 1.009) {
state = 'sellusdc'
} else if (compounds['DAI'].price * ethusd / (compounds['USDC'].price * ethusd) < 1 - .009) {
state = 'selldai'
} else {
state = 'none'
}
if (maining == false) {
console.log('state: ' + state)
mainLoop()
}
}, 12000)
})
} catch (err) {
}
}
let prevstate = 'none'
console.log(state)
setInterval(function() {
compoundPrices()
getTicker()
}, 5000)
let ticker = {}
async function getTicker() {
try {
publicClient.getProductTicker('DAI-USDC', function(e, r, d) {
ticker = (d)
});
} catch (err) {}
}
state = "none"
compoundPrices()
getTicker()
let daiAbi = [{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [{
"name": "",
"type": "string"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "spender",
"type": "address"
}, {
"name": "amount",
"type": "uint256"
}],
"name": "approve",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "repayAmount",
"type": "uint256"
}],
"name": "repayBorrow",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "reserveFactorMantissa",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "account",
"type": "address"
}],
"name": "borrowBalanceCurrent",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "exchangeRateStored",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "src",
"type": "address"
}, {
"name": "dst",
"type": "address"
}, {
"name": "amount",
"type": "uint256"
}],
"name": "transferFrom",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "borrower",
"type": "address"
}, {
"name": "repayAmount",
"type": "uint256"
}],
"name": "repayBorrowBehalf",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "pendingAdmin",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "owner",
"type": "address"
}],
"name": "balanceOfUnderlying",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "getCash",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "newComptroller",
"type": "address"
}],
"name": "_setComptroller",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "totalBorrows",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "comptroller",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "reduceAmount",
"type": "uint256"
}],
"name": "_reduceReserves",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "initialExchangeRateMantissa",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "accrualBlockNumber",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "underlying",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [{
"name": "owner",
"type": "address"
}],
"name": "balanceOf",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [],
"name": "totalBorrowsCurrent",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "redeemAmount",
"type": "uint256"
}],
"name": "redeemUnderlying",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "totalReserves",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [{
"name": "",
"type": "string"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [{
"name": "account",
"type": "address"
}],
"name": "borrowBalanceStored",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "mintAmount",
"type": "uint256"
}],
"name": "mint",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [],
"name": "accrueInterest",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "dst",
"type": "address"
}, {
"name": "amount",
"type": "uint256"
}],
"name": "transfer",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "borrowIndex",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "supplyRatePerBlock",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "liquidator",
"type": "address"
}, {
"name": "borrower",
"type": "address"
}, {
"name": "seizeTokens",
"type": "uint256"
}],
"name": "seize",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "newPendingAdmin",
"type": "address"
}],
"name": "_setPendingAdmin",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [],
"name": "exchangeRateCurrent",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [{
"name": "account",
"type": "address"
}],
"name": "getAccountSnapshot",
"outputs": [{
"name": "",
"type": "uint256"
}, {
"name": "",
"type": "uint256"
}, {
"name": "",
"type": "uint256"
}, {
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "borrowAmount",
"type": "uint256"
}],
"name": "borrow",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "redeemTokens",
"type": "uint256"
}],
"name": "redeem",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [{
"name": "owner",
"type": "address"
}, {
"name": "spender",
"type": "address"
}],
"name": "allowance",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [],
"name": "_acceptAdmin",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "newInterestRateModel",
"type": "address"
}],
"name": "_setInterestRateModel",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "interestRateModel",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "borrower",
"type": "address"
}, {
"name": "repayAmount",
"type": "uint256"
}, {
"name": "cTokenCollateral",
"type": "address"
}],
"name": "liquidateBorrow",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "admin",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "borrowRatePerBlock",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "newReserveFactorMantissa",
"type": "uint256"
}],
"name": "_setReserveFactor",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "isCToken",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"inputs": [{
"name": "underlying_",
"type": "address"
}, {
"name": "comptroller_",
"type": "address"
}, {
"name": "interestRateModel_",
"type": "address"
}, {
"name": "initialExchangeRateMantissa_",
"type": "uint256"
}, {
"name": "name_",
"type": "string"
}, {
"name": "symbol_",
"type": "string"
}, {
"name": "decimals_",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "interestAccumulated",
"type": "uint256"
}, {
"indexed": false,
"name": "borrowIndex",
"type": "uint256"
}, {
"indexed": false,
"name": "totalBorrows",
"type": "uint256"
}],
"name": "AccrueInterest",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "minter",
"type": "address"
}, {
"indexed": false,
"name": "mintAmount",
"type": "uint256"
}, {
"indexed": false,
"name": "mintTokens",
"type": "uint256"
}],
"name": "Mint",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "redeemer",
"type": "address"
}, {
"indexed": false,
"name": "redeemAmount",
"type": "uint256"
}, {
"indexed": false,
"name": "redeemTokens",
"type": "uint256"
}],
"name": "Redeem",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "borrower",
"type": "address"
}, {
"indexed": false,
"name": "borrowAmount",
"type": "uint256"
}, {
"indexed": false,
"name": "accountBorrows",
"type": "uint256"
}, {
"indexed": false,
"name": "totalBorrows",
"type": "uint256"
}],
"name": "Borrow",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "payer",
"type": "address"
}, {
"indexed": false,
"name": "borrower",
"type": "address"
}, {
"indexed": false,
"name": "repayAmount",
"type": "uint256"
}, {
"indexed": false,
"name": "accountBorrows",
"type": "uint256"
}, {
"indexed": false,
"name": "totalBorrows",
"type": "uint256"
}],
"name": "RepayBorrow",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "liquidator",
"type": "address"
}, {
"indexed": false,
"name": "borrower",
"type": "address"
}, {
"indexed": false,
"name": "repayAmount",
"type": "uint256"
}, {
"indexed": false,
"name": "cTokenCollateral",
"type": "address"
}, {
"indexed": false,
"name": "seizeTokens",
"type": "uint256"
}],
"name": "LiquidateBorrow",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "oldPendingAdmin",
"type": "address"
}, {
"indexed": false,
"name": "newPendingAdmin",
"type": "address"
}],
"name": "NewPendingAdmin",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "oldAdmin",
"type": "address"
}, {
"indexed": false,
"name": "newAdmin",
"type": "address"
}],
"name": "NewAdmin",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "oldComptroller",
"type": "address"
}, {
"indexed": false,
"name": "newComptroller",
"type": "address"
}],
"name": "NewComptroller",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "oldInterestRateModel",
"type": "address"
}, {
"indexed": false,
"name": "newInterestRateModel",
"type": "address"
}],
"name": "NewMarketInterestRateModel",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "oldReserveFactorMantissa",
"type": "uint256"
}, {
"indexed": false,
"name": "newReserveFactorMantissa",
"type": "uint256"
}],
"name": "NewReserveFactor",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "admin",
"type": "address"
}, {
"indexed": false,
"name": "reduceAmount",
"type": "uint256"
}, {
"indexed": false,
"name": "newTotalReserves",
"type": "uint256"
}],
"name": "ReservesReduced",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "error",
"type": "uint256"
}, {
"indexed": false,
"name": "info",
"type": "uint256"
}, {
"indexed": false,
"name": "detail",
"type": "uint256"
}],
"name": "Failure",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "from",
"type": "address"
}, {
"indexed": true,
"name": "to",
"type": "address"
}, {
"indexed": false,
"name": "amount",
"type": "uint256"
}],
"name": "Transfer",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "owner",
"type": "address"
}, {
"indexed": true,
"name": "spender",
"type": "address"
}, {
"indexed": false,
"name": "amount",
"type": "uint256"
}],
"name": "Approval",
"type": "event"
}]
let daiUnderlyingAbi = [{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [{
"name": "",
"type": "bytes32"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [],
"name": "stop",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "guy",
"type": "address"
}, {
"name": "wad",
"type": "uint256"
}],
"name": "approve",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "owner_",
"type": "address"
}],
"name": "setOwner",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "src",
"type": "address"
}, {
"name": "dst",
"type": "address"
}, {
"name": "wad",
"type": "uint256"
}],
"name": "transferFrom",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "guy",
"type": "address"
}, {
"name": "wad",
"type": "uint256"
}],
"name": "mint",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "wad",
"type": "uint256"
}],
"name": "burn",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "name_",
"type": "bytes32"
}],
"name": "setName",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [{
"name": "src",
"type": "address"
}],
"name": "balanceOf",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "stopped",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "authority_",
"type": "address"
}],
"name": "setAuthority",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [{
"name": "",
"type": "bytes32"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "guy",
"type": "address"
}, {
"name": "wad",
"type": "uint256"
}],
"name": "burn",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "wad",
"type": "uint256"
}],
"name": "mint",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "dst",
"type": "address"
}, {
"name": "wad",
"type": "uint256"
}],
"name": "transfer",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "dst",
"type": "address"
}, {
"name": "wad",
"type": "uint256"
}],
"name": "push",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "src",
"type": "address"
}, {
"name": "dst",
"type": "address"
}, {
"name": "wad",
"type": "uint256"
}],
"name": "move",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [],
"name": "start",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "authority",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "guy",
"type": "address"
}],
"name": "approve",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [{
"name": "src",
"type": "address"
}, {
"name": "guy",
"type": "address"
}],
"name": "allowance",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "src",
"type": "address"
}, {
"name": "wad",
"type": "uint256"
}],
"name": "pull",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"inputs": [{
"name": "symbol_",
"type": "bytes32"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "guy",
"type": "address"
}, {
"indexed": false,
"name": "wad",
"type": "uint256"
}],
"name": "Mint",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "guy",
"type": "address"
}, {
"indexed": false,
"name": "wad",
"type": "uint256"
}],
"name": "Burn",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "authority",
"type": "address"
}],
"name": "LogSetAuthority",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "owner",
"type": "address"
}],
"name": "LogSetOwner",
"type": "event"
}, {
"anonymous": true,
"inputs": [{
"indexed": true,
"name": "sig",
"type": "bytes4"
}, {
"indexed": true,
"name": "guy",
"type": "address"
}, {
"indexed": true,
"name": "foo",
"type": "bytes32"
}, {
"indexed": true,
"name": "bar",
"type": "bytes32"
}, {
"indexed": false,
"name": "wad",
"type": "uint256"
}, {
"indexed": false,
"name": "fax",
"type": "bytes"
}],
"name": "LogNote",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "src",
"type": "address"
}, {
"indexed": true,
"name": "guy",
"type": "address"
}, {
"indexed": false,
"name": "wad",
"type": "uint256"
}],
"name": "Approval",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "src",
"type": "address"
}, {
"indexed": true,
"name": "dst",
"type": "address"
}, {
"indexed": false,
"name": "wad",
"type": "uint256"
}],
"name": "Transfer",
"type": "event"
}]
let daiAddress = '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359'
let usdcAbi = [{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [{
"name": "",
"type": "string"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "spender",
"type": "address"
}, {
"name": "amount",
"type": "uint256"
}],
"name": "approve",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "repayAmount",
"type": "uint256"
}],
"name": "repayBorrow",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "reserveFactorMantissa",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "account",
"type": "address"
}],
"name": "borrowBalanceCurrent",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "exchangeRateStored",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "src",
"type": "address"
}, {
"name": "dst",
"type": "address"
}, {
"name": "amount",
"type": "uint256"
}],
"name": "transferFrom",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "borrower",
"type": "address"
}, {
"name": "repayAmount",
"type": "uint256"
}],
"name": "repayBorrowBehalf",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "pendingAdmin",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "owner",
"type": "address"
}],
"name": "balanceOfUnderlying",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "getCash",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "newComptroller",
"type": "address"
}],
"name": "_setComptroller",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "totalBorrows",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "comptroller",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "reduceAmount",
"type": "uint256"
}],
"name": "_reduceReserves",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "initialExchangeRateMantissa",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "accrualBlockNumber",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "underlying",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [{
"name": "owner",
"type": "address"
}],
"name": "balanceOf",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [],
"name": "totalBorrowsCurrent",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "redeemAmount",
"type": "uint256"
}],
"name": "redeemUnderlying",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "totalReserves",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [{
"name": "",
"type": "string"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [{
"name": "account",
"type": "address"
}],
"name": "borrowBalanceStored",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "mintAmount",
"type": "uint256"
}],
"name": "mint",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [],
"name": "accrueInterest",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "dst",
"type": "address"
}, {
"name": "amount",
"type": "uint256"
}],
"name": "transfer",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "borrowIndex",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "supplyRatePerBlock",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "liquidator",
"type": "address"
}, {
"name": "borrower",
"type": "address"
}, {
"name": "seizeTokens",
"type": "uint256"
}],
"name": "seize",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "newPendingAdmin",
"type": "address"
}],
"name": "_setPendingAdmin",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [],
"name": "exchangeRateCurrent",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [{
"name": "account",
"type": "address"
}],
"name": "getAccountSnapshot",
"outputs": [{
"name": "",
"type": "uint256"
}, {
"name": "",
"type": "uint256"
}, {
"name": "",
"type": "uint256"
}, {
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "borrowAmount",
"type": "uint256"
}],
"name": "borrow",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "redeemTokens",
"type": "uint256"
}],
"name": "redeem",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [{
"name": "owner",
"type": "address"
}, {
"name": "spender",
"type": "address"
}],
"name": "allowance",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [],
"name": "_acceptAdmin",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "newInterestRateModel",
"type": "address"
}],
"name": "_setInterestRateModel",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "interestRateModel",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "borrower",
"type": "address"
}, {
"name": "repayAmount",
"type": "uint256"
}, {
"name": "cTokenCollateral",
"type": "address"
}],
"name": "liquidateBorrow",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "admin",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "borrowRatePerBlock",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "newReserveFactorMantissa",
"type": "uint256"
}],
"name": "_setReserveFactor",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "isCToken",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"inputs": [{
"name": "underlying_",
"type": "address"
}, {
"name": "comptroller_",
"type": "address"
}, {
"name": "interestRateModel_",
"type": "address"
}, {
"name": "initialExchangeRateMantissa_",
"type": "uint256"
}, {
"name": "name_",
"type": "string"
}, {
"name": "symbol_",
"type": "string"
}, {
"name": "decimals_",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "interestAccumulated",
"type": "uint256"
}, {
"indexed": false,
"name": "borrowIndex",
"type": "uint256"
}, {
"indexed": false,
"name": "totalBorrows",
"type": "uint256"
}],
"name": "AccrueInterest",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "minter",
"type": "address"
}, {
"indexed": false,
"name": "mintAmount",
"type": "uint256"
}, {
"indexed": false,
"name": "mintTokens",
"type": "uint256"
}],
"name": "Mint",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "redeemer",
"type": "address"
}, {
"indexed": false,
"name": "redeemAmount",
"type": "uint256"
}, {
"indexed": false,
"name": "redeemTokens",
"type": "uint256"
}],
"name": "Redeem",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "borrower",
"type": "address"
}, {
"indexed": false,
"name": "borrowAmount",
"type": "uint256"
}, {
"indexed": false,
"name": "accountBorrows",
"type": "uint256"
}, {
"indexed": false,
"name": "totalBorrows",
"type": "uint256"
}],
"name": "Borrow",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "payer",
"type": "address"
}, {
"indexed": false,
"name": "borrower",
"type": "address"
}, {
"indexed": false,
"name": "repayAmount",
"type": "uint256"
}, {
"indexed": false,
"name": "accountBorrows",
"type": "uint256"
}, {
"indexed": false,
"name": "totalBorrows",
"type": "uint256"
}],
"name": "RepayBorrow",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "liquidator",
"type": "address"
}, {
"indexed": false,
"name": "borrower",
"type": "address"
}, {
"indexed": false,
"name": "repayAmount",
"type": "uint256"
}, {
"indexed": false,
"name": "cTokenCollateral",
"type": "address"
}, {
"indexed": false,
"name": "seizeTokens",
"type": "uint256"
}],
"name": "LiquidateBorrow",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "oldPendingAdmin",
"type": "address"
}, {
"indexed": false,
"name": "newPendingAdmin",
"type": "address"
}],
"name": "NewPendingAdmin",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "oldAdmin",
"type": "address"
}, {
"indexed": false,
"name": "newAdmin",
"type": "address"
}],
"name": "NewAdmin",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "oldComptroller",
"type": "address"
}, {
"indexed": false,
"name": "newComptroller",
"type": "address"
}],
"name": "NewComptroller",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "oldInterestRateModel",
"type": "address"
}, {
"indexed": false,
"name": "newInterestRateModel",
"type": "address"
}],
"name": "NewMarketInterestRateModel",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "oldReserveFactorMantissa",
"type": "uint256"
}, {
"indexed": false,
"name": "newReserveFactorMantissa",
"type": "uint256"
}],
"name": "NewReserveFactor",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "admin",
"type": "address"
}, {
"indexed": false,
"name": "reduceAmount",
"type": "uint256"
}, {
"indexed": false,
"name": "newTotalReserves",
"type": "uint256"
}],
"name": "ReservesReduced",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "error",
"type": "uint256"
}, {
"indexed": false,
"name": "info",
"type": "uint256"
}, {
"indexed": false,
"name": "detail",
"type": "uint256"
}],
"name": "Failure",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "from",
"type": "address"
}, {
"indexed": true,
"name": "to",
"type": "address"
}, {
"indexed": false,
"name": "amount",
"type": "uint256"
}],
"name": "Transfer",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "owner",
"type": "address"
}, {
"indexed": true,
"name": "spender",
"type": "address"
}, {
"indexed": false,
"name": "amount",
"type": "uint256"
}],
"name": "Approval",
"type": "event"
}]
let usdcUnderlyingAbi = [{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [{
"name": "",
"type": "string"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "_spender",
"type": "address"
}, {
"name": "_value",
"type": "uint256"
}],
"name": "approve",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "_to",
"type": "address"
}, {
"name": "_amount",
"type": "uint256"
}],
"name": "issueTo",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "newIssuer",
"type": "address"
}],
"name": "addIssuer",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "_from",
"type": "address"
}, {
"name": "_to",
"type": "address"
}, {
"name": "_value",
"type": "uint256"
}],
"name": "transferFrom",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [{
"name": "",
"type": "address"
}],
"name": "issuers",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [],
"name": "unpause",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "_value",
"type": "uint256"
}],
"name": "burn",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "removedIssuer",
"type": "address"
}],
"name": "removeIssuer",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "paused",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "_spender",
"type": "address"
}, {
"name": "_subtractedValue",
"type": "uint256"
}],
"name": "decreaseApproval",
"outputs": [{
"name": "success",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [{
"name": "_owner",
"type": "address"
}],
"name": "balanceOf",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "_from",
"type": "address"
}, {
"name": "_value",
"type": "uint256"
}],
"name": "burnFrom",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [],
"name": "pause",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [{
"name": "",
"type": "string"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "_to",
"type": "address"
}, {
"name": "_value",
"type": "uint256"
}],
"name": "transfer",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "_amount",
"type": "uint256"
}],
"name": "issue",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "_spender",
"type": "address"
}, {
"name": "_addedValue",
"type": "uint256"
}],
"name": "increaseApproval",
"outputs": [{
"name": "success",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [{
"name": "_owner",
"type": "address"
}, {
"name": "_spender",
"type": "address"
}],
"name": "allowance",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "_newOwner",
"type": "address"
}],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"inputs": [{
"name": "initialSupply",
"type": "uint256"
}, {
"name": "tokenName",
"type": "string"
}, {
"name": "tokenSymbol",
"type": "string"
}, {
"name": "tokenDecimals",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "to",
"type": "address"
}, {
"indexed": false,
"name": "amount",
"type": "uint256"
}],
"name": "Mint",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "newIssuer",
"type": "address"
}],
"name": "IssuerAdded",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "removedIssuer",
"type": "address"
}],
"name": "IssuerRemoved",
"type": "event"
}, {
"anonymous": false,
"inputs": [],
"name": "Pause",
"type": "event"
}, {
"anonymous": false,
"inputs": [],
"name": "Unpause",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "previousOwner",
"type": "address"
}],
"name": "OwnershipRenounced",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "previousOwner",
"type": "address"
}, {
"indexed": true,
"name": "newOwner",
"type": "address"
}],
"name": "OwnershipTransferred",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "burner",
"type": "address"
}, {
"indexed": false,
"name": "value",
"type": "uint256"
}],
"name": "Burn",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "owner",
"type": "address"
}, {
"indexed": true,
"name": "spender",
"type": "address"
}, {
"indexed": false,
"name": "value",
"type": "uint256"
}],
"name": "Approval",
"type": "event"
}, {
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "from",
"type": "address"
}, {
"indexed": true,
"name": "to",
"type": "address"
}, {
"indexed": false,
"name": "value",
"type": "uint256"
}],
"name": "Transfer",
"type": "event"
}]
let usdsAddress = '0xa4bdb11dc0a2bec88d24a3aa1e6bb17201112ebe'
let trollAbi = [{
"constant": true,
"inputs": [],
"name": "pendingAdmin",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [{
"name": "newPendingAdmin",
"type": "address"
}],
"name": "_setPendingAdmin",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "comptrollerImplementation",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"constant": false,
"inputs": [],