2022-07-04 19:49:14 +00:00
|
|
|
#!/usr/bin/python3.9
|
|
|
|
|
|
|
|
import contract
|
|
|
|
from robot.api import logger
|
|
|
|
from robot.api.deco import keyword
|
2022-07-05 10:17:36 +00:00
|
|
|
|
2022-07-12 09:59:19 +00:00
|
|
|
from common import IR_WALLET_PATH, IR_WALLET_PASS, MORPH_ENDPOINT
|
2022-07-05 10:17:36 +00:00
|
|
|
|
2022-07-12 09:59:19 +00:00
|
|
|
ROBOT_AUTO_KEYWORDS = False
|
2022-07-04 19:49:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
@keyword('Get Epoch')
|
|
|
|
def get_epoch():
|
|
|
|
epoch = int(contract.testinvoke_contract(
|
2022-07-12 09:59:19 +00:00
|
|
|
contract.get_netmap_contract_hash(MORPH_ENDPOINT),
|
|
|
|
"epoch",
|
|
|
|
MORPH_ENDPOINT)
|
2022-07-04 19:49:14 +00:00
|
|
|
)
|
|
|
|
logger.info(f"Got epoch {epoch}")
|
|
|
|
return epoch
|
|
|
|
|
|
|
|
|
|
|
|
@keyword('Tick Epoch')
|
|
|
|
def tick_epoch():
|
|
|
|
cur_epoch = get_epoch()
|
|
|
|
return contract.invoke_contract_multisig(
|
2022-07-12 09:59:19 +00:00
|
|
|
contract.get_netmap_contract_hash(MORPH_ENDPOINT),
|
2022-07-04 19:49:14 +00:00
|
|
|
f"newEpoch int:{cur_epoch+1}",
|
2022-07-12 09:59:19 +00:00
|
|
|
IR_WALLET_PATH, IR_WALLET_PASS, MORPH_ENDPOINT)
|