Example #1
0
def free_storage(client: ContractInterface):
    print("Seleccione la entrada que desea liberar ")
    # Enumerate posibilities
    posibilities = list(enumerate(client.remoteStorage.items()))
    for posib in posibilities:
        entry, (id, value) = posib
        print("{}) {} -> {} MB".format(entry, id, value))

    # for i, (k,v) in enumerate(client.remoteStorage.items()):
    #  print("{}) {} -> {} MB".format(i, k, v))

    choice = int(input(':'))

    # Get the values
    entry, (id, amount) = posibilities[choice]
    print('Selected entry: {} -> {} {} MB'.format(entry, id, amount))
    client.free_storage(id)
Example #2
0
def main():

    print('Instantiating ContractInterface')
    client = ContractInterface()

    print('Registering...')
    client.register()
    '''
    print("Transfering 50 IoT's")
    client.transfer(client.w3.eth.accounts[2], 50)'''

    # Request 5 GB. This one should be accepted
    print('Request 5 GB (even)')
    client.request_storage(5000)

    input('Press enter for freeing')
    id, _ = client.remoteStorage.popitem()
    client.free_storage(id)