Add deploy swap migration

- Deploy ERC20MinterPauser
- Deploy SimpleSwapFactory
- Deploy SimpleSwap

Note that this is only for one user.
This commit is contained in:
Oskar Thoren 2021-01-19 12:44:41 +08:00
parent f56f460fa1
commit 5b500c5e58
No known key found for this signature in database
GPG Key ID: BDB55C8C0EF29911
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
var {BN, balance, constants, expectEvent} = require("@openzeppelin/test-helpers");
var ERC20PresetMinterPauser = artifacts.require("ERC20PresetMinterPauser");
var SimpleSwapFactory = artifacts.require('./SimpleSwapFactory.sol')
var ERC20SimpleSwap = artifacts.require('./ERC20SimpleSwap.sol')
module.exports = async function(deployer, network, accounts) {
var DEFAULT_HARDDEPOSIT_DECREASE_TIMEOUT = new BN(86400)
// Deploy ERC20 token
await deployer.deploy(ERC20PresetMinterPauser, "TestToken", "TEST", {from: accounts[0]})
var erc20 = await ERC20PresetMinterPauser.deployed()
// Deploy SwapFactory
await deployer.deploy(SimpleSwapFactory, ERC20PresetMinterPauser.address)
var simpleSwapFactory = await SimpleSwapFactory.deployed()
// Deploy Swap
let { logs } = await simpleSwapFactory.deploySimpleSwap(accounts[0], DEFAULT_HARDDEPOSIT_DECREASE_TIMEOUT)
var ERC20SimpleSwapAddress = logs[0].args.contractAddress
console.log("ERC20SimpleSwapAddress ", ERC20SimpleSwapAddress)
}