Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #13 from keep-network/helpers
Browse files Browse the repository at this point in the history
Touchups

## Add `getSignerFee` helper to Deposit. 

This line in tbtc-dapp[1] fails with the new web3 tbtc.js. The new
method call would be deposit.methods.signerFee().call(), although
the line above uses a helper - I figure we should use one here too.

## Convert redemptionCost BN to string

I found this while investigating a redemption bug reported in Discord.
I didn't test this less-travelled code path of redemption.

[1] https://github.com/keep-network/tbtc-dapp/blob/b3cfbe418cf532a3bd2747ffce1740bc41c82650/src/sagas/deposit.js#L78
  • Loading branch information
Shadowfiend authored Mar 31, 2020
2 parents b19cef3 + 9818bca commit 72e4699
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Deposit.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,14 @@ export default class Deposit {
return toBN(await this.contract.methods.lotSizeSatoshis().call())
}

/**
* Get the signer fee, to be paid at redemption.
* @return {Promise<BN>} A promise to the signer fee for this deposit, in TBTC.
*/
async getSignerFeeTBTC() {
return toBN(await this.contract.methods.signerFee().call())
}

/**
* Returns a promise that resolves to the Bitcoin address for the wallet
* backing this deposit. May take an extended amount of time if this deposit
Expand Down Expand Up @@ -715,7 +723,7 @@ export default class Deposit {
} else {
console.debug(`Approving transfer of ${redemptionCost} to the deposit...`)
this.factory.tokenContract.methods
.approve(this.address, redemptionCost)
.approve(this.address, redemptionCost.toString())
.send()

console.debug(`Initiating redemption from deposit ${this.address}...`)
Expand Down

0 comments on commit 72e4699

Please sign in to comment.