Skip to content

Commit f0d81f9

Browse files
committed
feat: MetaToken
1 parent 5dd667e commit f0d81f9

7 files changed

Lines changed: 65 additions & 57 deletions

File tree

remappings.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ds-test/=lib/solmate/lib/ds-test/src/
2+
forge-std/=lib/forge-std/src/
3+
solmate/=lib/solmate/src/

script/Counter.s.sol

Lines changed: 0 additions & 19 deletions
This file was deleted.

script/MetaToken.s.sol

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity 0.8.28;
3+
4+
import {Script, console} from "forge-std/Script.sol";
5+
import {MetaToken} from "../src/MetaToken.sol";
6+
7+
contract MetaTokenScript is Script {
8+
MetaToken public META;
9+
10+
function setUp() public {}
11+
12+
function run(address distributor) public {
13+
vm.startBroadcast();
14+
15+
META = new MetaToken(distributor);
16+
17+
vm.stopBroadcast();
18+
}
19+
}

src/Counter.sol

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/MetaToken.sol

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.28;
3+
4+
import {ERC20} from "solmate/tokens/ERC20.sol";
5+
6+
contract MetaToken is ERC20 {
7+
uint256 private constant _INITIAL_TOTAL_SUPPLY = 1_000_000_000e18;
8+
9+
constructor(address distributor) ERC20("Metalamp token", "META", 18) {
10+
_mint(distributor, _INITIAL_TOTAL_SUPPLY);
11+
}
12+
}

test/Counter.t.sol

Lines changed: 0 additions & 24 deletions
This file was deleted.

test/MetaToken.t.sol

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity 0.8.28;
3+
4+
import {Test, console} from "forge-std/Test.sol";
5+
import {MetaToken} from "src/MetaToken.sol";
6+
7+
contract MetaTokenTest is Test {
8+
MetaToken public META;
9+
10+
address distributor;
11+
12+
function setUp() public {
13+
distributor = makeAddr("distributor");
14+
15+
META = new MetaToken(distributor);
16+
}
17+
18+
function test_deploy() public view {
19+
string memory expectedName = "Metalamp token";
20+
string memory expectedSymbol = "META";
21+
uint256 expectedDecimals = 18;
22+
uint256 expectedTotalSupply = 1_000_000_000e18;
23+
24+
assertEq(META.name(), expectedName);
25+
assertEq(META.symbol(), expectedSymbol);
26+
assertEq(META.decimals(), expectedDecimals);
27+
assertEq(META.totalSupply(), expectedTotalSupply);
28+
29+
assertEq(META.balanceOf(distributor), expectedTotalSupply);
30+
}
31+
}

0 commit comments

Comments
 (0)