Skip to content

Commit

Permalink
Fix first vote (#69)
Browse files Browse the repository at this point in the history
* Fix first vote

* Update oracle version
  • Loading branch information
tsudmi authored Feb 26, 2022
1 parent 8e29963 commit 58f131e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions deploy/gnosis/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ networks:
services:
oracle:
container_name: oracle_gnosis
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.7
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.8
restart: always
entrypoint: ["python"]
command: ["oracle/oracle/main.py"]
Expand All @@ -34,7 +34,7 @@ services:

keeper:
container_name: keeper_gnosis
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.7
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.8
restart: always
entrypoint: ["python"]
command: ["oracle/keeper/main.py"]
Expand Down
4 changes: 2 additions & 2 deletions deploy/goerli/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ networks:
services:
oracle:
container_name: oracle_goerli
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.7
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.8
restart: always
entrypoint: ["python"]
command: ["oracle/oracle/main.py"]
Expand All @@ -36,7 +36,7 @@ services:

keeper:
container_name: keeper_goerli
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.7
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.8
restart: always
entrypoint: ["python"]
command: ["oracle/keeper/main.py"]
Expand Down
4 changes: 2 additions & 2 deletions deploy/mainnet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ networks:
services:
oracle:
container_name: oracle_mainnet
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.7
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.8
restart: always
entrypoint: ["python"]
command: ["oracle/oracle/main.py"]
Expand All @@ -36,7 +36,7 @@ services:

keeper:
container_name: keeper_mainnet
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.7
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.8
restart: always
entrypoint: ["python"]
command: ["oracle/keeper/main.py"]
Expand Down
4 changes: 2 additions & 2 deletions deploy/perm_goerli/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ networks:
services:
oracle:
container_name: oracle_perm_goerli
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.7
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.8
restart: always
entrypoint: ["python"]
command: ["oracle/oracle/main.py"]
Expand All @@ -36,7 +36,7 @@ services:

keeper:
container_name: keeper_perm_goerli
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.7
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v2.2.8
restart: always
entrypoint: ["python"]
command: ["oracle/keeper/main.py"]
Expand Down
10 changes: 9 additions & 1 deletion oracle/oracle/distributor/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ async def process(self, voting_params: DistributorVotingParameters) -> None:

last_merkle_root = voting_params["last_merkle_root"]
last_merkle_proofs = voting_params["last_merkle_proofs"]
if w3.toInt(hexstr=last_merkle_root) and last_merkle_proofs:
if (
last_merkle_root is not None
and w3.toInt(hexstr=last_merkle_root)
and last_merkle_proofs
):
# fetch accounts that have claimed since last merkle root update
claimed_accounts = await get_distributor_claimed_accounts(
network=self.network, merkle_root=last_merkle_root
Expand Down Expand Up @@ -165,6 +169,10 @@ async def process(self, voting_params: DistributorVotingParameters) -> None:
final_rewards, unclaimed_rewards
)

if not final_rewards:
logger.info(f"[{self.network}] No rewards to distribute")
return

# calculate merkle root
merkle_root, claims = calculate_merkle_root(final_rewards)
logger.info(f"[{self.network}] Generated new merkle root: {merkle_root}")
Expand Down
4 changes: 2 additions & 2 deletions oracle/oracle/distributor/uniswap_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from eth_typing import BlockNumber, ChecksumAddress
from web3 import Web3

from oracle.networks import GNOSIS_CHAIN, NETWORKS
from oracle.networks import GNOSIS_CHAIN, NETWORKS, PERM_GOERLI
from oracle.oracle.clients import execute_uniswap_v3_gql_query
from oracle.oracle.graphql_queries import (
UNISWAP_V3_CURRENT_TICK_POSITIONS_QUERY,
Expand Down Expand Up @@ -38,7 +38,7 @@ async def get_uniswap_v3_pools(
network: str, block_number: BlockNumber
) -> UniswapV3Pools:
"""Fetches Uniswap V3 pools."""
if network == GNOSIS_CHAIN:
if network in (GNOSIS_CHAIN, PERM_GOERLI):
return UniswapV3Pools(
staked_token_pools=set(),
reward_token_pools=set(),
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "oracle"
version = "2.2.7"
version = "2.2.8"
description = "StakeWise Oracles are responsible for submitting off-chain data."
authors = ["Dmitri Tsumak <[email protected]>"]
license = "AGPL-3.0-only"
Expand Down

0 comments on commit 58f131e

Please sign in to comment.