Skip to content

olivmath/r2dc

Repository files navigation

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/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>

Cast

$ cast <subcommand>

Help

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

CONTRATO

INPUT -> Lucas deposita 100 TOKENS INPUT -> Aluno deposit 1 TOKEN

REQUIRE :: Só pode interagir uma vez

OUTPUT <- Aluno sacar 1 x 2 TOKEN

Faça uma chama usando cast de approve no seguinte formato

  • Approve no Erc20: 0x5FbDB2315678afecb367f032d93F642f64180aa3
  • De 100 Tokens para o contrato: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512

Faça uma chama usando cast de approve no seguinte formato

  • Chame a funcao found no contrato: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
  • chame a funcao getBalance no contrao: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512

1. Approve no ERC20 (Token) - 100 tokens para o contrato Reward

cast send 0x70ed51B53FB968083349B8B037DDF23a0CB36Ae8
"approve(address,uint256)"
0x7FbF2586957eEc6252CD89EeeC033Af6CbF33c6E
100000000000000000000
--rpc-url https://sepolia.gateway.tenderly.co
--account testff80

2. Chamar a função found no contrato Reward

cast send 0x7FbF2586957eEc6252CD89EeeC033Af6CbF33c6E
"found()"
--rpc-url https://sepolia.gateway.tenderly.co
--account testff80

3. Chamar a função getBalance no contrato Reward (view function)

cast call 0x7FbF2586957eEc6252CD89EeeC033Af6CbF33c6E
"getBalance()"
--rpc-url https://sepolia.gateway.tenderly.co

ALUNO

ALUNO

ALUNO

ALUNO

ALUNO

1. Approve no ERC20 (Token) - 100 tokens para o contrato Reward

cast send 0x5FbDB2315678afecb367f032d93F642f64180aa3
"approve(address,uint256)"
0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
1000000000000000000
--rpc-url http://localhost:8545
--private-key 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d

2. Chamar a função deposit no contrato Reward

cast send 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
"deposit()"
--rpc-url http://localhost:8545
--private-key 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d

3. Chamar a função claim no contrato Reward

cast send 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
"claim()"
--rpc-url http://localhost:8545
--private-key 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d

3. Chamar a função getBalance no contrato Reward (view function)

cast call 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
"getBalance()"
--rpc-url http://localhost:8545

cast call 0x5FbDB2315678afecb367f032d93F642f64180aa3
"balanceOf()"
0x70997970C51812dc3A010C7d01b50e0d17dc79C8
--rpc-url http://localhost:8545

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors