Source Code
Cross-Chain Transactions
Loading...
Loading
Contract Name:
BotcoinFaucet
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/// @title BotcoinFaucet
/// @notice A faucet that distributes BOTCOIN to AI agents authenticated via
/// SIWA (Sign In With Agent) and ERC-8004 identity. Agents can claim
/// once every 24 hours. Drip amount scales with reputation tier.
/// Anyone can deposit BOTCOIN to fund the faucet.
contract BotcoinFaucet is Ownable {
using SafeERC20 for IERC20;
// ── Constants ────────────────────────────────────────────────────
uint256 public constant COOLDOWN = 24 hours;
// ── Immutables ──────────────────────────────────────────────────
IERC20 public immutable botcoinToken;
// ── Config ──────────────────────────────────────────────────────
/// @notice Address authorized to call drip (backend after SIWA verification)
address public operator;
/// @notice Drip amounts per reputation tier (in token units, 18 decimals)
/// tier 0 = none, tier 1 = some, tier 2 = a lot
uint256[3] public dripAmounts;
// ── State ───────────────────────────────────────────────────────
/// @notice Last claim timestamp per 8004 agentId
mapping(uint256 => uint256) public lastClaimTime;
/// @notice Total BOTCOIN distributed by this faucet
uint256 public totalDistributed;
/// @notice Total BOTCOIN deposited into this faucet
uint256 public totalDeposited;
// ── Events ──────────────────────────────────────────────────────
event Deposit(address indexed depositor, uint256 amount);
event Drip(uint256 indexed agentId, address indexed recipient, uint8 tier, uint256 amount);
event OperatorUpdated(address indexed oldOperator, address indexed newOperator);
event DripAmountUpdated(uint8 tier, uint256 newAmount);
// ── Errors ──────────────────────────────────────────────────────
error OnlyOperator();
error CooldownActive(uint256 agentId, uint256 availableAt);
error InvalidTier(uint8 tier);
error InsufficientBalance(uint256 requested, uint256 available);
error ZeroAmount();
// ── Constructor ─────────────────────────────────────────────────
constructor(
address _botcoinToken,
address _operator,
address _owner
) Ownable(_owner) {
botcoinToken = IERC20(_botcoinToken);
operator = _operator;
// Default drip amounts (18 decimals)
dripAmounts[0] = 1000 ether; // tier 0: none reputation
dripAmounts[1] = 2000 ether; // tier 1: some reputation
dripAmounts[2] = 3000 ether; // tier 2: a lot of reputation
}
// ── Modifiers ───────────────────────────────────────────────────
modifier onlyOperator() {
if (msg.sender != operator) revert OnlyOperator();
_;
}
// ── Public Functions ────────────────────────────────────────────
/// @notice Deposit BOTCOIN into the faucet. Callable by anyone.
/// @param amount Amount of BOTCOIN to deposit (must have prior approval)
function deposit(uint256 amount) external {
if (amount == 0) revert ZeroAmount();
botcoinToken.safeTransferFrom(msg.sender, address(this), amount);
totalDeposited += amount;
emit Deposit(msg.sender, amount);
}
/// @notice Distribute BOTCOIN to an authenticated agent.
/// Called by the operator after successful SIWA verification.
/// @param agentId The ERC-8004 agent identity token ID
/// @param recipient The address to receive the drip
/// @param tier Reputation tier: 0 = none, 1 = some, 2 = a lot
function drip(uint256 agentId, address recipient, uint8 tier) external onlyOperator {
if (tier > 2) revert InvalidTier(tier);
uint256 lastClaim = lastClaimTime[agentId];
if (lastClaim != 0 && block.timestamp < lastClaim + COOLDOWN) {
revert CooldownActive(agentId, lastClaim + COOLDOWN);
}
uint256 amount = dripAmounts[tier];
uint256 balance = botcoinToken.balanceOf(address(this));
if (balance < amount) revert InsufficientBalance(amount, balance);
lastClaimTime[agentId] = block.timestamp;
totalDistributed += amount;
botcoinToken.safeTransfer(recipient, amount);
emit Drip(agentId, recipient, tier, amount);
}
// ── View Functions ──────────────────────────────────────────────
/// @notice Returns the BOTCOIN balance available in the faucet
function available() external view returns (uint256) {
return botcoinToken.balanceOf(address(this));
}
/// @notice Check if an agent can claim right now
/// @return canClaim_ Whether the agent can claim
/// @return availableAt Timestamp when the agent can next claim (0 if now)
function canClaim(uint256 agentId) external view returns (bool canClaim_, uint256 availableAt) {
uint256 lastClaim = lastClaimTime[agentId];
if (lastClaim == 0) return (true, 0);
uint256 nextAvailable = lastClaim + COOLDOWN;
if (block.timestamp >= nextAvailable) return (true, 0);
return (false, nextAvailable);
}
// ── Admin Functions ─────────────────────────────────────────────
/// @notice Update the operator address
function setOperator(address _operator) external onlyOwner {
emit OperatorUpdated(operator, _operator);
operator = _operator;
}
/// @notice Update drip amount for a specific tier
function setDripAmount(uint8 tier, uint256 amount) external onlyOwner {
if (tier > 2) revert InvalidTier(tier);
dripAmounts[tier] = amount;
emit DripAmountUpdated(tier, amount);
}
/// @notice Emergency withdraw BOTCOIN from faucet
function emergencyWithdraw(uint256 amount) external onlyOwner {
botcoinToken.safeTransfer(msg.sender, amount);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
if (!_safeTransfer(token, to, value, true)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
if (!_safeTransferFrom(token, from, to, value, true)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
return _safeTransfer(token, to, value, false);
}
/**
* @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
return _safeTransferFrom(token, from, to, value, false);
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
if (!_safeApprove(token, spender, value, false)) {
if (!_safeApprove(token, spender, 0, true)) revert SafeERC20FailedOperation(address(token));
if (!_safeApprove(token, spender, value, true)) revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Oppositely, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity `token.transfer(to, value)` call, relaxing the requirement on the return value: the
* return value is optional (but if data is returned, it must not be false).
*
* @param token The token targeted by the call.
* @param to The recipient of the tokens
* @param value The amount of token to transfer
* @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.
*/
function _safeTransfer(IERC20 token, address to, uint256 value, bool bubble) private returns (bool success) {
bytes4 selector = IERC20.transfer.selector;
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(0x00, selector)
mstore(0x04, and(to, shr(96, not(0))))
mstore(0x24, value)
success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)
// if call success and return is true, all is good.
// otherwise (not success or return is not true), we need to perform further checks
if iszero(and(success, eq(mload(0x00), 1))) {
// if the call was a failure and bubble is enabled, bubble the error
if and(iszero(success), bubble) {
returndatacopy(fmp, 0x00, returndatasize())
revert(fmp, returndatasize())
}
// if the return value is not true, then the call is only successful if:
// - the token address has code
// - the returndata is empty
success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
}
mstore(0x40, fmp)
}
}
/**
* @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, relaxing the requirement on the return
* value: the return value is optional (but if data is returned, it must not be false).
*
* @param token The token targeted by the call.
* @param from The sender of the tokens
* @param to The recipient of the tokens
* @param value The amount of token to transfer
* @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.
*/
function _safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value,
bool bubble
) private returns (bool success) {
bytes4 selector = IERC20.transferFrom.selector;
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(0x00, selector)
mstore(0x04, and(from, shr(96, not(0))))
mstore(0x24, and(to, shr(96, not(0))))
mstore(0x44, value)
success := call(gas(), token, 0, 0x00, 0x64, 0x00, 0x20)
// if call success and return is true, all is good.
// otherwise (not success or return is not true), we need to perform further checks
if iszero(and(success, eq(mload(0x00), 1))) {
// if the call was a failure and bubble is enabled, bubble the error
if and(iszero(success), bubble) {
returndatacopy(fmp, 0x00, returndatasize())
revert(fmp, returndatasize())
}
// if the return value is not true, then the call is only successful if:
// - the token address has code
// - the returndata is empty
success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
}
mstore(0x40, fmp)
mstore(0x60, 0)
}
}
/**
* @dev Imitates a Solidity `token.approve(spender, value)` call, relaxing the requirement on the return value:
* the return value is optional (but if data is returned, it must not be false).
*
* @param token The token targeted by the call.
* @param spender The spender of the tokens
* @param value The amount of token to transfer
* @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.
*/
function _safeApprove(IERC20 token, address spender, uint256 value, bool bubble) private returns (bool success) {
bytes4 selector = IERC20.approve.selector;
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(0x00, selector)
mstore(0x04, and(spender, shr(96, not(0))))
mstore(0x24, value)
success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)
// if call success and return is true, all is good.
// otherwise (not success or return is not true), we need to perform further checks
if iszero(and(success, eq(mload(0x00), 1))) {
// if the call was a failure and bubble is enabled, bubble the error
if and(iszero(success), bubble) {
returndatacopy(fmp, 0x00, returndatasize())
revert(fmp, returndatasize())
}
// if the return value is not true, then the call is only successful if:
// - the token address has code
// - the returndata is empty
success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
}
mstore(0x40, fmp)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)
pragma solidity >=0.6.2;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)
pragma solidity >=0.4.16;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)
pragma solidity >=0.4.16;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}{
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"forge-std/=lib/forge-std/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": true
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_botcoinToken","type":"address"},{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"agentId","type":"uint256"},{"internalType":"uint256","name":"availableAt","type":"uint256"}],"name":"CooldownActive","type":"error"},{"inputs":[{"internalType":"uint256","name":"requested","type":"uint256"},{"internalType":"uint256","name":"available","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"uint8","name":"tier","type":"uint8"}],"name":"InvalidTier","type":"error"},{"inputs":[],"name":"OnlyOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"agentId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint8","name":"tier","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Drip","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"tier","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"newAmount","type":"uint256"}],"name":"DripAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOperator","type":"address"},{"indexed":true,"internalType":"address","name":"newOperator","type":"address"}],"name":"OperatorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"COOLDOWN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"available","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"botcoinToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"agentId","type":"uint256"}],"name":"canClaim","outputs":[{"internalType":"bool","name":"canClaim_","type":"bool"},{"internalType":"uint256","name":"availableAt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"agentId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint8","name":"tier","type":"uint8"}],"name":"drip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"dripAmounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastClaimTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tier","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setDripAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalDeposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDistributed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a03461014a57601f610acb38819003918201601f19168301916001600160401b0383118484101761014e5780849260609460405283398101031261014a5761004781610162565b9061005460208201610162565b906001600160a01b039061006a90604001610162565b16918215610137575f80546001600160a01b031981168517825560405194916001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a36001600160a01b03908116608052600180546001600160a01b03191692909116919091179055683635c9adc5dea00000600255686c6b935b8bbd40000060035568a2a15d09519be00000600455610954908161017782396080518181816101ac015281816102230152818161055f015281816105b001526106c40152f35b631e4fbdf760e01b5f525f60045260245ffd5b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b038216820361014a5756fe60806040526004361015610011575f80fd5b5f3560e01c8063074bb3ac1461063057806348a0d754146105855780635312ea8e1461053d578063570ca73514610515578063667cb24f146104e9578063715018a614610492578063877dab7e146104685780638da5cb5b1461044157806392c6672814610392578063a2724a4d14610375578063b3ab15fb1461030d578063b6b55f2514610207578063c95c0d89146101db578063ef46e1e714610197578063efca2eed1461017a578063f2fde38b146100f55763ff50abdc146100d4575f80fd5b346100f1575f3660031901126100f1576020600754604051908152f35b5f80fd5b346100f15760203660031901126100f15761010e610812565b6101166108f8565b6001600160a01b03168015610167575f80546001600160a01b03198116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b631e4fbdf760e01b5f525f60045260245ffd5b346100f1575f3660031901126100f1576020600654604051908152f35b346100f1575f3660031901126100f1576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346100f15760203660031901126100f15760406101f960043561086b565b825191151582526020820152f35b346100f15760203660031901126100f15760043580156102fe577f00000000000000000000000000000000000000000000000000000000000000006040516323b872dd60e01b5f5233600452306024528260445260205f60648180865af19060015f51148216156102dd575b6040525f606052156102bd575061028c81600754610828565b6007556040519081527fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c60203392a2005b635274afe760e01b5f9081526001600160a01b0391909116600452602490fd5b9060018115166102f557823b15153d15161690610273565b503d5f823e3d90fd5b631f2a200560e01b5f5260045ffd5b346100f15760203660031901126100f157610326610812565b61032e6108f8565b6001546001600160a01b0391821691829082167ffbe5b6cbafb274f445d7fed869dc77a838d8243a22c460de156560e8857cad035f80a36001600160a01b03191617600155005b346100f1575f3660031901126100f1576020604051620151808152f35b346100f15760403660031901126100f15760043560ff81168082036100f157602435906103bd6108f8565b6002811161042f5750600382101561041b5781817f6db75dc79847b03b8f21d181d60eeb0ff6ac3f0da1173d035c71d09e9d68486a9360020155610416604051928392836020909392919360ff60408201951681520152565b0390a1005b634e487b7160e01b5f52603260045260245ffd5b635e50d4ab60e11b5f5260045260245ffd5b346100f1575f3660031901126100f1575f546040516001600160a01b039091168152602090f35b346100f15760203660031901126100f1576004355f526005602052602060405f2054604051908152f35b346100f1575f3660031901126100f1576104aa6108f8565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346100f15760203660031901126100f15760043560038110156100f15760209060020154604051908152f35b346100f1575f3660031901126100f1576001546040516001600160a01b039091168152602090f35b346100f15760203660031901126100f1576105566108f8565b610583600435337f00000000000000000000000000000000000000000000000000000000000000006108a0565b005b346100f1575f3660031901126100f1576040516370a0823160e01b81523060048201526020816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa8015610625575f906105f2575b602090604051908152f35b506020813d60201161061d575b8161060c60209383610835565b810103126100f157602090516105e7565b3d91506105ff565b6040513d5f823e3d90fd5b346100f15760603660031901126100f1576024356001600160a01b03811690600435908281036100f15760443560ff81168082036100f1576001546001600160a01b03163303610803576002811161042f5750825f52600560205260405f2054801515806107ee575b6107b75750600381101561041b5760028101546040516370a0823160e01b81523060048201529092907f0000000000000000000000000000000000000000000000000000000000000000906020816024816001600160a01b0386165afa908115610625575f91610785575b5084811061076f5750837fc711108b649c4035ac5609c07c556bf397feed662efee98c0d2599ac22240bff94939261075892875f5260056020524260405f205561075083600654610828565b6006556108a0565b6040805160ff9290921682526020820192909252a3005b8463cf47918160e01b5f5260045260245260445ffd5b90506020813d6020116107af575b816107a060209383610835565b810103126100f1575187610704565b3d9150610793565b836201518082018092116107da5763181511ab60e31b5f5260045260245260445ffd5b634e487b7160e01b5f52601160045260245ffd5b506201518081018082116107da574210610699565b6327e1f1e560e01b5f5260045ffd5b600435906001600160a01b03821682036100f157565b919082018092116107da57565b90601f8019910116810190811067ffffffffffffffff82111761085757604052565b634e487b7160e01b5f52604160045260245ffd5b5f52600560205260405f2054908115610898576201518082018092116107da5781421015610898575f9190565b600191505f90565b916040519163a9059cbb60e01b5f5260018060a01b031660045260245260205f60448180865af19060015f51148216156108e0575b604052156102bd5750565b9060018115166102f557823b15153d151616906108d5565b5f546001600160a01b0316330361090b57565b63118cdaa760e01b5f523360045260245ffdfea264697066735822122061d05c7cc2780ddf1899317c6a66125621331cc3f4ca7b328258a79ffd2543e964736f6c634300081c0033000000000000000000000000a601877977340862ca67f816eb079958e5bd0ba30000000000000000000000006463f89f102e9f53168abe557173f53c0bbbf6350000000000000000000000006463f89f102e9f53168abe557173f53c0bbbf635
Deployed Bytecode
0x60806040526004361015610011575f80fd5b5f3560e01c8063074bb3ac1461063057806348a0d754146105855780635312ea8e1461053d578063570ca73514610515578063667cb24f146104e9578063715018a614610492578063877dab7e146104685780638da5cb5b1461044157806392c6672814610392578063a2724a4d14610375578063b3ab15fb1461030d578063b6b55f2514610207578063c95c0d89146101db578063ef46e1e714610197578063efca2eed1461017a578063f2fde38b146100f55763ff50abdc146100d4575f80fd5b346100f1575f3660031901126100f1576020600754604051908152f35b5f80fd5b346100f15760203660031901126100f15761010e610812565b6101166108f8565b6001600160a01b03168015610167575f80546001600160a01b03198116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b631e4fbdf760e01b5f525f60045260245ffd5b346100f1575f3660031901126100f1576020600654604051908152f35b346100f1575f3660031901126100f1576040517f000000000000000000000000a601877977340862ca67f816eb079958e5bd0ba36001600160a01b03168152602090f35b346100f15760203660031901126100f15760406101f960043561086b565b825191151582526020820152f35b346100f15760203660031901126100f15760043580156102fe577f000000000000000000000000a601877977340862ca67f816eb079958e5bd0ba36040516323b872dd60e01b5f5233600452306024528260445260205f60648180865af19060015f51148216156102dd575b6040525f606052156102bd575061028c81600754610828565b6007556040519081527fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c60203392a2005b635274afe760e01b5f9081526001600160a01b0391909116600452602490fd5b9060018115166102f557823b15153d15161690610273565b503d5f823e3d90fd5b631f2a200560e01b5f5260045ffd5b346100f15760203660031901126100f157610326610812565b61032e6108f8565b6001546001600160a01b0391821691829082167ffbe5b6cbafb274f445d7fed869dc77a838d8243a22c460de156560e8857cad035f80a36001600160a01b03191617600155005b346100f1575f3660031901126100f1576020604051620151808152f35b346100f15760403660031901126100f15760043560ff81168082036100f157602435906103bd6108f8565b6002811161042f5750600382101561041b5781817f6db75dc79847b03b8f21d181d60eeb0ff6ac3f0da1173d035c71d09e9d68486a9360020155610416604051928392836020909392919360ff60408201951681520152565b0390a1005b634e487b7160e01b5f52603260045260245ffd5b635e50d4ab60e11b5f5260045260245ffd5b346100f1575f3660031901126100f1575f546040516001600160a01b039091168152602090f35b346100f15760203660031901126100f1576004355f526005602052602060405f2054604051908152f35b346100f1575f3660031901126100f1576104aa6108f8565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346100f15760203660031901126100f15760043560038110156100f15760209060020154604051908152f35b346100f1575f3660031901126100f1576001546040516001600160a01b039091168152602090f35b346100f15760203660031901126100f1576105566108f8565b610583600435337f000000000000000000000000a601877977340862ca67f816eb079958e5bd0ba36108a0565b005b346100f1575f3660031901126100f1576040516370a0823160e01b81523060048201526020816024817f000000000000000000000000a601877977340862ca67f816eb079958e5bd0ba36001600160a01b03165afa8015610625575f906105f2575b602090604051908152f35b506020813d60201161061d575b8161060c60209383610835565b810103126100f157602090516105e7565b3d91506105ff565b6040513d5f823e3d90fd5b346100f15760603660031901126100f1576024356001600160a01b03811690600435908281036100f15760443560ff81168082036100f1576001546001600160a01b03163303610803576002811161042f5750825f52600560205260405f2054801515806107ee575b6107b75750600381101561041b5760028101546040516370a0823160e01b81523060048201529092907f000000000000000000000000a601877977340862ca67f816eb079958e5bd0ba3906020816024816001600160a01b0386165afa908115610625575f91610785575b5084811061076f5750837fc711108b649c4035ac5609c07c556bf397feed662efee98c0d2599ac22240bff94939261075892875f5260056020524260405f205561075083600654610828565b6006556108a0565b6040805160ff9290921682526020820192909252a3005b8463cf47918160e01b5f5260045260245260445ffd5b90506020813d6020116107af575b816107a060209383610835565b810103126100f1575187610704565b3d9150610793565b836201518082018092116107da5763181511ab60e31b5f5260045260245260445ffd5b634e487b7160e01b5f52601160045260245ffd5b506201518081018082116107da574210610699565b6327e1f1e560e01b5f5260045ffd5b600435906001600160a01b03821682036100f157565b919082018092116107da57565b90601f8019910116810190811067ffffffffffffffff82111761085757604052565b634e487b7160e01b5f52604160045260245ffd5b5f52600560205260405f2054908115610898576201518082018092116107da5781421015610898575f9190565b600191505f90565b916040519163a9059cbb60e01b5f5260018060a01b031660045260245260205f60448180865af19060015f51148216156108e0575b604052156102bd5750565b9060018115166102f557823b15153d151616906108d5565b5f546001600160a01b0316330361090b57565b63118cdaa760e01b5f523360045260245ffdfea264697066735822122061d05c7cc2780ddf1899317c6a66125621331cc3f4ca7b328258a79ffd2543e964736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a601877977340862ca67f816eb079958e5bd0ba30000000000000000000000006463f89f102e9f53168abe557173f53c0bbbf6350000000000000000000000006463f89f102e9f53168abe557173f53c0bbbf635
-----Decoded View---------------
Arg [0] : _botcoinToken (address): 0xA601877977340862Ca67f816eb079958E5bd0BA3
Arg [1] : _operator (address): 0x6463f89F102e9f53168ABe557173f53c0bBbF635
Arg [2] : _owner (address): 0x6463f89F102e9f53168ABe557173f53c0bBbF635
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000a601877977340862ca67f816eb079958e5bd0ba3
Arg [1] : 0000000000000000000000006463f89f102e9f53168abe557173f53c0bbbf635
Arg [2] : 0000000000000000000000006463f89f102e9f53168abe557173f53c0bbbf635
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 32 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.