Skip to content

Commit

Permalink
[erc20-votes] add schema and fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaituVR committed Feb 8, 2025
1 parent 92da69c commit b0f28eb
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/strategies/erc20-votes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# erc20-votes strategy

This strategy gets voting power from compound like contracts, it uses `getVotes` function to get the voting power of an address.

## Params

| Param | Type | Description |
| --- | --- | --- |
|`address`|`string`|The address of the contract to get the voting power from|
|`symbol`|`string`|The symbol of the token|
|`decimals`|`number`|The decimals of the token|
9 changes: 5 additions & 4 deletions src/strategies/erc20-votes/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
"strategy": {
"name": "erc20-votes",
"params": {
"address": "0xc00e94cb662c3520282e6f5717214004a7f26888",
"address": "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72",
"symbol": "ENS"
}
},
"network": "1",
"addresses": [
"0x2B384212EDc04Ae8bB41738D05BA20E33277bf33",
"0xAC5720d6EE2d7872b88914C9c5Fa9BF38e72FaF6"
"0x552DF471a4c7Fea11Ea8d7a7b0Acc6989b902a95",
"0x89EdE5cBE53473A64d6C8DF14176a0d658dAAeDC",
"0x5BFCB4BE4d7B43437d5A0c57E908c048a4418390"
],
"snapshot": 12050071
"snapshot": 21791300
}
]
41 changes: 41 additions & 0 deletions src/strategies/erc20-votes/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/Strategy",
"definitions": {
"Strategy": {
"title": "Strategy",
"type": "object",
"properties": {
"symbol": {
"type": "string",
"title": "Symbol",
"examples": [

Check failure on line 12 in src/strategies/erc20-votes/schema.json

View workflow job for this annotation

GitHub Actions / lint / Lint

Replace `⏎············"e.g.·ENS"⏎··········` with `"e.g.·ENS"`
"e.g. ENS"
],
"maxLength": 16
},
"address": {
"type": "string",
"title": "Contract address",
"examples": ["e.g. 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"],
"pattern": "^0x[a-fA-F0-9]{40}$",
"minLength": 42,
"maxLength": 42
},
"decimals": {
"type": "integer",
"title": "Decimals",
"examples": [

Check failure on line 28 in src/strategies/erc20-votes/schema.json

View workflow job for this annotation

GitHub Actions / lint / Lint

Replace `⏎············"e.g.·18"⏎··········` with `"e.g.·18"`
"e.g. 18"
],
"minimum": 0,
"maximum": 18
}
},
"required": [

Check failure on line 35 in src/strategies/erc20-votes/schema.json

View workflow job for this annotation

GitHub Actions / lint / Lint

Replace `⏎········"address"⏎······` with `"address"`
"address"
],
"additionalProperties": false
}
}
}

0 comments on commit b0f28eb

Please sign in to comment.