Skip to content

Commit b3197ea

Browse files
authored
Minor fixes to token contract (#1614)
2 parents ec74e0f + 86dec3f commit b3197ea

File tree

4 files changed

+24
-43
lines changed

4 files changed

+24
-43
lines changed

claim_contracts/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ PRIVATE_KEY?=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
1212
deploy-all: ## 🚀 Deploy all contracts
1313
cd script && forge script DeployAll.s.sol --private-key $(PRIVATE_KEY) --rpc-url $(RPC_URL) --broadcast
1414

15+
CONFIG?=example
1516
deploy-token: ## 🚀 Deploy the token contract
1617
cd script && \
1718
forge script DeployAlignedToken.s.sol \
19+
--sig "run(string)" \
20+
$(CONFIG) \
1821
--private-key $(PRIVATE_KEY) \
1922
--rpc-url $(RPC_URL) \
2023
--broadcast

claim_contracts/script/DeployAlignedToken.s.sol

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ import "forge-std/Script.sol";
99
import {Utils} from "./Utils.sol";
1010

1111
contract DeployAlignedToken is Script {
12-
function run() public {
12+
function run(string memory config) public {
1313
string memory root = vm.projectRoot();
14-
string memory path = string.concat(root, "/script-config/config.json");
14+
string memory path = string.concat(
15+
root,
16+
"/script-config/config.",
17+
config,
18+
".json"
19+
);
1520
string memory config_json = vm.readFile(path);
1621

1722
address _safe = stdJson.readAddress(config_json, ".safe");
@@ -36,7 +41,6 @@ contract DeployAlignedToken is Script {
3641
address(_proxyAdmin),
3742
_salt,
3843
_deployer,
39-
_safe,
4044
_foundation,
4145
_claimSupplier
4246
);
@@ -51,6 +55,10 @@ contract DeployAlignedToken is Script {
5155
vm.toString(_safe)
5256
)
5357
);
58+
59+
console.log(
60+
"Remember that the foundation must accept the ownership of the contract after deployment in another transaction."
61+
);
5462
}
5563

5664
function deployProxyAdmin(
@@ -74,7 +82,6 @@ contract DeployAlignedToken is Script {
7482
address _proxyAdmin,
7583
bytes32 _salt,
7684
address _deployer,
77-
address _owner,
7885
address _foundation,
7986
address _claim
8087
) internal returns (TransparentUpgradeableProxy) {
@@ -85,7 +92,6 @@ contract DeployAlignedToken is Script {
8592
.alignedTokenProxyDeploymentData(
8693
_proxyAdmin,
8794
address(_token),
88-
_owner,
8995
_foundation,
9096
_claim
9197
);

claim_contracts/script/Utils.sol

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.so
77
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
88
import "../src/AlignedToken.sol";
99
import "../src/ClaimableAirdrop.sol";
10-
import "../src/ClaimableAirdropV2.sol";
1110

1211
library Utils {
1312
// Cheatcodes address, 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D.
@@ -86,7 +85,6 @@ library Utils {
8685
function alignedTokenProxyDeploymentData(
8786
address _proxyAdmin,
8887
address _implementation,
89-
address _owner,
9088
address _foundation,
9189
address _claim
9290
) internal pure returns (bytes memory) {
@@ -96,26 +94,20 @@ library Utils {
9694
abi.encode(
9795
_implementation,
9896
_proxyAdmin,
99-
alignedTokenInitData(
100-
_implementation,
101-
_owner,
102-
_foundation,
103-
_claim
104-
)
97+
alignedTokenInitData(_implementation, _foundation, _claim)
10598
)
10699
);
107100
}
108101

109102
function alignedTokenInitData(
110103
address _implementation,
111-
address _owner,
112104
address _foundation,
113105
address _claim
114106
) internal pure returns (bytes memory) {
115107
return
116108
abi.encodeCall(
117109
AlignedToken(_implementation).initialize,
118-
(_owner, _foundation, _claim)
110+
(_foundation, _claim)
119111
);
120112
}
121113

@@ -175,24 +167,6 @@ library Utils {
175167
);
176168
}
177169

178-
function claimableAirdropUpgradeData(
179-
address _proxy,
180-
address _newImplementation
181-
) internal pure returns (bytes memory) {
182-
return
183-
abi.encodeCall(
184-
ProxyAdmin(_newImplementation).upgradeAndCall,
185-
(
186-
ITransparentUpgradeableProxy(_proxy),
187-
_newImplementation,
188-
abi.encodeCall(
189-
ClaimableAirdropV2(_newImplementation).reinitialize,
190-
()
191-
)
192-
)
193-
);
194-
}
195-
196170
// ProxyAdmin utils
197171

198172
function deployProxyAdmin(address _safe) internal returns (address) {

claim_contracts/src/AlignedToken.sol

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,25 @@ contract AlignedToken is
3232

3333
/// @notice Initializes the contract.
3434
/// @dev This initializer should be called only once.
35-
/// @param _owner address of the owner of the token.
35+
/// @dev The _foundation must accept the ownership of the contract
36+
/// after deployment in another transaction.
3637
/// @param _foundation address of the foundation.
37-
/// @param _claim address of the claim.
38+
/// @param _claimSupplier address of the claim supplier.
3839
function initialize(
39-
address _owner,
4040
address _foundation,
41-
address _claim
41+
address _claimSupplier
4242
) public initializer {
4343
require(
44-
_foundation != address(0) &&
45-
_claim != address(0) &&
46-
_owner != address(0),
47-
"Invalid _foundation or _claim or _owner"
44+
_foundation != address(0) && _claimSupplier != address(0),
45+
"Invalid _foundation or _claim"
4846
);
4947
__ERC20_init(NAME, SYMBOL);
5048
__EIP712_init(NAME, VERSION);
5149
__ERC20Permit_init(NAME);
5250
__Ownable2Step_init(); // default is msg.sender
53-
_transferOwnership(_owner);
51+
_transferOwnership(_foundation);
5452
_mint(_foundation, 7_300_000_000e18); // 7.3 billion
55-
_mint(_claim, 2_700_000_000e18); // 2.7 billion
53+
_mint(_claimSupplier, 2_700_000_000e18); // 2.7 billion
5654
}
5755

5856
/// @notice Prevents the owner from renouncing ownership.

0 commit comments

Comments
 (0)