keep-network / tbtc-dapp

Deposit BTC and redeem TBTC
http://dapp.test.tbtc.network/
MIT License
33 stars 31 forks source link

Istanbul Not Constant-inople: Read lot size and signer fee from chain #172

Closed Shadowfiend closed 4 years ago

Shadowfiend commented 4 years ago

Rather than hard-code these, we now read them from on-chain contracts. The construction allows for the introduction of variable-lot-size deposits (which @NicholasDotSol is currently working on). Additionally, the QR code is now a bitcoin: URL and includes the funding amount directly.

There's some pretty nasty code here, because the bn.js numbers we get back from Web3 can't do decimal arithmetic, so we have to move to bignumber.js to do that arithmetic, but some parts of the system expect regular JS Numbers and others do need bn.js. So there's a bunch of back-and-forthing going on. Not sure what the best long-term solution is here, but this'll do for now.

Screen Shot 2020-01-23 at 17 28 18
Shadowfiend commented 4 years ago

Fixed the missing sats-to-BTC and vice versa constants at the tbtc-client level, and used those in the UI code :rocket: