Closed Marchand-Nicolas closed 3 weeks ago
Hello @Marchand-Nicolas, I would like to work on this task. Could you please assign it to me?
Here’s how I’ll approach the issue:
Create the /defi/rewards GET Accept a user's wallet address (addr). Return STARK rewards and the necessary claim data for a multicall transaction.
Fetch rewards from four protocols: ZkLend: Retrieve rewards using the API and parse response. Nostra: Use a POST request to fetch reward proofs. Nimbora: Send a GET request to get calldata. Ekubo: Fetch airdrop rewards with token information.
Construct response: Build the rewards and calls objects with entry points, contract addresses, and call data for each protocol.
Handle errors: Validate input, retry failed API calls, and handle timeouts.
Test thoroughly: Use various addresses and edge cases, ensuring proper functionality across all integrated protocols.
Hello @Marchand-Nicolas Please kindly assign this task to me. i will make sure a deliver a quality work. I am a Full Stack Developer with extensive experience in blockchain development, specializing in Next.js, TypeScript, Node.js, and Rust. With over 18 contributions across projects in the OnlyDust ecosystem, I’ve developed a strong proficiency in delivering high-quality solutions and tackling complex issues under tight deadlines. My experience spans frontend, backend, smart contract development, and a deep understanding of optimizing and maintaining scalable codebases.
The goal of this task is to implement a new GET route /defi/rewards
that simplifies the process of claiming DeFi Spring rewards by centralizing everything into one call.
ZkLend, Nostra, Nimbora, and Ekubo.
The route will be added under the endpoints directory, and main.rs will be updated to register the route. Also, Helper functions will be placed in utils.rs for code reusability.
Can I be assigned this please @Marchand-Nicolas ? I’ve gone through the proposed implementation and I’m ready to do just that. Please
@Marchand-Nicolas , I would love to work on this. I have experience working with this pools from issues i worked on, in starkfarm, and i will be able to send a PR in line with the time schedule.
I would love to work on this. I have some experience building APIs using Actix-web, I believe my knowledge of Rust and Actix-web is also applicable in Axum. I also made my first contribution to the Starknet Quest in the just concluded ODhack8.0
Applying for this task. Would love to take it on.
Add GET Route
/defi/rewards
to Centralize DeFi Spring Reward CollectionIssue Summary
We need to implement a new GET route
/defi/rewards
that accepts anaddr
parameter (user address) and returns:calls
array, where each call is an object containing:entryPoint
(function name, e.g., "claim")contract
(contract address)callData
(string array)The primary goal is to centralize the collection of DeFi Spring rewards, enabling users to execute all claim calls in a single multicall transaction.
Background and Motivation
Currently, users have to interact with multiple protocols individually to claim their DeFi Spring rewards. By aggregating this process into a single API route, we can streamline reward collection, improve user experience, and reduce transaction overhead.
Protocols to Integrate
We need to fetch reward data from the following protocols:
Each protocol provides an API to retrieve reward information and the necessary data to construct claim calls.
1. ZkLend
Endpoint:
GET https://app.zklend.com/api/reward/all/{address}
Response Example:
Claim Function: Typically called
claim
on theclaim_contract
.2. Nostra
Endpoint:
POST https://us-east-2.aws.data.mongodb-api.com/app/data-yqlpb/endpoint/data/v1/action/find
Request Body:
Response Example:
Reward Contract:
0x008faa2edc6833a6ad0625f1128d56cf471c3f9649ff2201d9ef49d7e9bb18de
3. Nimbora
Endpoint:
GET https://strk-dist-backend.nimbora.io/get_calldata?address={address}
Response Example:
Reward Contract:
0x07ed46700bd12bb1ee8a33a8594791003f9710a1ab18edd958aed86a8f82d3d1
4. Ekubo
GET https://mainnetapi.ekubo.org/airdrops/{address}?token={token_address}
Response Example:
Proposed Implementation
1. Create the GET Route
/defi/rewards
GET
addr
(string, required): User's wallet address.2. Route Handler Logic
Fetch Rewards:
addr
.amount
,proof
,contract
, etc.Construct the
calls
Array:callData
array should contain all the necessary arguments for theclaim
function, such asclaim_id
,amount
,proof
, etc.Return Response:
rewards
: Detailed reward information from all protocols.calls
: The array of call objects ready for multicall execution.3. Example Response
Implementation Steps
Setup Route
Add the new route to the API using the existing framework (e.g., Axum for Rust).
Validate Input
addr
parameter is provided and is a valid address format.Fetch Data from Protocols
ZkLend:
Nostra:
Nimbora:
Ekubo:
Construct Rewards
Array containing one element per protocol
Each element correspond to one line of the following modal:
In each element, just set the field required by the modal (protocol name, image, reward amounts & tokens).
Construct Calls
For each protocol, map the reward data to a call object.
Example for ZkLend:
Aggregate Results
Return the Response
Error Handling
Testing
Integration Tests:
Additional Notes
claim
, verify each protocol's contract to confirm the correct entry point using Voyager or StarkScan.callData
arrays are correctly formatted according to each contract's ABI.Example Code Snippet
Action Items
/defi/rewards
GET route with the specified functionality.References