Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yudilevi committed Nov 4, 2020
2 parents 14b54ba + 269fb12 commit 2accc7c
Show file tree
Hide file tree
Showing 11 changed files with 621 additions and 94 deletions.
58 changes: 58 additions & 0 deletions projects/bancor/abi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"abiContractRegistryAddressOf": {
"inputs": [{
"internalType": "bytes32",
"name": "_contractName",
"type": "bytes32"
}],
"name": "addressOf",
"outputs": [{
"internalType": "address",
"name": "",
"type": "address"
}],
"stateMutability": "view",
"type": "function"
},
"abiConverterRegistryGetPools": {
"inputs": [],
"name": "getLiquidityPools",
"outputs": [{
"internalType": "address[]",
"name": "",
"type": "address[]"
}],
"stateMutability": "view",
"type": "function"
},
"abiRegistryGetConvertersBySmartTokens": {
"inputs": [{
"internalType": "address[]",
"name": "_smartTokens",
"type": "address[]"
}],
"name": "getConvertersBySmartTokens",
"outputs": [{
"internalType": "contract IConverter[]",
"name": "",
"type": "address[]"
}],
"stateMutability": "view",
"type": "function"
},
"abiConverterConnectorTokens": {
"inputs": [{
"internalType": "uint256",
"name": "",
"type": "uint256"
}],
"name": "connectorTokens",
"outputs": [{
"internalType": "contract IERC20Token",
"name": "",
"type": "address"
}],
"stateMutability": "view",
"type": "function"
}
}
68 changes: 4 additions & 64 deletions projects/bancor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,13 @@
Modules
==================================================*/

const abi = require('./abi');
const sdk = require('../../sdk');
const axios = require('axios');
const _ = require('underscore');
const moment = require('moment');
const BigNumber = require('bignumber.js');

/*==================================================
ABIs
==================================================*/

const abiContractRegistryAddressOf = {
"inputs": [{
"internalType": "bytes32",
"name": "_contractName",
"type": "bytes32"
}],
"name": "addressOf",
"outputs": [{
"internalType": "address",
"name": "",
"type": "address"
}],
"stateMutability": "view",
"type": "function"
};
const abiConverterRegistryGetPools = {
"inputs": [],
"name": "getLiquidityPools",
"outputs": [{
"internalType": "address[]",
"name": "",
"type": "address[]"
}],
"stateMutability": "view",
"type": "function"
};
const abiRegistryGetConvertersBySmartTokens = {
"inputs": [{
"internalType": "address[]",
"name": "_smartTokens",
"type": "address[]"
}],
"name": "getConvertersBySmartTokens",
"outputs": [{
"internalType": "contract IConverter[]",
"name": "",
"type": "address[]"
}],
"stateMutability": "view",
"type": "function"
};
const abiConverterConnectorTokens = {
"inputs": [{
"internalType": "uint256",
"name": "",
"type": "uint256"
}],
"name": "connectorTokens",
"outputs": [{
"internalType": "contract IERC20Token",
"name": "",
"type": "address"
}],
"stateMutability": "view",
"type": "function"
};

/*==================================================
Helper Functions
==================================================*/
Expand Down Expand Up @@ -165,14 +105,14 @@
// get pool anchor addresses
result = await sdk.api.abi.call({
target: converterRegistryAddress,
abi: abiConverterRegistryGetPools,
abi: abi['abiConverterRegistryGetPools'],
block
});

// get converter addresses
result = await sdk.api.abi.call({
target: converterRegistryAddress,
abi: abiRegistryGetConvertersBySmartTokens,
abi: abi['abiRegistryGetConvertersBySmartTokens'],
params: [result.output],
block
});
Expand All @@ -193,7 +133,7 @@

result = await sdk.api.abi.multiCall({
calls: reserveTokenCalls,
abi: abiConverterConnectorTokens,
abi: abi['abiConverterConnectorTokens'],
block
});

Expand Down
24 changes: 24 additions & 0 deletions projects/harvest/abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,29 @@
"payable": false,
"stateMutability": "view",
"type": "function"
},
"uniABIReserves": {
"constant":true,
"inputs":[],
"name":"getReserves",
"outputs":[
{
"internalType":"uint112",
"name":"_reserve0",
"type":"uint112"
},
{
"internalType":"uint112",
"name":"_reserve1",
"type":"uint112"
},
{
"internalType":"uint32",
"name":"_blockTimestampLast",
"type":"uint32"}
],
"payable":false,
"stateMutability":"view",
"type":"function"
}
}
Loading

0 comments on commit 2accc7c

Please sign in to comment.