<reponame>edd34/OrFeed<filename>examples/python/oracle_arb_finder/core/smartcontracts.py
import os
from dotenv import load_dotenv

load_dotenv()

orfeed_contract_address_mainnet = "0x8316b082621cfedab95bf4a44a1d4b64a6ffc336"
registry_contract_address_mainnet = "0x74b5CE2330389391cC61bF2287BDC9Ac73757891"
aave_liquidity_provider = "0x3dfd23a6c5e8bbcfc9581d2e864a68feb6a076d3"

registry_abi_mainnet = [
    {
        "constant": False,
        "inputs": [
            {"name": "name", "type": "string"},
            {"name": "newOrSameOracleAddress", "type": "address"},
        ],
        "name": "editOracleAddress",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": True,
        "stateMutability": "payable",
        "type": "function",
    },
    {
        "constant": True,
        "inputs": [
            {"name": "selectedOracle", "type": "string"},
            {"name": "fromParam", "type": "string"},
            {"name": "toParam", "type": "string"},
            {"name": "side", "type": "string"},
            {"name": "amount", "type": "uint256"},
        ],
        "name": "getPriceFromOracle",
        "outputs": [{"name": "", "type": "uint256"}],
        "payable": False,
        "stateMutability": "view",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [],
        "name": "withdrawBalance",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": True,
        "inputs": [],
        "name": "getAllOracles",
        "outputs": [{"name": "", "type": "string[]"}],
        "payable": False,
        "stateMutability": "view",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "newFee", "type": "uint256"}],
        "name": "changeFee",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "name", "type": "string"},
            {"name": "requestedAddress", "type": "address"},
            {"name": "info", "type": "string"},
        ],
        "name": "registerOracle",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": True,
        "stateMutability": "payable",
        "type": "function",
    },
    {
        "constant": True,
        "inputs": [{"name": "nameReference", "type": "string"}],
        "name": "getOracleInfo",
        "outputs": [{"name": "", "type": "string"}],
        "payable": False,
        "stateMutability": "view",
        "type": "function",
    },
    {
        "constant": True,
        "inputs": [{"name": "nameReference", "type": "string"}],
        "name": "getOracleOwner",
        "outputs": [{"name": "", "type": "address"}],
        "payable": False,
        "stateMutability": "view",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "name", "type": "string"},
            {"name": "info", "type": "string"},
        ],
        "name": "editOracleInfo",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": True,
        "stateMutability": "payable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "newOwner", "type": "address"}],
        "name": "changeOwner",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": True,
        "inputs": [{"name": "nameReference", "type": "string"}],
        "name": "getOracleAddress",
        "outputs": [{"name": "", "type": "address"}],
        "payable": False,
        "stateMutability": "view",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "name", "type": "string"},
            {"name": "toAddress", "type": "address"},
        ],
        "name": "transferOracleName",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "inputs": [],
        "payable": True,
        "stateMutability": "payable",
        "type": "constructor",
    },
]

orfeed_abi_mainnet = [
    {
        "constant": False,
        "inputs": [
            {"name": "symb", "type": "string"},
            {"name": "tokenAddress", "type": "address"},
            {"name": "byteCode", "type": "bytes32"},
        ],
        "name": "addFreeCurrency",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": True,
        "inputs": [
            {"name": "fromSymbol", "type": "string"},
            {"name": "toSymbol", "type": "string"},
            {"name": "venue", "type": "string"},
            {"name": "amount", "type": "uint256"},
            {"name": "referenceId", "type": "string"},
        ],
        "name": "requestAsyncExchangeRateResult",
        "outputs": [{"name": "", "type": "uint256"}],
        "payable": False,
        "stateMutability": "view",
        "type": "function",
    },
    {
        "constant": True,
        "inputs": [
            {"name": "eventName", "type": "string"},
            {"name": "source", "type": "string"},
            {"name": "referenceId", "type": "string"},
        ],
        "name": "getAsyncEventResult",
        "outputs": [{"name": "", "type": "string"}],
        "payable": False,
        "stateMutability": "view",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "newDiv", "type": "uint256"},
            {"name": "newMul", "type": "uint256"},
        ],
        "name": "updateMulDivConverter2",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "synth", "type": "bytes32"},
            {"name": "token", "type": "address"},
            {"name": "inputAmount", "type": "uint256"},
        ],
        "name": "getSynthToTokenOutputAmount",
        "outputs": [{"name": "", "type": "uint256"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "symb", "type": "string"},
            {"name": "tokenAddress", "type": "address"},
        ],
        "name": "addFreeToken",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "_a", "type": "string"}, {"name": "_b", "type": "string"}],
        "name": "compare",
        "outputs": [{"name": "", "type": "int256"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "newOracle", "type": "address"}],
        "name": "updateForexOracleAddress",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "_a", "type": "string"}, {"name": "_b", "type": "string"}],
        "name": "equal",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": True,
        "inputs": [
            {"name": "eventName", "type": "string"},
            {"name": "source", "type": "string"},
        ],
        "name": "getEventResult",
        "outputs": [{"name": "", "type": "string"}],
        "payable": False,
        "stateMutability": "view",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "newOracle", "type": "address"}],
        "name": "updateSynthAddress",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "newDiv", "type": "uint256"},
            {"name": "newMul", "type": "uint256"},
        ],
        "name": "updateMulDivConverter1",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "newDiv", "type": "uint256"},
            {"name": "newMul", "type": "uint256"},
        ],
        "name": "updateMulDivConverter3",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": True,
        "inputs": [
            {"name": "fromSymbol", "type": "string"},
            {"name": "toSymbol", "type": "string"},
            {"name": "venue", "type": "string"},
            {"name": "amount", "type": "uint256"},
        ],
        "name": "getExchangeRate",
        "outputs": [{"name": "", "type": "uint256"}],
        "payable": False,
        "stateMutability": "view",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "symb", "type": "string"}],
        "name": "removeFreeToken",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "newOracle", "type": "address"}],
        "name": "updateEthTokenAddress",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "fundsReturnToAddress", "type": "address"},
            {"name": "liquidityProviderContractAddress", "type": "address"},
            {"name": "tokens", "type": "string[]"},
            {"name": "amount", "type": "uint256"},
            {"name": "exchanges", "type": "string[]"},
        ],
        "name": "arb",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": True,
        "stateMutability": "payable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "newOracle", "type": "address"}],
        "name": "updatePremiumSubOracleAddress",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "_haystack", "type": "string"},
            {"name": "_needle", "type": "string"},
        ],
        "name": "indexOf",
        "outputs": [{"name": "", "type": "int256"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "symb", "type": "string"}],
        "name": "removeFreeCurrency",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "newOracle", "type": "address"}],
        "name": "updateAsyncOracleAddress",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "venueToCheck", "type": "string"}],
        "name": "isFreeVenueCheck",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "symToCheck", "type": "string"}],
        "name": "isFree",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "newAddress", "type": "address"}],
        "name": "updateArbContractAddress",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "newOwner", "type": "address"}],
        "name": "changeOwner",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "newOracle", "type": "address"}],
        "name": "updateAsyncEventsAddress",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": True,
        "inputs": [{"name": "tokenAddress", "type": "address"}],
        "name": "getTokenDecimalCount",
        "outputs": [{"name": "", "type": "uint256"}],
        "payable": False,
        "stateMutability": "view",
        "type": "function",
    },
    {
        "constant": True,
        "inputs": [{"name": "a", "type": "string"}, {"name": "b", "type": "string"}],
        "name": "compareStrings",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "view",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "eventName", "type": "string"},
            {"name": "source", "type": "string"},
        ],
        "name": "requestAsyncEvent",
        "outputs": [{"name": "", "type": "string"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": True,
        "inputs": [{"name": "symbol", "type": "string"}],
        "name": "getTokenAddress",
        "outputs": [{"name": "", "type": "address"}],
        "payable": False,
        "stateMutability": "view",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "token", "type": "address"},
            {"name": "synth", "type": "bytes32"},
            {"name": "inputAmount", "type": "uint256"},
        ],
        "name": "getTokenToSynthOutputAmount",
        "outputs": [{"name": "", "type": "uint256"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "source", "type": "string"}],
        "name": "stringToBytes32",
        "outputs": [{"name": "result", "type": "bytes32"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "fromSymbol", "type": "string"},
            {"name": "toSymbol", "type": "string"},
            {"name": "venue", "type": "string"},
            {"name": "amount", "type": "uint256"},
        ],
        "name": "requestAsyncExchangeRate",
        "outputs": [{"name": "", "type": "string"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "newOracle", "type": "address"}],
        "name": "updateTokenOracleAddress2",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "newOracle", "type": "address"}],
        "name": "updateSyncEventsAddress",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": True,
        "inputs": [{"name": "symbol", "type": "string"}],
        "name": "getSynthBytes32",
        "outputs": [{"name": "", "type": "bytes32"}],
        "payable": False,
        "stateMutability": "view",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "fromSymb", "type": "string"},
            {"name": "toSymb", "type": "string"},
            {"name": "amount", "type": "uint256"},
        ],
        "name": "getFreeExchangeRate",
        "outputs": [{"name": "", "type": "uint256"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [{"name": "newOracle", "type": "address"}],
        "name": "updateTokenOracleAddress",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "newDiv", "type": "uint256"},
            {"name": "newMul", "type": "uint256"},
        ],
        "name": "updateMulDivConverter4",
        "outputs": [{"name": "", "type": "bool"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "constant": True,
        "inputs": [{"name": "symbol", "type": "string"}],
        "name": "getForexAddress",
        "outputs": [{"name": "", "type": "address"}],
        "payable": False,
        "stateMutability": "view",
        "type": "function",
    },
    {
        "constant": False,
        "inputs": [
            {"name": "param1", "type": "string"},
            {"name": "param2", "type": "string"},
            {"name": "param3", "type": "string"},
            {"name": "param4", "type": "string"},
        ],
        "name": "callExtraFunction",
        "outputs": [{"name": "", "type": "string"}],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function",
    },
    {
        "inputs": [],
        "payable": True,
        "stateMutability": "payable",
        "type": "constructor",
    },
    {"payable": True, "stateMutability": "payable", "type": "fallback"},
]

my_smartcontracts = {}
if os.getenv("NETWORK") == "mainnet":
    my_smartcontracts["orfeed"] = {
        "address": orfeed_contract_address_mainnet,
        "abi": orfeed_abi_mainnet,
    }
    my_smartcontracts["registry"] = {
        "address": registry_contract_address_mainnet,
        "abi": registry_abi_mainnet,
    }
