Overview of Covalent API features: Solving the Puzzle Paladin -the part of Dungeons & Data — 1INCH Network hackaton as a case study — Round 2.

This time, Covalent’s partner is the most popular DEX aggregator — 1inch!

So, today’s review of the second round of Puzzle Paladin.

Main Task.Calculate the fee percentage (weighted average) using the`DefaultFeeVoteUpdate` events on the 1inch default DAO for the month of April. Important note : We will use data from 1st April to 1st May for this puzzle.Resources:- [Covalent API Docs](https://www.covalenthq.com/docs/api/#overview)- [1Inch Website DAO](https://app.1inch.io/#/1/dao/governance?action=stake)
Step 1.Find the 1INCH contract address that has all default DAO methods.
Step 2Get all the DefaultFeeVoteUpdate events using the contract address from step 1. These are events which happen when someone votes for a fee percentage to apply to a swap. Most of the calls are made when a user stakes/unstakes.Note the following:The amount parameter corresponds to the new amount staked by a user. And the `fee` parameter is the fee percentage that the user votes for.So for example, on an `Unstake` transaction where the user completely removes all the previously staked tokens, the `amount` parameter will be 0 because the user doesn’t have any tokens.The fee percentage is a weighted average of the `fee` parameter with `amount` as weight.Using only the `DefaultFeeVoteUpdate` events during April, calculate the weighted average of the fee percentage. To do this, multiply the ‘amount’ * ‘fee percentage’ and sum that across all events. Divide that by the sum of all amounts and you will have your answer.
Step 3.
Once you have calculated the fee percentage, copy the first 6 decimal places.Your secret room with the next task will be unlocked at the website: https:// dnd.covalenthq.com/{6decimalplaces} e.g If your answer is 0.654321 the url will be `https://dnd.covalenthq.com/654321`

Correct link:

I saw the cherished inscription again!

Learn the Covalent API, it’s very entertaining!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store