-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate level-finance #202
Conversation
dbbaecc
to
e64dd55
Compare
|
||
func (d *PoolsListUpdater) init(ctx context.Context) ([]entity.Pool, error) { | ||
var ( | ||
allAssets = make([]common.Address, 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we hardcode 10 for all Assests, I see that ABI supports function method getAllAssets
[ getAllAssets method Response ] assets address[] : [[0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f] [0x82aF49447D8a07e3bd95BD0d56f35241523fBab1] [0x912CE59144191C1204E64559FE8253a0e49E6548] [0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9] [0xaf88d065e77c8cC2239327C5EDb3A432268e5831]] isStable bool[] : false,false,false,true,true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your implementation is still ok, incase I didn't find getAllAssets method on BSC chain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there are some differences between bsc and arbitrum to get pool states. I updated in notion https://www.notion.so/kybernetwork/Integration-Notes-Level-Finance-Study-note-23dded16b3d444caacd84c253f8eaecf?pvs=4
calls.AddCall(ðrpc.Call{ | ||
ABI: LiquidityPoolAbi, | ||
Target: p.Address, | ||
Method: liquidityPoolMethodFee, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this method in level-finance arbitrum sc, please help me check again. Error:
app/main.go:442 failed to aggregate call {"poolAddress": "0x32b7bf19cb8b95c27e644183837813d4b595dcc6", "type": "level-finance", "err": "execution reverted: Multicall aggregate: call failed"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated version for arbitrum
} | ||
|
||
func calcSwapOutput(tokenIn, tokenOut *TokenInfo, amountIn *big.Int, state *PoolState) (*big.Int, *big.Int, error) { | ||
priceIn := new(big.Int).Set(tokenIn.MinPrice) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @guiltylotus , please help me check this function, in levelOracle sc, we do not use the raw price value, instead, it does some calculations then return the calculated value as below:
https://arbiscan.io/address/0x82B585a8F15701BBD671850f0a9F1feE57a8DCB5#code#F1#L180
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 1 block, the swap does not cause the price changes. So we can use directly getPrice result from the contract.
|
||
func calcSwapOutput(tokenIn, tokenOut *TokenInfo, amountIn *big.Int, state *PoolState) (*big.Int, *big.Int, error) { | ||
priceIn := new(big.Int).Set(tokenIn.MinPrice) | ||
priceOut := new(big.Int).Set(tokenOut.MaxPrice) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same with priceIn above.
146a246
to
0db2c29
Compare
0db2c29
to
27646a2
Compare
Why did we need it?
Related Issue
Release Note
How Has This Been Tested?
Screenshots (if appropriate):