Skip to content
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

Rewards Event API V1 #275

Closed
wants to merge 9 commits into from
Closed

Rewards Event API V1 #275

wants to merge 9 commits into from

Conversation

surbhit14
Copy link
Collaborator

@surbhit14 surbhit14 commented Oct 28, 2024

Rewards Event API V1

Introduction

This API will comprise of one endpoint /avs/[address}/events/rewards and it will be covering the following event

  • EventLogs_AVSRewardsSubmission

The response format will be

{
  type: string // name of the event
  tx: string // transaction hash
  blockNumber: number // block number of the tx
  blockTime: Date // blocktime of the tx
    
  args: {
    submissionNonce: number
    rewardsSubmissionHash: string
    rewardsSubmissionToken: string
    rewardsSubmissionAmount: string
    rewardsSubmissionStartTimeStamp: number
    rewardsSubmissionDuration: number
    strategies: [
	{
	    strategy: string
            multiplier: string
            amount?: string
            amountEthValue?: number
	}	
    ]
  }
 
  ethValue?: number // value of rewardsSubmissionAmount in ETH
}

with the following event type

  • REWARDS

and the following filters will be supported

  • startAt and endAt for blockTime
  • txHash
  • rewardsSubmissionHash
  • rewardsSubmissionToken
  • withIndividualAmount (when enabled, returns individual share amount value for each strategy i.e amount)
  • withEthValue (when enabled, returns amountEthValue/ethValue )

API Routes

1.Fetch all rewards

GET /avs/[address}/events/rewards
{
    "data": [
        {
            "type": "REWARDS",
            "tx": "0xa37973e22106cd414e2fd3984412d3f0e3b2ddaaf0504c5ee6aec0c949ea0563",
            "blockNumber": 2592950,
            "blockTime": "2024-10-23T17:45:36.000Z",
            "args": {
                "submissionNonce": 0,
                "rewardsSubmissionHash": "0xd53cdb65c67075d658b803f38c9b1d2b2206a149d22e97e9ce1b3d1bbfa425a2",
                "rewardsSubmissionToken": "0x94373a4919b3240d86ea41593d5eba789fef3848",
                "rewardsSubmissionAmount": "50000000000000000",
                "rewardsSubmissionStartTimeStamp": 1729728000,
                "rewardsSubmissionDuration": 2419200,
                "strategies": [
                    {
                        "strategy": "0x05037a81bd7b4c9e0f7b430f1f2a22c31a2fd943",
                        "multiplier": "1000000000000000000"
                    },
                    {
                        "strategy": "0x31b6f59e1627cefc9fa174ad03859fc337666af7",
                        "multiplier": "1000000000000000000"
                    },
                    {
                        "strategy": "0x3a8fbdf9e77dfc25d09741f51d3e181b25d0c4e0",
                        "multiplier": "1000000000000000000"
                    },
                    {
                        "strategy": "0x43252609bff8a13dfe5e057097f2f45a24387a84",
                        "multiplier": "1000000000000000000"
                    },
                    {
                        "strategy": "0x46281e3b7fdcacdba44cadf069a94a588fd4c6ef",
                        "multiplier": "1000000000000000000"
                    },
                    {
                        "strategy": "0x7673a47463f80c6a3553db9e54c8cdcd5313d0ac",
                        "multiplier": "1000000000000000000"
                    },
                    {
                        "strategy": "0x7d704507b76571a51d9cae8addabbfd0ba0e63d3",
                        "multiplier": "1000000000000000000"
                    },
                    {
                        "strategy": "0x80528d6e9a2babfc766965e0e26d5ab08d9cfaf9",
                        "multiplier": "1000000000000000000"
                    },
                    {
                        "strategy": "0x9281ff96637710cd9a5cacce9c6fad8c9f54631c",
                        "multiplier": "1000000000000000000"
                    },
                    {
                        "strategy": "0xaccc5a86732be85b5012e8614af237801636f8e5",
                        "multiplier": "1000000000000000000"
                    },
                    {
                        "strategy": "0xad76d205564f955a9c18103c4422d1cd94016899",
                        "multiplier": "1000000000000000000"
                    },
                    {
                        "strategy": "0xbeac0eeeeeeeeeeeeeeeeeeeeeeeeeeeeeebeac0",
                        "multiplier": "1000000000000000000"
                    }
                ]
            }
        }
    ],
    "meta": {
        "total": 1,
        "skip": 0,
        "take": 12
    }
}
GET /avs/[address}/events/rewards?withEthValue=true&withIndividualShare=true
{
    "data": [
        {
            "type": "REWARDS",
            "tx": "0xa37973e22106cd414e2fd3984412d3f0e3b2ddaaf0504c5ee6aec0c949ea0563",
            "blockNumber": 2592950,
            "blockTime": "2024-10-23T17:45:36.000Z",
            "args": {
                "submissionNonce": 0,
                "rewardsSubmissionHash": "0xd53cdb65c67075d658b803f38c9b1d2b2206a149d22e97e9ce1b3d1bbfa425a2",
                "rewardsSubmissionToken": "0x94373a4919b3240d86ea41593d5eba789fef3848",
                "rewardsSubmissionAmount": "50000000000000000",
                "rewardsSubmissionStartTimeStamp": 1729728000,
                "rewardsSubmissionDuration": 2419200,
                "strategies": [
                    {
                        "strategy": "0x05037a81bd7b4c9e0f7b430f1f2a22c31a2fd943",
                        "multiplier": "1000000000000000000",
                        "amount": "4166666666666667",
                        "amountEthValue": 0.004159448238112538
                    },
                    {
                        "strategy": "0x31b6f59e1627cefc9fa174ad03859fc337666af7",
                        "multiplier": "1000000000000000000",
                        "amount": "4166666666666667",
                        "amountEthValue": 0.004159448238112538
                    },
                    {
                        "strategy": "0x3a8fbdf9e77dfc25d09741f51d3e181b25d0c4e0",
                        "multiplier": "1000000000000000000",
                        "amount": "4166666666666667",
                        "amountEthValue": 0.004159448238112538
                    },
                    {
                        "strategy": "0x43252609bff8a13dfe5e057097f2f45a24387a84",
                        "multiplier": "1000000000000000000",
                        "amount": "4166666666666667",
                        "amountEthValue": 0.004159448238112538
                    },
                    {
                        "strategy": "0x46281e3b7fdcacdba44cadf069a94a588fd4c6ef",
                        "multiplier": "1000000000000000000",
                        "amount": "4166666666666667",
                        "amountEthValue": 0.004159448238112538
                    },
                    {
                        "strategy": "0x7673a47463f80c6a3553db9e54c8cdcd5313d0ac",
                        "multiplier": "1000000000000000000",
                        "amount": "4166666666666667",
                        "amountEthValue": 0.004159448238112538
                    },
                    {
                        "strategy": "0x7d704507b76571a51d9cae8addabbfd0ba0e63d3",
                        "multiplier": "1000000000000000000",
                        "amount": "4166666666666667",
                        "amountEthValue": 0.004159448238112538
                    },
                    {
                        "strategy": "0x80528d6e9a2babfc766965e0e26d5ab08d9cfaf9",
                        "multiplier": "1000000000000000000",
                        "amount": "4166666666666667",
                        "amountEthValue": 0.004159448238112538
                    },
                    {
                        "strategy": "0x9281ff96637710cd9a5cacce9c6fad8c9f54631c",
                        "multiplier": "1000000000000000000",
                        "amount": "4166666666666667",
                        "amountEthValue": 0.004159448238112538
                    },
                    {
                        "strategy": "0xaccc5a86732be85b5012e8614af237801636f8e5",
                        "multiplier": "1000000000000000000",
                        "amount": "4166666666666667",
                        "amountEthValue": 0.004159448238112538
                    },
                    {
                        "strategy": "0xad76d205564f955a9c18103c4422d1cd94016899",
                        "multiplier": "1000000000000000000",
                        "amount": "4166666666666667",
                        "amountEthValue": 0.004159448238112538
                    },
                    {
                        "strategy": "0xbeac0eeeeeeeeeeeeeeeeeeeeeeeeeeeeeebeac0",
                        "multiplier": "1000000000000000000",
                        "amount": "4166666666666667",
                        "amountEthValue": 0.004159448238112538
                    }
                ]
            },
            "ethValue": 0.049913378857350456
        }
    ],
    "meta": {
        "total": 1,
        "skip": 0,
        "take": 12
    }
}

@surbhit14 surbhit14 linked an issue Oct 28, 2024 that may be closed by this pull request
@surbhit14 surbhit14 marked this pull request as draft October 28, 2024 14:59
@surbhit14 surbhit14 marked this pull request as ready for review November 5, 2024 16:27
@uditdc uditdc marked this pull request as draft December 3, 2024 05:12
@surbhit14 surbhit14 mentioned this pull request Dec 6, 2024
@surbhit14 surbhit14 closed this Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] - Reward Event History
1 participant