Skip to content

Add deposit query to dYdX Subgraph API #11

Open
yt8073 wants to merge 13 commits intodydxfoundation:masterfrom
yt8073:master
Open

Add deposit query to dYdX Subgraph API #11
yt8073 wants to merge 13 commits intodydxfoundation:masterfrom
yt8073:master

Conversation

@yt8073
Copy link
Copy Markdown

@yt8073 yt8073 commented Jun 8, 2022

The purpose here is to track the one time deposit to the exchange events.

Comment thread subgraph.template.yaml
source:
address: "{{dydxPerpetualAddress}}"
abi: DydxPerpetual
startBlock: {{startBlock}}
Copy link
Copy Markdown
Contributor

@lucas-dydx lucas-dydx Jun 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

startBlock should be updated to the deployment block of the dYdX perpetual contract, or else deposit events before block 12809555 on mainnet will be missing.

The deployment block of the dYdX perpetual contract on mainnet is 11834295, so that should be used instead in config/mainnet.json.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can set this to the current block, because we only care about the most recent deposit that users make after Rabbithole launches their deposit matching campaign.

Comment thread src/perpetual.ts
let userAddress: Address = event.params.depositorEthKey
let depositAmount: BigInt = event.params.quantizedAmount
let user: User = getUser(userAddress)
user.depositToPerpetual = depositAmount
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user.mostRecentDeposit

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.

3 participants