Skip to content

Commit

Permalink
[hopr-stake-and-balance-qv] Update "HOPR Stake and Balance QV" to ver…
Browse files Browse the repository at this point in the history
…sion `0.2.0` (snapshot-labs#1387)

* modify safe staking

* update strategy implementation for extended qv-like strategy

* update readme
  • Loading branch information
QYuQianchen authored Jan 23, 2024
1 parent 8f697e1 commit b79cf32
Show file tree
Hide file tree
Showing 4 changed files with 571 additions and 300 deletions.
38 changes: 23 additions & 15 deletions src/strategies/hopr-stake-and-balance-qv/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
# HOPR Stake and Balance QV

This `hopr-stake-and-balance-qv` strategy calculates voting power with:
`(B1 + B2 + B3 + S1 + S2)^0.5`
`(B1 + B2 + sum((B_i + S_i) * F_i)) ^ exponent`

where:
- B1: balance of HOPR token on mainnet
- B2: balance of HOPR token on Gnosis chain (xHOPR)
- B3: balance of wrapped HOPR token on Gnosis chain (wxHOPR)
- S1: amount of xHOPR token staked into the latest staking season
- S2: amount of wxHOPR token unclaimed from the latest staking season
- B1: HOPR token balance in the voting account on the mainnet
- B2: xHOPR token & wxHOPR token balance in the voting account on the Gnosis chain
- B_i: xHOPR token & wxHOPR token balance in the "Staking Safe", where the voting account is an owner, on the Gnosis chain
- S_i: wxHOPR token staked in outgoing HOPR Channels by HOPR nodes that are managed by the "Staking Safe", where the voting account is an owner, on the Gnosis chain
- F_i: Share of the voting account in the "Staking Safe", where the voting account is an owner, on the Gnosis chain
- exponent: Quadratic Voting-like exponent value. E.g., for quadratic-voting, the exponent is 0.5. This value can be set by the community to any value between 0 and 1, inclusive. Currently it is set at 0.75.


## Parameters
- "tokenAddress": Contract address of HOPR token on mainnet. Value should be `"0xf5581dfefd8fb0e4aec526be659cfab1f8c781da"`
- "symbol": Token Symbol. Value should be `"HOPR"`.
- "season": Number of the ongoing season. E.g. `7`.
- "fallbackGnosisBlock": Fallback block number on Gnosis chain, in case Gnosis block number cannot be translated from Ethereum mainnet due to subgraph issues. E.g. `27852687`,
- "subgraphStudioProdQueryApiKey": Production decentralized subgraph studio query API key. If no key can be provided, use `null`.
- "subgraphStudioDevAccountId": Development subgraph studio account ID. Note that this ID should not be exposed normally. If unknown, use `null`.
- "subgraphHostedAccountName": Legacy hosted subgraph account name. Value is `"hoprnet"`.
- "useStake": If the staking program should be considered. If `false`, `S1 + S2 === 0`. Value should be set to `true`.
- "useHoprOnGnosis": If tokens on Gnosis chain should be considered. If `false`, `B2 + B3 === 0`. Value should be set to `true`.
- "useHoprOnMainnet": If tokens on Ethereum mainnet should be considered. If `false`, `B1 === 0`. Value should be set to `true`.
- "subgraphStudioProdAllSeasonQueryId": Production stake all season subgraph ID. Value is `"DrkbaCvNGVcNH1RghepLRy6NSHFi8Dmwp4T2LN3LqcjY"`.
- "subgraphStudioDevAllSeasonVersion": Latest development version of the stake all season subgraph. E.g. `"v0.0.9"`
- "subgraphStudioDevAllSeasonSubgraphName": Name of the staking subgraph in Graph Studio. Value should be `"hopr-stake-all-seasons"`.
- "subgraphHostedAllSeasonSubgraphName": Name of the staking subgraph in Graph Hosted service. Value should be `"hopr-stake-all-seasons"`.
- "subgraphStudioProdHoprOnGnosisQueryId": Latest development version of the HOPR token balances on Gnosis subgraph. Value should be `"njToE7kpetd3P9sJdYQPSq6yQjBs7w9DahQpBj6WAoD"`.
- "useSafeStake": If "Safe Staking" should be considered. If `false`, `S_i === 0` and `F_i === 0`. This value should be set to `true`,
- "useChannelStake": If tokens staked in outgoing channels should be considered. If `false`, `S_i === 0`. This value should be set to `true`,
- "useHoprOnGnosis": If tokens on Gnosis chain should be considered. If `false`, `B2 === 0` and `B_i === 0`. This value should be set to `true`.
- "useHoprOnMainnet": If tokens on Ethereum mainnet should be considered. If `false`, `B1 === 0`. This value should be set to `true`.

- "subgraphStudioProdSafeStakeQueryId": ID of the "safe stake" subgraph in production. E.g. "DrkbaCvNGVcNH1RghepLRy6NSHFi8Dmwp4T2LN3LqcjY".
- "subgraphStudioDevSafeStakeSubgraphName": Name of the safe stake subgraph in Graph Studio. E.g. "hopr-nodes-dufour".
- "subgraphStudioDevSafeStakeVersion": Latest development version of the safe stake subgraph. E.g. "latest".
- "subgraphHostedSafeStakeSubgraphName": Name of the safe stake subgraph in Graph Hosted service. This servie does not exist, so the value should be `null`.
- "subgraphStudioProdChannelsQueryId": ID of the "channels" subgraph in production. E.g. "Feg6Jero3aQzesVYuqk253NNLyNAZZppbDPKFYEGJ1Hj".
- "subgraphStudioDevChannelsSubgraphName": Name of the channels subgraph in Graph Studio. E.g. "hopr-channels".
- "subgraphStudioDevChannelsVersion": Latest development version of the channels subgraph. E.g. "latest".
- "subgraphHostedChannelsSubgraphName": Name of the channels subgraph in Graph Hosted service. This servie does not exist, so the value should be `null`.
- "subgraphStudioProdHoprOnGnosisQueryId": ID of the HOPR token balances on Gnosis subgraph in production. Value should be `"njToE7kpetd3P9sJdYQPSq6yQjBs7w9DahQpBj6WAoD"`.
- "subgraphStudioDevHoprOnGnosisSubgraphName": Name of the HOPR token balances on Gnosis subgraph in Graph Studio. Value should be "hopr-on-gnosis"`
- "subgraphStudioDevHoprOnGnosisVersion": Latest development version of the HOPR token balances on Gnosis subgraph. E.g. "v0.0.2"`
- "subgraphHostedHoprOnGnosisSubgraphName": Name of the HOPR token balances on Gnosis in Graph Hosted service. Value should be `"hopr-on-xdai"`
- "exponent": Quadratic Voting-like exponent value. E.g., for quadratic-voting, the exponent is 0.5. This value can be set by the community to any value between 0 and 1, inclusive. Currently it is set at `"0.75"`.
19 changes: 12 additions & 7 deletions src/strategies/hopr-stake-and-balance-qv/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@
"params": {
"tokenAddress": "0xf5581dfefd8fb0e4aec526be659cfab1f8c781da",
"symbol": "HOPR",
"season": 7,
"fallbackGnosisBlock": 27852687,
"subgraphStudioProdQueryApiKey": null,
"subgraphStudioDevAccountId": null,
"subgraphHostedAccountName": "hoprnet",
"useStake": true,
"useSafeStake": true,
"useChannelStake": true,
"useHoprOnGnosis": true,
"useHoprOnMainnet": true,
"subgraphStudioProdAllSeasonQueryId": "DrkbaCvNGVcNH1RghepLRy6NSHFi8Dmwp4T2LN3LqcjY",
"subgraphStudioDevAllSeasonVersion": "v0.0.9",
"subgraphStudioDevAllSeasonSubgraphName": "hopr-stake-all-seasons",
"subgraphHostedAllSeasonSubgraphName": "hopr-stake-all-seasons",
"subgraphStudioProdSafeStakeQueryId": "DrkbaCvNGVcNH1RghepLRy6NSHFi8Dmwp4T2LN3LqcjY",
"subgraphStudioDevSafeStakeSubgraphName": "hopr-nodes-dufour",
"subgraphStudioDevSafeStakeVersion": "latest",
"subgraphHostedSafeStakeSubgraphName": null,
"subgraphStudioProdChannelsQueryId": "Feg6Jero3aQzesVYuqk253NNLyNAZZppbDPKFYEGJ1Hj",
"subgraphStudioDevChannelsSubgraphName": "hopr-channels",
"subgraphStudioDevChannelsVersion": "latest",
"subgraphHostedChannelsSubgraphName": null,
"subgraphStudioProdHoprOnGnosisQueryId": "njToE7kpetd3P9sJdYQPSq6yQjBs7w9DahQpBj6WAoD",
"subgraphStudioDevHoprOnGnosisSubgraphName": "hopr-on-gnosis",
"subgraphStudioDevHoprOnGnosisVersion": "v0.0.2",
"subgraphHostedHoprOnGnosisSubgraphName": "hopr-on-xdai"
"subgraphHostedHoprOnGnosisSubgraphName": "hopr-on-xdai",
"exponent": "0.75"
}
},
"network": "1",
Expand Down
Loading

0 comments on commit b79cf32

Please sign in to comment.