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

ERC20 Voting Delegation #50

Open
Inphi opened this issue Jan 31, 2023 · 2 comments
Open

ERC20 Voting Delegation #50

Inphi opened this issue Jan 31, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Inphi
Copy link

Inphi commented Jan 31, 2023

Is your feature request related to a problem? Please describe.
Support ERC20Votes delegation as a built-in operation type.

Describe the solution you'd like
The interface can be similar to ERC20_TRANSFER operations. When a user queries the /construction/preprocess endpoint for token delegation, they'll need to provide operations with the following schema:

 "operations": [
    {
      "operation_identifier": {
        "index": 0
      },
      "type": "ERC20VOTES_DELEGATE",
      "account": { "address": "<sender>"},
      "amount": {
        "value": "0",
        "currency": {
          "symbol": "TOKEN",
          "decimals": 18,
          "metadata": {
            "contractAddress": "0x..."
          }
        }
      }
    },
    {
      "operation_identifier": {
        "index": 1
      },
      "type": "ERC20VOTES_DELEGATE",
      "account": { "address": "<delegatee>"},
      "amount": {
        "value": "0",
        "currency": {
          "symbol": "TOKEN",
          "decimals": 18,
          "metadata": {
            "contractAddress": "0x..."
          }
        }
      }
    }
  ]
  1. A new operation type, ERC20VOTERS_DELEGATE, is introduced to describe the intent of an ERC20Votes delegate call.
  2. There must be exactly two operations for an ERC20Votes delegate call; the first representing an account that's delegating votes, and the second represents the account that's being delegated votes to.
  3. The type of each operation must be set to ERC20VOTES_DELEGATE.
  4. The value of each operation must be set to zero.
  5. The currency must contain a valid contractAddress in its metadata.
    The contractAddress should point to an ERC20Votes compatible token.

Once the metadata is created, it can be forwarded through the usual flow to construct, sign and submit the tx.

Describe alternatives you've considered

Additional context
The outlined schema is based off of the design used in optimism-rosetta.

@Inphi Inphi added the enhancement New feature or request label Jan 31, 2023
@xiaying-peng
Copy link
Contributor

Quick question, what is the best way to parse this type of transaction in Block API?

@Inphi
Copy link
Author

Inphi commented Feb 1, 2023

The receipt of such transactions contain DelegateChanged events. There's already logic in roseta-geth-sdk to parse ERC20 transfer events. Parsing delegate calls would be similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants