Skip to content

Commit

Permalink
Change the faucet to send ERC20 tokens and allow sending to the fauce…
Browse files Browse the repository at this point in the history
…t for heartbeating reasons
  • Loading branch information
af-afk committed Jun 22, 2024
1 parent f77dde2 commit 140aba0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cmd/faucet.superposition/graph/schema.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions pkg/sol/Faucet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ pragma solidity 0.8.16;

import "./IFaucet.sol";

interface IERC20 {
function transfer(address recipient, uint256 amount) external;
}

/*
* Faucet sends the SPN gas token to recipients given by a thirdparty service. Optionally
* sends multiple amounts at once (presumably upstream will batch every 5 seconds to
Expand All @@ -16,9 +20,12 @@ contract Faucet is IFaucet {
/// @dev emergency council to use to "rescue" the funds at any point.
address immutable EMERGENCY_COUNCIL;

constructor(address _operator, address _emergencyCouncil) {
IERC20 public immutable TOKEN;

constructor(address _operator, address _emergencyCouncil, IERC20 _token) {
operator_ = _operator;
EMERGENCY_COUNCIL = _emergencyCouncil;
TOKEN = _token;
}

receive() external payable {}
Expand All @@ -33,7 +40,7 @@ contract Faucet is IFaucet {
isContract := gt(extcodesize(recipient), 0)
}
require(!isContract, "no contract");
payable(recipient).transfer(_requests[i].amount);
TOKEN.transfer(recipient, _requests[i].amount);
}
}

Expand Down

0 comments on commit 140aba0

Please sign in to comment.