Giter Site home page Giter Site logo

atonomi / smart-contracts Goto Github PK

View Code? Open in Web Editor NEW
14.0 12.0 12.0 1.96 MB

Solidity smart contracts governing the device registration, activation, and reputation on the Atonomi network

License: MIT License

JavaScript 19.45% Solidity 10.28% Shell 0.66% CSS 1.54% HTML 68.07%
ethereum solidity web3 mocha chai truffle blockchain smart-contracts iot erc20-tokens

smart-contracts's Introduction

Atonomi Ethereum Smart Contracts

Hosho Audited

MainNet Chain

Contract Address
SafeMathLib (TokenMarket) 0x850493fd6f7a92f6d462ccba9e438b76b000bcc1
ATMI Token (TokenMarket) 0x97aeb5066e1a590e868b511457beb6fe99d329f5
Network Settings 0x2566c658331eac75d3b3ccd0e45c78d9cf6c4c4c
Atonomi 0x899f3b22908ff5674f8237c321ab309417887606

Kovan Chain

Contract Address
SafeMathLib (TokenMarket) 0x5ef8b987e8c733d957a70441d3a086bccd1f78a9
ATMI Token (TokenMarket) 0xe66254d9560c2d030ca5c3439c5d6b58061dd6f7
Network Settings 0x729a741ce0c776130c50d35906f0dbd248184982
Atonomi 0xbde8f51601e552d620c208049c5970f7b52cd044

Setup

Download and install the latest version of Solidity here: https://solidity.readthedocs.io/en/v0.4.23/installing-solidity.html (use Homebrew)

Download and install the latest LTS version of Node.js here: https://nodejs.org/en/

Also have truffle and ganache-cli installed globally

$ npm install -g truffle
$ npm install -g ganache-cli

Then run:

$ npm install

Compile

To re-compile contracts and build artifacts:

$ npm run compile

Linting

To validate linters for JS and SOL files:

$ npm run lint

Deploy to local ganache-cli

To deploy contracts to a local Ganche RPC provider at port 8546:

$ npm run ganache-cli
$ npm run deploy

Start a parity node

$ cd deploy/kovan
$ ./parity-kovan.sh

Deploy contracts

Make sure you have the latest version of geth installed: https://github.com/ethereum/go-ethereum/wiki/Installing-Geth

Then change into the deploy directory:

$ cd deploy
$ export PARITY_NODE=http://localhost:8545
$ export ETHER_ADDR=0xfb0987013cc730d33e537bb0ce61298ab8eb2553
$ ./geth-attach.sh

This will drop you into a geth console that will have preloaded the Atonomi constants and abi needed for contract deployment. Replace ETHER_ADDR with your own account.

To deploy the Atonomi contracts run the following:

> var estimateOnly = false
> var gasPriceGwei = 10
> hash = initSafeMathLib(estimateOnly)
> hash = initATMIToken("address of safemathlib", estimateOnly)
> hash = initNetworkSettings(estimateOnly, gasPriceGwei)
> hash = initAtonomi("address of erc token", "address of network settings contract", estimateOnly, gasPriceGwei)
> receipt = getTransactionReceipt('txn hash')  // use this to ping if the transaction has been confirmed

// to view pending transactions in mempool
> var myPending = []
> getParityPendingTransactions(ETHER_ADDR, function(err, results) { myPending = results })

Unit Tests

To execute the full unit test truffle suite:

$ npm test

Unit Test Coverage Report

To execute the full unit test truffle suite and generate test coverage report:

$ npm run test:coverage

View the current test coverage report here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.