read block ranges from chain
@@ -3,7 +3,7 @@ import time
from brownie import *
from config.badger_config import badger_config
from rich.console import Console
-from scripts.systems.badger_system import connect_badger
+from scripts.systems.badger_system import BadgerSystem, connect_badger
from config.rewards_config import rewards_config
from assistant.rewards.rewards_assistant import fetch_current_rewards_tree, fetch_pending_rewards_tree, run_action
@@ -25,12 +25,12 @@ def get_last_published_cycle(badger):
# Sanity check: Ensure start block is not too close to end block
return (currentRewards, lastClaimStart, lastClaimEnd)
-def get_last_proposed_cycle(badger):
+def get_last_proposed_cycle(badger: BadgerSystem):
# Fetch the appropriate file
currentRewards = fetch_pending_rewards_tree(badger)
- lastClaimEnd = int(currentRewards["endBlock"])
- lastClaimStart = int(currentRewards["startBlock"])
+ lastClaimEnd = badger.badgerTree.lastProposeEndBlock()
+ lastClaimStart = badger.badgerTree.lastProposeStartBlock()
# Sanity check: Ensure previous cycle was not too long
assert lastClaimStart > lastClaimEnd - rewards_config.maxStartBlockAge
@@ -47,7 +47,7 @@ def calc_next_cycle_range(badger):
# Fetch the appropriate file
currentRewards = fetch_current_rewards_tree(badger)
- lastClaimEnd = int(currentRewards["endBlock"])
+ lastClaimEnd = badger.badgerTree.lastPublishEndBlock()
startBlock = lastClaimEnd + 1
# Claim at current block
