Thanks for the feedback! Here are responses to the questions and issues you have raised:
Questions
[1] This is the Oku API, which I understand was developed under a Uniswap Foundation grant. See also https://blockworks.co/news/uniswap-v3-new-front-end for some background. It is not on the ICP network. How can I check if it is IPV6-compatible?
Getting the data that I have obtained from this API from on-chain data would be relatively straightforward for most of the variables used, but for a couple of them it is problematic:
- fees_24h_usd - Calculating cumulative fees for a pool is very complex and probably requires the use of historical data or stored snapshots rather than data that can be queried from a contract, as the Uniswap pool contracts only seem to provide fee data in the form of current state variables.
- ticks - I’ve used this variable for calculating the total value locked within a given range of ticks. This variable is readily available from the UniswapV3Pool contract but is difficult to implement for our purposes because the required ticks need to be individually specified in separate queries, which would consume huge resources and would not be workable if method values need to be hard-coded.
The remaining variables could be derived from 4 separate contract calls within UniswapV3Pool (slot0 for both the asset pair of interest and for UDSC/ETH, liquidity and tickSpacing) which would be easy to do but would start to get expensive in terms of cycles. I would have preferred to use on-chain data as much as possible, but for these limitations. Please correct me if my understanding of any this doesn’t seem right.
[2] The algorithm_lens all use the same logic except for the VRA/ETH pair. The reason is that in this pair, (W)ETH is designated as token0 but in the other pairs it is token1, so without this change the return rate would end up being somewhat different if the price ratio had fluctuated a great deal over the preceding week.
Bugs
[1] lens_targets: I couldn’t find this in the algorithm_lens schema but I see that it appears in the relayer schema, and is something that I had overlooked. To my mind this seems redundant as the information also appears under datasource in algorithm_lens (what am I missing?) but I’ve made this change for the each of the pairs. Does this look right?
[2] The indices in this section are 0, 1, 3, 4. Whoops! I must have deleted a line at some point and overlooked this detail. I didn’t understand how this part worked, but I gather that targets
here are specified by lens_targets, which would answer my question in the last paragraph? I’ll fix this up now.
Improvements
[1] Thanks for spotting that! Something I overlooked while replicating the manifests. Now fixed.
[2] I’m not sure how this would work. Wouldn’t datasource: methods: - id:
in each algorithm_lens.yaml still need to point to a specific set of snapshotters? By my understanding the contract address in each snapshotter manifest needs to be hard coded, so they are all unique. I can see how this would work for the relayers, but is there a way around this for the algorithm_lens?
Updating the project
Thanks again for such detailed feedback. This has really helped me get my head around how all this fits together! Now that I’ve corrected the two main bugs this should hopefully work as intended.
How should I now go about updating the deployed project? Should the following steps be sufficient to safely update and re-deploy the canisters?
csx generate
csx build --only-build
csx deploy --network ic
I’m cautious about using csx exec
as it seems to use a lot of cycles (about $80 worth to execute the full project), unless there’s a way to refund the cycles I spent on the faulty version of the project similar to what happens with using dfx canister delete
. If I’ve earnt the bounty then this won’t matter too much but I’m happy to be guided by your advice.