Ejemplo n.º 1
0
        def deploy(_deploy_data, _token_id):
            # TODO: Work out why execution options doesn't work
            g.show_all = True
            reserve_token_address = bt.deploy_and_fund_reserve_token(**_deploy_data)

            _token = Token.query.get(_token_id)
            _token.address = reserve_token_address

            _token.get_decimals()

            master_org = Organisation.query.filter_by(is_master=True).execution_options(show_all=True).first()
            master_org.bind_token(_token)
            master_org.org_level_transfer_account.set_balance_offset(int(_deploy_data['fund_amount_wei'] / 1e16))
            db.session.commit()
Ejemplo n.º 2
0
def get_or_create_reserve_token(deploying_address, name, symbol):

    reserve_token = Token.query.filter_by(symbol=symbol).first()
    if reserve_token:
        return reserve_token

    else:
        reserve_token_address = bt.deploy_and_fund_reserve_token(
            deploying_address=deploying_address,
            name=name,
            symbol=symbol,
            fund_amount_wei=0
        )

        reserve_token = Token(address=reserve_token_address, name=name, symbol=symbol, token_type=TokenType.RESERVE)
        reserve_token.decimals = 18

        db.session.add(reserve_token)

        return reserve_token
Ejemplo n.º 3
0
def external_reserve_token(test_client, init_database, loaded_master_wallet_address):
    from server.models.token import Token
    from server import bt

    name = "AUD Reserve Token"
    symbol = "AUD"

    reserve_token_address = bt.deploy_and_fund_reserve_token(
        deploying_address=loaded_master_wallet_address,
        name=name,
        symbol=symbol,
        fund_amount_wei=4 * 10 ** 18
    )

    reserve_token = Token(address=reserve_token_address, name=name, symbol=symbol, token_type=TokenType.RESERVE)
    reserve_token.decimals = 18

    db.session.add(reserve_token)
    db.session.commit()

    return reserve_token