Script calls requestRedemption, and catches errors
// DEPOSIT_ADDRESS - Address of Deposit contract instance
// OUTPUT_VALUE - value to be redeemed into BTC
// REQUESTER_PKH - public key hash of the user requesting redemption
-
// truffle exec 4_redemption.js 0xc536685ca46654f0e8e250382132b583d25e7fdd2e 0x1111111100000000 0x3333333333333333333333333333333333333333
const Deposit = artifacts.require('./Deposit.sol')
@@ -15,9 +14,9 @@ const TBTCSystem = artifacts.require('./TBTCSystem.sol')
const TBTCToken = artifacts.require('./TBTCToken.sol')
module.exports = async function() {
- const outputValue = process.argv[3]
- const requesterPKH = process.argv[4]
- const depositAddress = process.argv[5]
+ const depositAddress = process.argv[4]
+ const requesterPKH = process.argv[5]
+ const outputValue = process.argv[6]
/* eslint-disable no-unused-vars */
let deposit
@@ -37,7 +36,10 @@ module.exports = async function() {
await deposit.requestRedemption(
outputValue, // _outputValueBytes
requesterPKH, // _requesterPKH
- )
+ ).catch((err) => {
+ console.error(`requesting redemption failed: ${err}`)
+ process.exit(1)
+ })
process.exit()
}
