import os
from web3 import Web3
from node_manager.utils import NodeManager
import pprint

pp = pprint.PrettyPrinter(indent=4)

network = 'mocMainnet'
config_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'config.json')
node_manager = NodeManager(path_to_config=config_path, network=network)
node_manager.connect_node()


print("Connecting to %s..." % network)
print("Connected: {conectado}".format(conectado=node_manager.is_connected))

path_build = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../build/contracts')
mocState_address = Web3.toChecksumAddress(node_manager.options['networks'][network]['addresses']['mocState'])
moc_state = node_manager.load_json_contract(os.path.join(path_build, "MoCState.json"),
                                            deploy_address=mocState_address)
oracle_address = Web3.toChecksumAddress(node_manager.options['networks'][network]['addresses']['oracle'])
governor_address = Web3.toChecksumAddress(node_manager.options['networks'][network]['addresses']['governor'])

init_settings = dict()
init_settings['peg'] = 1
init_settings['liq'] = int(1.04 * 10 ** 18)
init_settings['utpdu'] = int(2 * 10 ** 18)
init_settings['maxDiscRate'] = int(0.0 * 10 ** 18)
init_settings['dayBlockSpan'] = 2880
init_settings['initialEma'] = int(0.089 * 10 ** 18)
init_settings['smoothFactor'] = int(0.011049724 * 10 ** 18)
import os
from web3 import Web3
from node_manager.utils import NodeManager
from collections import OrderedDict

network = 'mocTestnet'
config_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
                           'config.json')
node_manager = NodeManager(path_to_config=config_path, network=network)
node_manager.connect_node()

print("Connecting to %s..." % network)
print("Connected: {conectado}".format(conectado=node_manager.is_connected))

path_build = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                          '../../build/contracts')
moc_moc_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['moc'])
reserve_token_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['reserveToken'])

moc_moc = node_manager.load_json_contract(os.path.join(path_build, "MoC.json"),
                                          deploy_address=moc_moc_address)
reserve_token = node_manager.load_json_contract(
    os.path.join(path_build, "ReserveToken.json"),
    deploy_address=reserve_token_address)
moc_inrate_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['mocInrate'])
moc_inrate = node_manager.load_json_contract(os.path.join(
    path_build, "MoCInrate.json"),
                                             deploy_address=moc_inrate_address)
Exemplo n.º 3
0
import os
from web3 import Web3
from node_manager.utils import NodeManager
import pprint

pp = pprint.PrettyPrinter(indent=4)

network = 'development'
config_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
                           'config.json')
node_manager = NodeManager(path_to_config=config_path, network=network)
node_manager.connect_node()

print("Connecting to %s..." % network)
print("Connected: {conectado}".format(conectado=node_manager.is_connected))

path_build = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                          '../../build/contracts')
moc_inrate_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['mocInrate'])
moc_inrate = node_manager.load_json_contract(os.path.join(
    path_build, "MoCInrate.json"),
                                             deploy_address=moc_inrate_address)
oracle_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['oracle'])
governor_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['governor'])

dayBlockSpan = 2824
init_settings = dict()
init_settings['bitProInterestBlockSpan'] = int(dayBlockSpan * 1)
Exemplo n.º 4
0
import os
from web3 import Web3
from node_manager.utils import NodeManager
from collections import OrderedDict


network = 'mocMainnet'
config_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'config.json')
node_manager = NodeManager(path_to_config=config_path, network=network)
node_manager.connect_node()


print("Connecting to %s..." % network)
print("Connected: {conectado}".format(conectado=node_manager.is_connected))


path_build = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../build/contracts')
moc_inrate_address = Web3.toChecksumAddress(node_manager.options['networks'][network]['addresses']['mocInrate'])
moc_inrate = node_manager.load_json_contract(os.path.join(path_build, "MoCInrate.json"),
                                             deploy_address=moc_inrate_address)

info = OrderedDict()
description = OrderedDict()

# INRATE
info_inrate = OrderedDict()

print("")
print("INRATES")
print("========")
Exemplo n.º 5
0
import os
from web3 import Web3
from node_manager.utils import NodeManager
import pprint

pp = pprint.PrettyPrinter(indent=4)

network = 'mocTestnet'
config_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
                           'config.json')
node_manager = NodeManager(path_to_config=config_path, network=network)
node_manager.connect_node()

print("Connecting to %s..." % network)
print("Connected: {conectado}".format(conectado=node_manager.is_connected))

path_build = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                          '../../build/contracts')

# Moc Medianizer is oracle
moc_medianizer_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['oracle'])
moc_factory_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['FeedFactory'])

moc_medianizer = node_manager.load_json_contract(
    os.path.join(path_build, "oracle", "MoCMedianizer.json"),
    deploy_address=moc_medianizer_address)
moc_factory = node_manager.load_json_contract(
    os.path.join(path_build, "oracle", "FeedFactory.json"),
    deploy_address=moc_factory_address)
Exemplo n.º 6
0
import os
from web3 import Web3
from node_manager.utils import NodeManager

network = 'development'
config_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
                           'config.json')
node_manager = NodeManager(path_to_config=config_path, network=network)
node_manager.connect_node()

print("Connecting to %s..." % network)
print("Connected: {conectado}".format(conectado=node_manager.is_connected))

path_build = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                          '../../build/contracts')
moc_moc_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['moc'])
reserve_token_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['reserveToken'])

moc_moc = node_manager.load_json_contract(os.path.join(path_build, "MoC.json"),
                                          deploy_address=moc_moc_address)
reserve_token = node_manager.load_json_contract(
    os.path.join(path_build, "ReserveToken.json"),
    deploy_address=reserve_token_address)

print("NOTE: This only work on development!!")

print("Reserve token balance:")
from_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['accounts'][0]['address'])
Exemplo n.º 7
0
import os
from web3 import Web3
from node_manager.utils import NodeManager
import datetime
import csv

network = 'mocTestnet'
config_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
                           'config.json')
node_manager = NodeManager(path_to_config=config_path, network=network)
node_manager.connect_node()

print("Connecting to %s..." % network)
print("Connected: {conectado}".format(conectado=node_manager.is_connected))

path_build = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                          '../../build/contracts')
moc_factory_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['FeedFactory'])
moc_factory = node_manager.load_json_contract(
    os.path.join(path_build, "oracle", "FeedFactory.json"),
    deploy_address=moc_factory_address)

days = 60  # testnet 160
day_blocks = 2880
hours_delta = 0

block_number = int(node_manager.block_number)

l_events = list()
for i in range(days):
Exemplo n.º 8
0
import os
from web3 import Web3
from node_manager.utils import NodeManager

network = 'mocTestnet'
config_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
                           'config.json')
node_manager = NodeManager(path_to_config=config_path, network=network)
node_manager.connect_node()

print("Connecting to %s..." % network)
print("Connected: {conectado}".format(conectado=node_manager.is_connected))

path_build = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                          '../../build/contracts')

moc_medianizer_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['oracle'])
moc_medianizer = node_manager.load_json_contract(
    os.path.join(path_build, "oracle_testnet", "MoCMedianizer.json"),
    deploy_address=moc_medianizer_address)

price_feeders = [
    '0x462D7082F3671a3BE160638Be3f8C23Ca354F48A',
    '0xE0A3dCe741b7eAd940204820B78e7990a136eaC1'
]

peek = moc_medianizer.functions.peek().call()
price = Web3.toInt(peek[0])
have_value = peek[1]
Exemplo n.º 9
0
import os
from web3 import Web3
from node_manager.utils import NodeManager

network = 'development'
config_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
                           'config.json')
node_manager = NodeManager(path_to_config=config_path, network=network)
node_manager.connect_node()

print("Connecting to %s..." % network)
print("Connected: {conectado}".format(conectado=node_manager.is_connected))

path_build = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                          '../../build/contracts')
moc_inrate_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['mocInrate'])
moc_moc_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['moc'])
mocState_address = Web3.toChecksumAddress(
    node_manager.options['networks'][network]['addresses']['mocState'])

moc_inrate = node_manager.load_json_contract(os.path.join(
    path_build, "MoCInrate.json"),
                                             deploy_address=moc_inrate_address)
moc_moc = node_manager.load_json_contract(os.path.join(path_build, "MoC.json"),
                                          deploy_address=moc_moc_address)
moc_state = node_manager.load_json_contract(os.path.join(
    path_build, "MoCState.json"),
                                            deploy_address=mocState_address)
Exemplo n.º 10
0
import os
from web3 import Web3
from node_manager.utils import NodeManager

network = 'development'
config_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
                           'config.json')
node_manager = NodeManager(path_to_config=config_path, network=network)
node_manager.connect_node()
print("Connecting to %s..." % network)
print("Connected: {conectado}".format(conectado=node_manager.is_connected))
print("Gas price: {gas_price}".format(gas_price=node_manager.gas_price))
"""
curl http://localhost:8545 -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
"""