Ejemplo n.º 1
0
def test_transfer(accounts, rpc):
    pub = PublicKeyAccount("0x0000Ed2a7C4cC60DD8F676AE44D0831d3c9b2a9E")
    assert pub.balance() == 0
    accounts[0].transfer(pub, "10 ether")
    assert pub.balance() == "10 ether"
    rpc.reset()
    assert pub.balance() == 0
Ejemplo n.º 2
0
def test_init(accounts):
    PublicKeyAccount("0x14b0Ed2a7C4cC60DD8F676AE44D0831d3c9b2a9E")
    PublicKeyAccount(accounts[0])
    with pytest.raises(ValueError):
        PublicKeyAccount(
            "0x416b8a7d9290502f5661da81f0cf43893e3d19cb9aea3c426cfb36e8186e9c09"
        )
Ejemplo n.º 3
0
def test_eq(accounts):
    pub = PublicKeyAccount("0x14b0Ed2a7C4cC60DD8F676AE44D0831d3c9b2a9E")
    assert pub == PublicKeyAccount(
        "0x14b0Ed2a7C4cC60DD8F676AE44D0831d3c9b2a9E")
    assert pub == "0x14b0Ed2a7C4cC60DD8F676AE44D0831d3c9b2a9E"
    assert pub != "potato"
    assert PublicKeyAccount(accounts[0]) != accounts[0]
def main():
    print(f"You are using the '{network.show_active()}' network")
    dev = accounts.load("dev")
    print(f"You are using: 'dev' [{dev.address}]")

    if input("Deploy TrustedVaultSwap? y/[N]: ").lower() != "y":
        return

    vaultSwap = TrustedVaultSwap.deploy(
        PublicKeyAccount("v2.registry.ychad.eth").address, {"from": dev})
Ejemplo n.º 5
0
def main():
    print(f"You are using the '{network.show_active()}' network")
    dev = accounts.load("dev")
    print(f"You are using: 'dev' [{dev.address}]")
    print(f"You are using 'gas price' [{GAS_PRICE}]")
    gas_strategy = GasNowStrategy(GAS_PRICE)

    if input("Deploy TrustedVaultMigrator? y/[N]: ").lower() != "y":
        return

    publish_source = click.confirm("Verify source on etherscan?")

    TrustedVaultMigrator.deploy(
        PublicKeyAccount("v2.registry.ychad.eth").address,
        "0x0000000000004946c0e9F43F4Dee607b0eF1fA1c",  # Mainnet Chi Token
        {"from": dev, "gas_price": gas_strategy},
        publish_source=publish_source,
    )
Ejemplo n.º 6
0
def test_balance(accounts):
    balance = PublicKeyAccount(accounts[0]).balance()
    assert type(balance) is Wei
    assert balance == "100 ether"
Ejemplo n.º 7
0
def test_balance(accounts):
    balance = PublicKeyAccount(accounts[0]).balance()
    assert isinstance(balance, Wei)
    assert balance == "1000 ether"
Ejemplo n.º 8
0
def test_lookup():
    pub = PublicKeyAccount("ens.snakecharmers.eth")
    assert pub == "0x808B53bF4D70A24bA5cb720D37A4835621A9df00"
    assert pub == "ens.snakecharmers.eth"
Ejemplo n.º 9
0
def test_unset():
    with pytest.raises(UnsetENSName):
        PublicKeyAccount("pleasedonot.buythisoryouwill.breakmytests.eth")
Ejemplo n.º 10
0
def test_invalid():
    with pytest.raises(InvalidName):
        PublicKeyAccount("this-is-not-an-ENS-address,isit?.eth")
Ejemplo n.º 11
0
#config['network']['networks']['ropsten'] = bc_yaml['network']['networks']['ropsten']
'''
config['networks']['default'] = bc_yaml['networks']['ropsten']
'''

data = [['Owner', 'Address', 'Balance']]

account_mio = web3.eth.account.from_key(private_key)
local_account = LocalAccount(account_mio.address, account_mio,
                             account_mio.privateKey)

print("Balance local account: {}".format(local_account.balance()))

for address in address_list:
    account = PublicKeyAccount(address['address'])
    data.append([address['name'], account.address, account.balance()])

data_table = AsciiTable(data)
print(data_table.table)

#bAccount_prj = project.load('./', name='FaucetAdvDef')

#print(local_account.address)

#fc = local_account.deploy(bAccount_prj.FaucetAdvDef)

#local_account.transfer(fc.address, Wei('1 ether'))
f = open(
    "blockchain_course_unimi/advaced_faucet/chiara_mancuso/FaucetAdvance.sol",
    "r")