Skip to content

Instantly share code, notes, and snippets.

@tyrion70
Created August 18, 2020 17:52
Show Gist options
  • Select an option

  • Save tyrion70/0bbccd3c60fee907d1ea445358f8da52 to your computer and use it in GitHub Desktop.

Select an option

Save tyrion70/0bbccd3c60fee907d1ea445358f8da52 to your computer and use it in GitHub Desktop.
let abi = [
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "oracle",
"type": "address"
},
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "withdrawPayment",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "oracle",
"type": "address"
}
],
"name": "withdrawablePayment",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
var Web3 = require('web3');
contracts = [
'0x3A33c0eFD0EB8fd38a6E1904dF1E32f95F67616b',
'0xdf005CaD29AAC8b1170960807f99B62aaeD1bb0a',
'0x8f71c9c583248A11CAcBbC8FD0D5dFa483D3b109',
'0xc95B41df94F3890122B2bcEf9005AFDe17773dB2',
'0x3a6e27b663593E34a7FB80bA9544d9E8BAbdF001',
'0x87CFEA02C8322653a7335C6f72Be19ce54ECbFb5',
'0x4Fa0655c09E0b5B2F50F1bd861B2d9BC63ccBBCB',
'0xF320E19B2ED82F1B226b006cD43FE600FEA56615',
'0x06A7689149cf04DacFDE555d1e1EAD7dD7370316',
'0xca947C9ddF31EE6c2E994EFB794Fdb0819AEEeD0',
'0xF570deEffF684D964dc3E15E1F9414283E3f7419',
'0x00c7A37B03690fb9f41b5C5AF8131735C7275446',
'0x3146392934Da3AE09447CD7Fe4061d8aa96B50ae',
'0xbD72DA70007E47AAf1BBD84918675392cf6885F7',
'0xd866A07Dea5Ee3c093e21d33660b5579C21F140b',
'0x7E6C635d6A53B5033D1B0ceE84ecCeA9096859e4',
'0x8e1BB728b37832754A260D99B5467fE6d164c068',
'0x0c632eC5982e3A8dC116a02ebA7A419efec170B1',
'0x1058a82C25F55aB8ab0cE717F3e6e164E80f1A0B'
]
node = process.argv[2];
async function run() {
// var web3 = new Web3('wss://eth-mainnet.ws.alchemyapi.io/v2/N0BAWZ8djU4Op3j81K5wNH4LzthZNvhC');
var web3 = new Web3('ws://176.125.234.101:8546');
var sum = 0
for (i in contracts) {
var myContract = new web3.eth.Contract(abi, contracts[i]);
value = await myContract.methods.withdrawablePayment(node).call()
console.log(contracts[i], Number(value) / 1000000000000000000)
sum = sum + Number(value)
}
console.log(sum / 1000000000000000000);
process.exit()
}
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment