-
Notifications
You must be signed in to change notification settings - Fork 38
Script Usage Examples
Benjamin Smith edited this page Jul 22, 2019
·
9 revisions
Most, if not all of these commands will require one to run Environment Setup (which registers accounts and tokens on the contract and funds each of the accounts for all the tokens)
truffle migrate
npm run setup
The following example demonstrates usage of many different scripts. Although here they are run with npx truffle exec
they are also part of the node package and can be run with npm run
.
npx truffle exec scripts/deposit.js 1 1 1
npx truffle exec scripts/deposit.js 1 2 1
npx truffle exec scripts/deposit.js 3 2 1
npx truffle exec scripts/mine_blocks.js 20
npx truffle exec scripts/apply_deposits.js 0 0x0
npx truffle exec scripts/apply_deposits.js 1 0x0
npx truffle exec scripts/request_withdraw.js 1 1 1
npx truffle exec scripts/request_withdraw.js 2 1 1
npx truffle exec scripts/request_withdraw.js 1 3 1
npx truffle exec scripts/mine_blocks.js 20
npx truffle exec scripts/apply_withdrawals.js 0 0x0 0x0
npx truffle exec scripts/apply_withdrawals.js 1 0x4c90e21c23e2888ed383b709a30b1249f44f8540a8acf3679d821a1a3f16fbfd 0x0
# [Generic Claims]
npx truffle exec scripts/claim_withdraw.js 1 1 1
npx truffle exec scripts/claim_withdraw.js 1 3 2
# [Invalid: Will fail]
npx truffle exec scripts/claim_withdraw.js 1 1 2
# [Double Claim: Will fail]
npx truffle exec scripts/claim_withdraw.js 1 1 1
Note that script requires arguments -
npm run sell-order 1 2 3 12 12
npm run sell-order 1 3 2 22 20
npm run sell-order 1 1 3 15 10
npm run sell-order 1 1 2 180 15
npm run sell-order 1 2 1 4 52
npm run sell-order 1 3 1 20 280
# Place standing order in current Auction (accountId, buyToken, sellToken, minBuy, maxSell)
truffle exec scripts/standing_order.js 0 1 2 12 12