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: emit drop description at creation #5

Merged
merged 1 commit into from
Apr 18, 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
17 changes: 12 additions & 5 deletions src/Dropper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ contract Dropper {
uint40 startTimestamp,
uint40 expirationTimestamp,
address expirationRecipient,
string merkleTreeURI
string merkleTreeURI,
string dropDescription
);

event DropClaimed(uint256 indexed dropId, address indexed recipient, address indexed tokenAddress, uint256 amount);
Expand Down Expand Up @@ -79,6 +80,7 @@ contract Dropper {
* @param expirationTimestamp The timestamp at which the drop will expire
* @param expirationRecipient The address to which the remaining tokens will be refunded after expiration
* @param merkleTreeURI The URI of the full merkle tree for the drop
* @param dropDescription A description of the drop emitted at creation
* @return dropId The ID of the newly created drop
*/
function permitAndCreateDrop(
Expand All @@ -89,7 +91,8 @@ contract Dropper {
uint40 startTimestamp,
uint40 expirationTimestamp,
address expirationRecipient,
string calldata merkleTreeURI
string calldata merkleTreeURI,
string calldata dropDescription
)
external
returns (uint256)
Expand All @@ -106,7 +109,8 @@ contract Dropper {
startTimestamp,
expirationTimestamp,
expirationRecipient,
merkleTreeURI
merkleTreeURI,
dropDescription
);
}

Expand All @@ -119,6 +123,7 @@ contract Dropper {
* @param expirationTimestamp The timestamp at which the drop will expire
* @param expirationRecipient The address to which the remaining tokens will be refunded after expiration
* @param merkleTreeURI The URI of the full merkle tree for the drop
* @param dropDescription A description of the drop emitted at creation
* @return dropId The ID of the newly created drop
*/
function createDrop(
Expand All @@ -128,7 +133,8 @@ contract Dropper {
uint40 startTimestamp,
uint40 expirationTimestamp,
address expirationRecipient,
string calldata merkleTreeURI
string calldata merkleTreeURI,
string calldata dropDescription
)
public
returns (uint256 dropId)
Expand Down Expand Up @@ -161,7 +167,8 @@ contract Dropper {
startTimestamp,
expirationTimestamp,
expirationRecipient,
merkleTreeURI
merkleTreeURI,
dropDescription
);
}

Expand Down
39 changes: 26 additions & 13 deletions test/Dropper.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ contract DropperTest is PRBTest, StdCheats {
uint40 startTimestamp,
uint40 expirationTimestamp,
address expirationRecipient,
string merkleTreeURI
string merkleTreeURI,
string dropDescription
);

event DropClaimed(uint256 indexed dropId, address indexed recipient, address indexed tokenAddress, uint256 amount);
Expand Down Expand Up @@ -79,7 +80,8 @@ contract DropperTest is PRBTest, StdCheats {
uint40(block.timestamp),
uint40(block.timestamp + 3600),
address(this),
"someURI"
"someURI",
"My Drop"
);

uint256 balanceBefore = token.balanceOf(address(dropper));
Expand All @@ -90,7 +92,8 @@ contract DropperTest is PRBTest, StdCheats {
uint40(block.timestamp),
uint40(block.timestamp + 3600),
address(this),
"someURI"
"someURI",
"My Drop"
);

assertEq(dropId, expectedDropId);
Expand All @@ -109,7 +112,8 @@ contract DropperTest is PRBTest, StdCheats {
uint40(block.timestamp),
uint40(block.timestamp + 3600),
address(this),
"someURI"
"someURI",
"My Drop"
);
}

Expand All @@ -125,7 +129,8 @@ contract DropperTest is PRBTest, StdCheats {
uint40(block.timestamp),
uint40(block.timestamp + 3600),
address(this),
"someURI"
"someURI",
"My Drop"
);
}

Expand All @@ -141,7 +146,8 @@ contract DropperTest is PRBTest, StdCheats {
uint40(block.timestamp),
uint40(block.timestamp + 3600),
address(this),
"someURI"
"someURI",
"My Drop"
);
}

Expand All @@ -157,7 +163,8 @@ contract DropperTest is PRBTest, StdCheats {
uint40(block.timestamp),
uint40(block.timestamp) - 1,
address(this),
"someURI"
"someURI",
"My Drop"
);
}

Expand Down Expand Up @@ -246,7 +253,8 @@ contract DropperTest is PRBTest, StdCheats {
uint40(block.timestamp),
uint40(block.timestamp) + 3600,
address(this),
"someURI"
"someURI",
"My Drop"
);

uint256 balanceBefore = token.balanceOf(address(dropper));
Expand All @@ -257,7 +265,8 @@ contract DropperTest is PRBTest, StdCheats {
uint40(block.timestamp),
uint40(block.timestamp + 3600),
address(this),
"someURI"
"someURI",
"My Drop"
);

assertEq(dropId, expectedDropId);
Expand Down Expand Up @@ -341,7 +350,8 @@ contract DropperTest is PRBTest, StdCheats {
uint40(block.timestamp + 3601),
uint40(block.timestamp + 3600),
address(this),
"someURI"
"someURI",
"My Drop"
);
}

Expand Down Expand Up @@ -397,7 +407,8 @@ contract DropperTest is PRBTest, StdCheats {
uint40(block.timestamp),
uint40(block.timestamp + 3600),
address(this),
"someURI"
"someURI",
"My Drop"
);

Dropper.PermitArgs memory permitArgs = Dropper.PermitArgs(totalDropAmount, block.timestamp + 1, v, r, s);
Expand All @@ -411,7 +422,8 @@ contract DropperTest is PRBTest, StdCheats {
uint40(block.timestamp),
uint40(block.timestamp) + 3600,
address(this),
"someURI"
"someURI",
"My Drop"
);
}

Expand Down Expand Up @@ -452,7 +464,8 @@ contract DropperTest is PRBTest, StdCheats {
uint40(block.timestamp),
uint40(block.timestamp) + 3600,
address(this),
"someURI"
"someURI",
"My Drop"
);
}

Expand Down