Skip to content

Commit

Permalink
update: aula 2
Browse files Browse the repository at this point in the history
  • Loading branch information
olivmath committed Sep 23, 2024
1 parent 25eb368 commit f23fe63
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 7 deletions.
1 change: 0 additions & 1 deletion smartcontracts/src/Counter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ contract Counter {
number++;
}


function getError(uint256 yourAmount) public pure returns (string memory) {
revert CustomError("An error occurred", yourAmount);
}
Expand Down
6 changes: 6 additions & 0 deletions smartcontracts/src/ERC20.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {IERC20} from "./IERC20.sol";

contract ERC20 is IERC20 {}
19 changes: 19 additions & 0 deletions smartcontracts/src/IERC20.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

interface IERC20 {
function symbol() external returns (string memory);
function name() external returns (string memory);
function decimals() external returns (uint8);

function allowance(address owner, address spender) external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function totalSupply() external view returns (uint256);

function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
function transfer(address recipient, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);

event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
2 changes: 2 additions & 0 deletions smartcontracts/src/Token.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
10 changes: 10 additions & 0 deletions smartcontracts/test/Token.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {BaseSetup} from "./BaseSetup.t.sol";

contract TokenTest is BaseSetup {
function setUp() public override {
BaseSetup.setUp();
}
}
9 changes: 3 additions & 6 deletions smartcontracts/test/Utils.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ import {Test} from "forge-std/Test.sol";
import {Vm} from "forge-std/Vm.sol";

contract Utils is Test {
string mnemonic =
"test test test test test test test test test test test junk";
string mnemonic = "test test test test test test test test test test test junk";

function createUsers(
uint32 userNum
) public returns (address payable[] memory) {
function createUsers(uint32 userNum) public returns (address payable[] memory) {
address payable[] memory users = new address payable[](userNum);
for (uint32 i = 0; i < userNum; i++) {
(address user, ) = deriveRememberKey(mnemonic, i);
(address user,) = deriveRememberKey(mnemonic, i);
vm.deal(user, 10000 ether);
users[i] = payable(user);
}
Expand Down

0 comments on commit f23fe63

Please sign in to comment.