def voting_deploy(config: BoardCommmadConfiguration, token_address, kyc_address, voting_name, uri, type, options): """ Deploys Voting contract to desired ethereum network network, ethereum-abi-file, ethereum-private-key, ethereum-node-url are required args """ from sto.ethereum.utils import deploy_contract, integer_hash, get_contract_deployed_tx from eth_utils import to_bytes if kyc_address is None: tx = get_contract_deployed_tx(config.dbsession, 'BasicKYC') if not tx: raise Exception( 'BasicKYC contract not deployed. Please call kyc-deploy') kyc_address = tx.contract_address args = { '_token': token_address, '_KYC': kyc_address, 'name': to_bytes(text=voting_name), 'URI': to_bytes(text=uri), '_type': type, '_hash': integer_hash(type), '_options': [to_bytes(i) for i in options] } deploy_contract(config, contract_name='VotingContract', constructor_args=args)
def payout_deploy(config: BoardCommmadConfiguration, token_address, payout_token_address, payout_token_name, kyc_address, payout_name, uri, type, options): """ Deploys Voting contract to desired ethereum network network, ethereum-abi-file, ethereum-private-key, ethereum-node-url are required args """ from sto.ethereum.utils import deploy_contract, integer_hash, get_contract_deployed_tx from eth_utils import to_bytes from sto.ethereum.utils import (get_contract_deployed_tx) if kyc_address is None: tx = get_contract_deployed_tx(config.dbsession, 'BasicKYC') if not tx: raise Exception('BasicKYC contract not deployed. Please call ') kyc_address = tx.contract_address if payout_token_name: tx = get_contract_deployed_tx(config.dbsession, payout_token_name) if not tx: raise Exception( '{0} contract not deployed.'.format(payout_token_name)) payout_token_address = tx.contract_address if payout_token_address is None: raise Exception(''' Either payout token is not deployed or --payout-token-address not provided ''') args = { '_token': token_address, '_payoutToken': payout_token_address, '_KYC': kyc_address, 'name': to_bytes(text=payout_name), 'URI': to_bytes(text=uri), '_type': type, '_hash': integer_hash(type), '_options': [to_bytes(text=i) for i in options] } deploy_contract(config, contract_name='PayoutContract', constructor_args=args)