add log to approval set

This commit is contained in:
Ricardo Guilherme Schmidt 2018-05-31 01:59:31 -03:00 committed by Barry Gitarts
parent 9a56838ad8
commit 832fa1bcc7
1 changed files with 5 additions and 1 deletions

View File

@ -43,14 +43,18 @@ class TokenHandle extends PureComponent {
const { approved } = this.state;
const { methods: { approve }, spender } = this.props;
const isApproved = !!Number(approved);
let amountToApprove = isApproved ? 0 : unlimitedAllowance;
console.log("approve(\""+spender+"\",\"" +amountToApprove +"\")")
approve(
spender,
isApproved ? 0 : unlimitedAllowance
amountToApprove
)
.send()
.then(approval => {
const { events: { Approval: { returnValues: { _value } } } } = approval
this.setState({ ...this.state, approved: _value })
}).catch(err => {
console.log("Approve failed: " + err);
})
}