testnet icon indicating copy to clipboard operation
testnet copied to clipboard

feat: WM on Test wallet

Open sanducb opened this issue 1 year ago • 7 comments

Context

  • closes #1358
  • closes #1357

This PR introduces changes that will allow creation of asset scale 9 wallet addresses by default and all WM accounting logic is removed as there will be no difference between payment pointers. Rapyd will only take into account asset scale 2 (this is unchanged) while we also keep track of an asset scale 9 "virtual" balance in our wallet's db. This virtual balance is separated into incomingBalance and outgoingBalance for each PP. Whenever scale 9 incoming or outgoing transfers add up to the lowest amount representable in scale 2 (i.e. 0.01), then Rapyd balance is updated. This is similar to the previous WM accounting logic, but it now applies to all transactions.

Changes TLDR;

  • Allowing creation of asset scale 9 wallet addresses by default
  • Deleted WM accounting logic, wallet addresses are WM ready by default
  • Added virtual balance logic for dealing with scale 9 amounts

Important questions

  • Should we drop incomingBalance and outgoingBalance columns from walletAddresses table and move them to accounts table?
  • Should we drop debt column in the accounts table?

sanducb avatar Jun 27 '24 08:06 sanducb

Something has happened with the quotes: image

All the values are 0 and if you click send it is Internal Server error.

Tymmmy avatar Jul 18 '24 06:07 Tymmmy

Regarding question nr 1.: Caching Wallet Addresses that are in use for WM is still a good ideea for latency, since in WM cases, we end up fetching the wallet address with a much higher frequency. Since we would not have anything that differentiates Wallet addresses that are in use in WM to ones that are not, I think an LRU cache would achieve the same goal here?

On nr 2 and 3, tbh I don't know how those fields are used in order to answer.

Thoughts? @dragosp1011 @raducristianpopa

beniaminmunteanu avatar Aug 01 '24 06:08 beniaminmunteanu

Fee still is 0.... :( image

Tymmmy avatar Aug 02 '24 07:08 Tymmmy

I'll take another look at the frontend to make sure that every amount displayed is properly formatted with a single shared function instead of the already existing code that I added for doing that which is not clean. I'll update the PR with the refactor.

sanducb avatar Aug 02 '24 09:08 sanducb

What will happen if we cache a WA, then update it, and then fetch it again before its expiry time has passed?

domin191013 avatar Aug 06 '24 07:08 domin191013

What will happen if we cache a WA, then update it, and then fetch it again before its expiry time has passed?

there are 2 options is this case: 1. invalidate the cache on update or 2. cache the WA after update

dragosp1011 avatar Aug 06 '24 08:08 dragosp1011

@sanducb please be aware that change the scale here too.

domin191013 avatar Aug 07 '24 08:08 domin191013

We will cherry pick the useful code we need from this. Integrating Gatehub sandbox and replacing Rapyd, sadly made this story n0t needed anymore, as only asset code 2 will be supported.

Tymmmy avatar Sep 02 '24 06:09 Tymmmy