Skip to content

Commit

Permalink
Fix gas estimates for ANT, aDAI, and cDAI
Browse files Browse the repository at this point in the history
  • Loading branch information
mds1 committed Jun 19, 2020
1 parent 6cec988 commit 5e621b9
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions app/assets/v2/js/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,22 @@ Vue.component('grants-cart', {
// donation (i.e. one item in the cart). Because gas prices go down with batched
// transactions, whereas this assumes they're constant, this gives us a conservative estimate
const gasLimit = this.donationInputs.reduce((accumulator, currentValue) => {
return currentValue.token === ETH_ADDRESS
? accumulator + 50000// ETH donation gas estimate
: accumulator + 100000; // token donation gas estimate
const tokenAddr = currentValue.token.toLowerCase();

if (currentValue.token === ETH_ADDRESS) {
return accumulator + 50000; // ETH donation gas estimate

} else if (tokenAddr === '0x960b236A07cf122663c4303350609A66A7B288C0'.toLowerCase()) {
return accumulator + 170000; // ANT donation gas estimate

} else if (tokenAddr === '0xfC1E690f61EFd961294b3e1Ce3313fBD8aa4f85d'.toLowerCase()) {
return accumulator + 500000; // aDAI donation gas estimate

} else if (tokenAddr === '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643'.toLowerCase()) {
return accumulator + 450000; // cDAI donation gas estimate

}
return accumulator + 100000; // generic token donation gas estimate
}, 0);

return gasLimit;
Expand Down

0 comments on commit 5e621b9

Please sign in to comment.