Skip to content

Commit

Permalink
fix: tweak compare with prev params tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kadmil committed Oct 7, 2021
1 parent e41d2da commit 885d4a5
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions scripts/check_deployment_just_as_an_old_one.py
@@ -1,9 +1,6 @@
import os
from brownie import PurchaseExecutor

from utils.mainnet_fork import chain_snapshot, pass_and_exec_dao_vote
from utils.config import get_is_live

from purchase_config import (
ETH_TO_LDO_RATE_PRECISION,
ETH_TO_LDO_RATE,
Expand All @@ -13,49 +10,45 @@

DIRECT_TRANSFER_GAS_LIMIT = 400_000
SEC_IN_A_DAY = 60 * 60 * 24
OLD_EXECUTOR_ADDRESS = '0x489f04eeff0ba8441d42736549a1f1d6cca74775'

def main():
if 'EXECUTOR_ADDRESS' not in os.environ:
raise EnvironmentError('Please set the EXECUTOR_ADDRESS environment variable')

executor_address = os.environ['EXECUTOR_ADDRESS']
print(f'Using deployed executor at address {executor_address}')
print(f'Using old executor at address {OLD_EXECUTOR_ADDRESS}')

executor = PurchaseExecutor.at(executor_address)
old_executor = PurchaseExecutor.at('0x489f04eeff0ba8441d42736549a1f1d6cca74775')
old_executor = PurchaseExecutor.at(OLD_EXECUTOR_ADDRESS)

check_config_equals_old_one(executor, old_executor)
check_allocations_equal_old_ones(executor, old_executor)

print(f'[ok] Executor is configured correctly')

if get_is_live():
print('Running on a live network, cannot check allocations reception.')
print('Run on a mainnet fork to do this.')
return

with chain_snapshot():
if 'VOTE_IDS' in os.environ:
for vote_id in os.environ['VOTE_IDS'].split(','):
pass_and_exec_dao_vote(int(vote_id))
print(f'[ok] Executor is configured just as an old one')

print(f'All good!')


def check_config_equals_old_one(executor, old_executor):
print(f'Previous ETHLDO rate: {old_executor.eth_to_ldo_rate()}')
assert executor.eth_to_ldo_rate() == old_executor.eth_to_ldo_rate()
old_rate = old_executor.eth_to_ldo_rate()
print(f'Previous ETHLDO rate: {old_rate}')
assert executor.eth_to_ldo_rate() == old_rate

print(f'Previous Offer expiration delay: {old_executor.offer_expiration_delay()} days')
assert executor.offer_expiration_delay() == old_executor.offer_expiration_delay()
old_offer_expiration_delay = old_executor.offer_expiration_delay()
print(f'Previous Offer expiration delay: {old_offer_expiration_delay} days')
assert executor.offer_expiration_delay() == old_offer_expiration_delay

print(f'Previous Vesting start delay: {old_executor.vesting_start_delay()} days')
assert executor.vesting_start_delay() == old_executor.vesting_start_delay()
old_vesting_start_delay = old_executor.vesting_start_delay()
print(f'Previous Vesting start delay: {old_vesting_start_delay} days')
assert executor.vesting_start_delay() == old_vesting_start_delay

print(f'Previous Vesting end delay: {old_executor.vesting_end_delay()} days')
assert executor.vesting_end_delay() == old_executor.vesting_end_delay()
old_vesting_end_delay = old_executor.vesting_end_delay()
print(f'Previous Vesting end delay: {old_vesting_end_delay} days')
assert executor.vesting_end_delay() == old_vesting_end_delay

print(f'[ok] Global config is correct')
print(f'[ok] Global config equals an old one')


def check_allocations_equal_old_ones(executor, old_executor):
Expand All @@ -77,4 +70,4 @@ def check_allocations_equal_old_ones(executor, old_executor):

assert executor.ldo_allocations_total() == sum_old_allocations

print(f'[ok] Allocations are correct')
print(f'[ok] Allocations equal the old ones & no other are included')

0 comments on commit 885d4a5

Please sign in to comment.