From 48fe81ad253f868e77f32a18e3cad69a066915f2 Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Tue, 5 Sep 2023 00:00:13 +0530 Subject: [PATCH] [aave-governance-power] Add aave gov power strategy schema (#1277) * Update aave-governance-power strategy Readme * Add schema --- .../aave-governance-power/examples.json | 10 ++--- src/strategies/aave-governance-power/index.ts | 22 +--------- .../aave-governance-power/schema.json | 40 +++++++++++++++++++ 3 files changed, 47 insertions(+), 25 deletions(-) create mode 100644 src/strategies/aave-governance-power/schema.json diff --git a/src/strategies/aave-governance-power/examples.json b/src/strategies/aave-governance-power/examples.json index 76b6e2b5f..e297a3380 100644 --- a/src/strategies/aave-governance-power/examples.json +++ b/src/strategies/aave-governance-power/examples.json @@ -4,14 +4,14 @@ "strategy": { "name": "aave-governance-power", "params": { - "governanceStrategy": "0xb7e383ef9b1e9189fc0f71fb30af8aa14377429e", + "symbol": "AAVE+stkAAVE", + "decimals": 18, "powerType": "vote", - "symbol": "Voting Power", - "decimals": 18 + "governanceStrategy": "0xb7e383ef9b1e9189fc0f71fb30af8aa14377429e" } }, "network": "1", - "addresses": ["0x5BC928BF0DAb1e4A2ddd9e347b0F22e88026D76c"], - "snapshot": 12657715 + "addresses": ["0x329c54289Ff5D6B7b7daE13592C6B1EDA1543eD4", "0x57ab7ee15cE5ECacB1aB84EE42D5A9d0d8112922", "0x0ab97008cad303a8C90ea630c282760284c19e93"], + "snapshot": 18054498 } ] diff --git a/src/strategies/aave-governance-power/index.ts b/src/strategies/aave-governance-power/index.ts index 0e0542f97..a7157abf3 100644 --- a/src/strategies/aave-governance-power/index.ts +++ b/src/strategies/aave-governance-power/index.ts @@ -10,26 +10,8 @@ export const version = '0.1.0'; */ const abi = [ - { - inputs: [ - { internalType: 'address', name: 'user', type: 'address' }, - { internalType: 'uint256', name: 'blockNumber', type: 'uint256' } - ], - name: 'getPropositionPowerAt', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { internalType: 'address', name: 'user', type: 'address' }, - { internalType: 'uint256', name: 'blockNumber', type: 'uint256' } - ], - name: 'getVotingPowerAt', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function' - } + 'function getPropositionPowerAt(address user, uint256 blockNumber) view returns (uint256)', + 'function getVotingPowerAt(address user, uint256 blockNumber) view returns (uint256)' ]; const powerTypesToMethod = { diff --git a/src/strategies/aave-governance-power/schema.json b/src/strategies/aave-governance-power/schema.json new file mode 100644 index 000000000..25cedec86 --- /dev/null +++ b/src/strategies/aave-governance-power/schema.json @@ -0,0 +1,40 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$ref": "#/definitions/Strategy", + "definitions": { + "Strategy": { + "title": "Strategy", + "type": "object", + "properties": { + "symbol": { + "type": "string", + "title": "Symbol", + "examples": ["e.g. DOODLE"], + "maxLength": 16 + }, + "governanceStrategy": { + "type": "string", + "title": "Contract address", + "examples": ["e.g. 0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"], + "pattern": "^0x[a-fA-F0-9]{40}$", + "minLength": 42, + "maxLength": 42 + }, + "powerType": { + "type": "string", + "title": "Power type", + "enum": ["vote", "proposition"] + }, + "decimals": { + "type": "integer", + "title": "Decimals", + "examples": ["e.g. 18"], + "minimum": 0, + "maximum": 18 + } + }, + "required": ["governanceStrategy", "powerType", "decimals"], + "additionalProperties": false + } + } +}