mirror of
git://holbrook.no/eth-faucet
synced 2025-01-06 00:57:33 +01:00
Rename events
This commit is contained in:
parent
c8aed1b351
commit
f7a5a5a900
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"FaucetAmountChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"FaucetFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_sealState","type":"uint256"},{"indexed":false,"internalType":"address","name":"_registry","type":"address"},{"indexed":false,"internalType":"address","name":"_periodChecker","type":"address"}],"name":"FaucetStateChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"FaucetUsed","type":"event"},{"anonymous":false,"inputs":[],"name":"ImNotGassy","type":"event"},{"inputs":[],"name":"gimme","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"giveTo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxSealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"}],"name":"nextTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodChecker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"seal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_v","type":"uint256"}],"name":"setAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_checker","type":"address"}],"name":"setPeriodChecker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_registry","type":"address"}],"name":"setRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"tokenAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
|
||||
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"FaucetAmountChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Give","type":"event"},{"anonymous":false,"inputs":[],"name":"ImNotGassy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_sealState","type":"uint256"},{"indexed":false,"internalType":"address","name":"_registry","type":"address"},{"indexed":false,"internalType":"address","name":"_periodChecker","type":"address"}],"name":"SealStateChange","type":"event"},{"inputs":[],"name":"gimme","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"giveTo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxSealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"}],"name":"nextTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodChecker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"seal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_v","type":"uint256"}],"name":"setAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_checker","type":"address"}],"name":"setPeriodChecker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_registry","type":"address"}],"name":"setRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"tokenAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
|
||||
|
@ -1,6 +1,6 @@
|
||||
[metadata]
|
||||
name = eth-faucet
|
||||
version = 0.1.1
|
||||
version = 0.1.2
|
||||
description = Gas token gifter with controls from time intervals, amounts and access.
|
||||
author = Louis Holbrook
|
||||
author_email = dev@holbrook.no
|
||||
|
@ -15,10 +15,9 @@ contract EthFacuet {
|
||||
uint8 constant VALUE_STATE = 4;
|
||||
uint256 constant public maxSealState = 7;
|
||||
|
||||
event FaucetUsed(address indexed _recipient, address indexed _token, uint256 _amount);
|
||||
event FaucetFail(address indexed _recipient, address indexed _token, uint256 _amount);
|
||||
event Give(address indexed _recipient, address indexed _token, uint256 _amount);
|
||||
event FaucetAmountChange(uint256 _amount);
|
||||
event FaucetStateChange(uint256 indexed _sealState, address _registry, address _periodChecker);
|
||||
event SealStateChange(uint256 indexed _sealState, address _registry, address _periodChecker);
|
||||
event ImNotGassy();
|
||||
|
||||
constructor() {
|
||||
@ -29,7 +28,7 @@ contract EthFacuet {
|
||||
require(_state < 8, 'ERR_INVALID_STATE');
|
||||
require(_state & sealState == 0, 'ERR_ALREADY_LOCKED');
|
||||
sealState |= _state;
|
||||
emit FaucetStateChange(sealState, registry, periodChecker);
|
||||
emit SealStateChange(sealState, registry, periodChecker);
|
||||
return uint256(sealState);
|
||||
}
|
||||
|
||||
@ -45,14 +44,14 @@ contract EthFacuet {
|
||||
require(msg.sender == owner, 'ERR_NOT_OWNER');
|
||||
require(sealState & PERIODCHECKER_STATE == 0, 'ERR_SEALED');
|
||||
periodChecker = _checker;
|
||||
emit FaucetStateChange(sealState, registry, periodChecker);
|
||||
emit SealStateChange(sealState, registry, periodChecker);
|
||||
}
|
||||
|
||||
function setRegistry(address _registry) public {
|
||||
require(msg.sender == owner, 'ERR_NOT_OWNER');
|
||||
require(sealState & REGISTRY_STATE == 0, 'ERR_SEALED');
|
||||
registry = _registry;
|
||||
emit FaucetStateChange(sealState, registry, periodChecker);
|
||||
emit SealStateChange(sealState, registry, periodChecker);
|
||||
}
|
||||
|
||||
function checkPeriod(address _recipient) private returns(bool) {
|
||||
@ -61,17 +60,14 @@ contract EthFacuet {
|
||||
|
||||
(_ok, _result) = periodChecker.call(abi.encodeWithSignature("check(address)", _recipient));
|
||||
if (!_ok) {
|
||||
emit FaucetFail(_recipient, address(0), amount);
|
||||
revert('ERR_PERIOD_BACKEND_ERROR');
|
||||
}
|
||||
if (_result[31] == 0) {
|
||||
emit FaucetFail(_recipient, address(0), amount);
|
||||
revert('ERR_PERIOD_CHECK');
|
||||
}
|
||||
|
||||
(_ok, _result) = periodChecker.call(abi.encodeWithSignature("poke(address)", _recipient));
|
||||
if (!_ok) {
|
||||
emit FaucetFail(_recipient, address(0), amount);
|
||||
revert('ERR_REGISTRY_BACKEND_ERROR');
|
||||
}
|
||||
return true;
|
||||
@ -83,15 +79,13 @@ contract EthFacuet {
|
||||
|
||||
(_ok, _result) = registry.call(abi.encodeWithSignature("have(address)", _recipient));
|
||||
if (!_ok) {
|
||||
emit FaucetFail(_recipient, address(0), amount);
|
||||
revert('ERR_TRANSFER');
|
||||
}
|
||||
if (_result[31] == 0) {
|
||||
emit FaucetFail(_recipient, address(0), amount);
|
||||
revert('ERR_REGISTRY_CHECK');
|
||||
}
|
||||
|
||||
emit FaucetUsed(_recipient, address(0), amount);
|
||||
emit Give(_recipient, address(0), amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user