GithubHelp home page GithubHelp logo

foundry-demo's Introduction

Foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.

Foundry consists of:

  • Forge: Ethereum testing framework (like Truffle, Hardhat and DappTools).
  • Cast: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
  • Anvil: Local Ethereum node, akin to Ganache, Hardhat Network.
  • Chisel: Fast, utilitarian, and verbose solidity REPL.

Documentation

https://book.getfoundry.sh/

Usage

Build

$ forge build

Test

$ forge test

Format

$ forge fmt

Gas Snapshots

$ forge snapshot

Anvil

$ anvil

Deploy

forge script script/FSU.s.sol:FSUScript --rpc-url <your_rpc_url> --private-key <your_private_key> --legacy --broadcast
forge script script/FSU.s.sol:FSUScript --rpc-url https://rpc.scfchain.io --legacy --broadcast

forge script script/BTK.s.sol:BTKScript --rpc-url <your_rpc_url> --private-key <your_private_key> --legacy --broadcast

Deploying to ftcmain chain

forge script script/BTK.s.sol:BTKScript --rpc-url https://rpc.scfchain.io
forge script script/FSU.s.sol:FSUScript --rpc-url https://rpc.scfchain.io

Cast

$ cast <subcommand>

check balance

cast call <contract_address> --rpc-url <your_rpc_url> "balanceOf(address)(uint256)" <user_address>
cast call 0xD4D62eC43F77Fe6eE54c228fA9f58Ab246f14843 --rpc-url https://rpc.scfchain.io/ "balanceOf(address)(uint256)" 0x98F915F20E1F338c32dFF8a55b307960C24d1b7C

cast balance --rpc-url <your_rpc_url> <user_address>
cast balance --rpc-url https://rpc.scfchain.io/ 0x98F915F20E1F338c32dFF8a55b307960C24d1b7C

check nonce

cast nonce --rpc-url <your_rpc_url> <user_address>
cast nonce --rpc-url https://rpc.scfchain.io/ 0x98F915F20E1F338c32dFF8a55b307960C24d1b7C
cast nonce --rpc-url https://rpc.scfchain.io/ 0x842544664e170B4A5d90AfEc923bFFBa09bfDa35

transfer

cast send <contract_address> --rpc-url <your_rpc_url> --private-key <your_private_key> --gas-price <your_gas_price> --nonce <your_nonce> --gas-limit <your_gas_limit> "transfer(address,uint256)(bool)" <to_address> <amount>
cast send 0xD4D62eC43F77Fe6eE54c228fA9f58Ab246f14843 --rpc-url https://rpc.scfchain.io/ --legacy --private-key 68a267efd48f58ef250be855477779a8875fcbc8a9b7c0d6639c668cde4f3dc7 --gas-price 500000000000 --nonce 3 --gas-limit 150000 "transfer(address,uint256)(bool)" 0xa3bdac83327ff0dcd7550d88c33f71e9d09dd3e5 10000
transfer 5 million FSU to sending out address of FSU

FSU sending out address: 0xcbc99ade523c138442068c85183719b3e751256e

cast send 0x680367D3719431172A749fED0Df142B88B1A2970 --rpc-url https://rpc.scfchain.io/ --legacy --private-key 0x1a634b5e0f9983e9e21786da279307c27e6b7ecdffd4ac03597cc842d5761b2d --gas-price 500000000000 --nonce 2 --gas-limit 150000 "transfer(address,uint256)(bool)" 0x3Cc22f386b293a49D9172Bcb907EBBDbE0FE6E81 49995000000000000000000000000

tranfer ownership

cast send <contract_address> --rpc-url <your_rpc_url> --private-key <your_private_key> --gas-price <your_gas_price> --nonce <your_nonce> --gas-limit <your_gas_limit> "transferOwnership(address)" <new_owner_address>
cast send 0xD4D62eC43F77Fe6eE54c228fA9f58Ab246f14843 --rpc-url https://rpc.scfchain.io/ --legacy --private-key 68a267efd48f58ef250be855477779a8875fcbc8a9b7c0d6639c668cde4f3dc7 --gas-price 500000000000 --nonce 3 --gas-limit 150000 "transferOwnership(address)" 0xa3bdac83327ff0dcd7550d88c33f71e9d09dd3e5

fsu transfer ownership
cast call 0x680367D3719431172A749fED0Df142B88B1A2970 --rpc-url https://rpc.scfchain.io/ "owner()(address)"

cast send 0x680367D3719431172A749fED0Df142B88B1A2970 --rpc-url https://rpc.scfchain.io/ --legacy --private-key 0x1a634b5e0f9983e9e21786da279307c27e6b7ecdffd4ac03597cc842d5761b2d --gas-price 500000000000 --nonce 3 --gas-limit 150000 "transferOwnership(address)" 0xB3458F744f86436b277790827481E417D11311ce

Help

$ forge --help
$ anvil --help
$ cast --help

foundry-demo's People

Watchers

 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.