Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
afcc6e55
Commit
afcc6e55
authored
May 08, 2023
by
tre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests
parent
629e9bc0
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
269 additions
and
16 deletions
+269
-16
Faucet.t.sol
.../contracts-periphery/contracts/foundry-tests/Faucet.t.sol
+250
-16
Faucet.sol
...contracts-periphery/contracts/universal/faucet/Faucet.sol
+19
-0
No files found.
packages/contracts-periphery/contracts/foundry-tests/Faucet.t.sol
View file @
afcc6e55
This diff is collapsed.
Click to expand it.
packages/contracts-periphery/contracts/universal/faucet/Faucet.sol
View file @
afcc6e55
...
...
@@ -21,6 +21,20 @@ contract SafeSend {
* @notice Faucet contract that drips ETH to users.
*/
contract Faucet {
/**
* @notice Emitted on each drip.
* @param authModule The type of authentication that was used for verifying the drip.
* @param userId The id of the user that requested the drip.
* @param amount The amount of funds sent.
* @param recipient The recipient of the drip.
*/
event Drip(
string indexed authModule,
bytes indexed userId,
uint256 amount,
address indexed recipient
);
/**
* @notice Parameters for a drip.
*/
...
...
@@ -147,7 +161,12 @@ contract Faucet {
// Set the next timestamp at which this auth id can be used.
timeouts[_auth.module][_auth.id] = block.timestamp + config.ttl;
// Mark the nonce as used.
usedNonces[_auth.id][_params.nonce] = true;
// Execute a safe transfer of ETH to the recipient account.
new SafeSend{ value: config.amount }(_params.recipient);
emit Drip(config.name, _auth.id, config.amount, _params.recipient);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment