Exemplo n.º 1
0
Arquivo: main.py Projeto: uivlis/sto
def kyc_deploy(config: BoardCommmadConfiguration):
    """
    Deploys Kyc contract to desired ethereum network.
    required args network, ethereum-abi-file, ethereum-private-key, ethereum-node-url
    """
    from sto.ethereum.utils import deploy_contract
    deploy_contract(config, contract_name='BasicKYC')
Exemplo n.º 2
0
Arquivo: main.py Projeto: uivlis/sto
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)
Exemplo n.º 3
0
Arquivo: main.py Projeto: uivlis/sto
def deploy_crowdsale_token(config: BoardCommmadConfiguration):
    """
    Command to be used only for testing
    """
    from sto.ethereum.utils import deploy_contract
    args = {
        "_name": 'test_token',
        "_symbol": 'TEST',
        "_initialSupply": 900000000,
        "_decimals": 18,
        "_mintable": True
    }
    deploy_contract(config,
                    contract_name='CrowdsaleToken',
                    constructor_args=args)
Exemplo n.º 4
0
Arquivo: main.py Projeto: uivlis/sto
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)
Exemplo n.º 5
0
 def contract_deploy(config, contract_name, args):
     deploy_contract(config, contract_name, constructor_args=args)