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(protocol): allow ERC20Airdrop.delegateBySig to fail #16622

Merged
merged 9 commits into from
Apr 4, 2024
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
6 changes: 4 additions & 2 deletions packages/protocol/contracts/team/airdrop/ERC20Airdrop.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import "./MerkleClaimable.sol";
contract ERC20Airdrop is MerkleClaimable {
using SafeERC20 for IERC20;

/// @notice The address of the token contract.
/// @notice The address of the Taiko token contract.
address public token;

/// @notice The address of the vault contract.
Expand Down Expand Up @@ -72,6 +72,8 @@ contract ERC20Airdrop is MerkleClaimable {
// client can change the data to call delegateBySig for another user.
(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) =
abi.decode(delegationData, (address, uint256, uint256, uint8, bytes32, bytes32));
IVotes(_token).delegateBySig(delegatee, nonce, expiry, v, r, s);

// Allow delegateBySig to fail to avoid potential frontfun
try IVotes(token).delegateBySig(delegatee, nonce, expiry, v, r, s) { } catch { }
}
}
8 changes: 4 additions & 4 deletions packages/protocol/contracts/team/airdrop/ERC20Airdrop2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ contract ERC20Airdrop2 is MerkleClaimable {
/// @notice The address of the vault contract.
address public vault;

/// @notice Length of the withdrawal window.
uint64 public withdrawalWindow;

/// @notice Represents the token amount for which the user has claimed.
mapping(address addr => uint256 amountClaimed) public claimedAmount;

/// @notice Represents the already withdrawn amount.
mapping(address addr => uint256 amountWithdrawn) public withdrawnAmount;

/// @notice Length of the withdrawal window.
uint64 public withdrawalWindow;

uint256[45] private __gap;
uint256[46] private __gap;

/// @notice Event emitted when a user withdraws their tokens.
/// @param user The address of the user.
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/test/team/airdrop/ERC20Airdrop.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ contract TestERC20Airdrop is TaikoTest {

delegation = abi.encode(delegatee, nonce, expiry, v, r, s);

vm.expectRevert(); // signature invalid
// vm.expectRevert(); // signature invalid
vm.prank(Lily, Lily);
airdrop.claimAndDelegate(Lily, 100, merkleProof, delegation);
}
Expand Down
Loading