Exemple #1
0
from ether_node import EtherNode

ETH_NODE_HTTP = "https://mainnet.infura.io/v3/99a79f80961b4db7aab7c9f54375eda7"
idexfile = "../build/contracts/Exchange.json"

if __name__ == "__main__":
    # get ether node
    enode = EtherNode(ETH_NODE_HTTP)
    # get idex contract: exchange
    idex = enode.get_contract("0x2a0c0DBEcC7E4D658f48E01e3fA353F44050c208",
                              idexfile)

    # get period
    period = idex.functions.inactivityReleasePeriod().call()
    print("period :", period)
Exemple #2
0
from ether_node import EtherNode

ETH_NODE_HTTP = "https://mainnet.infura.io/v3/99a79f80961b4db7aab7c9f54375eda7"
ddexfile = "../build/contracts/HybridExchange.json"

if __name__ == "__main__":
    # get ether node
    enode = EtherNode(ETH_NODE_HTTP)
    # get ddex contract: hybrid exchange
    ddex = enode.get_contract("0xE2a0BFe759e2A4444442Da5064ec549616FFF101", ddexfile)

    # get proxy
    proxy = ddex.functions.proxyAddress().call()
    print("proxy address:", proxy)

Exemple #3
0
qts = [
    "0x8e4d8D520f52B044e1E8B054D763B723B7C3E716",
    "0x45e110F81bBf89041A63Bc2403058743bc552bAF",
    "0x7B29ed69368B0Ed0d3b21A857BaEeF788B13c626",
    "0x60423Ebc63245631Ea71bdF58CF23A3949329cDb"
]

proxyaddr = "0x6BeE8B8a06F2Df4c3e3BE7E6ca8E489602378186"
hdaddr = "0xbc6B59f5a1e86F262Ae92A81aE1c44F401521577"
ymaddr = "0x950b5C568c46B1abcDC21F7348d9F29B7c64462a"

ownerfile = "./keystore/UTC--2019-07-20T04-00-01.800933268Z--a9535b10ee96b4a03269d0e0def417af97477fd6"

# get ether node
enode = EtherNode(ETH_NODE_HTTP)

# decrype keystore file
acc = enode.decrypt_keystore(ownerfile, "123456")
print("acc address:", acc.address)
relayer = acc
print("relayer address:", relayer.address)

# get contract
proxy = enode.get_contract(proxyaddr, proxyjson)
hd = enode.get_contract(hdaddr, hdjson)
tm = enode.get_contract(ymaddr, tmjson)

APPROVE_VALUE = 10**27

# approve
Exemple #4
0
ownerfile = "./keystore/UTC--2019-07-20T04-00-01.800933268Z--a9535b10ee96b4a03269d0e0def417af97477fd6"
MAGNITUDE = 10 ** 18


def tpt_cstcb(cst, args):
    return cst()

def rand_cstcb(cst, args):
    return cst()

def bt_cstcb(cst, args):
    return cst(args[0])

if __name__ == "__main__":
    # get ether node
    enode = EtherNode()
    # decrype keystore file
    acc = enode.decrypt_keystore(ownerfile, None)

    # deploy contract: TPT
    #tpt = enode.create_contract(acc, tptfile, tpt_cstcb, None, True)
    #print("tpt address:", tpt.address)
    #tpt = enode.create_contract(acc, tptfile, tpt_cstcb, None, True)
    #print("tpt address:", tpt.address)
    #tpt = enode.create_contract(acc, tptfile, tpt_cstcb, None, True)
    #print("tpt address:", tpt.address)
    #tpt = enode.create_contract(acc, tptfile, tpt_cstcb, None, True)
    #print("tpt address:", tpt.address)

    # deploy contract: random
    #random = enode.create_contract(acc, randfile, rand_cstcb, None, True)
Exemple #5
0
qts = [
    "0x6C3118c39FAB22caF3f9910cd054F8ea435B5FFB",
    "0xe898663A2CbDf7a371bB4B6a5dd7aC93d4505C9a",
    "0xEAB3A69a992aeC845099717B148DC1995DD57685",
    "0x2e01154391F7dcBf215c77DBd7fF3026Ea7514ce"
]

proxyaddr = "0x6BeE8B8a06F2Df4c3e3BE7E6ca8E489602378186"
hdaddr = "0xbc6B59f5a1e86F262Ae92A81aE1c44F401521577"
ymaddr = "0x950b5C568c46B1abcDC21F7348d9F29B7c64462a"

ownerfile = "./keystore/UTC--2019-07-20T04-00-01.800933268Z--a9535b10ee96b4a03269d0e0def417af97477fd6"

# get ether node
enode = EtherNode(ETH_NODE_HTTP)

# decrype keystore file
acc = enode.decrypt_keystore(ownerfile, "123456")
print("acc address:", acc.address)
relayer = acc
print("relayer address:", acc.address)

# get contract
proxy = enode.get_contract(proxyaddr, proxyjson)
hd = enode.get_contract(hdaddr, hdjson)
ym = enode.get_contract(ymaddr, ymjson)

APPROVE_VALUE = 10**27

################### approve for proxy ##############start
Exemple #6
0
from ether_node import EtherNode
from eth_account.messages import encode_defunct
import web3

ETH_NODE_HTTP = "https://ropsten.infura.io/v3/99a79f80961b4db7aab7c9f54375eda7"

tptjson = "../build/contracts/TPToken.json"

btaddr = "0x2e01154391F7dcBf215c77DBd7fF3026Ea7514ce"
qtaddr = "0x2e01154391F7dcBf215c77DBd7fF3026Ea7514ce"

proxy = "0x141A60c20026d88385a5339191C3950285e41072"
owner = web3.Web3.toChecksumAddress("0xab890808775d51e9bf9fa76f40ee5fff124dece5")

# get ether node
enode = EtherNode(ETH_NODE_HTTP)

# get btaddr, qtaddr
btoken = enode.get_contract(btaddr, tptjson)
qtoken = enode.get_contract(qtaddr, tptjson)

bb = btoken.functions.balanceOf(owner).call()
bq = qtoken.functions.balanceOf(owner).call()
print("base  token amount", bb)
print("quote token amount", bq)

ab = btoken.functions.allowance(owner, proxy).call()
aq = qtoken.functions.allowance(owner, proxy).call()
print("base  token appove", ab)
print("quote token appove", aq)
Exemple #7
0
#qtaddr = "0xf5b328881db39a497e3a5937F3fE44709069796e"
#relayer = "0xef7bd13F0Cc305A907E1e75B16bc4A7c2F28f073"

proxyaddr = "0x6BeE8B8a06F2Df4c3e3BE7E6ca8E489602378186"
tmaddr = "0x3762fF9389feaE5C7C00aC765C1f0056f9B53eCB"
hdaddr = "0xC34528755ACBcf1872FeE04c5Cf4BbE112cdafA2"
btaddr = "0x6C3118c39FAB22caF3f9910cd054F8ea435B5FFB"
qtaddr = "0xe898663A2CbDf7a371bB4B6a5dd7aC93d4505C9a"

#relayer = web3.Web3.toChecksumAddress("0x3d9c6c5a7b2b2744870166eac237bd6e366fa3ef")
#relayer = web3.Web3.toChecksumAddress("0xA9535b10EE96b4A03269D0e0DEf417aF97477FD6")

ownerfile = "./keystore/UTC--2019-07-20T04-00-01.800933268Z--a9535b10ee96b4a03269d0e0def417af97477fd6"

# get ether node
enode = EtherNode(ETH_NODE_HTTP)

# decrype keystore file
relayer = enode.decrypt_keystore(ownerfile, "123456")
print("relayer address:", relayer.address)
acc = web3.eth.Eth.account.privateKeyToAccount(
    "279EFAC43AAE9405DCD9A470B9228C1A3C0F2DEFC930AD1D9B764E78D28DB1DF")
print("acc address:", acc.address)

# get contract
tm = enode.get_contract(tmaddr, tmjson)
hd = enode.get_contract(hdaddr, hdjson)
proxy = enode.get_contract(proxyaddr, proxyjson)

# get btaddr, qtaddr
btoken = enode.get_contract(btaddr, tptjson)
Exemple #8
0
from ether_node import EtherNode

randaddr = "0x53bf75a6948ce0B0A7680d87881008972c7CcBcB"
randfile = "../build/contracts/Random.json"
ownerfile = "./keystore/UTC--2019-07-20T04-00-01.800933268Z--a9535b10ee96b4a03269d0e0def417af97477fd6"

if __name__ == "__main__":
    # get ether node
    enode = EtherNode()
    # decrype keystore file
    acc = enode.decrypt_keystore(ownerfile)
    random = enode.get_contract(randaddr, randfile)

    rnum = enode.call_func(acc, random.functions.random(1), True)
    print("random number:", rnum)
Exemple #9
0
from ether_node import EtherNode
import config as cfg

if __name__ == "__main__":
    # get ether node
    enode = EtherNode()
    # decrype keystore file
    acc = enode.decrypt_keystore(cfg.ETH_KEYSTORE_FILE, None)
    # deploy contract
    address, abi = enode.create_contract(acc, cfg.ETH_CONTRACT_SHT_FILE, True)
    print("contract address:", address)
Exemple #10
0
from ether_node import EtherNode
import sys
from web3 import Web3

if __name__ == "__main__":
    # get ether node
    enode = EtherNode()
    # get balance
    ret = enode.get_balance(sys.argv[1])
    print(ret, "Wei --->", Web3.fromWei(ret, 'ether'), "ether")

Exemple #11
0
qts = [
    "0x6C3118c39FAB22caF3f9910cd054F8ea435B5FFB",
    "0xe898663A2CbDf7a371bB4B6a5dd7aC93d4505C9a",
    "0xEAB3A69a992aeC845099717B148DC1995DD57685",
    "0x2e01154391F7dcBf215c77DBd7fF3026Ea7514ce"
]

proxyaddr = "0x6BeE8B8a06F2Df4c3e3BE7E6ca8E489602378186"
hdaddr = "0xbc6B59f5a1e86F262Ae92A81aE1c44F401521577"
ymaddr = "0x950b5C568c46B1abcDC21F7348d9F29B7c64462a"

ownerfile = "./keystore/UTC--2019-07-20T04-00-01.800933268Z--a9535b10ee96b4a03269d0e0def417af97477fd6"

# get ether node
enode = EtherNode(ETH_NODE_HTTP)

# decrype keystore file
acc = enode.decrypt_keystore(ownerfile, None)
print("acc address:", acc.address)
print("relayer address:", acc.address)

# get contract
proxy = enode.get_contract(proxyaddr, proxyjson)
hd = enode.get_contract(hdaddr, hdjson)
ym = enode.get_contract(ymaddr, ymjson)

APPROVE_VALUE = 10**27

################### approve for proxy ##############start