Conversation
|
@thebaoman (or anyone else who may be able to advise here - please feel free to tag them)... A few questions:
Apologies for the newbie questions - as I stated when I applied I'm relatively new with the web3 bits. Hopefully you can bear with me! I've joined the discord (@blockcontractor#7712) - not likely to be on much over the easter weekend though. |
|
As an update: whilst waiting for input on the batch request question tonight, I worked on non-WETH denominated pairs. Haven't pushed as it's still a WIP. Looking very achievable (nearly there) for mainnet, but haven't considered xDai (or others) properly yet so may need to rethink. Thought I'd get mainnet down though to ensure my approach is sound. As mentioned before I'll probably not get a chance to work on this again until after easter weekend (i.e. not until tues 6th). |
|
Managed to spend some time today on this - APYs now show for all pairs, using the sushiswap sdk. A couple of notes (partially to myself!)
|
|
@blockcontractor https://github.com/baofinance/baoswap-ui/pull/42 some relevant work there. you'll have to do cross-chain lookups for xdai and use the reserve ratio on the SLPs for some of the pairs happy to discuss here or on discord, DM'd you there. |
I believe the issue is pushing too many request within a short span of time, causing some sort of throttling problem. You probably can fix it if you can sub-batch and space the requests out with some time delay |
|
@zashton - I don't actually experience the issue - how does it manifest / how do you reproduce it? All of the APYs now show for me. Surely batching requests has reduced the number? |
|
@rocky-baoboa @thebaoman appreciate you're busy but some feedback would be useful when you get a chance. |
|
@rocky-baoboa bump |
|
Thanks for bumping @blockcontractor apologies this has sat for so long. To answer some of your questions.
I believe you'll actually have to implement your own batch/delay mechanism so we can query with one batch, wait some amount of time, and then query again. With APY optimizing we've seen a few times where it seems to work locally when not doing this batch/delay method, but not in staging.
I'm unsure if these changes will actually reduce the overall number of HTTP calls being made, but only because I'm unsure about the batch method itself. I'll do some more testing on this branch and hopefully have some answers for you. |
|
Hi @rocky-baoboa & @thebaoman, I'm looking for this to get merged and for a payout on the bounty. I've done the work requested and without further, concrete steps to reproduce the issue and demonstrate that my changes do not solve it, I feel this passes both of the points in both the original brief and the work plan I submitted, and was approved based upon. If the issue is no-longer relevant due to changes in the product, I still feel it is fair to pay the bounty, as the work was submitted two months ago. Thanks. |
Closes #65
### Approach
denominatorAddressesfield inconstants.jsthat points to the denominator token adddresses. This is optional, and if no denominator contract is set, we assume the denominator is ETH.denominatorAmount,denominatorWethEquivalent, andtokenPriceInDenominatorgetTotalLPWethValuefunction:denominatorContractis set, we additionally fetch the value of the denominator in WETH, and the number of decimals it has, by callinggetDenominatorWethValueAndDecimals. This function makes requests to sushiswap to get the token details, and the current midprice of the denomninator/WETH pair. These values are then used to calcualte the ETH worth of the denominator for use in the APY calcs.addCallsToBatchutility function that accepts a web3 batch request object and an array of contract calls, and returns a promise that will resolve with the result, without executing the batch (i.e. the requests won't actually be called by the function).getTotalLPWethValueto batch all calls there.Additional Notes
ethers was added to dependencies due to it being a requirement for the sushiswap SDK. It may be preferable to add API keys instead of using the default ones. This is relatively straightforward but not 100% necessary (I've not had any issues with the defaults). Details here.