Skip to content

Commit

Permalink
set active no swaps on resume
Browse files Browse the repository at this point in the history
  • Loading branch information
ovidiuolteanu committed Jul 10, 2023
1 parent 656b302 commit 6b64178
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions contracts/pair_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,14 @@ def resume(self, deployer: Account, proxy: ProxyNetworkProvider):
sc_args = []
return endpoint_call(proxy, gas_limit, deployer, Address(self.address), "resume", sc_args)

def set_active_no_swaps(self, deployer: Account, proxy: ProxyNetworkProvider):
function_purpose = f"Set pair active no swaps"
logger.info(function_purpose)

gas_limit = 10000000
sc_args = []
return endpoint_call(proxy, gas_limit, deployer, Address(self.address), "setStateActiveNoSwaps", sc_args)

def contract_start(self, deployer: Account, proxy: ProxyNetworkProvider, args: list = []):
_ = self.resume(deployer, proxy)

Expand Down
6 changes: 6 additions & 0 deletions tools/contracts_upgrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,12 @@ def resume_pair_contracts(dex_owner: Account, network_providers: NetworkProvider
if not network_providers.check_simple_tx_status(tx_hash, f"resume pair contract: {pair_address}"):
if not get_user_continue(config.FORCE_CONTINUE_PROMPT):
return
elif contract_states[pair_address] == 2:
pair_contract = PairContract("", "", PairContractVersion.V2, address=pair_address)
tx_hash = pair_contract.set_active_no_swaps(dex_owner, network_providers.proxy)
if not network_providers.check_simple_tx_status(tx_hash, f"set active no swaps on pair contract: {pair_address}"):
if not get_user_continue(config.FORCE_CONTINUE_PROMPT):
return
else:
print(f"Contract {pair_address} wasn't touched because of initial state: {contract_states[pair_address]}")

Expand Down

0 comments on commit 6b64178

Please sign in to comment.