GithubHelp home page GithubHelp logo

token-swap-dapp's Introduction

token-swap-dapp

npm build dependencies license

Swippin' and swappin' the foreigns

Dapp and example Solidity contracts demonstrating a straight-forward token swap. Useful framework for controlled and secure token upgrades.

Installation

  1. Clone this repo.
$ clone github.com/auser/token-swap-dapp
  1. Install dependencies.
$ cd token-swap-dapp && npm install
  1. Run the development console.
$ truffle develop
  1. Compile and migrate the smart contracts. Note inside the development console we don't preface commands with truffle.
compile
migrate
  1. Run the webpack server for front-end hot reloading (outside the development console). Smart contract changes must be manually recompiled and migrated.
// Serves the front-end on http://localhost:3000
npm run start
  1. Truffle can run tests written in Solidity or JavaScript against your smart contracts. Note the command varies slightly if you're in or outside of the development console.
// If inside the development console.
test

// If outside the development console..
truffle test
  1. Jest is included for testing React components. Compile your contracts before running Jest, or you may receive some file not found errors.
// Run Jest outside of the development console for front-end component tests.
npm run test
  1. To build the application for production, use the build command. A production build will be in the build_webpack folder.
npm run build

Debugging and development

REACT_APP_TOKEN_ADDRESS='0xd5de1a88bf957388431dadb6eb5aeeebb636201c'
REACT_APP_CONTROLLER_ADDRESS='0x224813a9bf691586e58a03f4ef3652b38c33d481'
REACT_APP_FACTORY_ADDRESS='0x27bb7642ed4724e94c45a235d6b6f67efcd63369'

controller = SwapController.at(REACT_APP_CONTROLLER_ADDRESS)

YOURADDRESS = '0xbEA369E5a450340A4cAc6bB2AEB8Ffe25B89Ee01'

controller.addToWhitelist(YOURADDRESS)
controller.isWhitelisted(YOURADDRESS)

factory = SwapFactory.at(REACT_APP_FACTORY_ADDRESS)

factory.getContractCount()

FAQ

  • How do I use this with the EthereumJS TestRPC?

    It's as easy as modifying the config file! Check out our documentation on adding network configurations. Depending on the port you're using, you'll also need to update line 24 of src/utils/getWeb3.js.

  • Where is my production build?

    The production build will be in the build_webpack folder. This is because Truffle outputs contract compilations to the build folder.

  • Where can I find more documentation?

    This box is a marriage of Truffle and a React setup created with create-react-app. Either one would be a great place to start!

About

Originally designed for and utilized by Shopin for their token swap in a collaboration between Hanzo and Shishito.

License

MIT

token-swap-dapp's People

Contributors

auser avatar chews avatar zeekay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.