Skip to content

Commit

Permalink
Allow delegation strategy to accept space name from strategy params (s…
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaituVR authored Jan 28, 2022
1 parent 2bdd52c commit 0cb7f0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/strategies/delegation/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# delegation

If you want to delegate your voting power to another wallet address, you can do this using the “delegation strategy”. In delegation strategy, if A delegates to B and both of them vote, then the delegated voting power is not calculated. Only the vote of A will be calculated. The vote of B will be counted if A does not vote.
If you want to delegate your voting power to another wallet address, you can do this using the “delegation strategy”. In delegation strategy, if A delegates to B and both of them vote, then the delegated voting power is not calculated. Only the vote of A will be calculated. The vote of B will be counted if A does not vote.

In delegation strategy, the sub strategies defined in params are used to delegate vote from one address to another.

| Param Name | Description |
| ----------- | ----------- |
| strategies | list of sub strategies to calculate voting power based on delegation |
| delegationSpace (optional) | Get delegations of a particular space (by default it take delegations of current space) |

Here is an example of parameters:

Expand All @@ -30,4 +34,4 @@ Here is an example of parameters:
]
}

```
```
3 changes: 2 additions & 1 deletion src/strategies/delegation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export async function strategy(
options,
snapshot
) {
const delegations = await getDelegations(space, network, addresses, snapshot);
const delegationSpace = options.delegationSpace || space;
const delegations = await getDelegations(delegationSpace, network, addresses, snapshot);
if (Object.keys(delegations).length === 0) return {};

const scores = (
Expand Down

0 comments on commit 0cb7f0f

Please sign in to comment.