From 5296b318f5bb39df0a75e5e57a52cd890b1977ef Mon Sep 17 00:00:00 2001 From: Najatul Muslim Dinatra Date: Fri, 9 Aug 2024 15:38:51 +0700 Subject: [PATCH] fix import forge-std --- .gitignore | 6 ---- script/BottleToken.s.sol | 10 +++--- src/{BottleToken.sol => XottleToken.sol} | 0 test/Counter.t.sol | 40 +++++++++++++----------- 4 files changed, 27 insertions(+), 29 deletions(-) rename src/{BottleToken.sol => XottleToken.sol} (100%) diff --git a/.gitignore b/.gitignore index 9f42362..125606d 100644 --- a/.gitignore +++ b/.gitignore @@ -15,10 +15,4 @@ docs/ # dev file .vscode/ -.next/ lib/ -backend/ -frontend/ -backend/node_modules/ -frontend/node_modules/ -node_modules/ diff --git a/script/BottleToken.s.sol b/script/BottleToken.s.sol index d788207..90897f2 100644 --- a/script/BottleToken.s.sol +++ b/script/BottleToken.s.sol @@ -1,18 +1,18 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; -import {Script, console} from "forge-std/Script.sol"; -import {BottleToken} from "../src/BottleToken.sol"; +import {Script, console} from "lib/forge-std/src/Script.sol"; +import {XottleToken} from "../src/XottleToken.sol"; -contract BottleTokenScript is Script { - BottleToken public bottleToken; +contract XottleTokenScript is Script { + XottleToken public xottleToken; function setUp() public {} function run() public { vm.startBroadcast(); - bottleToken = new BottleToken(); + xottleToken = new XottleToken(msg.sender); vm.stopBroadcast(); } diff --git a/src/BottleToken.sol b/src/XottleToken.sol similarity index 100% rename from src/BottleToken.sol rename to src/XottleToken.sol diff --git a/test/Counter.t.sol b/test/Counter.t.sol index 9afb4e6..139fb59 100644 --- a/test/Counter.t.sol +++ b/test/Counter.t.sol @@ -1,24 +1,28 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; +pragma solidity ^0.8.23; -import {Test, console} from "forge-std/Test.sol"; -// import {Counter} from "../src/Counter.sol"; +import {Test} from "lib/forge-std/src/Test.sol"; +import {XottleToken} from "../src/XottleToken.sol"; -// contract CounterTest is Test { -// Counter public counter; +contract XottleTokenTest is Test { + XottleToken public token; + address public owner; -// function setUp() public { -// counter = new Counter(); -// counter.setNumber(0); -// } + function setUp() public { + owner = address(this); + token = new XottleToken(owner); + } -// function test_Increment() public { -// counter.increment(); -// assertEq(counter.number(), 1); -// } + function testMint() public { + uint256 amount = 1000; + token.mint(address(this), amount); + assertEq(token.balanceOf(address(this)), amount); + } -// function testFuzz_SetNumber(uint256 x) public { -// counter.setNumber(x); -// assertEq(counter.number(), x); -// } -// } + function testApprove() public { + uint256 amount = 500; + token.mint(address(this), 1000); // Mint tokens first + token.approve(address(0xBEEF), amount); + assertEq(token.allowance(address(this), address(0xBEEF)), amount); + } +} \ No newline at end of file