Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy on Neutron-testnet #80

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,45 +24,59 @@
CONTRACT_NAMES = {
'bostrom': 'on-chain-registry github.com/Snedashkovsky/on-chain-registry',
'localbostrom': 'on-chain-registry github.com/Snedashkovsky/on-chain-registry',
'osmosis-testnet': 'on-chain-registry github.com/Snedashkovsky/on-chain-registry'
'osmosis-testnet': 'on-chain-registry github.com/Snedashkovsky/on-chain-registry',
'neutron-testnet': 'on-chain-registry github.com/Snedashkovsky/on-chain-registry'
}
CODE_IDS = {
'bostrom': '33',
'localbostrom': '57',
'osmosis-testnet': '3352'
'osmosis-testnet': '3352',
'neutron-testnet': '1697'
}

# for export to contracts
EXPORT_CHAINS = ['bostrom', 'osmosis-testnet']
CHAIN_IDS = {
'bostrom': 'bostrom',
'localbostrom': 'localbostrom',
'osmosis-testnet': 'osmo-test-5'
'osmosis-testnet': 'osmo-test-5',
'neutron-testnet': 'pion-1'
}
PREFIXES = {
'bostrom': 'bostrom',
'localbostrom': 'bostrom',
'osmosis-testnet': 'osmo'
'osmosis-testnet': 'osmo',
'neutron-testnet': 'neutron'
}
FEE_DENOMS = {
'bostrom': 'boot',
'localbostrom': 'boot',
'osmosis-testnet': 'uosmo'
'osmosis-testnet': 'uosmo',
'neutron-testnet': 'untrn'
}
CLI_NAME = {
'bostrom': 'cyber',
'localbostrom': 'cyber',
'osmosis-testnet': 'osmosisd',
'neutron-testnet': 'neutrond'
}
NODE_RPC_URLS = {
'bostrom': 'https://rpc.bostrom.cybernode.ai:443',
'localbostrom': 'http://localhost:26657',
'osmosis-testnet': 'https://osmosis-testnet-rpc.polkachu.com:443'
'osmosis-testnet': 'https://osmosis-testnet-rpc.polkachu.com:443',
'neutron-testnet': 'https://rpc-falcron.pion-1.ntrn.tech:443'
}
NODE_LCD_URLS = {
'bostrom': 'https://lcd.bostrom.cybernode.ai',
'localbostrom': 'http://localhost:1317',
'osmosis-testnet': 'https://osmosis-testnet-api.polkachu.com'
'osmosis-testnet': 'https://osmosis-testnet-api.polkachu.com',
'neutron-testnet': 'https://rest-falcron.pion-1.ntrn.tech'
}
CONTRACT_ADDRESSES = {
'bostrom': 'bostrom1w33tanvadg6fw04suylew9akcagcwngmkvns476wwu40fpq36pms92re6u',
'localbostrom': 'bostrom1l2rs0hxzfy343z8n6punpj9gwzrsq644nzzls6dql52jjj2nxncqjn5vg3',
'osmosis-testnet': 'osmo1nwesd2xe6cnvtpqd29xg7qeznlm65x02lfjfg20wlvkdze20hcxsftxtzz'
'osmosis-testnet': 'osmo1nwesd2xe6cnvtpqd29xg7qeznlm65x02lfjfg20wlvkdze20hcxsftxtzz',
'neutron-testnet': 'neutron10v5u2pqce59j0sm6nzv6a42qfus2rdcsxr5y2g27qawulqdss57qjsta8y'
}

LCD_CLIENTS = {_network: LCDClient(url=NODE_LCD_URLS[_network],
Expand Down
11 changes: 7 additions & 4 deletions contract_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from cyberutils.bash import execute_bash

from config import logging, CHAIN_IDS, NODE_RPC_URLS, WALLET_ADDRESSES, CONTRACT_NAMES, CODE_IDS
from config import logging, CHAIN_IDS, NODE_RPC_URLS, WALLET_ADDRESSES, CONTRACT_NAMES, CODE_IDS, CLI_NAME


def build_code(
Expand Down Expand Up @@ -157,25 +157,28 @@ def init_on_chain_registry_contract(

chain_name = args.chain_name if args.chain_name else 'bostrom'
assert chain_name in CHAIN_IDS.keys()

logging.info('!!! start')
if args.build_code:
logging.info(f'start code building')
build_code()
logging.info(f'the code has been built')

if args.store_code:
logging.info('start storing of code')
code_id = store_code(
wallet_address=WALLET_ADDRESSES[chain_name],
note=CONTRACT_NAMES[chain_name],
chain_id=CHAIN_IDS[chain_name],
node_rpc_url=NODE_RPC_URLS[chain_name],
cli_name='osmosisd' if chain_name[:7] == 'osmosis' else 'cyber'
cli_name=CLI_NAME[chain_name]
)
if code_id:
logging.info(f'the code has been stored in {chain_name}, code id {code_id}.\nplease update `config.py`')
else:
code_id = CODE_IDS[chain_name]

if args.init_contract:
logging.info('start contract instantiating')
contract_address = init_on_chain_registry_contract(
executors_addresses=[WALLET_ADDRESSES[chain_name]],
admins_addresses=[WALLET_ADDRESSES[chain_name]],
Expand All @@ -184,7 +187,7 @@ def init_on_chain_registry_contract(
contract_label=CONTRACT_NAMES[chain_name],
chain_id=CHAIN_IDS[chain_name],
node_rpc_url=NODE_RPC_URLS[chain_name],
cli_name='osmosisd' if chain_name[:7] == 'osmosis' else 'cyber'
cli_name=CLI_NAME[chain_name]
)
if contract_address:
logging.info(f'the contract has been instantiated in {chain_name} network, '
Expand Down
5 changes: 3 additions & 2 deletions src/contract_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from tqdm import tqdm
import requests
import base64
from time import sleep

from cyber_sdk.client.lcd import LCDClient, Wallet
from cyber_sdk.client.lcd.api.tx import BlockTxBroadcastResult
from cyberutils.contract import execute_contract
from cyberutils.bash import display_sleep

from config import logging, CONTRACT_ADDRESSES, LCD_CLIENTS, WALLETS, WALLET_ADDRESSES, FEE_DENOMS, EXPORT_CHAINS

Expand Down Expand Up @@ -99,10 +99,11 @@ def save_to_contract(
fee_amount=int(gas * 0.0025) if wallet_address[:4] == 'osmo' else 0
)
if _res is None:
sleep(10)
display_sleep(10)
_res_list.append(_res)
if len(str(_res)) < 500:
logging.error(_res)
display_sleep(10)

return _res_list

Expand Down