Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler errors #1617

Closed
Closed
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
2 changes: 2 additions & 0 deletions claim_contracts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ RPC_URL?=http://localhost:8545
PRIVATE_KEY?=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d

deploy-all: ## 🚀 Deploy all contracts
forge build
cd script && forge script DeployAll.s.sol --private-key $(PRIVATE_KEY) --rpc-url $(RPC_URL) --broadcast

CONFIG?=example
deploy-token: ## 🚀 Deploy the token contract
forge build
cd script && \
forge script DeployAlignedToken.s.sol \
--sig "run(string)" \
Expand Down
130 changes: 24 additions & 106 deletions claim_contracts/script/DeployAll.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,15 @@ contract DeployAll is Script {
bytes32 _salt = stdJson.readBytes32(config_json, ".salt");
address _deployer = stdJson.readAddress(config_json, ".deployer");
address _foundation = stdJson.readAddress(config_json, ".foundation");
address _claim = stdJson.readAddress(config_json, ".claim");
uint256 _claimPrivateKey = stdJson.readUint(
config_json,
".claimPrivateKey"
);
uint256 _limitTimestampToClaim = stdJson.readUint(
config_json,
".limitTimestampToClaim"
);
bytes32 _claimMerkleRoot = stdJson.readBytes32(
config_json,
".claimMerkleRoot"
);
address _claim = stdJson.readAddress(config_json, ".claimSupplier");
uint256 _claimPrivateKey = stdJson.readUint(config_json, ".claimSupplierPrivateKey");
uint256 _limitTimestampToClaim = stdJson.readUint(config_json, ".limitTimestampToClaim");
bytes32 _claimMerkleRoot = stdJson.readBytes32(config_json, ".claimMerkleRoot");

ProxyAdmin _proxyAdmin = deployProxyAdmin(_safe, _salt, _deployer);

TransparentUpgradeableProxy _tokenProxy = deployAlignedTokenProxy(
address(_proxyAdmin),
_salt,
_deployer,
_safe,
_foundation,
_claim
);
TransparentUpgradeableProxy _tokenProxy =
deployAlignedTokenProxy(address(_proxyAdmin), _salt, _deployer, _foundation, _claim);

TransparentUpgradeableProxy _airdropProxy = deployClaimableAirdropProxy(
address(_proxyAdmin),
Expand All @@ -57,32 +42,13 @@ contract DeployAll is Script {
approve(address(_tokenProxy), address(_airdropProxy), _claimPrivateKey);
}

function deployProxyAdmin(
address _safe,
bytes32 _salt,
address _deployer
) internal returns (ProxyAdmin) {
bytes memory _proxyAdminDeploymentData = Utils.proxyAdminDeploymentData(
_safe
);
address _proxyAdminCreate2Address = Utils.deployWithCreate2(
_proxyAdminDeploymentData,
_salt,
_deployer
);
function deployProxyAdmin(address _safe, bytes32 _salt, address _deployer) internal returns (ProxyAdmin) {
bytes memory _proxyAdminDeploymentData = Utils.proxyAdminDeploymentData(_safe);
address _proxyAdminCreate2Address = Utils.deployWithCreate2(_proxyAdminDeploymentData, _salt, _deployer);

console.log(
"Proxy Admin Address:",
_proxyAdminCreate2Address,
"Owner:",
_safe
);
console.log("Proxy Admin Address:", _proxyAdminCreate2Address, "Owner:", _safe);
vm.serializeAddress("proxyAdmin", "address", _proxyAdminCreate2Address);
vm.serializeBytes(
"proxyAdmin",
"deploymentData",
_proxyAdminDeploymentData
);
vm.serializeBytes("proxyAdmin", "deploymentData", _proxyAdminDeploymentData);

return ProxyAdmin(_proxyAdminCreate2Address);
}
Expand All @@ -91,39 +57,19 @@ contract DeployAll is Script {
address _proxyAdmin,
bytes32 _salt,
address _deployer,
address _owner,
address _foundation,
address _claim
) internal returns (TransparentUpgradeableProxy) {
vm.broadcast();
AlignedToken _token = new AlignedToken();

bytes memory _alignedTokenDeploymentData = Utils
.alignedTokenProxyDeploymentData(
_proxyAdmin,
address(_token),
_owner,
_foundation,
_claim
);
address _alignedTokenProxy = Utils.deployWithCreate2(
_alignedTokenDeploymentData,
_salt,
_deployer
);
bytes memory _alignedTokenDeploymentData =
Utils.alignedTokenProxyDeploymentData(_proxyAdmin, address(_token), _foundation, _claim);
address _alignedTokenProxy = Utils.deployWithCreate2(_alignedTokenDeploymentData, _salt, _deployer);

console.log(
"AlignedToken proxy deployed with address:",
_alignedTokenProxy,
"and admin:",
_proxyAdmin
);
console.log("AlignedToken proxy deployed with address:", _alignedTokenProxy, "and admin:", _proxyAdmin);
vm.serializeAddress("alignedToken", "address", _alignedTokenProxy);
vm.serializeBytes(
"alignedToken",
"deploymentData",
_alignedTokenDeploymentData
);
vm.serializeBytes("alignedToken", "deploymentData", _alignedTokenDeploymentData);

return TransparentUpgradeableProxy(payable(_alignedTokenProxy));
}
Expand All @@ -141,50 +87,22 @@ contract DeployAll is Script {
vm.broadcast();
ClaimableAirdrop _airdrop = new ClaimableAirdrop();

bytes memory _airdropDeploymentData = Utils
.claimableAirdropProxyDeploymentData(
_proxyAdmin,
address(_airdrop),
_owner,
_token,
_tokenOwner,
_limitTimestampToClaim,
_claimMerkleRoot
);
address _airdropProxy = Utils.deployWithCreate2(
_airdropDeploymentData,
_salt,
_deployer
bytes memory _airdropDeploymentData = Utils.claimableAirdropProxyDeploymentData(
_proxyAdmin, address(_airdrop), _owner, _token, _tokenOwner, _limitTimestampToClaim, _claimMerkleRoot
);
address _airdropProxy = Utils.deployWithCreate2(_airdropDeploymentData, _salt, _deployer);

console.log(
"ClaimableAirdrop proxy deployed with address:",
_airdropProxy,
"and admin:",
_proxyAdmin
);
console.log("ClaimableAirdrop proxy deployed with address:", _airdropProxy, "and admin:", _proxyAdmin);
vm.serializeAddress("claimableAirdrop", "address", _airdropProxy);
vm.serializeBytes(
"claimableAirdrop",
"deploymentData",
_airdropDeploymentData
);
vm.serializeBytes("claimableAirdrop", "deploymentData", _airdropDeploymentData);

return TransparentUpgradeableProxy(payable(_airdropProxy));
}

function approve(
address _tokenContractProxy,
address _airdropContractProxy,
uint256 _claimPrivateKey
) public {
function approve(address _tokenContractProxy, address _airdropContractProxy, uint256 _claimPrivateKey) public {
vm.startBroadcast(_claimPrivateKey);
(bool success, bytes memory data) = address(_tokenContractProxy).call(
abi.encodeCall(
IERC20.approve,
(address(_airdropContractProxy), 1 ether)
)
);
(bool success, bytes memory data) =
address(_tokenContractProxy).call(abi.encodeCall(IERC20.approve, (address(_airdropContractProxy), 1 ether)));
bool approved;
assembly {
approved := mload(add(data, 0x20))
Expand Down