balancednetwork / balanced-network-interface

An open-source interface for the Balanced Network protocol (https://balanced.network)
https://app.balanced.network/
22 stars 21 forks source link

Integrate stability fund swaps via router #1328

Open hetfly opened 2 months ago

AntonAndell commented 2 months ago

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 And a RouteAction is: RLP [int action, Address toToken] public String receiver; public BigInteger minimumReceive; public List 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;

parrot9design commented 2 months ago

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?

hetfly commented 2 months ago

@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

FezBox commented 2 months ago

Have reassigned to @0xmilktea

@0xmilktea something you and @swiftcc624 can tackle?

FezBox commented 3 weeks ago

Ready for testing in 2 days