fix erc721, erc20 test
MODIFY
examples/pos/erc20/approve.js
examples/pos/erc20/approve.js
-const { getMaticPOSClient } = require('../../utils')
+const { pos, from, getMaticPOSClient } = require('../../utils')
-const execute = async () => {
- try {
+const amount = '1000000000000000' // amount in wei
+const erc20TokenOnParent = pos.parent.erc20
+async function execute() {
const maticPOSClient = getMaticPOSClient()
- maticPOSClient.transferERC20Tokens()
- const tx = await maticPOSClient.approveERC20ForDeposit(config.root.DERC20, config.user.amount, {
- from: config.user.address,
- gasPrice: '900000000000',
- gas: '250000',
- })
-
- console.log(tx) // eslint-disable-line
- } catch (e) {
- console.error(e) // eslint-disable-line
- }
+ const result = await maticPOSClient.approveERC20ForDeposit(erc20TokenOnParent, amount, { from })
+ console.log(result)
}
-execute().then(() => process.exit(0))
+
+execute().then(_ => {
+ process.exit(0)
+})

MODIFY
examples/pos/erc20/burn.js
examples/pos/erc20/burn.js
-const config = require('../config')
-const utils = require('../utils')
-const maticPOSClient = utils.getMaticPOSClient()
+const { getMaticPOSClient, pos, from } = require('../../utils')
+
+const amount = '1000000000000000' // amount in wei
+const token = pos.child.erc20
const execute = async () => {
try {
- const tx = await maticPOSClient.burnERC20(config.child.DERC20, config.user.amount, {
- from: config.user.address,
+ const tx = await getMaticPOSClient().burnERC20(token, amount, {
+ from: from,
gasPrice: 900000000000,
gas: 300000,
})

MODIFY
examples/pos/erc20/deposit.js
examples/pos/erc20/deposit.js
-const config = require('../config')
-const utils = require('../utils')
-const maticPOSClient = utils.getMaticPOSClient()
+const { getMaticPOSClient, from, pos } = require('../../utils')
+
+const amount = '1000000000000000' // amount in wei
+const token = pos.parent.erc20
const execute = async () => {
try {
- const tx = await maticPOSClient.depositERC20ForUser(config.root.DERC20, config.user.address, config.user.amount)
+ const tx = await getMaticPOSClient().depositERC20ForUser(token, from, amount)
console.log(tx.transactionHash) // eslint-disable-line
} catch (e) {
console.error(e) // eslint-disable-line

MODIFY
examples/pos/erc20/exit.js
examples/pos/erc20/exit.js
-const utils = require('../utils')
-const maticPOSClient = utils.getMaticPOSClient()
-const config = require('../config')
+const { getMaticPOSClient, from } = require('../../utils')
const burnHash = '0xbadbf10a33ba5ae48cfa1660e011eb15bf927773610ace9466c71d14749d4132'
const execute = async () => {
try {
- const tx = await maticPOSClient.exitERC20(burnHash, {
- from: config.user.address,
+ const tx = await getMaticPOSClient().exitERC20(burnHash, {
+ from: from,
gasPrice: 900000000000,
gas: 400000,
})

MODIFY
examples/pos/erc721/approve.js
examples/pos/erc721/approve.js
-const config = require('../config')
-const utils = require('../utils')
-const maticPOSClient = utils.getMaticPOSClient()
+const { getMaticPOSClient, pos, from } = require('../../utils')
+
+const token = pos.parent.erc721
+const tokenId = '60399350241383852757821046101235634991156913804166740995010931519407953501076'
const execute = async () => {
try {
- const tx = await maticPOSClient.approveERC721TokensForDeposit(config.root.DERC721, config.user.tokenId, {
- from: config.user.address,
+ const tx = await getMaticPOSClient().approveERC721ForDeposit(token, tokenId, {
+ from: from,
gasPrice: '500000000000',
gas: 2500000,
})

MODIFY
examples/pos/erc721/burn.js
examples/pos/erc721/burn.js
-const config = require('../config')
-const utils = require('../utils')
-const maticPOSClient = utils.getMaticPOSClient()
+const { getMaticPOSClient, pos } = require('../../utils')
+
+const token = pos.child.erc721
+const tokenId = '60399350241383852757821046101235634991156913804166740995010931519407953501076'
const execute = async () => {
try {
- const tx = await maticPOSClient.burnERC721(config.child.DERC721, config.user.tokenId)
+ const tx = await getMaticPOSClient().burnERC721(token, tokenId)
console.log(tx.transactionHash) // eslint-disable-line
} catch (e) {
console.error(e) // eslint-disable-line

MODIFY
examples/pos/erc721/deposit.js
examples/pos/erc721/deposit.js
-const config = require('../config')
-const utils = require('../utils')
-const maticPOSClient = utils.getMaticPOSClient()
+const { getMaticPOSClient, pos, from } = require('../../utils')
+
+const token = pos.child.erc721
+const tokenId = '12'
const execute = async () => {
try {
- const tx = await maticPOSClient.depositERC721ForUser(config.root.DERC721, config.user.address, config.user.tokenId)
+ const tx = await getMaticPOSClient().depositERC721ForUser(token, from, tokenId)
console.log(tx.transactionHash) // eslint-disable-line
} catch (e) {
console.error(e) // eslint-disable-line

MODIFY
examples/pos/erc721/exit.js
examples/pos/erc721/exit.js
-const utils = require('../utils')
-const maticPOSClient = utils.getMaticPOSClient()
+const { getMaticPOSClient } = require('../../utils')
const burnHash = '0xbadbf10a33ba5ae48cfa1660e011eb15bf927773610ace9466c71d14749d4132'
const execute = async () => {
try {
- const tx = await maticPOSClient.exitERC721(burnHash)
+ const tx = await getMaticPOSClient().exitERC721(burnHash)
console.log(tx.transactionHash) // eslint-disable-line
} catch (e) {
console.error(e) // eslint-disable-line

fix erc721, erc20 test