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

proper veDelegation #663

Merged
merged 1 commit into from Apr 28, 2023
Merged

proper veDelegation #663

merged 1 commit into from Apr 28, 2023

Conversation

alexcos20
Copy link
Member

@alexcos20 alexcos20 commented Apr 28, 2023

Fixes # .

Changes proposed in this PR:

  • proper schema refactor
  • veDelegation as state entity
  • add veDelegationHistory, so we can track all past activities
  • add proper tests

Query:

query{
  veDelegations(where:{delegator:"0xbe5449a6a97ad46c8558a3356267ee5d2731ab5e"}){
    id
    delegator {
      id
    }
    receiver{
      id
    }
    amount
    tokenId
    cancelTime
    expireTime
    updates(orderBy:timestamp orderDirection:asc){
      id
      block
      timestamp
      tx
      sender
      amount
      cancelTime
      expireTime
      type
    }
  }
}

Result : (contains both current state of veDelegation, and updates history)

{
  "data": {
    "veDelegations": [
      {
        "id": "0xf152cf3c67dfd41a317eae8fac0e1e8e98724a13-0xbe5449a6a97ad46c8558a3356267ee5d2731ab5e000000000000000000000000",
        "delegator": {
          "id": "0xbe5449a6a97ad46c8558a3356267ee5d2731ab5e"
        },
        "receiver": {
          "id": "0xa78deb2fa79463945c247991075e2a0e98ba7a09"
        },
        "amount": "0",
        "tokenId": "86088364704944767065825748042033305100613135882130307974387559050022387449856",
        "cancelTime": "0",
        "expireTime": "1716422400",
        "updates": [
          {
            "id": "0x3744fdcfed82aa1bda200fe7fa3367dce69ab8449dc632fd8d5574e18b8ee5ea-1",
            "block": 58,
            "timestamp": 1684562340,
            "tx": "0x3744fdcfed82aa1bda200fe7fa3367dce69ab8449dc632fd8d5574e18b8ee5ea",
            "sender": "0xbe5449a6a97ad46c8558a3356267ee5d2731ab5e",
            "amount": "12628448439876407820",
            "cancelTime": "0",
            "expireTime": "1716429726",
            "type": 0
          },
          {
            "id": "0x98b9f46b650426f9d95707ec459e4f05e56ed98b8a950a79f68bbe31f59f6aff-0",
            "block": 60,
            "timestamp": 1684562400,
            "tx": "0x98b9f46b650426f9d95707ec459e4f05e56ed98b8a950a79f68bbe31f59f6aff",
            "sender": "0xbe5449a6a97ad46c8558a3356267ee5d2731ab5e",
            "amount": "25256849315064840000",
            "cancelTime": "0",
            "expireTime": "1716422400",
            "type": 1
          },
          {
            "id": "0x686e389d2475028eaeae5170e2ff58a043ce732ddf548773e8efd84b92db7a06-0",
            "block": 62,
            "timestamp": 1684562460,
            "tx": "0x686e389d2475028eaeae5170e2ff58a043ce732ddf548773e8efd84b92db7a06",
            "sender": "0xbe5449a6a97ad46c8558a3356267ee5d2731ab5e",
            "amount": "0",
            "cancelTime": "0",
            "expireTime": "1716422400",
            "type": 2
          }
        ]
      }
    ]
  }
}

@alexcos20 alexcos20 self-assigned this Apr 28, 2023
@alexcos20 alexcos20 merged commit c33868d into main Apr 28, 2023
4 checks passed
@alexcos20 alexcos20 deleted the bug/proper_veDelegation branch April 28, 2023 06:36
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.

None yet

1 participant