Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 43 additions & 9 deletions claim_contracts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,55 @@ upgrade-token: ## 🚀 Upgrade the token contract
--broadcast \
--verbosity 3

# Approve
# Miscellaneous

approve-claimable: ## 🚀 Approve the claimable airdrop contract to spend the token
DISTRIBUTOR_PRIVATE_KEY?=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d

approve-claimable: ## 🚀 Approve the ClaimableAirdrop contract to spend the token
cast send \
--rpc-url $(RPC_URL) \
--private-key $(PRIVATE_KEY) \
--private-key $(DISTRIBUTOR_PRIVATE_KEY) \
$(TOKEN) \
'approve(address,uint256)' $(AIRDROP) 2600000000000000000000000000

claimable-update-root: ## 🚀 Update the merkle root of the ClaimableAirdrop contract
cast send \
--rpc-url $(RPC_URL) \
--private-key $(PRIVATE_KEY) \
$(AIRDROP) \
'updateMerkleRoot(bytes32)' $(MERKLE_ROOT)

claimable-get-root: ## 🚀 Get the merkle root of the ClaimableAirdrop contract
cast call \
--rpc-url $(RPC_URL) \
$(AIRDROP) \
"claimMerkleRoot()(bytes32)"

claimable-update-timestamp: ## 🚀 Update the limit timestamp of the ClaimableAirdrop contract
cast send \
--rpc-url $(RPC_URL) \
--private-key $(PRIVATE_KEY) \
$(AIRDROP) \
'extendClaimPeriod(uint256)' $(TIMESTAMP)

claimable-get-timestamp: ## 🚀 Get the limit timestamp of the ClaimableAirdrop contract
cast call \
--rpc-url $(RPC_URL) \
$(AIRDROP) \
"limitTimestampToClaim()(uint256)"

pause:
cast send \
--rpc-url $(RPC_URL) \
--private-key $(PRIVATE_KEY) \
$(AIRDROP) "pause()"

unpause:
cast send \
--rpc-url $(RPC_URL) \
--private-key $(PRIVATE_KEY) \
$(AIRDROP) "unpause()"

# Upgrades

upgrade-aligned-token-implementation: ## 🚀 Upgrade the AlignedToken implementation contract
Expand Down Expand Up @@ -124,9 +164,3 @@ OWNER_PRIVATE_KEY?=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f
test-airdrop:
cast call $(AIRDROP) "paused()(bool)" --rpc-url $(RPC_URL)
cast call $(AIRDROP) "owner()(address)" --rpc-url $(RPC_URL)

test-pause:
cast send $(AIRDROP) --private-key $(OWNER_PRIVATE_KEY) "pause()" --rpc-url $(RPC_URL)

test-unpause:
cast send $(AIRDROP) --private-key $(OWNER_PRIVATE_KEY) "unpause()" --rpc-url $(RPC_URL)
2 changes: 0 additions & 2 deletions claim_contracts/script-config/config.example.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"foundation": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
"tokenDistributor": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
"limitTimestampToClaim": 2733427549,
"claimMerkleRoot": "0x90076b5fb9a6c81d9fce83dfd51760987b8c49e7c861ea25b328e6e63d2cd3df",
"airdropProxy": "0x882b82f4E9014164Af87ecdAB64955cf7C252C4f",
"tokenProxy": "0x2E983A1Ba5e8b38AAAeC4B440B9dDcFBf72E15d1"
}
3 changes: 0 additions & 3 deletions claim_contracts/script-config/config.mainnet.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"foundation": "",
"tokenDistributor": "",

"limitTimestampToClaim": 2733427549,
"claimMerkleRoot": "",
"tokenProxy": "0x0000000000000000000000000000000000000000"
}
16 changes: 2 additions & 14 deletions claim_contracts/script/DeployClaimableAirdrop.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ contract DeployAlignedToken is Script {
".tokenDistributor"
);
address _tokenProxy = stdJson.readAddress(config_json, ".tokenProxy");
uint256 _limitTimestampToClaim = stdJson.readUint(
config_json,
".limitTimestampToClaim"
);
bytes32 _claimMerkleRoot = stdJson.readBytes32(
config_json,
".claimMerkleRoot"
);

vm.broadcast();
ClaimableAirdrop _airdrop = new ClaimableAirdrop();
Expand All @@ -50,9 +42,7 @@ contract DeployAlignedToken is Script {
address(_airdrop),
_foundation,
_tokenProxy,
_tokenDistributor,
_limitTimestampToClaim,
_claimMerkleRoot
_tokenDistributor
)
);

Expand All @@ -61,9 +51,7 @@ contract DeployAlignedToken is Script {
address(_airdrop),
_foundation,
_tokenProxy,
_tokenDistributor,
_limitTimestampToClaim,
_claimMerkleRoot
_tokenDistributor
);

console.log(
Expand Down
24 changes: 6 additions & 18 deletions claim_contracts/script/Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ library Utils {
address _implementation,
address _owner,
address _tokenContractAddress,
address _tokenOwnerAddress,
uint256 _limitTimestampToClaim,
bytes32 _claimMerkleRoot
address _tokenOwnerAddress
) internal pure returns (bytes memory) {
return
abi.encodePacked(
Expand All @@ -154,9 +152,7 @@ library Utils {
_implementation,
_owner,
_tokenContractAddress,
_tokenOwnerAddress,
_limitTimestampToClaim,
_claimMerkleRoot
_tokenOwnerAddress
)
)
);
Expand All @@ -166,19 +162,15 @@ library Utils {
address _implementation,
address _foundation,
address _tokenContractAddress,
address _tokenOwnerAddress,
uint256 _limitTimestampToClaim,
bytes32 _claimMerkleRoot
address _tokenOwnerAddress
) internal pure returns (bytes memory) {
return
abi.encodeCall(
ClaimableAirdrop(_implementation).initialize,
(
_foundation,
_tokenContractAddress,
_tokenOwnerAddress,
_limitTimestampToClaim,
_claimMerkleRoot
_tokenOwnerAddress
)
);
}
Expand All @@ -187,9 +179,7 @@ library Utils {
address _implementation,
address _foundation,
address _tokenProxy,
address _tokenDistributor,
uint256 _limitTimestampToClaim,
bytes32 _claimMerkleRoot
address _tokenDistributor
) internal pure returns (bytes memory) {
return
abi.encode(
Expand All @@ -199,9 +189,7 @@ library Utils {
_implementation,
_foundation,
_tokenProxy,
_tokenDistributor,
_limitTimestampToClaim,
_claimMerkleRoot
_tokenDistributor
)
);
}
Expand Down
33 changes: 11 additions & 22 deletions claim_contracts/src/ClaimableAirdrop.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,39 +54,28 @@ contract ClaimableAirdrop is

/// @notice Initializes the contract.
/// @dev This initializer should be called only once.
/// @param _owner address of the owner of the token.
/// @param _foundation address of the Aligned foundation.
/// @param _tokenProxy address of the token contract.
/// @param _tokenDistributor address of the wallet that has the tokens to distribute to the claimants.
/// @param _limitTimestampToClaim timestamp until which the claimants can claim the tokens.
/// @param _claimMerkleRoot Merkle root of the claimants.
function initialize(
address _owner,
address _foundation,
address _tokenProxy,
address _tokenDistributor,
uint256 _limitTimestampToClaim,
bytes32 _claimMerkleRoot
address _tokenDistributor
) external initializer {
require(_owner != address(0), "Invalid owner address");
require(
_tokenProxy != address(0) && _tokenProxy != address(this),
"Invalid token contract address"
);
require(
_tokenDistributor != address(0) &&
_tokenDistributor != address(this),
"Invalid token owner address"
);
require(_limitTimestampToClaim > block.timestamp, "Invalid timestamp");
require(_claimMerkleRoot != 0, "Invalid Merkle root");
require(_foundation != address(0), "Invalid foundation address");
require(_tokenProxy != address(0), "Invalid token contract address");
require(_tokenDistributor != address(0), "Invalid token owner address");

__Ownable_init(_owner);
__Ownable_init(_foundation);
__Pausable_init();
__ReentrancyGuard_init();

tokenProxy = _tokenProxy;
tokenDistributor = _tokenDistributor;
limitTimestampToClaim = _limitTimestampToClaim;
claimMerkleRoot = _claimMerkleRoot;
limitTimestampToClaim = 0;
claimMerkleRoot = 0;

_pause();
}

/// @notice Claim the tokens.
Expand Down