mirror of
https://github.com/Instadapp/dsa-connectors-old.git
synced 2024-07-29 22:47:46 +00:00
commit
ce45fdaa92
|
@ -1,7 +1,7 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.0;
|
||||||
|
|
||||||
interface TokenInterface {
|
interface TokenInterface {
|
||||||
function approve(address, uint) external;
|
function approve(address, uint256) external;
|
||||||
function transfer(address, uint) external;
|
function transfer(address, uint) external;
|
||||||
function transferFrom(address, address, uint) external;
|
function transferFrom(address, address, uint) external;
|
||||||
function deposit() external payable;
|
function deposit() external payable;
|
||||||
|
|
|
@ -8,6 +8,10 @@ contract DSMath {
|
||||||
require((z = x + y) >= x, "math-not-safe");
|
require((z = x + y) >= x, "math-not-safe");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sub(uint x, uint y) internal pure returns (uint z) {
|
||||||
|
require((z = x - y) <= x, "ds-math-sub-underflow");
|
||||||
|
}
|
||||||
|
|
||||||
function mul(uint x, uint y) internal pure returns (uint z) {
|
function mul(uint x, uint y) internal pure returns (uint z) {
|
||||||
require(y == 0 || (z = x * y) / y == x, "math-not-safe");
|
require(y == 0 || (z = x * y) / y == x, "math-not-safe");
|
||||||
}
|
}
|
||||||
|
|
224
contracts/connectors/curve.sol
Normal file
224
contracts/connectors/curve.sol
Normal file
|
@ -0,0 +1,224 @@
|
||||||
|
pragma solidity ^0.6.0;
|
||||||
|
|
||||||
|
interface ICurve {
|
||||||
|
function underlying_coins(int128 tokenId) external view returns (address token);
|
||||||
|
function calc_token_amount(uint256[4] calldata amounts, bool deposit) external returns (uint256 amount);
|
||||||
|
function add_liquidity(uint256[4] calldata amounts, uint256 min_mint_amount) external;
|
||||||
|
function get_dy(int128 sellTokenId, int128 buyTokenId, uint256 sellTokenAmt) external returns (uint256 buyTokenAmt);
|
||||||
|
function exchange(int128 sellTokenId, int128 buyTokenId, uint256 sellTokenAmt, uint256 minBuyToken) external;
|
||||||
|
function remove_liquidity_imbalance(uint256[4] calldata amounts, uint256 max_burn_amount) external;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ICurveZap {
|
||||||
|
function calc_withdraw_one_coin(uint256 _token_amount, int128 i) external returns (uint256 amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
// import files from common directory
|
||||||
|
import { TokenInterface , MemoryInterface, EventInterface} from "../common/interfaces.sol";
|
||||||
|
import { Stores } from "../common/stores.sol";
|
||||||
|
import { DSMath } from "../common/math.sol";
|
||||||
|
|
||||||
|
contract CurveHelpers is Stores, DSMath {
|
||||||
|
/**
|
||||||
|
* @dev Return Curve Swap Address
|
||||||
|
*/
|
||||||
|
function getCurveSwapAddr() internal pure returns (address) {
|
||||||
|
return 0xA5407eAE9Ba41422680e2e00537571bcC53efBfD;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Return Curve Token Address
|
||||||
|
*/
|
||||||
|
function getCurveTokenAddr() internal pure returns (address) {
|
||||||
|
return 0xC25a3A3b969415c80451098fa907EC722572917F;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Return Curve Zap Address
|
||||||
|
*/
|
||||||
|
function getCurveZapAddr() internal pure returns (address) {
|
||||||
|
return 0xFCBa3E75865d2d561BE8D220616520c171F12851;
|
||||||
|
}
|
||||||
|
|
||||||
|
function convert18ToDec(uint _dec, uint256 _amt) internal pure returns (uint256 amt) {
|
||||||
|
amt = (_amt / 10 ** (18 - _dec));
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertTo18(uint _dec, uint256 _amt) internal pure returns (uint256 amt) {
|
||||||
|
amt = mul(_amt, 10 ** (18 - _dec));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTokenI(address token) internal pure returns (int128 i) {
|
||||||
|
if (token == address(0x6B175474E89094C44Da98b954EedeAC495271d0F)) {
|
||||||
|
// DAI Token
|
||||||
|
i = 0;
|
||||||
|
} else if (token == address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48)) {
|
||||||
|
// USDC Token
|
||||||
|
i = 1;
|
||||||
|
} else if (token == address(0xdAC17F958D2ee523a2206206994597C13D831ec7)) {
|
||||||
|
// USDT Token
|
||||||
|
i = 2;
|
||||||
|
} else if (token == address(0x57Ab1ec28D129707052df4dF418D58a2D46d5f51)) {
|
||||||
|
// sUSD Token
|
||||||
|
i = 3;
|
||||||
|
} else {
|
||||||
|
revert("token-not-found.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTokenAddr(ICurve curve, uint256 i) internal view returns (address token) {
|
||||||
|
token = curve.underlying_coins(int128(i));
|
||||||
|
require(token != address(0), "token-not-found.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
contract CurveProtocol is CurveHelpers {
|
||||||
|
|
||||||
|
event LogSell(
|
||||||
|
address indexed buyToken,
|
||||||
|
address indexed sellToken,
|
||||||
|
uint256 buyAmt,
|
||||||
|
uint256 sellAmt,
|
||||||
|
uint256 getId,
|
||||||
|
uint256 setId
|
||||||
|
);
|
||||||
|
event LogDeposit(address token, uint256 amt, uint256 mintAmt, uint256 getId, uint256 setId);
|
||||||
|
event LogWithdraw(address token, uint256 amt, uint256 burnAmt, uint256 getId, uint256 setId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Sell Stable ERC20_Token.
|
||||||
|
* @param buyAddr buying token address.
|
||||||
|
* @param sellAddr selling token amount.
|
||||||
|
* @param sellAmt selling token amount.
|
||||||
|
* @param unitAmt unit amount of buyAmt/sellAmt with slippage.
|
||||||
|
* @param getId Get token amount at this ID from `InstaMemory` Contract.
|
||||||
|
* @param setId Set token amount at this ID in `InstaMemory` Contract.
|
||||||
|
*/
|
||||||
|
function sell(
|
||||||
|
address buyAddr,
|
||||||
|
address sellAddr,
|
||||||
|
uint sellAmt,
|
||||||
|
uint unitAmt,
|
||||||
|
uint getId,
|
||||||
|
uint setId
|
||||||
|
) external {
|
||||||
|
uint _sellAmt = getUint(getId, sellAmt);
|
||||||
|
ICurve curve = ICurve(getCurveSwapAddr());
|
||||||
|
TokenInterface _buyToken = TokenInterface(buyAddr);
|
||||||
|
TokenInterface _sellToken = TokenInterface(sellAddr);
|
||||||
|
_sellAmt = _sellAmt == uint(-1) ? _sellToken.balanceOf(address(this)) : _sellAmt;
|
||||||
|
_sellToken.approve(address(curve), _sellAmt);
|
||||||
|
|
||||||
|
uint _slippageAmt = convert18ToDec(_buyToken.decimals(), wmul(unitAmt, convertTo18(_sellToken.decimals(), _sellAmt)));
|
||||||
|
|
||||||
|
uint _buyAmt = curve.get_dy(getTokenI(sellAddr), getTokenI(buyAddr), _sellAmt);
|
||||||
|
|
||||||
|
curve.exchange(getTokenI(sellAddr), getTokenI(buyAddr), _sellAmt, _slippageAmt);
|
||||||
|
|
||||||
|
setUint(setId, _buyAmt);
|
||||||
|
|
||||||
|
emit LogSell(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||||
|
bytes32 _eventCode = keccak256("LogSell(address,address,uint256,uint256,uint256,uint256)");
|
||||||
|
bytes memory _eventParam = abi.encode(buyAddr, sellAddr, _buyAmt, _sellAmt, getId, setId);
|
||||||
|
emitEvent(_eventCode, _eventParam);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Deposit Token.
|
||||||
|
* @param token token address.
|
||||||
|
* @param amt token amount.
|
||||||
|
* @param unitAmt unit amount of curve_amt/token_amt with slippage.
|
||||||
|
* @param getId Get token amount at this ID from `InstaMemory` Contract.
|
||||||
|
* @param setId Set token amount at this ID in `InstaMemory` Contract.
|
||||||
|
*/
|
||||||
|
function deposit(
|
||||||
|
address token,
|
||||||
|
uint amt,
|
||||||
|
uint unitAmt,
|
||||||
|
uint getId,
|
||||||
|
uint setId
|
||||||
|
) external {
|
||||||
|
uint256 _amt = getUint(getId, amt);
|
||||||
|
TokenInterface tokenContract = TokenInterface(token);
|
||||||
|
|
||||||
|
_amt = _amt == uint(-1) ? tokenContract.balanceOf(address(this)) : _amt;
|
||||||
|
uint[4] memory _amts;
|
||||||
|
_amts[uint(getTokenI(token))] = _amt;
|
||||||
|
|
||||||
|
tokenContract.approve(getCurveSwapAddr(), _amt);
|
||||||
|
|
||||||
|
uint _amt18 = convertTo18(tokenContract.decimals(), _amt);
|
||||||
|
uint _slippageAmt = wmul(unitAmt, _amt18);
|
||||||
|
|
||||||
|
TokenInterface curveTokenContract = TokenInterface(getCurveTokenAddr());
|
||||||
|
uint initialCurveBal = curveTokenContract.balanceOf(address(this));
|
||||||
|
|
||||||
|
ICurve(getCurveSwapAddr()).add_liquidity(_amts, _slippageAmt);
|
||||||
|
|
||||||
|
uint finalCurveBal = curveTokenContract.balanceOf(address(this));
|
||||||
|
|
||||||
|
uint mintAmt = sub(finalCurveBal, initialCurveBal);
|
||||||
|
|
||||||
|
setUint(setId, mintAmt);
|
||||||
|
|
||||||
|
emit LogDeposit(token, _amt, mintAmt, getId, setId);
|
||||||
|
bytes32 _eventCode = keccak256("LogDeposit(address,uint256,uint256,uint256,uint256)");
|
||||||
|
bytes memory _eventParam = abi.encode(_amt, mintAmt, getId, setId);
|
||||||
|
emitEvent(_eventCode, _eventParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Withdraw Token.
|
||||||
|
* @param token token address.
|
||||||
|
* @param amt token amount.
|
||||||
|
* @param unitAmt unit amount of curve_amt/token_amt with slippage.
|
||||||
|
* @param getId Get token amount at this ID from `InstaMemory` Contract.
|
||||||
|
* @param setId Set token amount at this ID in `InstaMemory` Contract.
|
||||||
|
*/
|
||||||
|
function withdraw(
|
||||||
|
address token,
|
||||||
|
uint256 amt,
|
||||||
|
uint256 unitAmt,
|
||||||
|
uint getId,
|
||||||
|
uint setId
|
||||||
|
) external {
|
||||||
|
uint _amt = getUint(getId, amt);
|
||||||
|
int128 tokenId = getTokenI(token);
|
||||||
|
|
||||||
|
TokenInterface curveTokenContract = TokenInterface(getCurveTokenAddr());
|
||||||
|
ICurveZap curveZap = ICurveZap(getCurveZapAddr());
|
||||||
|
ICurve curveSwap = ICurve(getCurveSwapAddr());
|
||||||
|
|
||||||
|
uint _curveAmt;
|
||||||
|
uint[4] memory _amts;
|
||||||
|
if (_amt == uint(-1)) {
|
||||||
|
_curveAmt = curveTokenContract.balanceOf(address(this));
|
||||||
|
_amt = curveZap.calc_withdraw_one_coin(_curveAmt, tokenId);
|
||||||
|
_amts[uint(tokenId)] = _amt;
|
||||||
|
} else {
|
||||||
|
_amts[uint(tokenId)] = _amt;
|
||||||
|
_curveAmt = curveSwap.calc_token_amount(_amts, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
curveTokenContract.approve(address(curveSwap), _curveAmt);
|
||||||
|
|
||||||
|
uint _amt18 = convertTo18(TokenInterface(token).decimals(), _amt);
|
||||||
|
uint _slippageAmt = wmul(unitAmt, _amt18);
|
||||||
|
|
||||||
|
curveSwap.remove_liquidity_imbalance(_amts, _slippageAmt);
|
||||||
|
|
||||||
|
setUint(setId, _amt);
|
||||||
|
|
||||||
|
emit LogWithdraw(token, _amt, _curveAmt, getId, setId);
|
||||||
|
bytes32 _eventCode = keccak256("LogWithdraw(address,uint256,uint256,uint256,uint256)");
|
||||||
|
bytes memory _eventParam = abi.encode(token, _amt, _curveAmt, getId, setId);
|
||||||
|
emitEvent(_eventCode, _eventParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
contract ConnectCurve is CurveProtocol {
|
||||||
|
string public name = "Curve-susd-v1";
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
const Connector = artifacts.require("MockProtocol"); // Change the Connector name while deploying.
|
const Connector = artifacts.require("CurveProtocol"); // Change the Connector name while deploying.
|
||||||
|
|
||||||
module.exports = function(deployer) {
|
module.exports = function(deployer) {
|
||||||
deployer.deploy(Connector);
|
deployer.deploy(Connector);
|
||||||
|
|
3748
package-lock.json
generated
3748
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -22,17 +22,20 @@
|
||||||
"homepage": "https://github.com/InstaDApp/dsa-connectors#readme",
|
"homepage": "https://github.com/InstaDApp/dsa-connectors#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@truffle/artifactor": "^4.0.45",
|
"@truffle/artifactor": "^4.0.45",
|
||||||
|
"chai": "^4.2.0",
|
||||||
|
"chalk": "^4.0.0",
|
||||||
"dotenv": "^7.0.0",
|
"dotenv": "^7.0.0",
|
||||||
"ethereumjs-abi": "^0.6.8",
|
"ethereumjs-abi": "^0.6.8",
|
||||||
|
"minimist": "^1.2.5",
|
||||||
|
"openzeppelin-test-helpers": "^0.5.1",
|
||||||
"solc": "^0.6.0",
|
"solc": "^0.6.0",
|
||||||
"truffle-assertions": "^0.9.2",
|
"truffle-assertions": "^0.9.2",
|
||||||
"truffle-hdwallet-provider": "^1.0.17",
|
"truffle-hdwallet-provider": "^1.0.17",
|
||||||
"truffle-plugin-verify": "^0.3.10",
|
"truffle-plugin-verify": "^0.3.10",
|
||||||
"truffle-verify": "^1.0.8",
|
"truffle-verify": "^1.0.8"
|
||||||
"minimist": "^1.2.5",
|
|
||||||
"chalk": "^4.0.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"chai-bn": "^0.2.1",
|
||||||
"sol-merger": "^2.0.1",
|
"sol-merger": "^2.0.1",
|
||||||
"solidity-coverage": "0.5.11",
|
"solidity-coverage": "0.5.11",
|
||||||
"solium": "1.2.3"
|
"solium": "1.2.3"
|
||||||
|
|
18
tenderly.yaml
Normal file
18
tenderly.yaml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
account_id: ""
|
||||||
|
exports:
|
||||||
|
ganache:
|
||||||
|
project_slug: dsa
|
||||||
|
rpc_address: 127.0.0.1:8545
|
||||||
|
protocol: ""
|
||||||
|
forked_network: Mainnet
|
||||||
|
chain_config:
|
||||||
|
homestead_block: 0
|
||||||
|
eip150_block: 0
|
||||||
|
eip150_hash: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
eip155_block: 0
|
||||||
|
eip158_block: 0
|
||||||
|
byzantium_block: 0
|
||||||
|
constantinople_block: 0
|
||||||
|
petersburg_block: 0
|
||||||
|
istanbul_block: 0
|
||||||
|
project_slug: ""
|
122
test/CurveProtocol.js
Normal file
122
test/CurveProtocol.js
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
const CurveProtocol = artifacts.require('CurveProtocol')
|
||||||
|
const daiABI = require('./abi/dai');
|
||||||
|
const erc20 = require('./abi/erc20')
|
||||||
|
const swap_abi = require('./abi/swap')
|
||||||
|
const { ether, balance } = require('openzeppelin-test-helpers');
|
||||||
|
|
||||||
|
const BN = require('bn.js')
|
||||||
|
|
||||||
|
const chai = require('chai')
|
||||||
|
const expect = chai.expect
|
||||||
|
chai.use(require('chai-bn')(BN));
|
||||||
|
|
||||||
|
// userAddress must be unlocked using --unlock ADDRESS
|
||||||
|
const userAddress = '0x9eb7f2591ed42dee9315b6e2aaf21ba85ea69f8c';
|
||||||
|
const daiAddress = '0x6b175474e89094c44da98b954eedeac495271d0f';
|
||||||
|
const daiContract = new web3.eth.Contract(daiABI, daiAddress);
|
||||||
|
|
||||||
|
const usdcAddress = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
|
||||||
|
const usdcContract = new web3.eth.Contract(erc20, usdcAddress);
|
||||||
|
|
||||||
|
const swap = '0xA5407eAE9Ba41422680e2e00537571bcC53efBfD'
|
||||||
|
const swapContract = new web3.eth.Contract(swap_abi, swap)
|
||||||
|
|
||||||
|
const swapToken = '0xC25a3A3b969415c80451098fa907EC722572917F'
|
||||||
|
const tokenContract = new web3.eth.Contract(erc20, swapToken)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
contract('Curve Protocol', async accounts => {
|
||||||
|
|
||||||
|
|
||||||
|
it('should send ether to the DAI address', async () => {
|
||||||
|
let account = accounts[0]
|
||||||
|
let contract = await CurveProtocol.deployed()
|
||||||
|
// Send 0.1 eth to userAddress to have gas to send an ERC20 tx.
|
||||||
|
await web3.eth.sendTransaction({
|
||||||
|
from: accounts[0],
|
||||||
|
to: userAddress,
|
||||||
|
value: ether('0.1')
|
||||||
|
});
|
||||||
|
const ethBalance = await balance.current(userAddress);
|
||||||
|
expect(+ethBalance).to.be.at.least(+ether('0.1'))
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should transfer DAI to CurveProtocol', async () => {
|
||||||
|
let account = accounts[0]
|
||||||
|
let contract = await CurveProtocol.deployed()
|
||||||
|
// Get 100 DAI for first 5 accounts
|
||||||
|
// daiAddress is passed to ganache-cli with flag `--unlock`
|
||||||
|
// so we can use the `transfer` method
|
||||||
|
await daiContract.methods
|
||||||
|
.transfer(contract.address, ether('100').toString())
|
||||||
|
.send({ from: userAddress, gasLimit: 800000 });
|
||||||
|
const daiBalance = await daiContract.methods.balanceOf(contract.address).call();
|
||||||
|
expect(+daiBalance).to.be.at.least(+ether('100'))
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should approve DAI to CurveProtocol', async() => {
|
||||||
|
let account = accounts[0]
|
||||||
|
let contract = await CurveProtocol.deployed()
|
||||||
|
|
||||||
|
await daiContract.methods
|
||||||
|
.approve(contract.address, ether('100').toString())
|
||||||
|
.send({ from: account, gasLimit: 800000 });
|
||||||
|
const daiAllowance = await daiContract.methods.allowance(account, contract.address).call()
|
||||||
|
expect(+daiAllowance).to.be.at.least(+ether('100'))
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should exchange', async () => {
|
||||||
|
let account = accounts[0]
|
||||||
|
let contract = await CurveProtocol.deployed()
|
||||||
|
|
||||||
|
// Get 100 DAI for first 5 accounts
|
||||||
|
let get_dy = await contract.get_dy.call(0, 1, ether('1').toString())
|
||||||
|
let min_dy = +get_dy * 0.99
|
||||||
|
let receipt = await contract.exchange(0, 1, ether('1').toString(), 1, { from: account })
|
||||||
|
let buyAmount = receipt.logs[0].args.buyAmount.toString()
|
||||||
|
expect(+buyAmount).to.be.at.least(min_dy);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add liquidity', async () => {
|
||||||
|
let account = accounts[0]
|
||||||
|
let contract = await CurveProtocol.deployed()
|
||||||
|
|
||||||
|
let amounts = [ether('1').toString(), 0, 0, 0]
|
||||||
|
let token_amount = await contract.calc_token_amount.call(amounts, true)
|
||||||
|
|
||||||
|
let receipt = await contract.add_liquidity(amounts, 1, { from: account })
|
||||||
|
let mintAmount = receipt.logs[0].args.mintAmount.toString()
|
||||||
|
expect(+mintAmount).to.be.at.least(+mintAmount)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should remove liquidity imbalance', async () => {
|
||||||
|
let account = accounts[0]
|
||||||
|
let contract = await CurveProtocol.deployed()
|
||||||
|
|
||||||
|
let tokenBalance = await tokenContract.methods.balanceOf(contract.address).call()
|
||||||
|
let receipt = await contract.remove_liquidity_imbalance(["100000000000", 0, 0, 0], { from: account })
|
||||||
|
let burnAmount = receipt.logs[0].args.burnAmount.toString()
|
||||||
|
let tokenBalanceAfter = await tokenContract.methods.balanceOf(contract.address).call()
|
||||||
|
|
||||||
|
//weird Ganache errors sometimes "cannot decode event"
|
||||||
|
console.log(+tokenBalance, +tokenBalanceAfter, +burnAmount)
|
||||||
|
//expect(BN(tokenBalance)).to.be.a.bignumber.equal(BN(tokenBalanceAfter).add(burnAmount))
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should remove liquidity in one coin', async() => {
|
||||||
|
let account = accounts[0]
|
||||||
|
let contract = await CurveProtocol.deployed()
|
||||||
|
|
||||||
|
let daiBalance = await daiContract.methods.balanceOf(contract.address).call()
|
||||||
|
let receipt = await contract.remove_liquidity_one_coin("100000000000", 0, 1, { from: account })
|
||||||
|
let withdrawnAmount = receipt.logs[0].args.withdrawnAmount.toString()
|
||||||
|
let daiBalanceAfter = await daiContract.methods.balanceOf(contract.address).call()
|
||||||
|
|
||||||
|
//weird Ganache errors sometimes "cannot decode event"
|
||||||
|
console.log(+daiBalance, +daiBalanceAfter, +withdrawnAmount)
|
||||||
|
//expect(BN(daiBalance)).to.be.a.bignumber.equal(BN(daiBalanceAfter).sub(withdrawnAmount));
|
||||||
|
})
|
||||||
|
});
|
325
test/abi/dai.js
Normal file
325
test/abi/dai.js
Normal file
|
@ -0,0 +1,325 @@
|
||||||
|
module.exports = [
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [],
|
||||||
|
name: 'name',
|
||||||
|
outputs: [{ name: '', type: 'bytes32' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [],
|
||||||
|
name: 'stop',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'guy', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'approve',
|
||||||
|
outputs: [{ name: '', type: 'bool' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [{ name: 'owner_', type: 'address' }],
|
||||||
|
name: 'setOwner',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [],
|
||||||
|
name: 'totalSupply',
|
||||||
|
outputs: [{ name: '', type: 'uint256' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'src', type: 'address' },
|
||||||
|
{ name: 'dst', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'transferFrom',
|
||||||
|
outputs: [{ name: '', type: 'bool' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [],
|
||||||
|
name: 'decimals',
|
||||||
|
outputs: [{ name: '', type: 'uint256' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'guy', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'mint',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [{ name: 'wad', type: 'uint256' }],
|
||||||
|
name: 'burn',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [{ name: 'name_', type: 'bytes32' }],
|
||||||
|
name: 'setName',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [{ name: 'src', type: 'address' }],
|
||||||
|
name: 'balanceOf',
|
||||||
|
outputs: [{ name: '', type: 'uint256' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [],
|
||||||
|
name: 'stopped',
|
||||||
|
outputs: [{ name: '', type: 'bool' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [{ name: 'authority_', type: 'address' }],
|
||||||
|
name: 'setAuthority',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [],
|
||||||
|
name: 'owner',
|
||||||
|
outputs: [{ name: '', type: 'address' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [],
|
||||||
|
name: 'symbol',
|
||||||
|
outputs: [{ name: '', type: 'bytes32' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'guy', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'burn',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [{ name: 'wad', type: 'uint256' }],
|
||||||
|
name: 'mint',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'dst', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'transfer',
|
||||||
|
outputs: [{ name: '', type: 'bool' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'dst', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'push',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'src', type: 'address' },
|
||||||
|
{ name: 'dst', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'move',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [],
|
||||||
|
name: 'start',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [],
|
||||||
|
name: 'authority',
|
||||||
|
outputs: [{ name: '', type: 'address' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [{ name: 'guy', type: 'address' }],
|
||||||
|
name: 'approve',
|
||||||
|
outputs: [{ name: '', type: 'bool' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'src', type: 'address' },
|
||||||
|
{ name: 'guy', type: 'address' }
|
||||||
|
],
|
||||||
|
name: 'allowance',
|
||||||
|
outputs: [{ name: '', type: 'uint256' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'src', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'pull',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
inputs: [{ name: 'symbol_', type: 'bytes32' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'constructor'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
anonymous: false,
|
||||||
|
inputs: [
|
||||||
|
{ indexed: true, name: 'guy', type: 'address' },
|
||||||
|
{ indexed: false, name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'Mint',
|
||||||
|
type: 'event'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
anonymous: false,
|
||||||
|
inputs: [
|
||||||
|
{ indexed: true, name: 'guy', type: 'address' },
|
||||||
|
{ indexed: false, name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'Burn',
|
||||||
|
type: 'event'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
anonymous: false,
|
||||||
|
inputs: [{ indexed: true, name: 'authority', type: 'address' }],
|
||||||
|
name: 'LogSetAuthority',
|
||||||
|
type: 'event'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
anonymous: false,
|
||||||
|
inputs: [{ indexed: true, name: 'owner', type: 'address' }],
|
||||||
|
name: 'LogSetOwner',
|
||||||
|
type: 'event'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
anonymous: true,
|
||||||
|
inputs: [
|
||||||
|
{ indexed: true, name: 'sig', type: 'bytes4' },
|
||||||
|
{ indexed: true, name: 'guy', type: 'address' },
|
||||||
|
{ indexed: true, name: 'foo', type: 'bytes32' },
|
||||||
|
{ indexed: true, name: 'bar', type: 'bytes32' },
|
||||||
|
{ indexed: false, name: 'wad', type: 'uint256' },
|
||||||
|
{ indexed: false, name: 'fax', type: 'bytes' }
|
||||||
|
],
|
||||||
|
name: 'LogNote',
|
||||||
|
type: 'event'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
anonymous: false,
|
||||||
|
inputs: [
|
||||||
|
{ indexed: true, name: 'src', type: 'address' },
|
||||||
|
{ indexed: true, name: 'guy', type: 'address' },
|
||||||
|
{ indexed: false, name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'Approval',
|
||||||
|
type: 'event'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
anonymous: false,
|
||||||
|
inputs: [
|
||||||
|
{ indexed: true, name: 'src', type: 'address' },
|
||||||
|
{ indexed: true, name: 'dst', type: 'address' },
|
||||||
|
{ indexed: false, name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'Transfer',
|
||||||
|
type: 'event'
|
||||||
|
}
|
||||||
|
];
|
325
test/abi/erc20.js
Normal file
325
test/abi/erc20.js
Normal file
|
@ -0,0 +1,325 @@
|
||||||
|
module.exports = [
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [],
|
||||||
|
name: 'name',
|
||||||
|
outputs: [{ name: '', type: 'bytes32' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [],
|
||||||
|
name: 'stop',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'guy', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'approve',
|
||||||
|
outputs: [{ name: '', type: 'bool' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [{ name: 'owner_', type: 'address' }],
|
||||||
|
name: 'setOwner',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [],
|
||||||
|
name: 'totalSupply',
|
||||||
|
outputs: [{ name: '', type: 'uint256' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'src', type: 'address' },
|
||||||
|
{ name: 'dst', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'transferFrom',
|
||||||
|
outputs: [{ name: '', type: 'bool' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [],
|
||||||
|
name: 'decimals',
|
||||||
|
outputs: [{ name: '', type: 'uint256' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'guy', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'mint',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [{ name: 'wad', type: 'uint256' }],
|
||||||
|
name: 'burn',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [{ name: 'name_', type: 'bytes32' }],
|
||||||
|
name: 'setName',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [{ name: 'src', type: 'address' }],
|
||||||
|
name: 'balanceOf',
|
||||||
|
outputs: [{ name: '', type: 'uint256' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [],
|
||||||
|
name: 'stopped',
|
||||||
|
outputs: [{ name: '', type: 'bool' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [{ name: 'authority_', type: 'address' }],
|
||||||
|
name: 'setAuthority',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [],
|
||||||
|
name: 'owner',
|
||||||
|
outputs: [{ name: '', type: 'address' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [],
|
||||||
|
name: 'symbol',
|
||||||
|
outputs: [{ name: '', type: 'bytes32' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'guy', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'burn',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [{ name: 'wad', type: 'uint256' }],
|
||||||
|
name: 'mint',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'dst', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'transfer',
|
||||||
|
outputs: [{ name: '', type: 'bool' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'dst', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'push',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'src', type: 'address' },
|
||||||
|
{ name: 'dst', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'move',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [],
|
||||||
|
name: 'start',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [],
|
||||||
|
name: 'authority',
|
||||||
|
outputs: [{ name: '', type: 'address' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [{ name: 'guy', type: 'address' }],
|
||||||
|
name: 'approve',
|
||||||
|
outputs: [{ name: '', type: 'bool' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: true,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'src', type: 'address' },
|
||||||
|
{ name: 'guy', type: 'address' }
|
||||||
|
],
|
||||||
|
name: 'allowance',
|
||||||
|
outputs: [{ name: '', type: 'uint256' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'view',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
constant: false,
|
||||||
|
inputs: [
|
||||||
|
{ name: 'src', type: 'address' },
|
||||||
|
{ name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'pull',
|
||||||
|
outputs: [],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
inputs: [{ name: 'symbol_', type: 'bytes32' }],
|
||||||
|
payable: false,
|
||||||
|
stateMutability: 'nonpayable',
|
||||||
|
type: 'constructor'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
anonymous: false,
|
||||||
|
inputs: [
|
||||||
|
{ indexed: true, name: 'guy', type: 'address' },
|
||||||
|
{ indexed: false, name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'Mint',
|
||||||
|
type: 'event'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
anonymous: false,
|
||||||
|
inputs: [
|
||||||
|
{ indexed: true, name: 'guy', type: 'address' },
|
||||||
|
{ indexed: false, name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'Burn',
|
||||||
|
type: 'event'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
anonymous: false,
|
||||||
|
inputs: [{ indexed: true, name: 'authority', type: 'address' }],
|
||||||
|
name: 'LogSetAuthority',
|
||||||
|
type: 'event'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
anonymous: false,
|
||||||
|
inputs: [{ indexed: true, name: 'owner', type: 'address' }],
|
||||||
|
name: 'LogSetOwner',
|
||||||
|
type: 'event'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
anonymous: true,
|
||||||
|
inputs: [
|
||||||
|
{ indexed: true, name: 'sig', type: 'bytes4' },
|
||||||
|
{ indexed: true, name: 'guy', type: 'address' },
|
||||||
|
{ indexed: true, name: 'foo', type: 'bytes32' },
|
||||||
|
{ indexed: true, name: 'bar', type: 'bytes32' },
|
||||||
|
{ indexed: false, name: 'wad', type: 'uint256' },
|
||||||
|
{ indexed: false, name: 'fax', type: 'bytes' }
|
||||||
|
],
|
||||||
|
name: 'LogNote',
|
||||||
|
type: 'event'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
anonymous: false,
|
||||||
|
inputs: [
|
||||||
|
{ indexed: true, name: 'src', type: 'address' },
|
||||||
|
{ indexed: true, name: 'guy', type: 'address' },
|
||||||
|
{ indexed: false, name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'Approval',
|
||||||
|
type: 'event'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
anonymous: false,
|
||||||
|
inputs: [
|
||||||
|
{ indexed: true, name: 'src', type: 'address' },
|
||||||
|
{ indexed: true, name: 'dst', type: 'address' },
|
||||||
|
{ indexed: false, name: 'wad', type: 'uint256' }
|
||||||
|
],
|
||||||
|
name: 'Transfer',
|
||||||
|
type: 'event'
|
||||||
|
}
|
||||||
|
];
|
760
test/abi/swap.js
Normal file
760
test/abi/swap.js
Normal file
|
@ -0,0 +1,760 @@
|
||||||
|
module.exports = [
|
||||||
|
{
|
||||||
|
"name": "TokenExchange",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "address",
|
||||||
|
"name": "buyer",
|
||||||
|
"indexed": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "sold_id",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "tokens_sold",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "bought_id",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "tokens_bought",
|
||||||
|
"indexed": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"anonymous": false,
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "TokenExchangeUnderlying",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "address",
|
||||||
|
"name": "buyer",
|
||||||
|
"indexed": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "sold_id",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "tokens_sold",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "bought_id",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "tokens_bought",
|
||||||
|
"indexed": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"anonymous": false,
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "AddLiquidity",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "address",
|
||||||
|
"name": "provider",
|
||||||
|
"indexed": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256[4]",
|
||||||
|
"name": "token_amounts",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256[4]",
|
||||||
|
"name": "fees",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "invariant",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "token_supply",
|
||||||
|
"indexed": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"anonymous": false,
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "RemoveLiquidity",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "address",
|
||||||
|
"name": "provider",
|
||||||
|
"indexed": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256[4]",
|
||||||
|
"name": "token_amounts",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256[4]",
|
||||||
|
"name": "fees",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "token_supply",
|
||||||
|
"indexed": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"anonymous": false,
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "RemoveLiquidityImbalance",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "address",
|
||||||
|
"name": "provider",
|
||||||
|
"indexed": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256[4]",
|
||||||
|
"name": "token_amounts",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256[4]",
|
||||||
|
"name": "fees",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "invariant",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "token_supply",
|
||||||
|
"indexed": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"anonymous": false,
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CommitNewAdmin",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "deadline",
|
||||||
|
"indexed": true,
|
||||||
|
"unit": "sec"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "address",
|
||||||
|
"name": "admin",
|
||||||
|
"indexed": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"anonymous": false,
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "NewAdmin",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "address",
|
||||||
|
"name": "admin",
|
||||||
|
"indexed": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"anonymous": false,
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CommitNewParameters",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "deadline",
|
||||||
|
"indexed": true,
|
||||||
|
"unit": "sec"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "A",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "fee",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "admin_fee",
|
||||||
|
"indexed": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"anonymous": false,
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "NewParameters",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "A",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "fee",
|
||||||
|
"indexed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "admin_fee",
|
||||||
|
"indexed": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"anonymous": false,
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "address[4]",
|
||||||
|
"name": "_coins"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "address[4]",
|
||||||
|
"name": "_underlying_coins"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "address",
|
||||||
|
"name": "_pool_token"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "_A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "_fee"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "constructor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "get_virtual_price",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 1570535
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "calc_token_amount",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256[4]",
|
||||||
|
"name": "amounts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bool",
|
||||||
|
"name": "deposit"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 6103471
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "add_liquidity",
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256[4]",
|
||||||
|
"name": "amounts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "min_mint_amount"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 9331701
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "get_dy",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "i"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "j"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "dx"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 3489637
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "get_dy_underlying",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "i"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "j"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "dx"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 3489467
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "exchange",
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "i"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "j"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "dx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "min_dy"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 7034253
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "exchange_underlying",
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "i"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "j"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "dx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "min_dy"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 7050488
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "remove_liquidity",
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "_amount"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256[4]",
|
||||||
|
"name": "min_amounts"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 241191
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "remove_liquidity_imbalance",
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256[4]",
|
||||||
|
"name": "amounts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "max_burn_amount"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 9330864
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "commit_new_parameters",
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "amplification"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "new_fee"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": "new_admin_fee"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 146045
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "apply_new_parameters",
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 133452
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "revert_new_parameters",
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 21775
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "commit_transfer_ownership",
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "address",
|
||||||
|
"name": "_owner"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 74452
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "apply_transfer_ownership",
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 60508
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "revert_transfer_ownership",
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 21865
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "withdraw_admin_fees",
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 23448
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "kill_me",
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 37818
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "unkill_me",
|
||||||
|
"outputs": [],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": false,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 21955
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "coins",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "address",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "arg0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 2130
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "underlying_coins",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "address",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "arg0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 2160
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "balances",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "int128",
|
||||||
|
"name": "arg0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 2190
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "A",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 2021
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fee",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 2051
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "admin_fee",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 2081
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "owner",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "address",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 2111
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "admin_actions_deadline",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"unit": "sec",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 2141
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "transfer_ownership_deadline",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"unit": "sec",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 2171
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "future_A",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 2201
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "future_fee",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 2231
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "future_admin_fee",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "uint256",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 2261
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "future_owner",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"type": "address",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [],
|
||||||
|
"constant": true,
|
||||||
|
"payable": false,
|
||||||
|
"type": "function",
|
||||||
|
"gas": 2291
|
||||||
|
}
|
||||||
|
]
|
54
test/dai.js
Normal file
54
test/dai.js
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
// const { BN, ether, balance } = require('openzeppelin-test-helpers');
|
||||||
|
// const { expect } = require('chai');
|
||||||
|
// const { asyncForEach } = require('./utils');
|
||||||
|
|
||||||
|
// // ABI
|
||||||
|
// const daiABI = require('./abi/dai');
|
||||||
|
|
||||||
|
// // userAddress must be unlocked using --unlock ADDRESS
|
||||||
|
// const userAddress = '0x9eb7f2591ed42dee9315b6e2aaf21ba85ea69f8c';
|
||||||
|
// const daiAddress = '0x6b175474e89094c44da98b954eedeac495271d0f';
|
||||||
|
// const daiContract = new web3.eth.Contract(daiABI, daiAddress);
|
||||||
|
|
||||||
|
// contract('Truffle Mint DAI', async accounts => {
|
||||||
|
// it('should send ether to the DAI address', async () => {
|
||||||
|
// // Send 0.1 eth to userAddress to have gas to send an ERC20 tx.
|
||||||
|
// await web3.eth.sendTransaction({
|
||||||
|
// from: accounts[0],
|
||||||
|
// to: userAddress,
|
||||||
|
// value: ether('0.1')
|
||||||
|
// });
|
||||||
|
// const ethBalance = await balance.current(userAddress);
|
||||||
|
// expect(new BN(ethBalance)).to.be.bignumber.least(new BN(ether('0.1')));
|
||||||
|
// });
|
||||||
|
|
||||||
|
// it('should mint DAI for our first 5 generated accounts', async () => {
|
||||||
|
// // Get 100 DAI for first 5 accounts
|
||||||
|
// await asyncForEach(accounts.slice(0, 5), async account => {
|
||||||
|
// // daiAddress is passed to ganache-cli with flag `--unlock`
|
||||||
|
// // so we can use the `transfer` method
|
||||||
|
// await daiContract.methods
|
||||||
|
// .transfer(account, ether('100').toString())
|
||||||
|
// .send({ from: userAddress, gasLimit: 800000 });
|
||||||
|
// const daiBalance = await daiContract.methods.balanceOf(account).call();
|
||||||
|
// expect(new BN(daiBalance)).to.be.bignumber.least(ether('100'));
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
// contract('Truffle Approve DAI', async accounts => {
|
||||||
|
|
||||||
|
// it('should mint DAI for our first 5 generated accounts', async () => {
|
||||||
|
// // Get 100 DAI for first 5 accounts
|
||||||
|
// await asyncForEach(accounts.slice(0, 5), async account => {
|
||||||
|
// // daiAddress is passed to ganache-cli with flag `--unlock`
|
||||||
|
// // so we can use the `transfer` method
|
||||||
|
// await daiContract.methods
|
||||||
|
// .approve('0xDCa32D06633e49F4731cF473587691355F24476a', "1000000000000000000000000000")
|
||||||
|
// .send({ from: account, gasLimit: 800000 });
|
||||||
|
|
||||||
|
// console.log(await daiContract.methods.allowance(account, '0xA5407eAE9Ba41422680e2e00537571bcC53efBfD').call())
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// });
|
5
test/utils.js
Normal file
5
test/utils.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
module.exports.asyncForEach = async (array, callback) => {
|
||||||
|
for (let index = 0; index < array.length; index++) {
|
||||||
|
await callback(array[index], index, array);
|
||||||
|
}
|
||||||
|
};
|
|
@ -51,7 +51,7 @@ module.exports = {
|
||||||
//
|
//
|
||||||
development: {
|
development: {
|
||||||
host: "127.0.0.1", // Localhost (default: none)
|
host: "127.0.0.1", // Localhost (default: none)
|
||||||
port: 9545, // Standard Ethereum port (default: none)
|
port: 8545, // Standard Ethereum port (default: none)
|
||||||
network_id: "*", // Any network (default: none)
|
network_id: "*", // Any network (default: none)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user