GithubHelp home page GithubHelp logo

kimsijin33 / solidity Goto Github PK

View Code? Open in Web Editor NEW

This project forked from knix008/solidity

1.0 0.0 0.0 1.69 MB

Solidity Programming Practice

License: MIT License

Solidity 41.90% JavaScript 55.32% HTML 2.00% Shell 0.79%

solidity's Introduction

Solidity test using truffle + ganache

Solidity Programming Practice

Truffle console example :

$truffle console

truffle(ganache)> let instance = await METoken.deployed() undefined

truffle(ganache)> let accounts = await web3.eth.getAccounts()

undefined

truffle(ganache)> accounts

[ '0x6B942ed5a758B16458329DbB7873F04A9942Fbe8', ... ]

truffle(ganache)> instance.approve(accounts[0], 10000)

truffle(ganache)> instance.balanceOf(accounts[0])

BN { negative: 0, words: [ 1000000, <1 empty item> ], length: 1, red: null }

truffle(ganache)> instance.transferFrom(accounts[0], METFaucet.address, 1000)

truffle(ganache)> instance.balanceOf(METFaucet.address)

BN { negative: 0, words: [ 1000, <1 empty item> ], length: 1, red: null }

truffle(ganache)> instance.approve(accounts[1], 1000)

truffle(ganache)> METFaucet.deployed().then(instance => {instance.withdraw(100, {from:accounts[1]})})

undefined

truffle(ganache)> instance.balanceOf(accounts[1]) BN { negative: 0, words: [ 100, <1 empty item> ], length: 1, red: null }

truffle(ganache)> instance.balanceOf(METFaucet.address)

BN { negative: 0, words: [ 1000, <1 empty item> ], length: 1, red: null }

truffle(ganache)>

solidity's People

Contributors

knix008 avatar

Stargazers

Roman 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.