mesh-geth-sdk icon indicating copy to clipboard operation
mesh-geth-sdk copied to clipboard

ERC20 Voting Delegation

Open Inphi opened this issue 2 years ago • 2 comments

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 avatar Jan 31 '23 23:01 Inphi