Esempio n. 1
0
def test_create_token(eosio_testnet):
    account = eosio_testnet.new_account()

    symbol = random_token_symbol()
    max_supply = f'1000.00 {symbol}'
    ec, out = eosio_testnet.create_token(account, max_supply)

    assert ec == 0

    stats = eosio_testnet.get_token_stats(symbol)

    assert stats is not None
    assert stats['supply'] == f'0.00 {symbol}'
    assert stats['max_supply'] == max_supply
    assert stats['issuer'] == account
Esempio n. 2
0
def test_multi_sig_transaction_ok(eosio_testnet):

    issuer, worker = (eosio_testnet.new_account() for _ in range(2))

    symbol = random_token_symbol()
    amount = '1000.00'
    max_supply = f'{amount} {symbol}'

    first_amount = 20
    second_amount = 30

    fpay_amount = f'{first_amount}.00'
    spay_amount = f'{second_amount}.00'

    total_pay = f'{first_amount + second_amount}.00 {symbol}'

    ec, _ = eosio_testnet.create_token(issuer, max_supply)
    assert ec == 0

    ec, _ = eosio_testnet.issue_token(issuer, max_supply, '')
    assert ec == 0

    ec, _ = eosio_testnet.transfer_token(issuer, worker,
                                         f'{fpay_amount} {symbol}',
                                         'first pay')

    pay_asset = f'{spay_amount} {symbol}'

    proposal = eosio_testnet.multi_sig_propose(
        worker, [f'{issuer}@active'], [f'{issuer}@active'], 'eosio.token',
        'transfer', {
            'from': issuer,
            'to': worker,
            'quantity': pay_asset,
            'memo': 'multi payment'
        })

    ec, out = eosio_testnet.multi_sig_approve(worker, proposal,
                                              [f'{issuer}@active'], issuer)
    assert ec == 0

    ec, out = eosio_testnet.multi_sig_exec(worker, proposal, worker)
    assert ec == 0

    balance = eosio_testnet.get_balance(worker)

    assert balance
    assert balance == total_pay
Esempio n. 3
0
def test_issue_token(eosio_testnet):
    account = eosio_testnet.new_account()

    symbol = random_token_symbol()
    max_supply = f'1000.00 {symbol}'
    eosio_testnet.create_token(account, max_supply)

    ec, out = eosio_testnet.issue_token(account, max_supply, random_string())

    assert ec == 0

    stats = eosio_testnet.get_token_stats(symbol)

    assert stats['supply'] == max_supply

    assert eosio_testnet.get_balance(account) == max_supply
Esempio n. 4
0
def test_transfer(eosio_testnet):
    account = eosio_testnet.new_account()

    symbol = random_token_symbol()
    max_supply = f'1000.00 {symbol}'
    eosio_testnet.create_token(account, max_supply)
    eosio_testnet.issue_token(account, max_supply, random_string())

    peasant = eosio_testnet.new_account()

    charity = f'0.01 {symbol}'

    ec, out = eosio_testnet.transfer_token(account, peasant, charity,
                                           random_string())

    assert ec == 0

    assert eosio_testnet.get_balance(account) == f'999.99 {symbol}'
    assert eosio_testnet.get_balance(peasant) == charity