balanced-network-interface icon indicating copy to clipboard operation
balanced-network-interface copied to clipboard

Integrate stability fund swaps via router

Open hetfly opened this issue 10 months ago • 4 comments

hetfly avatar Apr 24 '24 10:04 hetfly

In the new version of the router a new payable method is added: routeV2(byte[] _path, @Optional BigInteger _minReceive, @Optional String _receiver) And a new choice for data on the tokenFallback. Instead of using JSON these new methods uses RLP encoded Data: The _path is now a RLP List<RouteAction> And a RouteAction is: RLP [int action, Address toToken] public String receiver; public BigInteger minimumReceive; public List<RouteAction> actions; And for the tokenFallback Data it now takes:

RLP [
String method
String receiver
BigInteger minimumReceive
List<RouteAction> _path
]

method is still "_swap" like in json receiver and minimumReceive are optional and can be nullable in RLP _path pararmeter is the same as in the routeV2 method.

Current actions are: static final int SWAP = 1; static final int STABILITY_SWAP = 2;

AntonAndell avatar Apr 24 '24 10:04 AntonAndell

Here's how to handle for assets like USDC and ETH that have liquidity spread across a number of chains.

App

When you enter an amount larger than can be sent to your blockchain of choice, make the Swap button inactive and include this message underneath:

Only {amount} {ticker} is available on {blockchain}.

swap-message

If you click the linked amount, it should populate the For field.

Stats page

Add a tooltip to applicable assets in the Tokens section (Stats page) and Stability Fund section (Performance Details) to show the breakdown of liquidity on each blockchain: asset-blockchains-tooltip


@hetfly I've assigned you to tackle the Stats page piece of this. I'm not sure how much work is required for the Stability Fund integration piece, but I'm wondering if we should pull in @0xmilktea for that part?

parrot9design avatar May 02 '24 22:05 parrot9design

@parrot9design I think it would be more efficient to let @0xmilktea do it while I review the AVAX connection and work on the Loans UI

cc @FezBox

hetfly avatar May 05 '24 11:05 hetfly

Have reassigned to @0xmilktea

@0xmilktea something you and @swiftcc624 can tackle?

FezBox avatar May 05 '24 22:05 FezBox

Ready for testing in 2 days

FezBox avatar Jun 17 '24 07:06 FezBox