balanced-network-interface
balanced-network-interface copied to clipboard
Integrate stability fund swaps via router
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;
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}.
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:
@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 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
Have reassigned to @0xmilktea
@0xmilktea something you and @swiftcc624 can tackle?
Ready for testing in 2 days