Ethers.js: Discussion: Using ethers.js with truffle

Created on 18 Nov 2017  ·  18Comments  ·  Source: ethers-io/ethers.js

Any pointers on using ethers.js with truffle ?

discussion

Most helpful comment

That certainly looks fine. Can you try:

console.log(registryAbi.abi.forEach)

It should print out “[function]”.

All 18 comments

Still highly experimental, but try out my npm package ethers-cli. It replaces much of truffle, and has a TestRPC included along with the ethers hook-ups to make it all work.

I hope to get the documentation up week after next, but until then it will be a lot of poking around source code to figure it out.

I'll post the Firefly sticker code tomorrow which uses it for testing, building and deploying.

Thanks ! Ethers.js is awesome and clean to use !

yes ethers.js is a huge contribution to the community. Thank you @ricmoo - ethers-cli is great too.

The community needs a standard interface for ethereum web client, so users can converge on tooling. Ie. the ruby rack for ethereum, but for clients.

I installed ethers and ethers-cli and still getting Error: Cannot find module 'ethers' in truffle. Hard to figure out what to do. It doesn't make any sense. I am coming back to web3

@robertmagier

How were you attempting to use ethers? I just tried truffle out and was able to just use:

var ethers = require('ethers');

Can you provide an example project which does not work?

Just to be clear, can I use truffle ABI files with ethers.js? Here are some lines I'm piecing together right now in a truffle test file (I'm using the experimental ABI):

const { providers, Contract } = require('ethers');
const registryAbi = require('../build/contracts/Registry.json');
const web3Provider = new providers.Web3Provider(web3.currentProvider);
const signer = web3Provider.getSigner(accounts[0]);
const registry = Registry.deployed();
const registryWrapper = new Contract(Registry.address, registryAbi.abi, signer);

Am I on the right track here? I tried just sending in registryAbi instead of registryAbi.abi but I got abi.forEach is not defined.

Thanks

Can you paste and example of what the ABI looks like here? It should work, since it is just the Solidity ABI format.

Here's a snippet. Everything seems to be OK so far.

{
  "contractName": "Registry",
  "abi": [
    {
      "constant": false,
      "inputs": [],
      "name": "renounceOwnership",
      "outputs": [],
      "payable": false,
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [
        {
          "name": "",
          "type": "bytes32"
        }
      ],
      "name": "markets",
      "outputs": [
        {
          "name": "",
          "type": "bool"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "owner",
      "outputs": [
        {
          "name": "",
          "type": "address"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [
        {
          "name": "",
          "type": "bytes32"
        }
      ],
      "name": "hashToMarket",
      "outputs": [
        {
          "name": "baseToken",
          "type": "address"
        },
        {
          "name": "startDate",
          "type": "uint256"
        },
        {
          "name": "expiryDate",
          "type": "uint256"
        },
        {
          "name": "referenceEntity",
          "type": "string"
        },
        {
          "name": "referenceCoin",
          "type": "string"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": false,
      "inputs": [
        {
          "name": "_newOwner",
          "type": "address"
        }
      ],
      "name": "transferOwnership",
      "outputs": [],
      "payable": false,
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "name": "startDate",
          "type": "uint256"
        },
        {
          "indexed": true,
          "name": "expiryDate",
          "type": "uint256"
        },
        {
          "indexed": true,
          "name": "referenceEntity",
          "type": "string"
        },
        {
          "indexed": false,
          "name": "marketHash",
          "type": "bytes32"
        }
      ],
      "name": "MarketRegistered",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "name": "startDate",
          "type": "uint256"
        },
        {
          "indexed": true,
          "name": "expiryDate",
          "type": "uint256"
        },
        {
          "indexed": true,
          "name": "referenceEntity",
          "type": "string"
        },
        {
          "indexed": false,
          "name": "marketHash",
          "type": "bytes32"
        }
      ],
      "name": "MarketUnregistered",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "name": "previousOwner",
          "type": "address"
        }
      ],
      "name": "OwnershipRenounced",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "name": "previousOwner",
          "type": "address"
        },
        {
          "indexed": true,
          "name": "newOwner",
          "type": "address"
        }
      ],
      "name": "OwnershipTransferred",
      "type": "event"
    },
    {
      "constant": false,
      "inputs": [
        {
          "components": [
            {
              "name": "baseToken",
              "type": "address"
            },
            {
              "name": "startDate",
              "type": "uint256"
            },
            {
              "name": "expiryDate",
              "type": "uint256"
            },
            {
              "name": "referenceEntity",
              "type": "string"
            },
            {
              "name": "referenceCoin",
              "type": "string"
            }
          ],
          "name": "market",
          "type": "tuple"
        }
      ],
      "name": "registerMarket",
      "outputs": [],
      "payable": false,
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "constant": false,
      "inputs": [
        {
          "components": [
            {
              "name": "baseToken",
              "type": "address"
            },
            {
              "name": "startDate",
              "type": "uint256"
            },
            {
              "name": "expiryDate",
              "type": "uint256"
            },
            {
              "name": "referenceEntity",
              "type": "string"
            },
            {
              "name": "referenceCoin",
              "type": "string"
            }
          ],
          "name": "market",
          "type": "tuple"
        }
      ],
      "name": "unregisterMarket",
      "outputs": [],
      "payable": false,
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [
        {
          "name": "marketHash",
          "type": "bytes32"
        }
      ],
      "name": "getMarket",
      "outputs": [
        {
          "components": [
            {
              "name": "baseToken",
              "type": "address"
            },
            {
              "name": "startDate",
              "type": "uint256"
            },
            {
              "name": "expiryDate",
              "type": "uint256"
            },
            {
              "name": "referenceEntity",
              "type": "string"
            },
            {
              "name": "referenceCoin",
              "type": "string"
            }
          ],
          "name": "",
          "type": "tuple"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    }
  ],
  "bytecode": "0x6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611630806100536000396000f30060806040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063715018a6146100935780637564912b146100aa5780638da5cb5b146100e7578063a87ebb7514610112578063ba980b681461013b578063c3c95c7b14610164578063cc8d37e5146101a1578063f2fde38b146101e2575b600080fd5b34801561009f57600080fd5b506100a861020b565b005b3480156100b657600080fd5b506100d160048036036100cc9190810190611127565b61030d565b6040516100de9190611413565b60405180910390f35b3480156100f357600080fd5b506100fc61032d565b6040516101099190611397565b60405180910390f35b34801561011e57600080fd5b5061013960048036036101349190810190611150565b610352565b005b34801561014757600080fd5b50610162600480360361015d9190810190611150565b61050f565b005b34801561017057600080fd5b5061018b60048036036101869190810190611127565b610715565b60405161019891906114a9565b60405180910390f35b3480156101ad57600080fd5b506101c860048036036101c39190810190611127565b6108f9565b6040516101d99594939291906113b2565b60405180910390f35b3480156101ee57600080fd5b50610209600480360361020491908101906110fe565b610a7f565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561026657600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60016020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103af57600080fd5b6103b882610ae6565b9050600060016000836000191660001916815260200190815260200160002060006101000a81548160ff021916908315150217905550600260008260001916600019168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000905560028201600090556003820160006104519190610e81565b6004820160006104619190610e81565b505081606001516040518082805190602001908083835b60208310151561049d5780518252602082019150602081019050602083039250610478565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020826040015183602001517ff150173fd9556b3b2432f6f9eaaea719ab64cd4352164eb7de66b13e90b7c3ed84604051610503919061142e565b60405180910390a45050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561056c57600080fd5b8161057681610c7a565b61057f83610ae6565b91506001806000846000191660001916815260200190815260200160002060006101000a81548160ff0219169083151502179055508260026000846000191660001916815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201556060820151816003019080519060200190610647929190610ec9565b506080820151816004019080519060200190610664929190610ec9565b5090505082606001516040518082805190602001908083835b6020831015156106a2578051825260208201915060208101905060208303925061067d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020836040015184602001517fe4e91bb06588b088712ded563a178c1f04399ed04599d0b61a40de61433a670785604051610708919061142e565b60405180910390a4505050565b61071d610f49565b60026000836000191660001916815260200190815260200160002060a060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201548152602001600382018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108475780601f1061081c57610100808354040283529160200191610847565b820191906000526020600020905b81548152906001019060200180831161082a57829003601f168201915b50505050508152602001600482018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108e95780601f106108be576101008083540402835291602001916108e9565b820191906000526020600020905b8154815290600101906020018083116108cc57829003601f168201915b5050505050815250509050919050565b60026020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002015490806003018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109d75780601f106109ac576101008083540402835291602001916109d7565b820191906000526020600020905b8154815290600101906020018083116109ba57829003601f168201915b505050505090806004018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a755780601f10610a4a57610100808354040283529160200191610a75565b820191906000526020600020905b815481529060010190602001808311610a5857829003601f168201915b5050505050905085565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ada57600080fd5b610ae381610d87565b50565b600081600001518260200151836040015184606001518560800151604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140185815260200184815260200183805190602001908083835b602083101515610b865780518252602082019150602081019050602083039250610b61565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b602083101515610bd95780518252602082019150602081019050602083039250610bb4565b6001836020036101000a038019825116818451168082178552505050505050905001955050505050506040516020818303038152906040526040518082805190602001908083835b602083101515610c465780518252602082019150602081019050602083039250610c21565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209050919050565b428160200151111515610cc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb990611489565b60405180910390fd5b80602001518160400151111515610d0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0590611449565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614151515610d84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7b90611469565b60405180910390fd5b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610dc357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b50805460018160011615610100020316600290046000825580601f10610ea75750610ec6565b601f016020900490600052602060002090810190610ec59190610f8f565b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610f0a57805160ff1916838001178555610f38565b82800160010185558215610f38579182015b82811115610f37578251825591602001919060010190610f1c565b5b509050610f459190610f8f565b5090565b60a060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160608152602001606081525090565b610fb191905b80821115610fad576000816000905550600101610f95565b5090565b90565b6000610fc0823561156f565b905092915050565b6000610fd4823561158f565b905092915050565b600082601f8301121515610fef57600080fd5b8135611002610ffd826114f8565b6114cb565b9150808252602083016020830185838301111561101e57600080fd5b6110298382846115a3565b50505092915050565b600060a0828403121561104457600080fd5b61104e60a06114cb565b9050600061105e84828501610fb4565b6000830152506020611072848285016110ea565b6020830152506040611086848285016110ea565b604083015250606082013567ffffffffffffffff8111156110a657600080fd5b6110b284828501610fdc565b606083015250608082013567ffffffffffffffff8111156110d257600080fd5b6110de84828501610fdc565b60808301525092915050565b60006110f68235611599565b905092915050565b60006020828403121561111057600080fd5b600061111e84828501610fb4565b91505092915050565b60006020828403121561113957600080fd5b600061114784828501610fc8565b91505092915050565b60006020828403121561116257600080fd5b600082013567ffffffffffffffff81111561117c57600080fd5b61118884828501611032565b91505092915050565b61119a8161152f565b82525050565b6111a98161154f565b82525050565b6111b88161155b565b82525050565b60006111c982611524565b8084526111dd8160208601602086016115b2565b6111e6816115e5565b602085010191505092915050565b6000602582527f4578706972792064617465206d7573742062652061667465722073746172742060208301527f646174652e0000000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000602282527f4261736520746f6b656e2063616e6e6f74206265207a65726f2061646472657360208301527f732e0000000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000602182527f53746172742064617465206d75737420626520696e207468652066757475726560208301527f2e000000000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b600060a0830160008301516113236000860182611191565b5060208301516113366020860182611388565b5060408301516113496040860182611388565b506060830151848203606086015261136182826111be565b9150506080830151848203608086015261137b82826111be565b9150508091505092915050565b61139181611565565b82525050565b60006020820190506113ac6000830184611191565b92915050565b600060a0820190506113c76000830188611191565b6113d46020830187611388565b6113e16040830186611388565b81810360608301526113f381856111be565b9050818103608083015261140781846111be565b90509695505050505050565b600060208201905061142860008301846111a0565b92915050565b600060208201905061144360008301846111af565b92915050565b60006020820190508181036000830152611462816111f4565b9050919050565b6000602082019050818103600083015261148281611251565b9050919050565b600060208201905081810360008301526114a2816112ae565b9050919050565b600060208201905081810360008301526114c3818461130b565b905092915050565b6000604051905081810181811067ffffffffffffffff821117156114ee57600080fd5b8060405250919050565b600067ffffffffffffffff82111561150f57600080fd5b601f19601f8301169050602081019050919050565b600081519050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60008115159050919050565b6000819050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000819050919050565b82818337600083830152505050565b60005b838110156115d05780820151818401526020810190506115b5565b838111156115df576000848401525b50505050565b6000601f19601f83011690509190505600a265627a7a72305820aea575dd87fa5c28284f64718a83cccd373c29f41631d07c2c5530c13d66455a6c6578706572696d656e74616cf50037",
  "deployedBytecode": "0x60806040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063715018a6146100935780637564912b146100aa5780638da5cb5b146100e7578063a87ebb7514610112578063ba980b681461013b578063c3c95c7b14610164578063cc8d37e5146101a1578063f2fde38b146101e2575b600080fd5b34801561009f57600080fd5b506100a861020b565b005b3480156100b657600080fd5b506100d160048036036100cc9190810190611127565b61030d565b6040516100de9190611413565b60405180910390f35b3480156100f357600080fd5b506100fc61032d565b6040516101099190611397565b60405180910390f35b34801561011e57600080fd5b5061013960048036036101349190810190611150565b610352565b005b34801561014757600080fd5b50610162600480360361015d9190810190611150565b61050f565b005b34801561017057600080fd5b5061018b60048036036101869190810190611127565b610715565b60405161019891906114a9565b60405180910390f35b3480156101ad57600080fd5b506101c860048036036101c39190810190611127565b6108f9565b6040516101d99594939291906113b2565b60405180910390f35b3480156101ee57600080fd5b50610209600480360361020491908101906110fe565b610a7f565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561026657600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60016020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103af57600080fd5b6103b882610ae6565b9050600060016000836000191660001916815260200190815260200160002060006101000a81548160ff021916908315150217905550600260008260001916600019168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000905560028201600090556003820160006104519190610e81565b6004820160006104619190610e81565b505081606001516040518082805190602001908083835b60208310151561049d5780518252602082019150602081019050602083039250610478565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020826040015183602001517ff150173fd9556b3b2432f6f9eaaea719ab64cd4352164eb7de66b13e90b7c3ed84604051610503919061142e565b60405180910390a45050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561056c57600080fd5b8161057681610c7a565b61057f83610ae6565b91506001806000846000191660001916815260200190815260200160002060006101000a81548160ff0219169083151502179055508260026000846000191660001916815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201556060820151816003019080519060200190610647929190610ec9565b506080820151816004019080519060200190610664929190610ec9565b5090505082606001516040518082805190602001908083835b6020831015156106a2578051825260208201915060208101905060208303925061067d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020836040015184602001517fe4e91bb06588b088712ded563a178c1f04399ed04599d0b61a40de61433a670785604051610708919061142e565b60405180910390a4505050565b61071d610f49565b60026000836000191660001916815260200190815260200160002060a060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201548152602001600382018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108475780601f1061081c57610100808354040283529160200191610847565b820191906000526020600020905b81548152906001019060200180831161082a57829003601f168201915b50505050508152602001600482018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108e95780601f106108be576101008083540402835291602001916108e9565b820191906000526020600020905b8154815290600101906020018083116108cc57829003601f168201915b5050505050815250509050919050565b60026020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002015490806003018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109d75780601f106109ac576101008083540402835291602001916109d7565b820191906000526020600020905b8154815290600101906020018083116109ba57829003601f168201915b505050505090806004018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a755780601f10610a4a57610100808354040283529160200191610a75565b820191906000526020600020905b815481529060010190602001808311610a5857829003601f168201915b5050505050905085565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ada57600080fd5b610ae381610d87565b50565b600081600001518260200151836040015184606001518560800151604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140185815260200184815260200183805190602001908083835b602083101515610b865780518252602082019150602081019050602083039250610b61565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b602083101515610bd95780518252602082019150602081019050602083039250610bb4565b6001836020036101000a038019825116818451168082178552505050505050905001955050505050506040516020818303038152906040526040518082805190602001908083835b602083101515610c465780518252602082019150602081019050602083039250610c21565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209050919050565b428160200151111515610cc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb990611489565b60405180910390fd5b80602001518160400151111515610d0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0590611449565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614151515610d84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7b90611469565b60405180910390fd5b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610dc357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b50805460018160011615610100020316600290046000825580601f10610ea75750610ec6565b601f016020900490600052602060002090810190610ec59190610f8f565b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610f0a57805160ff1916838001178555610f38565b82800160010185558215610f38579182015b82811115610f37578251825591602001919060010190610f1c565b5b509050610f459190610f8f565b5090565b60a060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160608152602001606081525090565b610fb191905b80821115610fad576000816000905550600101610f95565b5090565b90565b6000610fc0823561156f565b905092915050565b6000610fd4823561158f565b905092915050565b600082601f8301121515610fef57600080fd5b8135611002610ffd826114f8565b6114cb565b9150808252602083016020830185838301111561101e57600080fd5b6110298382846115a3565b50505092915050565b600060a0828403121561104457600080fd5b61104e60a06114cb565b9050600061105e84828501610fb4565b6000830152506020611072848285016110ea565b6020830152506040611086848285016110ea565b604083015250606082013567ffffffffffffffff8111156110a657600080fd5b6110b284828501610fdc565b606083015250608082013567ffffffffffffffff8111156110d257600080fd5b6110de84828501610fdc565b60808301525092915050565b60006110f68235611599565b905092915050565b60006020828403121561111057600080fd5b600061111e84828501610fb4565b91505092915050565b60006020828403121561113957600080fd5b600061114784828501610fc8565b91505092915050565b60006020828403121561116257600080fd5b600082013567ffffffffffffffff81111561117c57600080fd5b61118884828501611032565b91505092915050565b61119a8161152f565b82525050565b6111a98161154f565b82525050565b6111b88161155b565b82525050565b60006111c982611524565b8084526111dd8160208601602086016115b2565b6111e6816115e5565b602085010191505092915050565b6000602582527f4578706972792064617465206d7573742062652061667465722073746172742060208301527f646174652e0000000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000602282527f4261736520746f6b656e2063616e6e6f74206265207a65726f2061646472657360208301527f732e0000000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000602182527f53746172742064617465206d75737420626520696e207468652066757475726560208301527f2e000000000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b600060a0830160008301516113236000860182611191565b5060208301516113366020860182611388565b5060408301516113496040860182611388565b506060830151848203606086015261136182826111be565b9150506080830151848203608086015261137b82826111be565b9150508091505092915050565b61139181611565565b82525050565b60006020820190506113ac6000830184611191565b92915050565b600060a0820190506113c76000830188611191565b6113d46020830187611388565b6113e16040830186611388565b81810360608301526113f381856111be565b9050818103608083015261140781846111be565b90509695505050505050565b600060208201905061142860008301846111a0565b92915050565b600060208201905061144360008301846111af565b92915050565b60006020820190508181036000830152611462816111f4565b9050919050565b6000602082019050818103600083015261148281611251565b9050919050565b600060208201905081810360008301526114a2816112ae565b9050919050565b600060208201905081810360008301526114c3818461130b565b905092915050565b6000604051905081810181811067ffffffffffffffff821117156114ee57600080fd5b8060405250919050565b600067ffffffffffffffff82111561150f57600080fd5b601f19601f8301169050602081019050919050565b600081519050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60008115159050919050565b6000819050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000819050919050565b82818337600083830152505050565b60005b838110156115d05780820151818401526020810190506115b5565b838111156115df576000848401525b50505050565b6000601f19601f83011690509190505600a265627a7a72305820aea575dd87fa5c28284f64718a83cccd373c29f41631d07c2c5530c13d66455a6c6578706572696d656e74616cf50037",
  "sourceMap": "191:1548:5:-;;;575:10:16;567:5;;:18;;;;;;;;;;;;;;;;;;191:1548:5;;;;;;",
  "deployedSourceMap": "191:1548:5:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1001:111:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1001:111:16;;;;;;270:39:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;270:39:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;238:20:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;238:20:16;;;;;;;;;;;;;;;;;;;;1234:372:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1234:372:5;;;;;;;;;;;;;;;;;;;840:388;;8:9:-1;5:2;;;30:1;27;20:12;5:2;840:388:5;;;;;;;;;;;;;;;;;;;1612:125;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1612:125:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;315:56;;8:9:-1;5:2;;;30:1;27;20:12;5:2;315:56:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1274:103:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1274:103:16;;;;;;;;;;;;;;;;;;;1001:111;719:5;;;;;;;;;;;705:19;;:10;:19;;;697:28;;;;;;;;1077:5;;;;;;;;;;;1058:25;;;;;;;;;;;;1105:1;1089:5;;:18;;;;;;;;;;;;;;;;;;1001:111::o;270:39:5:-;;;;;;;;;;;;;;;;;;;;;;:::o;238:20:16:-;;;;;;;;;;;;;:::o;1234:372:5:-;1312:18;719:5:16;;;;;;;;;;;705:19;;:10;:19;;;697:28;;;;;;;;1333:22:5;:6;:20;:22::i;:::-;1312:43;;1387:5;1365:7;:19;1373:10;1365:19;;;;;;;;;;;;;;;;;;:27;;;;;;;;;;;;;;;;;;1409:12;:24;1422:10;1409:24;;;;;;;;;;;;;;;;;;1402:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;:::i;:::-;;;1543:6;:22;;;1450:149;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;1450:149:5;;;;;;;;;;;;;;;;1512:6;:17;;;1482:6;:16;;;1450:149;1579:10;1450:149;;;;;;;;;;;;;;;1234:372;;:::o;840:388::-;936:18;719:5:16;;;;;;;;;;;705:19;;:10;:19;;;697:28;;;;;;;;918:6:5;784:32;:6;:30;:32::i;:::-;957:22;:6;:20;:22::i;:::-;936:43;;1011:4;989:7;:19;997:10;989:19;;;;;;;;;;;;;;;;;;:26;;;;;;;;;;;;;;;;;;1052:6;1025:12;:24;1038:10;1025:24;;;;;;;;;;;;;;;;;:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;1165:6;:22;;;1074:147;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;1074:147:5;;;;;;;;;;;;;;;;1134:6;:17;;;1104:6;:16;;;1074:147;1201:10;1074:147;;;;;;;;;;;;;;;731:1:16;840:388:5;;:::o;1612:125::-;1671:16;;:::i;:::-;1706:12;:24;1719:10;1706:24;;;;;;;;;;;;;;;;;1699:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1612:125;;;:::o;315:56::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1274:103:16:-;719:5;;;;;;;;;;;705:19;;:10;:19;;;697:28;;;;;;;;1343:29;1362:9;1343:18;:29::i;:::-;1274:103;:::o;771:342:7:-;832:7;915:6;:16;;;950:6;:16;;;985:6;:17;;;1021:6;:22;;;1062:6;:20;;;881:215;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;881:215:7;;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;881:215:7;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;881:215:7;;;858:248;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;858:248:7;;;;;;;;;;;;;;;;851:255;;771:342;;;:::o;435:330::-;534:3;515:6;:16;;;:22;507:68;;;;;;;;;;;;;;;;;;;;;;;;613:6;:16;;;593:6;:17;;;:36;585:86;;;;;;;;;;;;;;;;;;;;;;;;717:1;689:30;;:6;:16;;;:30;;;;681:77;;;;;;;;;;;;;;;;;;;;;;;;435:330;:::o;1512:171:16:-;1603:1;1582:23;;:9;:23;;;;1574:32;;;;;;;;1645:9;1617:38;;1638:5;;;;;;;;;;;1617:38;;;;;;;;;;;;1669:9;1661:5;;:17;;;;;;;;;;;;;;;;;;1512:171;:::o;191:1548:5:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;;63:55;;57:66;;;;;130:118;;197:46;235:6;222:20;197:46;;;188:55;;182:66;;;;;256:434;;354:3;347:4;339:6;335:17;331:27;324:35;321:2;;;372:1;369;362:12;321:2;409:6;396:20;431:61;446:45;484:6;446:45;;;431:61;;;422:70;;512:6;505:5;498:21;548:4;540:6;536:17;581:4;574:5;570:16;616:3;607:6;602:3;598:16;595:25;592:2;;;633:1;630;623:12;592:2;643:41;677:6;672:3;667;643:41;;;314:376;;;;;;;;728:1118;;841:4;829:9;824:3;820:19;816:30;813:2;;;859:1;856;849:12;813:2;877:20;892:4;877:20;;;868:29;;952:1;983:49;1028:3;1019:6;1008:9;1004:22;983:49;;;977:3;970:5;966:15;959:74;907:137;1099:2;1132:49;1177:3;1168:6;1157:9;1153:22;1132:49;;;1125:4;1118:5;1114:16;1107:75;1054:139;1249:2;1282:49;1327:3;1318:6;1307:9;1303:22;1282:49;;;1275:4;1268:5;1264:16;1257:75;1203:140;1432:2;1421:9;1417:18;1404:32;1456:18;1448:6;1445:30;1442:2;;;1488:1;1485;1478:12;1442:2;1523:55;1574:3;1565:6;1554:9;1550:22;1523:55;;;1516:4;1509:5;1505:16;1498:81;1353:237;1677:3;1666:9;1662:19;1649:33;1702:18;1694:6;1691:30;1688:2;;;1734:1;1731;1724:12;1688:2;1769:55;1820:3;1811:6;1800:9;1796:22;1769:55;;;1762:4;1755:5;1751:16;1744:81;1600:236;807:1039;;;;;1853:118;;1920:46;1958:6;1945:20;1920:46;;;1911:55;;1905:66;;;;;1978:241;;2082:2;2070:9;2061:7;2057:23;2053:32;2050:2;;;2098:1;2095;2088:12;2050:2;2133:1;2150:53;2195:7;2186:6;2175:9;2171:22;2150:53;;;2140:63;;2112:97;2044:175;;;;;2226:241;;2330:2;2318:9;2309:7;2305:23;2301:32;2298:2;;;2346:1;2343;2336:12;2298:2;2381:1;2398:53;2443:7;2434:6;2423:9;2419:22;2398:53;;;2388:63;;2360:97;2292:175;;;;;2474:375;;2602:2;2590:9;2581:7;2577:23;2573:32;2570:2;;;2618:1;2615;2608:12;2570:2;2681:1;2670:9;2666:17;2653:31;2704:18;2696:6;2693:30;2690:2;;;2736:1;2733;2726:12;2690:2;2756:77;2825:7;2816:6;2805:9;2801:22;2756:77;;;2746:87;;2632:207;2564:285;;;;;2856:110;2929:31;2954:5;2929:31;;;2924:3;2917:44;2911:55;;;2973:101;3040:28;3062:5;3040:28;;;3035:3;3028:41;3022:52;;;3081:110;3154:31;3179:5;3154:31;;;3149:3;3142:44;3136:55;;;3198:292;;3296:35;3325:5;3296:35;;;3348:6;3343:3;3336:19;3360:63;3416:6;3409:4;3404:3;3400:14;3393:4;3386:5;3382:16;3360:63;;;3455:29;3477:6;3455:29;;;3448:4;3443:3;3439:14;3435:50;3428:57;;3276:214;;;;;;3498:397;;3653:2;3648:3;3641:15;3690:66;3685:2;3680:3;3676:12;3669:88;3791:66;3786:2;3781:3;3777:12;3770:88;3886:2;3881:3;3877:12;3870:19;;3634:261;;;;3904:397;;4059:2;4054:3;4047:15;4096:66;4091:2;4086:3;4082:12;4075:88;4197:66;4192:2;4187:3;4183:12;4176:88;4292:2;4287:3;4283:12;4276:19;;4040:261;;;;4310:397;;4465:2;4460:3;4453:15;4502:66;4497:2;4492:3;4488:12;4481:88;4603:66;4598:2;4593:3;4589:12;4582:88;4698:2;4693:3;4689:12;4682:19;;4446:261;;;;4772:1167;;4911:4;4906:3;4902:14;5002:3;4995:5;4991:15;4985:22;5019:61;5075:3;5070;5066:13;5053:11;5019:61;;;4931:161;5173:4;5166:5;5162:16;5156:23;5191:62;5247:4;5242:3;5238:14;5225:11;5191:62;;;5102:163;5347:4;5340:5;5336:16;5330:23;5365:62;5421:4;5416:3;5412:14;5399:11;5365:62;;;5275:164;5526:4;5519:5;5515:16;5509:23;5577:3;5571:4;5567:14;5560:4;5555:3;5551:14;5544:38;5597:68;5660:4;5647:11;5597:68;;;5589:76;;5449:228;5762:4;5755:5;5751:16;5745:23;5813:3;5807:4;5803:14;5796:4;5791:3;5787:14;5780:38;5833:68;5896:4;5883:11;5833:68;;;5825:76;;5687:226;5930:4;5923:11;;4884:1055;;;;;;5946:110;6019:31;6044:5;6019:31;;;6014:3;6007:44;6001:55;;;6063:193;;6171:2;6160:9;6156:18;6148:26;;6185:61;6243:1;6232:9;6228:17;6219:6;6185:61;;;6142:114;;;;;6263:759;;6515:3;6504:9;6500:19;6492:27;;6530:61;6588:1;6577:9;6573:17;6564:6;6530:61;;;6602:62;6660:2;6649:9;6645:18;6636:6;6602:62;;;6675;6733:2;6722:9;6718:18;6709:6;6675:62;;;6785:9;6779:4;6775:20;6770:2;6759:9;6755:18;6748:48;6810:64;6869:4;6860:6;6810:64;;;6802:72;;6923:9;6917:4;6913:20;6907:3;6896:9;6892:19;6885:49;6948:64;7007:4;6998:6;6948:64;;;6940:72;;6486:536;;;;;;;;;7029:181;;7131:2;7120:9;7116:18;7108:26;;7145:55;7197:1;7186:9;7182:17;7173:6;7145:55;;;7102:108;;;;;7217:193;;7325:2;7314:9;7310:18;7302:26;;7339:61;7397:1;7386:9;7382:17;7373:6;7339:61;;;7296:114;;;;;7417:387;;7598:2;7587:9;7583:18;7575:26;;7648:9;7642:4;7638:20;7634:1;7623:9;7619:17;7612:47;7673:121;7789:4;7673:121;;;7665:129;;7569:235;;;;7811:387;;7992:2;7981:9;7977:18;7969:26;;8042:9;8036:4;8032:20;8028:1;8017:9;8013:17;8006:47;8067:121;8183:4;8067:121;;;8059:129;;7963:235;;;;8205:387;;8386:2;8375:9;8371:18;8363:26;;8436:9;8430:4;8426:20;8422:1;8411:9;8407:17;8400:47;8461:121;8577:4;8461:121;;;8453:129;;8357:235;;;;8599:337;;8755:2;8744:9;8740:18;8732:26;;8805:9;8799:4;8795:20;8791:1;8780:9;8776:17;8769:47;8830:96;8921:4;8912:6;8830:96;;;8822:104;;8726:210;;;;;8943:256;;9005:2;8999:9;8989:19;;9043:4;9035:6;9031:17;9142:6;9130:10;9127:22;9106:18;9094:10;9091:34;9088:62;9085:2;;;9163:1;9160;9153:12;9085:2;9183:10;9179:2;9172:22;8983:216;;;;;9206:255;;9346:18;9338:6;9335:30;9332:2;;;9378:1;9375;9368:12;9332:2;9422:4;9418:9;9411:4;9403:6;9399:17;9395:33;9387:41;;9451:4;9445;9441:15;9433:23;;9269:192;;;;9468:88;;9545:5;9539:12;9529:22;;9523:33;;;;9563:128;;9643:42;9636:5;9632:54;9621:65;;9615:76;;;;9698:92;;9778:5;9771:13;9764:21;9753:32;;9747:43;;;;9797:79;;9866:5;9855:16;;9849:27;;;;9883:79;;9952:5;9941:16;;9935:27;;;;9969:128;;10049:42;10042:5;10038:54;10027:65;;10021:76;;;;10104:79;;10173:5;10162:16;;10156:27;;;;10190:79;;10259:5;10248:16;;10242:27;;;;10277:145;10358:6;10353:3;10348;10335:30;10414:1;10405:6;10400:3;10396:16;10389:27;10328:94;;;;10431:268;10496:1;10503:101;10517:6;10514:1;10511:13;10503:101;;;10593:1;10588:3;10584:11;10578:18;10574:1;10569:3;10565:11;10558:39;10539:2;10536:1;10532:10;10527:15;;10503:101;;;10619:6;10616:1;10613:13;10610:2;;;10684:1;10675:6;10670:3;10666:16;10659:27;10610:2;10480:219;;;;;10707:97;;10795:2;10791:7;10786:2;10779:5;10775:14;10771:28;10761:38;;10755:49;;;",
  "source": "pragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\npragma experimental \"v0.5.0\";\n\nimport \"./libraries/LibMarket.sol\";\nimport \"openzeppelin-solidity/contracts/ownership/Ownable.sol\";\n\n\ncontract Registry is Ownable {\n\n    using LibMarket for LibMarket.Market;\n\n    mapping(bytes32 => bool) public markets;\n    mapping(bytes32 => LibMarket.Market) public hashToMarket;\n\n    event MarketRegistered(\n        uint256 indexed startDate,\n        uint256 indexed expiryDate,\n        string indexed referenceEntity,\n        bytes32 marketHash\n    );\n\n    event MarketUnregistered(\n        uint256 indexed startDate,\n        uint256 indexed expiryDate,\n        string indexed referenceEntity,\n        bytes32 marketHash\n    );\n\n    modifier marketValid(LibMarket.Market market) {\n        market.assertMarketParamsValid();\n        _;\n    }\n\n    function registerMarket(LibMarket.Market market) public onlyOwner marketValid(market) {\n        bytes32 marketHash = market.getMarketHash();\n        markets[marketHash] = true;\n        hashToMarket[marketHash] = market;\n\n        emit MarketRegistered(\n            market.startDate,\n            market.expiryDate,\n            market.referenceEntity,\n            marketHash\n        );\n    }\n\n    function unregisterMarket(LibMarket.Market market) public onlyOwner {\n        bytes32 marketHash = market.getMarketHash();\n        markets[marketHash] = false;\n        delete hashToMarket[marketHash]; \n\n        emit MarketUnregistered(\n            market.startDate,\n            market.expiryDate,\n            market.referenceEntity,\n            marketHash\n        );\n    }\n\n    function getMarket(bytes32 marketHash) public view returns(LibMarket.Market) {\n        return hashToMarket[marketHash];\n    }\n}",
  "sourcePath": "/home/julian/Desktop/cdx/cdx-contracts/contracts/Registry.sol",
  "ast": {
    "absolutePath": "/home/julian/Desktop/cdx/cdx-contracts/contracts/Registry.sol",
    "exportedSymbols": {
      "Registry": [
        1519
      ]
    },
    "id": 1520,
    "nodeType": "SourceUnit",
    "nodes": [
      {
        "id": 1384,
        "literals": [
          "solidity",
          "0.4",
          ".24"
        ],
        "nodeType": "PragmaDirective",
        "src": "0:23:5"
      },
      {
        "id": 1385,
        "literals": [
          "experimental",
          "ABIEncoderV2"
        ],
        "nodeType": "PragmaDirective",
        "src": "24:33:5"
      },
      {
        "id": 1386,
        "literals": [
          "experimental",
          "v0.5.0"
        ],

That certainly looks fine. Can you try:

console.log(registryAbi.abi.forEach)

It should print out “[function]”.

Thanks for the help @ricmoo . Works like a charm. Hopefully my code can be instructive to those trying to integrate truffle with ethers.js.

Closing this now, but please feel free to re-open if you have any problems.

Thanks! :)

How can i get contract address from a already deployed contract . I have only json file which was generated by truffle.
I want to use that contract address in below code.
var contract = new ethers.Contract("ADDRESS", contractAbi.abi, wallet);

I have tried to pass name of contract but it throws "ERROR: Cannot find Contract - MyToken"

I don’t use truffle myself, but there may be some property inside your contractAbi object. Maybe contractAbi.address? Did you use truffle to deploy it?

Thanks for reply

The contract JSON file does not has any address property.

I deployed contract using truffle.

When truffle deploys a contract it must output the address somewhere... Sorry, I’m not familiar enough though to know where. Can you include the JSON?

Is this on a public network like Ropsten or mainnet? If so, you can use Etherscan to look up the address.

If it is Ganache, the UI should indicate the address.

Is it possible to retrieve contract address from json file or is there any other way i can create a ethers.Contract object so that i can use its methods.

I have deployed contract in ropsten.
https://ropsten.etherscan.io/address/0x953ca09453c00baab0560aa8384e60b069cd7426

I have attached MyToken.zip file

MyToken.zip

In the JSON file you provided, you can access the address using:

let address = myToken.networks["3"].address;

Where the "3" is for Ropsten; for other networks you would need to specify the correct chain ID...

Thanks a lot.

I should have searched contract ABI file with contract address.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lastmjs picture lastmjs  ·  31Comments

fmsouza picture fmsouza  ·  44Comments

gitpusha picture gitpusha  ·  25Comments

fmsouza picture fmsouza  ·  51Comments

subramanianv picture subramanianv  ·  34Comments