Skip to content

Commit 0819ad7

Browse files
committed
very basic erc20 restrictions
mints full supply during construction Signed-off-by: stadolf <stadolf@gmail.com>
1 parent e6484fb commit 0819ad7

File tree

6 files changed

+50
-52
lines changed

6 files changed

+50
-52
lines changed

script/Counter.s.sol

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

script/DeployToken.sol

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.25;
3+
4+
import {Script, console} from "forge-std/Script.sol";
5+
import {WelToken} from "../src/WelToken.sol";
6+
7+
contract DeployWelToken is Script {
8+
9+
address sepoliaMultisig = 0x62ee749EA4d0407a2C44690933F58B05C7867e5f;
10+
11+
function run() public {
12+
vm.broadcast();
13+
WelToken token = new WelToken(sepoliaMultisig);
14+
console.log("WEL_TOKEN=", address(token));
15+
}
16+
}

src/Counter.sol

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

src/WelToken.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
3030

3131
/// @custom:security-contact stefan@welshare.health
3232
contract WelToken is ERC20, ERC20Permit {
33-
constructor() ERC20("WelToken", "WEL") ERC20Permit("WelToken") {
34-
_mint(msg.sender, 1000000 * 10 ** decimals());
33+
34+
uint256 public constant WEL_SUPPLY = 2_500_000_000 ether;
35+
constructor(address treasury) ERC20("WelToken", "WEL") ERC20Permit("WelToken") {
36+
_mint(treasury, WEL_SUPPLY);
3537
}
3638
}
3739

test/Counter.t.sol

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

test/WelToken.t.sol

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.25;
3+
4+
import {Test, console} from "forge-std/Test.sol";
5+
import {WelToken} from "../src/WelToken.sol";
6+
7+
contract WelTokenTest is Test {
8+
9+
address deployer = makeAddr("deployer");
10+
address treasury = makeAddr("treasury");
11+
address welteam = makeAddr("welteam");
12+
13+
function setUp() public {
14+
}
15+
16+
function test_initialize() public {
17+
vm.startPrank(deployer);
18+
WelToken token = new WelToken(treasury);
19+
assertEq(token.name(), "WelToken");
20+
assertEq(token.totalSupply(), 2_500_000_000 ether);
21+
assertEq(token.balanceOf(treasury), 2_500_000_000 ether);
22+
23+
vm.startPrank(treasury);
24+
token.transfer(welteam, 10_000 ether);
25+
26+
assertEq(token.balanceOf(welteam), 10_000 ether);
27+
assertEq(token.balanceOf(treasury), 2_500_000_000 ether - 10_000 ether);
28+
assertEq(token.totalSupply(), 2_500_000_000 ether);
29+
}
30+
}

0 commit comments

Comments
 (0)