Skip to content

Commit

Permalink
Add PARTY_ADDRESS_KEY functionality (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
arr00 authored Apr 1, 2024
1 parent 1fffcc7 commit a1f7059
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion contracts/crowdfund/ERC20LaunchCrowdfund.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ contract ERC20LaunchCrowdfund is InitialETHCrowdfund {
error InvalidTokenDistribution();
error TokenAlreadyLaunched();

address public constant PARTY_ADDRESS_KEY =
address(uint160(uint256(keccak256(abi.encode("party address")))));
IERC20Creator public immutable ERC20_CREATOR;

ERC20LaunchOptions public tokenOpts;
Expand Down Expand Up @@ -96,6 +98,11 @@ contract ERC20LaunchCrowdfund is InitialETHCrowdfund {
totalContributions_ -= uint96((uint256(totalContributions_) * fundingSplitBps_) / 1e4);
}

address tokenRecipient = tokenOpts.recipient;
if (tokenRecipient == PARTY_ADDRESS_KEY) {
tokenRecipient = address(party);
}

// Create the ERC20 token.
ERC20LaunchOptions memory _tokenOpts = tokenOpts;
token = ERC20_CREATOR.createToken{ value: totalContributions_ }(
Expand All @@ -108,7 +115,7 @@ contract ERC20LaunchCrowdfund is InitialETHCrowdfund {
numTokensForRecipient: _tokenOpts.numTokensForRecipient,
numTokensForLP: _tokenOpts.numTokensForLP
}),
_tokenOpts.recipient
tokenRecipient
);
}

Expand Down
1 change: 1 addition & 0 deletions utils/output-abis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const RELEVANT_ABIS = [
"OffChainSignatureValidator",
"BondingCurveAuthority",
"EZPartyBuilder",
"ERC20LaunchCrowdfund",
];

// AFileName -> a_file_name
Expand Down

0 comments on commit a1f7059

Please sign in to comment.