mirror of
https://github.com/vacp2p/swap-contracts-module.git
synced 2025-02-28 02:40:39 +00:00
Return JSON string for setupSwap
This commit is contained in:
parent
feb07ef01f
commit
609ed987ae
@ -25,10 +25,9 @@ task("balance", "Prints an account's balance")
|
||||
|
||||
task("setupSwap", "Setup Swap")
|
||||
.setAction(async taskArgs => {
|
||||
await swap.setupSwap();
|
||||
var resp = await swap.setupSwap();
|
||||
|
||||
// TODO Should return JSON
|
||||
console.log("NYI")
|
||||
console.log(JSON.stringify(resp));
|
||||
//console.log(web3.utils.fromWei(balance, "ether"), "ETH");
|
||||
});
|
||||
|
||||
|
@ -2,7 +2,10 @@ const hre = require("hardhat");
|
||||
let swap = require("../src/setup-swap");
|
||||
|
||||
async function main() {
|
||||
await swap.setupSwap();
|
||||
var resp = await swap.setupSwap();
|
||||
|
||||
console.log("JSON resp");
|
||||
console.log(JSON.stringify(resp));
|
||||
}
|
||||
|
||||
// We recommend this pattern to be able to use async/await everywhere
|
||||
|
@ -48,15 +48,25 @@ async function setupSwap() {
|
||||
var aliceSwapBalance = (await erc20contract.balanceOf(aliceSwapAddress)).toNumber();
|
||||
|
||||
// Print stuff
|
||||
console.log("ERC20:", erc20.address);
|
||||
console.log("SimpleSwapFactory:", simpleSwapFactory.address);
|
||||
console.log("Alice address:", aliceAddress);
|
||||
console.log("Bob address:", bobAddress);
|
||||
console.log("AliceSwapAddress:", aliceSwapAddress)
|
||||
console.log("BobSwapAddress:", bobSwapAddress)
|
||||
console.log("Alice ERC20 balance:", aliceBalance);
|
||||
console.log("Bob ERC20 balance:", bobBalance);
|
||||
// console.log("ERC20:", erc20.address);
|
||||
// console.log("SimpleSwapFactory:", simpleSwapFactory.address);
|
||||
// console.log("Alice address:", aliceAddress);
|
||||
// console.log("Bob address:", bobAddress);
|
||||
// console.log("AliceSwapAddress:", aliceSwapAddress)
|
||||
// console.log("BobSwapAddress:", bobSwapAddress)
|
||||
// console.log("Alice ERC20 balance:", aliceBalance);
|
||||
// console.log("Bob ERC20 balance:", bobBalance);
|
||||
// console.log("Alice Swap balance:", aliceSwapBalance);
|
||||
|
||||
var resp = {
|
||||
erc20: erc20.address,
|
||||
aliceAddress: aliceAddress,
|
||||
bobAddress: bobAddress,
|
||||
aliceSwapAddress: aliceSwapAddress,
|
||||
bobSwapAddress: bobSwapAddress
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
module.exports.setupSwap = setupSwap;
|
||||
|
Loading…
x
Reference in New Issue
Block a user