Skip to content

Commit db032a0

Browse files
fixes
1 parent ac52da7 commit db032a0

File tree

4 files changed

+38
-20
lines changed

4 files changed

+38
-20
lines changed

script/TokenDeployer.s.sol

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
// SPDX-License-Identifier: UNLICENSED
22
pragma solidity ^0.8.13;
33

4-
import { Distribution, EnsoToken } from "../src/EnsoToken.sol";
5-
import { Script } from "forge-std/Script.sol";
4+
import { Distribution } from "../src/Distribution.sol";
5+
import { EnsoToken } from "../src/EnsoToken.sol";
6+
import { Script, console } from "forge-std/Script.sol";
67
import { ERC1967Proxy } from "openzeppelin-contracts/proxy/ERC1967/ERC1967Proxy.sol";
78

89
contract TokenDeployer is Script {
910
address public OWNER = 0x0676675F4fddC2f572cf0CdDaAf0a6b31841CDaC; // TODO
10-
address public COINLIST = 0x6969696969696969696969696969696969696969; // TODO
11+
address public COINLIST = 0x477F48C93738C0A3a49E365c90Dc56e5466544Df;
12+
address public COINLIST_FEE = 0x9CA33da9D11cCb2E2b0870f83C0f963573B74A43;
1113

12-
uint256 WEI = 10 ** 18;
13-
uint256 TOTAL_SUPPLY = 100_000_000 * WEI;
14-
uint256 BASIS_POINTS = 10_000;
15-
uint256 COINLIST_SHARE = (TOTAL_SUPPLY * 440) / BASIS_POINTS;
16-
uint256 OWNER_SHARE = TOTAL_SUPPLY - COINLIST_SHARE;
14+
uint256 internal WEI = 10 ** 18;
15+
uint256 internal BASIS_POINTS = 10_000;
16+
17+
uint256 public TOTAL_SUPPLY = 100_000_000 * WEI;
18+
uint256 public COINLIST_SHARE = (TOTAL_SUPPLY * 400) / BASIS_POINTS;
19+
uint256 public COINLIST_FEE_SHARE = (TOTAL_SUPPLY * 45) / BASIS_POINTS;
20+
uint256 public OWNER_SHARE = TOTAL_SUPPLY - COINLIST_SHARE - COINLIST_FEE_SHARE;
1721

1822
function deploy() public returns (ERC1967Proxy token, EnsoToken implementation) {
1923
implementation = new EnsoToken();
@@ -22,9 +26,10 @@ contract TokenDeployer is Script {
2226

2327
string memory name = "Enso";
2428
string memory symbol = "ENSO";
25-
Distribution[] memory distribution = new Distribution[](2);
29+
Distribution[] memory distribution = new Distribution[](3);
2630
distribution[0] = Distribution(OWNER, OWNER_SHARE);
2731
distribution[1] = Distribution(COINLIST, COINLIST_SHARE);
32+
distribution[2] = Distribution(COINLIST_FEE, COINLIST_FEE_SHARE);
2833
bytes memory initializationCall =
2934
abi.encodeWithSelector(EnsoToken.initialize.selector, name, symbol, OWNER, distribution);
3035
token = new ERC1967Proxy(address(implementation), initializationCall);

src/Distribution.sol

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// SPDX-License-Identifier: GPL-3.0-only
2+
pragma solidity ^0.8.0;
3+
4+
struct Distribution {
5+
address account;
6+
uint256 amount;
7+
}

src/EnsoToken.sol

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: GPL-3.0-only
22
pragma solidity ^0.8.20;
33

4+
import { Distribution } from "./Distribution.sol";
45
import { OwnableUpgradeable } from "openzeppelin-contracts-upgradeable/access/OwnableUpgradeable.sol";
56
import { UUPSUpgradeable } from "openzeppelin-contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
67
import { ERC20Upgradeable } from "openzeppelin-contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
@@ -13,11 +14,6 @@ import {
1314
import { ERC20VotesUpgradeable } from
1415
"openzeppelin-contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol";
1516

16-
struct Distribution {
17-
address account;
18-
uint256 amount;
19-
}
20-
2117
contract EnsoToken is
2218
ERC20Upgradeable,
2319
ERC20PausableUpgradeable,
@@ -35,21 +31,21 @@ contract EnsoToken is
3531
external
3632
initializer
3733
{
38-
__ERC20_init(name, symbol);
39-
__ERC20Permit_init(name);
40-
__ERC20Votes_init();
41-
__Ownable_init(owner);
42-
__UUPSUpgradeable_init();
34+
__ERC20_init_unchained(name, symbol);
35+
__EIP712_init_unchained(name, "1");
36+
__Ownable_init_unchained(owner);
4337
for (uint256 i = 0; i < distribution.length; ++i) {
4438
_mint(distribution[i].account, distribution[i].amount);
4539
}
4640
_pause();
4741
}
4842

43+
// @notice Pause transfer functions
4944
function pause() external onlyOwner {
5045
_pause();
5146
}
5247

48+
// @notice Unpause transfer functions
5349
function unpause() external onlyOwner {
5450
_unpause();
5551
}
@@ -84,5 +80,7 @@ contract EnsoToken is
8480
ERC20VotesUpgradeable._update(from, to, value);
8581
}
8682

87-
function _authorizeUpgrade(address) internal override onlyOwner { }
83+
function _authorizeUpgrade(address) internal override onlyOwner {
84+
// all necessary validation is handled by the onlyOwner modifier
85+
}
8886
}

test/TokenTest.t.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ contract TokenTest is Test {
2222
token = EnsoToken(address(proxy));
2323
}
2424

25+
function test_Decimals() public view {
26+
assertEq(token.decimals(), 18);
27+
}
28+
29+
function test_TotalSupply() public view {
30+
assertEq(token.totalSupply(), deployer.TOTAL_SUPPLY());
31+
}
32+
2533
function test_PausedFail() public {
2634
vm.startPrank(deployer.COINLIST());
2735
vm.expectRevert(PausableUpgradeable.EnforcedPause.selector);

0 commit comments

Comments
 (0)