Exemple #1
0
def init_web3(providers=default):
    from vns_web3 import Web3

    if providers is default:
        w3 = Web3(ens=None)
    else:
        w3 = Web3(providers, ens=None)

    return customize_web3(w3)
Exemple #2
0
def name_to_hash(name):
    node = EMPTY_SHA3_BYTES
    if name:
        labels = name.split(".")
        for label in reversed(labels):
            labelhash = label_to_hash(label)
            assert isinstance(labelhash, bytes)
            assert isinstance(node, bytes)
            node = Web3().sha3(node + labelhash)
    return node
Exemple #3
0
def ensure_hex(data):
    if not isinstance(data, str):
        return Web3().toHex(data)
    return data
Exemple #4
0
def sha3_text(val):
    if isinstance(val, str):
        val = val.encode('utf-8')
    return Web3().sha3(val)
Exemple #5
0
def label_to_hash(label):
    label = normalize_name(label)
    if '.' in label:
        raise ValueError("Cannot generate hash for label %r with a '.'" %
                         label)
    return Web3().sha3(text=label)
Exemple #6
0
from vns_web3 import (
    IPCProvider,
    Web3,
)

w3 = Web3(IPCProvider())
Exemple #7
0
import json
import vns_web3
from vns_web3 import Web3, HTTPProvider
import rlp
from solc import compile_source
from web3.contract import ConciseContract
web3 = Web3(HTTPProvider('http://192.168.0.40:8585'))

def getCat(contract_address):
    json_file = open('dss/output/Cat.abi', 'r')
    json_abi = json.load(json_file)
    json_file.close()
    
    contract_address = web3.toChecksumAddress(contract_address)
    
    cat = web3.vns.contract(address=contract_address, abi=json_abi)
    return cat


def getDai(contract_address):
    json_file = open('dss/output/Dai.abi', 'r')
    json_abi = json.load(json_file)
    json_file.close()
    
    contract_address = web3.toChecksumAddress(contract_address)

    dai = web3.vns.contract(address=contract_address, abi=json_abi)
    return dai
    

def getDaiJoin(contract_address):
Exemple #8
0
from vns_web3 import (
    HTTPProvider,
    Web3,
)

w3 = Web3(HTTPProvider())
Exemple #9
0
from vns_web3 import Web3

w3 = Web3()
Exemple #10
0
from vns_web3 import (
    Web3,
    WebsocketProvider,
)

w3 = Web3(WebsocketProvider())