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

feat: Season 1 Airdrop Implementation #149

Merged
merged 7 commits into from
Apr 1, 2024
Merged

feat: Season 1 Airdrop Implementation #149

merged 7 commits into from
Apr 1, 2024

Conversation

PowVT
Copy link
Contributor

@PowVT PowVT commented Mar 26, 2024

Modify the airdrop inheritance structure to allow for more composable future airdrop scenarios. A new folder named contracts/token/airdrop now holds the airdrop implementation contracts. Additionally in this folder, there is a ArcadeAirdropBase contract that inherits ArcadeMerkleRewards. The ArcadeAirdropBase contract should be inherited by all airdrop implementation (season) contracts.

For the latest airdrop season, season 1, users have two claiming options. Either claim the airdrop directly to their wallets, or claim to the ArcadeSingleSidedStaking vault to accrue points and access voting power.

All scripts and tests have been updated to reflect these changes.

@PowVT PowVT requested review from kkennis and Mouzayan March 26, 2024 17:47
@@ -18,8 +18,11 @@ import { AA_ClaimingNotExpired, AA_ClaimingExpired, AA_ZeroAddress } from "../er
* The contract is ownable, where the owner can reclaim any remaining tokens once the airdrop is
* over and also change the merkle root and its expiration at their discretion.
*/
contract ArcadeAirdrop is ArcadeMerkleRewards, Authorizable {
abstract contract ArcadeAirdropBase is ArcadeMerkleRewards, Authorizable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the motivation for separating ArcadeAirdropBase and ArcadeMerkleRewards? I'm not sure what other contracts would inherit ArcadeMerkleRewards

// stake tokens in voting vault for this msg.sender and delegate
votingVault.airdropReceive(msg.sender, totalGrant, delegate, lock);

emit ClaimAndStaked(msg.sender, totalGrant, delegate, lock);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably just emit Claim here, all claims should emit a unified event or it adds overhead to all tracking/notification hooks (which may or may care if something is staked after or not).

You could emit two events, both Claim and ClaimAndStake, but IMO the latter is not needed because the staking contract will emit its own Deposit event

// must be before the expiration time
if (block.timestamp > expiration) revert AA_ClaimingExpired();
// validate the withdraw
_validateWithdraw(totalGrant, merkleProof);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure a better name, but I was a bit surprised here that _validateWithdraw was not view, in my mind "validate" in a function name implies behavior that it will check values and error, so the storage update to claim was a bit of a surprise

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I could pull the state change in claim out to the inherting contract, but was trying to be as least invasive with the changes since I was changing audited code. Same with the ArcadeStakingRewards contract that was how it was done originally and since it was audited was trying to lower my risk by not moving too much around.

But what I am gathering from these comments is I should take it one step further and make it as clean as possible by making validations view and have a combined ArcadeAirdropBase contract. Will make these changes.

@PowVT
Copy link
Contributor Author

PowVT commented Mar 27, 2024

Summary of changes made after first code review.
1). Condensed the ArcadeMerkleRewards contract into the ArcadeAirdropBase contract. Additionally, the logic in _validateWithdraw does not include any state updates and now also included revert checks that used to be located in each airdrop season contract.
2). There is also a new helper function to set the claimed mapping which can be used by the child contracts.
3). Replaced the ClaimAndStaked event with Claimed since the staking information is already being emitted by the staking contract events.

@PowVT PowVT merged commit 791d1cf into main Apr 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants