mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
Merge pull request #38 from Instadapp/feat/compoud-testcase
Added Basic Compound test cases
This commit is contained in:
commit
fb71978100
|
@ -15,7 +15,7 @@ interface CTokenInterface {
|
|||
}
|
||||
|
||||
interface MappingControllerInterface {
|
||||
function hasRole(address,address) public view returns (bool);
|
||||
function hasRole(address,address) external view returns (bool);
|
||||
}
|
||||
|
||||
abstract contract Helpers {
|
||||
|
@ -140,7 +140,7 @@ contract InstaCreamMapping is Helpers {
|
|||
string[] memory _ctokenNames,
|
||||
address[] memory _tokens,
|
||||
address[] memory _ctokens
|
||||
) Helpers(_connectors) {
|
||||
) {
|
||||
_addCtokenMapping(_ctokenNames, _tokens, _ctokens);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ interface IndexInterface {
|
|||
}
|
||||
|
||||
interface MappingControllerInterface {
|
||||
function hasRole(address,address) public view returns (bool);
|
||||
function hasRole(address,address) external view returns (bool);
|
||||
}
|
||||
contract Helpers {
|
||||
// TODO: thrilok, verify this address
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"_format": "hh-sol-artifact-1",
|
||||
"contractName": "ConnectorsInterface",
|
||||
"sourceName": "contracts/v2/accounts/Implementation_m1.sol",
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string[]",
|
||||
"name": "connectorNames",
|
||||
"type": "string[]"
|
||||
}
|
||||
],
|
||||
"name": "isConnectors",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x",
|
||||
"deployedBytecode": "0x",
|
||||
"linkReferences": {},
|
||||
"deployedLinkReferences": {}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
40
deployements/mainnet/Implementation_m1.sol/Constants.json
Normal file
40
deployements/mainnet/Implementation_m1.sol/Constants.json
Normal file
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"_format": "hh-sol-artifact-1",
|
||||
"contractName": "Constants",
|
||||
"sourceName": "contracts/v2/accounts/Implementation_m1.sol",
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_instaIndex",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_connectors",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "connectorsM1",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x60c060405234801561001057600080fd5b50604051610259380380610259833981810160405281019061003291906100bc565b8073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b815250508173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250505050610141565b6000815190506100b68161012a565b92915050565b600080604083850312156100cf57600080fd5b60006100dd858286016100a7565b92505060206100ee858286016100a7565b9150509250929050565b60006101038261010a565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b610133816100f8565b811461013e57600080fd5b50565b60805160601c60a05160601c60f761016260003980604952505060f76000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80636254a08f14602d575b600080fd5b60336047565b604051603e91906078565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b6072816091565b82525050565b6000602082019050608b6000830184606b565b92915050565b6000609a8260a1565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff8216905091905056fea2646970667358221220699279b70fa8da43ab7a9539e71580df4db8693687d48ed183b46ebe8dd7ae4064736f6c63430007000033",
|
||||
"deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060285760003560e01c80636254a08f14602d575b600080fd5b60336047565b604051603e91906078565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b6072816091565b82525050565b6000602082019050608b6000830184606b565b92915050565b6000609a8260a1565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff8216905091905056fea2646970667358221220699279b70fa8da43ab7a9539e71580df4db8693687d48ed183b46ebe8dd7ae4064736f6c63430007000033",
|
||||
"linkReferences": {},
|
||||
"deployedLinkReferences": {}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
File diff suppressed because one or more lines are too long
4
deployements/mainnet/index.sol/AccountInterface.dbg.json
Normal file
4
deployements/mainnet/index.sol/AccountInterface.dbg.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
66
deployements/mainnet/index.sol/AccountInterface.json
Normal file
66
deployements/mainnet/index.sol/AccountInterface.json
Normal file
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
"_format": "hh-sol-artifact-1",
|
||||
"contractName": "AccountInterface",
|
||||
"sourceName": "contracts/registry/index.sol",
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "_targets",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes[]",
|
||||
"name": "_datas",
|
||||
"type": "bytes[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_origin",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "cast",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32[]",
|
||||
"name": "responses",
|
||||
"type": "bytes32[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "authority",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "enable",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "version",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x",
|
||||
"deployedBytecode": "0x",
|
||||
"linkReferences": {},
|
||||
"deployedLinkReferences": {}
|
||||
}
|
4
deployements/mainnet/index.sol/AddressIndex.dbg.json
Normal file
4
deployements/mainnet/index.sol/AddressIndex.dbg.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
238
deployements/mainnet/index.sol/AddressIndex.json
Normal file
238
deployements/mainnet/index.sol/AddressIndex.json
Normal file
File diff suppressed because one or more lines are too long
4
deployements/mainnet/index.sol/CloneFactory.dbg.json
Normal file
4
deployements/mainnet/index.sol/CloneFactory.dbg.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
262
deployements/mainnet/index.sol/CloneFactory.json
Normal file
262
deployements/mainnet/index.sol/CloneFactory.json
Normal file
File diff suppressed because one or more lines are too long
4
deployements/mainnet/index.sol/InstaIndex.dbg.json
Normal file
4
deployements/mainnet/index.sol/InstaIndex.dbg.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
389
deployements/mainnet/index.sol/InstaIndex.json
Normal file
389
deployements/mainnet/index.sol/InstaIndex.json
Normal file
File diff suppressed because one or more lines are too long
4
deployements/mainnet/index.sol/ListInterface.dbg.json
Normal file
4
deployements/mainnet/index.sol/ListInterface.dbg.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../build-info/048b6554db9e446c503d80cfaa6cd3a6.json"
|
||||
}
|
24
deployements/mainnet/index.sol/ListInterface.json
Normal file
24
deployements/mainnet/index.sol/ListInterface.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"_format": "hh-sol-artifact-1",
|
||||
"contractName": "ListInterface",
|
||||
"sourceName": "contracts/registry/index.sol",
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "init",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x",
|
||||
"deployedBytecode": "0x",
|
||||
"linkReferences": {},
|
||||
"deployedLinkReferences": {}
|
||||
}
|
|
@ -1,6 +1,11 @@
|
|||
|
||||
require("@nomiclabs/hardhat-waffle");
|
||||
require("@nomiclabs/hardhat-ethers");
|
||||
require("@tenderly/hardhat-tenderly");
|
||||
require("@nomiclabs/hardhat-etherscan");
|
||||
require("@nomiclabs/hardhat-web3")
|
||||
require("hardhat-deploy");
|
||||
require("hardhat-deploy-ethers");
|
||||
require('dotenv').config();
|
||||
|
||||
const { utils } = require("ethers");
|
||||
|
@ -29,7 +34,7 @@ module.exports = {
|
|||
]
|
||||
},
|
||||
networks: {
|
||||
// default: "hardhat",
|
||||
// defaultNetwork: "hardhat",
|
||||
kovan: {
|
||||
url: `https://eth-kovan.alchemyapi.io/v2/${ALCHEMY_ID}`,
|
||||
accounts: [`0x${PRIVATE_KEY}`]
|
||||
|
@ -43,7 +48,7 @@ module.exports = {
|
|||
hardhat: {
|
||||
forking: {
|
||||
url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`,
|
||||
blockNumber: 12070498,
|
||||
blockNumber: 12433781,
|
||||
},
|
||||
blockGasLimit: 12000000,
|
||||
},
|
||||
|
|
8390
package-lock.json
generated
8390
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
|
@ -25,27 +25,27 @@
|
|||
"chalk": "^4.0.0",
|
||||
"commander": "^7.1.0",
|
||||
"dotenv": "^7.0.0",
|
||||
"ethereumjs-abi": "^0.6.8",
|
||||
"hardhat-docgen": "^1.1.0",
|
||||
"hardhat-docgen": "^1.1.1",
|
||||
"minimist": "^1.2.5",
|
||||
"solc": "^0.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nomiclabs/buidler": "^1.3.8",
|
||||
"@nomiclabs/buidler-web3": "^1.3.4",
|
||||
"@nomiclabs/hardhat-ethers": "^2.0.2",
|
||||
"@nomiclabs/hardhat-etherscan": "^2.1.1",
|
||||
"@nomiclabs/hardhat-etherscan": "^2.1.2",
|
||||
"@nomiclabs/hardhat-waffle": "^2.0.1",
|
||||
"@nomiclabs/hardhat-web3": "^2.0.0",
|
||||
"@openzeppelin/test-helpers": "^0.5.6",
|
||||
"@studydefi/money-legos": "^2.3.7",
|
||||
"@tenderly/hardhat-tenderly": "^1.0.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"ethereum-waffle": "^3.3.0",
|
||||
"ethers": "^5.0.32",
|
||||
"hardhat": "^2.0.8",
|
||||
"ethers": "^5.1.4",
|
||||
"hardhat": "^2.3.0",
|
||||
"hardhat-deploy": "^0.7.5",
|
||||
"hardhat-deploy-ethers": "^0.3.0-beta.7",
|
||||
"husky": "^6.0.0",
|
||||
"sol-merger": "^2.0.1",
|
||||
"solidity-coverage": "0.5.11",
|
||||
"web3": "^1.3.4"
|
||||
"web3": "^1.3.0"
|
||||
}
|
||||
}
|
||||
|
|
15
scripts/buildDSAv2.js
Normal file
15
scripts/buildDSAv2.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
const hre = require("hardhat");
|
||||
const { ethers } = hre;
|
||||
const addresses = require("./constant/addresses");
|
||||
const abis = require("./constant/abis");
|
||||
|
||||
const instaImplementations_m1 = require("../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json")
|
||||
|
||||
module.exports = async function (owner) {
|
||||
const instaIndex = await ethers.getContractAt(abis.core.instaIndex, addresses.core.instaIndex)
|
||||
|
||||
const tx = await instaIndex.build(owner, 2, owner);
|
||||
const receipt = await tx.wait()
|
||||
const event = receipt.events.find(a => a.event === "LogAccountCreated")
|
||||
return await ethers.getContractAt(instaImplementations_m1.abi, event.args.account)
|
||||
};
|
222
scripts/constant/abi/basics/erc20.json
Normal file
222
scripts/constant/abi/basics/erc20.json
Normal file
|
@ -0,0 +1,222 @@
|
|||
[
|
||||
{
|
||||
"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": true,
|
||||
"inputs": [],
|
||||
"name": "totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"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": "uint8"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "balance",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"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": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "allowance",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"payable": true,
|
||||
"stateMutability": "payable",
|
||||
"type": "fallback"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
97
scripts/constant/abi/connectors/auth.json
Normal file
97
scripts/constant/abi/connectors/auth.json
Normal file
|
@ -0,0 +1,97 @@
|
|||
[
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "_msgSender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "_authority",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogAddAuth",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "_msgSender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "_authority",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogRemoveAuth",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "authority",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "add",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "connectorID",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_type",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "_id",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "authority",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "remove",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
133
scripts/constant/abi/connectors/basic.json
Normal file
133
scripts/constant/abi/connectors/basic.json
Normal file
|
@ -0,0 +1,133 @@
|
|||
[
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "erc20",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogDeposit",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "erc20",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogWithdraw",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "connectorID",
|
||||
"outputs": [
|
||||
{ "internalType": "uint256", "name": "_type", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "_id", "type": "uint256" }
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "erc20", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "tokenAmt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "deposit",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getEthAddr",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getEventAddr",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getMemoryAddr",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "erc20", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "tokenAmt", "type": "uint256" },
|
||||
{ "internalType": "address payable", "name": "to", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "withdraw",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
445
scripts/constant/abi/connectors/compound.json
Normal file
445
scripts/constant/abi/connectors/compound.json
Normal file
|
@ -0,0 +1,445 @@
|
|||
[
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "cToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogBorrow",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "cToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogDeposit",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "cToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "cTokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogDepositCToken",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "borrower",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "tokenToPay",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "tokenInReturn",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogLiquidate",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "cToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogPayback",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "borrower",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "cToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogPaybackBehalf",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "cToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogWithdraw",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "cToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "cTokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogWithdrawCToken",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "token", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "borrow",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "connectorID",
|
||||
"outputs": [
|
||||
{ "internalType": "uint256", "name": "_type", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "_id", "type": "uint256" }
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "token", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "deposit",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "token", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "depositCToken",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "borrower", "type": "address" },
|
||||
{ "internalType": "address", "name": "tokenToPay", "type": "address" },
|
||||
{ "internalType": "address", "name": "tokenInReturn", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "liquidate",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "token", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "payback",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "borrower", "type": "address" },
|
||||
{ "internalType": "address", "name": "token", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "paybackBehalf",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "token", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "withdraw",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "token", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "cTokenAmt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "withdrawCToken",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "ClaimComp",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
483
scripts/constant/abi/connectors/maker.json
Normal file
483
scripts/constant/abi/connectors/maker.json
Normal file
|
@ -0,0 +1,483 @@
|
|||
[
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "vault",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "bytes32",
|
||||
"name": "ilk",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogBorrow",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "vault",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "bytes32",
|
||||
"name": "ilk",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "LogClose",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "vault",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "bytes32",
|
||||
"name": "ilk",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogDeposit",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogDepositDai",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "vault",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "bytes32",
|
||||
"name": "ilk",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogExitDai",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "vault",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "bytes32",
|
||||
"name": "ilk",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "LogOpen",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "vault",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "bytes32",
|
||||
"name": "ilk",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogPayback",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "vault",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "bytes32",
|
||||
"name": "ilk",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogTransfer",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "vault",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "bytes32",
|
||||
"name": "ilk",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogWithdraw",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogWithdrawDai",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "vault",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "bytes32",
|
||||
"name": "ilk",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LogWithdrawLiquidated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "uint256", "name": "vault", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "borrow",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "uint256", "name": "vault", "type": "uint256" }
|
||||
],
|
||||
"name": "close",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "connectorID",
|
||||
"outputs": [
|
||||
{ "internalType": "uint256", "name": "_type", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "_id", "type": "uint256" }
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "uint256", "name": "vault", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "deposit",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "uint256", "name": "vault", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "depositAmt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "borrowAmt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getIdDeposit", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getIdBorrow", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setIdDeposit", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setIdBorrow", "type": "uint256" }
|
||||
],
|
||||
"name": "depositAndBorrow",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "depositDai",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "uint256", "name": "vault", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "exitDai",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "string", "name": "colType", "type": "string" }
|
||||
],
|
||||
"name": "open",
|
||||
"outputs": [
|
||||
{ "internalType": "uint256", "name": "vault", "type": "uint256" }
|
||||
],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "uint256", "name": "vault", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "payback",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "uint256", "name": "vault", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "withdraw",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "withdrawDai",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "uint256", "name": "vault", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "amt", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "getId", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "setId", "type": "uint256" }
|
||||
],
|
||||
"name": "withdrawLiquidated",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
177
scripts/constant/abi/connectors/uniswap.json
Normal file
177
scripts/constant/abi/connectors/uniswap.json
Normal file
|
@ -0,0 +1,177 @@
|
|||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "buyAddr",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "sellAddr",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "buyAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "unitAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "buy",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenB",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amtA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "unitAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "slippage",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "deposit",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "buyAddr",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "sellAddr",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "sellAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "unitAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "setId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "sell",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenB",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "uniAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "unitAmtA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "unitAmtB",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "getId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "setIds",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"name": "withdraw",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
250
scripts/constant/abi/core/connectorsV2.json
Normal file
250
scripts/constant/abi/core/connectorsV2.json
Normal file
|
@ -0,0 +1,250 @@
|
|||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_instaIndex",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "bytes32",
|
||||
"name": "connectorNameHash",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "string",
|
||||
"name": "connectorName",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "connector",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogConnectorAdded",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "bytes32",
|
||||
"name": "connectorNameHash",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "string",
|
||||
"name": "connectorName",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "connector",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogConnectorRemoved",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "bytes32",
|
||||
"name": "connectorNameHash",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "string",
|
||||
"name": "connectorName",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "oldConnector",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "newConnector",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogConnectorUpdated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "addr",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "bool",
|
||||
"name": "isChief",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "LogController",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string[]",
|
||||
"name": "_connectorNames",
|
||||
"type": "string[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "_connectors",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "addConnectors",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "chief",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"name": "connectors",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "instaIndex",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string[]",
|
||||
"name": "_connectorNames",
|
||||
"type": "string[]"
|
||||
}
|
||||
],
|
||||
"name": "isConnectors",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "isOk",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "_connectors",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string[]",
|
||||
"name": "_connectorNames",
|
||||
"type": "string[]"
|
||||
}
|
||||
],
|
||||
"name": "removeConnectors",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_chiefAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "toggleChief",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string[]",
|
||||
"name": "_connectorNames",
|
||||
"type": "string[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "_connectors",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "updateConnectors",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
380
scripts/constant/abi/core/instaIndex.json
Normal file
380
scripts/constant/abi/core/instaIndex.json
Normal file
|
@ -0,0 +1,380 @@
|
|||
[
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "sender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "origin",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogAccountCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "_newAccount",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "_connectors",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "_check",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogNewAccount",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "accountVersion",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "check",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogNewCheck",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "master",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogNewMaster",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "master",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogUpdateMaster",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "account",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_newAccount",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_connectors",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_check",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "addNewAccount",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "accountVersion",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_origin",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "build",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "accountVersion",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "_targets",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes[]",
|
||||
"name": "_datas",
|
||||
"type": "bytes[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_origin",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "buildWithCast",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "accountVersion",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_newCheck",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "changeCheck",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_newMaster",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "changeMaster",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "check",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "connectors",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "version",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "query",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isClone",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "result",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "list",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "master",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_master",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_list",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_account",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_connectors",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "setBasics",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "updateMaster",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "versionCount",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
186
scripts/constant/abi/read/compound.json
Normal file
186
scripts/constant/abi/read/compound.json
Normal file
|
@ -0,0 +1,186 @@
|
|||
[
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCETHAddress",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCompReadAddress",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCompToken",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract TokenInterface",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "owner", "type": "address" },
|
||||
{ "internalType": "address[]", "name": "cAddress", "type": "address[]" }
|
||||
],
|
||||
"name": "getCompoundData",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "tokenPriceInEth",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "tokenPriceInUsd",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "exchangeRateStored",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "balanceOfUser",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "borrowBalanceStoredUser",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "supplyRatePerBlock",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "borrowRatePerBlock",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"internalType": "struct Helpers.CompData[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getComptroller",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract ComptrollerLensInterface",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getOracleAddress",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "owner", "type": "address" },
|
||||
{ "internalType": "address[]", "name": "cAddress", "type": "address[]" }
|
||||
],
|
||||
"name": "getPosition",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "tokenPriceInEth",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "tokenPriceInUsd",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "exchangeRateStored",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "balanceOfUser",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "borrowBalanceStoredUser",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "supplyRatePerBlock",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "borrowRatePerBlock",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"internalType": "struct Helpers.CompData[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
},
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "uint256", "name": "balance", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "votes", "type": "uint256" },
|
||||
{ "internalType": "address", "name": "delegate", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "allocated", "type": "uint256" }
|
||||
],
|
||||
"internalType": "struct CompReadInterface.CompBalanceMetadataExt",
|
||||
"name": "",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "cToken", "type": "address" },
|
||||
{ "internalType": "address", "name": "token", "type": "address" }
|
||||
],
|
||||
"name": "getPriceInEth",
|
||||
"outputs": [
|
||||
{ "internalType": "uint256", "name": "priceInETH", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "priceInUSD", "type": "uint256" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
312
scripts/constant/abi/read/core.json
Normal file
312
scripts/constant/abi/read/core.json
Normal file
|
@ -0,0 +1,312 @@
|
|||
[
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_index", "type": "address" },
|
||||
{ "internalType": "address", "name": "gnosisFactory", "type": "address" }
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "connectors",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "uint64", "name": "id", "type": "uint64" }],
|
||||
"name": "getAccount",
|
||||
"outputs": [
|
||||
{ "internalType": "address", "name": "account", "type": "address" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "account", "type": "address" }
|
||||
],
|
||||
"name": "getAccountAuthorities",
|
||||
"outputs": [
|
||||
{ "internalType": "address[]", "name": "", "type": "address[]" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "account", "type": "address" }
|
||||
],
|
||||
"name": "getAccountAuthoritiesTypes",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "address", "name": "owner", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "authType", "type": "uint256" }
|
||||
],
|
||||
"internalType": "struct AccountResolver.AuthType[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "account", "type": "address" }
|
||||
],
|
||||
"name": "getAccountDetails",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "uint256", "name": "ID", "type": "uint256" },
|
||||
{ "internalType": "address", "name": "account", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "version", "type": "uint256" },
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "authorities",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"internalType": "struct AccountResolver.AccountData",
|
||||
"name": "",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "uint256", "name": "id", "type": "uint256" }],
|
||||
"name": "getAccountIdDetails",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "uint256", "name": "ID", "type": "uint256" },
|
||||
{ "internalType": "address", "name": "account", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "version", "type": "uint256" },
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "authorities",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"internalType": "struct AccountResolver.AccountData",
|
||||
"name": "",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address[]", "name": "accounts", "type": "address[]" }
|
||||
],
|
||||
"name": "getAccountVersions",
|
||||
"outputs": [
|
||||
{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "authority", "type": "address" }
|
||||
],
|
||||
"name": "getAuthorityAccounts",
|
||||
"outputs": [
|
||||
{ "internalType": "address[]", "name": "", "type": "address[]" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "authority", "type": "address" }
|
||||
],
|
||||
"name": "getAuthorityDetails",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "uint64[]", "name": "IDs", "type": "uint64[]" },
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "accounts",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "versions",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"internalType": "struct AccountResolver.AuthorityData",
|
||||
"name": "",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "authority", "type": "address" }
|
||||
],
|
||||
"name": "getAuthorityIDs",
|
||||
"outputs": [{ "internalType": "uint64[]", "name": "", "type": "uint64[]" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "authorities",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "getAuthorityTypes",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "address", "name": "owner", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "authType", "type": "uint256" }
|
||||
],
|
||||
"internalType": "struct AccountResolver.AuthType[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_addr", "type": "address" }
|
||||
],
|
||||
"name": "getContractCode",
|
||||
"outputs": [{ "internalType": "bytes", "name": "o_code", "type": "bytes" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getEnabledConnectors",
|
||||
"outputs": [
|
||||
{ "internalType": "address[]", "name": "", "type": "address[]" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getEnabledConnectorsData",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "address", "name": "connector", "type": "address" },
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "connectorID",
|
||||
"type": "uint256"
|
||||
},
|
||||
{ "internalType": "string", "name": "name", "type": "string" }
|
||||
],
|
||||
"internalType": "struct ConnectorsResolver.ConnectorsData[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "account", "type": "address" }
|
||||
],
|
||||
"name": "getID",
|
||||
"outputs": [{ "internalType": "uint256", "name": "id", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "uint256", "name": "id", "type": "uint256" }],
|
||||
"name": "getIDAuthorities",
|
||||
"outputs": [
|
||||
{ "internalType": "address[]", "name": "", "type": "address[]" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getStaticConnectors",
|
||||
"outputs": [
|
||||
{ "internalType": "address[]", "name": "", "type": "address[]" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getStaticConnectorsData",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "address", "name": "connector", "type": "address" },
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "connectorID",
|
||||
"type": "uint256"
|
||||
},
|
||||
{ "internalType": "string", "name": "name", "type": "string" }
|
||||
],
|
||||
"internalType": "struct ConnectorsResolver.ConnectorsData[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "index",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "account", "type": "address" }
|
||||
],
|
||||
"name": "isShield",
|
||||
"outputs": [{ "internalType": "bool", "name": "shield", "type": "bool" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "list",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "version",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
68
scripts/constant/abi/read/erc20.json
Normal file
68
scripts/constant/abi/read/erc20.json
Normal file
|
@ -0,0 +1,68 @@
|
|||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "tknAddress",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "getAllowances",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "tknAddress",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "getBalances",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
263
scripts/constant/abi/read/maker.json
Normal file
263
scripts/constant/abi/read/maker.json
Normal file
|
@ -0,0 +1,263 @@
|
|||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string[]",
|
||||
"name": "name",
|
||||
"type": "string[]"
|
||||
}
|
||||
],
|
||||
"name": "getColInfo",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "borrowRate",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "price",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidationRatio",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "debtCeiling",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "totalDebt",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"internalType": "struct Helpers.ColInfo[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getDaiPosition",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "dsr",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getDsrRate",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "dsr",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getMcdAddresses",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "id",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getVaultById",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "id",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "colType",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "collateral",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "art",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "debt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidatedCol",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "borrowRate",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "colPrice",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidationRatio",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "vaultAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"internalType": "struct Helpers.VaultData",
|
||||
"name": "",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getVaults",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "id",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "colType",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "collateral",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "art",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "debt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidatedCol",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "borrowRate",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "colPrice",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidationRatio",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "vaultAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"internalType": "struct Helpers.VaultData[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
281
scripts/constant/abi/read/uniswap.json
Normal file
281
scripts/constant/abi/read/uniswap.json
Normal file
|
@ -0,0 +1,281 @@
|
|||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "buyAddr",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "sellAddr",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "sellAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "slippage",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getBuyAmount",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "buyAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "unitAmt",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenB",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amtA",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getDepositAmount",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amtB",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "unitAmt",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenB",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amtA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amtB",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getDepositAmountNewPool",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "unitAmt",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getEthAddr",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenB",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"internalType": "struct Resolver.TokenPair[]",
|
||||
"name": "tokenPairs",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"name": "getPosition",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "tokenAShareAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "tokenBShareAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "uniAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "totalSupply",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"internalType": "struct Resolver.PoolData[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "buyAddr",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "sellAddr",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "buyAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "slippage",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getSellAmount",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "sellAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "unitAmt",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenB",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "uniAmt",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "slippage",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getWithdrawAmounts",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amtA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amtB",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "unitAmtA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "unitAmtB",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
14
scripts/constant/abis.js
Normal file
14
scripts/constant/abis.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
module.exports = {
|
||||
core: {
|
||||
connectorsV2: require("./abi/core/connectorsV2.json"),
|
||||
instaIndex: require("./abi/core/instaIndex.json"),
|
||||
},
|
||||
connectors: {
|
||||
basic: require("./abi/connectors/basic.json"),
|
||||
auth: require("./abi/connectors/auth.json"),
|
||||
},
|
||||
basic: {
|
||||
erc20: require("./abi/basics/erc20.json"),
|
||||
},
|
||||
};
|
||||
|
11
scripts/constant/addresses.js
Normal file
11
scripts/constant/addresses.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
connectors: {
|
||||
basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6",
|
||||
auth: "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9",
|
||||
},
|
||||
core: {
|
||||
connectorsV2: "0xFE2390DAD597594439f218190fC2De40f9Cf1179",
|
||||
instaIndex: "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723"
|
||||
}
|
||||
};
|
||||
|
6
scripts/constant/constant.js
Normal file
6
scripts/constant/constant.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
module.exports = {
|
||||
address_zero: "0x0000000000000000000000000000000000000000",
|
||||
eth_addr: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
||||
max_value: "115792089237316195423570985008687907853269984665640564039457584007913129639935"
|
||||
};
|
||||
|
23
scripts/constant/tokens.js
Normal file
23
scripts/constant/tokens.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
module.exports = {
|
||||
"eth": {
|
||||
"type": "token",
|
||||
"symbol": "ETH",
|
||||
"name": "Ethereum",
|
||||
"address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
|
||||
"decimals": 18
|
||||
},
|
||||
"dai": {
|
||||
"type": "token",
|
||||
"symbol": "DAI",
|
||||
"name": "DAI Stable",
|
||||
"address": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
|
||||
"decimals": 18
|
||||
},
|
||||
"usdc": {
|
||||
"type": "token",
|
||||
"symbol": "USDC",
|
||||
"name": "USD Coin",
|
||||
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
||||
"decimals": 6
|
||||
}
|
||||
}
|
19
scripts/deployAndEnableConnector.js
Normal file
19
scripts/deployAndEnableConnector.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
const abis = require("./constant/abis");
|
||||
const addresses = require("./constant/addresses");
|
||||
|
||||
const hre = require("hardhat");
|
||||
const { ethers, waffle } = hre;
|
||||
const { deployContract } = waffle;
|
||||
const fs = require("fs")
|
||||
|
||||
|
||||
module.exports = async function ({connectorName, contractArtifact, signer, connectors}) {
|
||||
const connectorInstanace = await deployContract(signer, contractArtifact, []);
|
||||
|
||||
await connectors.connect(signer).addConnectors([connectorName], [connectorInstanace.address])
|
||||
|
||||
addresses.connectors[connectorName] = connectorInstanace.address
|
||||
abis.connectors[connectorName] = contractArtifact.abi;
|
||||
|
||||
return connectorInstanace;
|
||||
};
|
18
scripts/encodeSpells.js
Normal file
18
scripts/encodeSpells.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
const abis = require("./constant/abis");
|
||||
const addresses = require("./constant/addresses");
|
||||
const { web3 } = hre;
|
||||
|
||||
module.exports = function (spells) {
|
||||
const targets = spells.map(a => a.connector)
|
||||
const calldatas = spells.map(a => {
|
||||
const functionName = a.method;
|
||||
// console.log(functionName)
|
||||
const abi = abis.connectors[a.connector].find(b => {
|
||||
return b.name === functionName
|
||||
});
|
||||
// console.log(functionName)
|
||||
if (!abi) throw new Error("Couldn't find function")
|
||||
return web3.eth.abi.encodeFunctionCall(abi, a.args)
|
||||
})
|
||||
return [targets, calldatas]
|
||||
};
|
23
scripts/getMasterSigner.js
Normal file
23
scripts/getMasterSigner.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
const hre = require("hardhat");
|
||||
const { ethers, waffle } = hre;
|
||||
const addresses = require("./constant/addresses");
|
||||
const abis = require("./constant/abis");
|
||||
const { provider, deployContract } = waffle
|
||||
|
||||
|
||||
module.exports = async function () {
|
||||
const instaIndex = await ethers.getContractAt(abis.core.instaIndex, addresses.core.instaIndex)
|
||||
|
||||
const masterAddress = await instaIndex.master(); // TODO: make it constant?
|
||||
await hre.network.provider.request({
|
||||
method: "hardhat_impersonateAccount",
|
||||
params: [ masterAddress]
|
||||
})
|
||||
const [wallet0, wallet1, wallet2, wallet3] = await ethers.getSigners()
|
||||
await wallet3.sendTransaction({
|
||||
to: masterAddress,
|
||||
value: ethers.utils.parseEther("10")
|
||||
});
|
||||
|
||||
return await ethers.getSigner(masterAddress);
|
||||
};
|
127
test/compound/compound.test.js
Normal file
127
test/compound/compound.test.js
Normal file
|
@ -0,0 +1,127 @@
|
|||
const { expect } = require("chai");
|
||||
const hre = require("hardhat");
|
||||
const { web3, deployments, waffle, ethers } = hre;
|
||||
const { provider, deployContract } = waffle
|
||||
|
||||
const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector.js")
|
||||
const buildDSAv2 = require("../../scripts/buildDSAv2")
|
||||
const encodeSpells = require("../../scripts/encodeSpells.js")
|
||||
const getMasterSigner = require("../../scripts/getMasterSigner")
|
||||
|
||||
const addresses = require("../../scripts/constant/addresses");
|
||||
const abis = require("../../scripts/constant/abis");
|
||||
const constants = require("../../scripts/constant/constant");
|
||||
const tokens = require("../../scripts/constant/tokens");
|
||||
|
||||
const connectV2CompoundArtifacts = require("../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json")
|
||||
|
||||
describe("Compound", function () {
|
||||
const connectorName = "COMPOUND-TEST-A"
|
||||
|
||||
let dsaWallet0
|
||||
let masterSigner;
|
||||
let instaConnectorsV2;
|
||||
let connector;
|
||||
|
||||
const wallets = provider.getWallets()
|
||||
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
||||
before(async () => {
|
||||
masterSigner = await getMasterSigner(wallet3)
|
||||
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
||||
connector = await deployAndEnableConnector({
|
||||
connectorName,
|
||||
contractArtifact: connectV2CompoundArtifacts,
|
||||
signer: masterSigner,
|
||||
connectors: instaConnectorsV2
|
||||
})
|
||||
console.log("Connector address", connector.address)
|
||||
})
|
||||
|
||||
it("Should have contracts deployed.", async function () {
|
||||
expect(!!instaConnectorsV2.address).to.be.true;
|
||||
expect(!!connector.address).to.be.true;
|
||||
expect(!!masterSigner.address).to.be.true;
|
||||
});
|
||||
|
||||
describe("DSA wallet setup", function () {
|
||||
it("Should build DSA v2", async function () {
|
||||
dsaWallet0 = await buildDSAv2(wallet0.address)
|
||||
expect(!!dsaWallet0.address).to.be.true;
|
||||
});
|
||||
|
||||
it("Deposit ETH into DSA wallet", async function () {
|
||||
await wallet0.sendTransaction({
|
||||
to: dsaWallet0.address,
|
||||
value: ethers.utils.parseEther("10")
|
||||
});
|
||||
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("10"));
|
||||
});
|
||||
});
|
||||
|
||||
describe("Main", function () {
|
||||
|
||||
it("Should deposit ETH in Compound", async function () {
|
||||
const amount = ethers.utils.parseEther("1") // 1 ETH
|
||||
const spells = [
|
||||
{
|
||||
connector: connectorName,
|
||||
method: "deposit",
|
||||
args: ["ETH-A", amount, 0, 0]
|
||||
}
|
||||
]
|
||||
|
||||
const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address)
|
||||
const receipt = await tx.wait()
|
||||
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("9"));
|
||||
});
|
||||
|
||||
it("Should borrow and payback DAI from Compound", async function () {
|
||||
const amount = ethers.utils.parseEther("100") // 100 DAI
|
||||
const setId = "83478237"
|
||||
const spells = [
|
||||
{
|
||||
connector: connectorName,
|
||||
method: "borrow",
|
||||
args: ["DAI-A", amount, 0, setId]
|
||||
},
|
||||
{
|
||||
connector: connectorName,
|
||||
method: "payback",
|
||||
args: ["DAI-A", 0, setId, 0]
|
||||
}
|
||||
]
|
||||
|
||||
const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address)
|
||||
const receipt = await tx.wait()
|
||||
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("9"));
|
||||
});
|
||||
|
||||
it("Should deposit all ETH in Compound", async function () {
|
||||
const spells = [
|
||||
{
|
||||
connector: connectorName,
|
||||
method: "deposit",
|
||||
args: ["ETH-A", constants.max_value, 0, 0]
|
||||
}
|
||||
]
|
||||
|
||||
const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address)
|
||||
const receipt = await tx.wait()
|
||||
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("0"));
|
||||
});
|
||||
|
||||
it("Should withdraw all ETH from Compound", async function () {
|
||||
const spells = [
|
||||
{
|
||||
connector: connectorName,
|
||||
method: "withdraw",
|
||||
args: ["ETH-A", constants.max_value, 0, 0]
|
||||
}
|
||||
]
|
||||
|
||||
const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address)
|
||||
const receipt = await tx.wait()
|
||||
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("10"));
|
||||
});
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user