Skip to content

Commit

Permalink
Update withdrawals cache
Browse files Browse the repository at this point in the history
Signed-off-by: cyc60 <[email protected]>
  • Loading branch information
cyc60 committed Apr 11, 2024
1 parent cb180c4 commit b73e1d3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 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:v4.0.1
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v4.0.2
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:v4.0.1
image: europe-west4-docker.pkg.dev/stakewiselabs/public/oracle:v4.0.2
restart: always
entrypoint: ["python"]
command: ["oracle/keeper/main.py"]
Expand Down
4 changes: 2 additions & 2 deletions oracle/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
Web3.toChecksumAddress("0x59ecf48345a221e0731e785ed79ed40d0a94e2a5"): 4971,
Web3.toChecksumAddress("0xf37c8f35fc820354b402054699610c098559ae44"): 4971,
},
WITHDRAWALS_CACHE_BLOCK=33192932,
WITHDRAWALS_CACHE_AMOUNT=286633425704392,
WITHDRAWALS_CACHE_BLOCK=33342932,
WITHDRAWALS_CACHE_AMOUNT=290112726977685,
),
}
8 changes: 4 additions & 4 deletions oracle/oracle/rewards/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@


class WithdrawalsCache:
def __init__(self, block: BlockNumber = None, withdrawals: Wei = None):
def __init__(self, block: BlockNumber = None, withdrawals: int = None):
self.block = block
self.withdrawals = withdrawals

def set(self, block: BlockNumber, withdrawals: Wei):
def set(self, block: BlockNumber, withdrawals: int):
self.block = block
self.withdrawals = withdrawals

def get(self) -> tuple[BlockNumber, Wei]:
def get(self) -> tuple[BlockNumber, int]:
return self.block, self.withdrawals


Expand Down Expand Up @@ -258,12 +258,12 @@ async def calculate_withdrawal_rewards(
execution_client=execution_client,
)

self.withdrawals_cache.set(to_block, withdrawals_amount)
withdrawals_amount = Web3.toWei(withdrawals_amount, "gwei")
if NETWORK == GNOSIS_CHAIN:
# apply mGNO <-> GNO exchange rate
withdrawals_amount = Wei(int(withdrawals_amount * WAD // MGNO_RATE))

self.withdrawals_cache.set(to_block, withdrawals_amount)
return withdrawals_amount

async def fetch_withdrawal_chunk(
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 = "4.0.1"
version = "4.0.2"
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 b73e1d3

Please sign in to comment.