Verified contractExactMIT
Gather
Address0x73a2df0c734edf677b4576218d39108331bb9052
- Balance
0 ETH
- Transactions
2
- Compiler
solc 0.8.30
- Same code
Only this contract
Details
- Compiler
- solc 0.8.30+commit.73712a01
- Language
- solidity
- Optimization
- Yes, 10,000 runs
- EVM version
- prague
- Via IR
- yes
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 24,694,588
- Creation transaction
- 0x16442450d5…1cbd8ffe12
7 files
- lib/yield-claim-nft/src/dispatchers/Gather.solmain2.37 KB
- lib/phUSD-stable-minter/lib/openzeppelin-contracts/contracts/access/Ownable.sol3.1 KB
- lib/phUSD-stable-minter/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol2.78 KB
- lib/phUSD-stable-minter/lib/openzeppelin-contracts/contracts/utils/Context.sol963 B
- lib/phUSD-stable-minter/lib/openzeppelin-contracts/contracts/utils/Pausable.sol2.71 KB
- lib/yield-claim-nft/src/dispatchers/ATokenDispatcher.sol3.26 KB
- lib/yield-claim-nft/src/interfaces/ITokenDispatcher.sol600 B
lib/yield-claim-nft/src/dispatchers/Gather.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ATokenDispatcher} from "./ATokenDispatcher.sol";
import {ITokenDispatcher} from "../interfaces/ITokenDispatcher.sol";
/// @title Gather
/// @notice A token dispatcher that forwards received tokens to a configurable recipient address.
/// @dev Tokens arrive directly on this contract via the minter's transferFrom.
/// The recipient address is updatable by the owner.
contract Gather is ATokenDispatcher {
address private immutable _token;
address private _recipient;
/// @notice Emitted when the recipient address is updated.
event RecipientUpdated(address indexed oldRecipient, address indexed newRecipient);
/// @param token_ The prime token this dispatcher acts on.
/// @param recipient_ The initial address to forward tokens to.
/// @param initialOwner The initial owner of this dispatcher.
constructor(address token_, address recipient_, address initialOwner)
ATokenDispatcher(initialOwner)
{
require(recipient_ != address(0), "Gather: zero recipient address");
_token = token_;
_recipient = recipient_;
}
/// @inheritdoc ITokenDispatcher
function primeToken() external view returns (address) {
return _token;
}
/// @notice Returns the current recipient address where tokens are forwarded.
function recipient() external view returns (address) {
return _recipient;
}
/// @notice Updates the recipient address. Only callable by the owner.
/// @param newRecipient The new address to forward tokens to.
function setRecipient(address newRecipient) external onlyOwner {
require(newRecipient != address(0), "Gather: zero recipient address");
address oldRecipient = _recipient;
_recipient = newRecipient;
emit RecipientUpdated(oldRecipient, newRecipient);
}
/// @notice Forwards tokens (already on this contract) to the recipient.
/// @param amount The FOT-adjusted amount of prime token to forward.
function dispatch(
address,
uint256 amount,
bytes calldata /* extraData */
)
external
override
onlyMinter
whenNotPaused
{
IERC20(_token).transfer(_recipient, amount);
}
}
lib/phUSD-stable-minter/lib/openzeppelin-contracts/contracts/access/Ownable.sol
// 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);
}
}
lib/phUSD-stable-minter/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
// 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);
}
lib/phUSD-stable-minter/lib/openzeppelin-contracts/contracts/utils/Context.sol
// 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;
}
}
lib/phUSD-stable-minter/lib/openzeppelin-contracts/contracts/utils/Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/Pausable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
bool private _paused;
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
/**
* @dev The operation failed because the contract is paused.
*/
error EnforcedPause();
/**
* @dev The operation failed because the contract is not paused.
*/
error ExpectedPause();
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
if (paused()) {
revert EnforcedPause();
}
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
if (!paused()) {
revert ExpectedPause();
}
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
lib/yield-claim-nft/src/dispatchers/ATokenDispatcher.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {ITokenDispatcher} from "../interfaces/ITokenDispatcher.sol";
import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/// @title ATokenDispatcher
/// @notice Abstract base contract for token dispatchers with pausability support.
/// @dev Inherits ITokenDispatcher, Pausable, and Ownable. Provides a minter authorization
/// mechanism so that the NFTMinter can pause/unpause dispatchers.
abstract contract ATokenDispatcher is ITokenDispatcher, Pausable, Ownable {
/// @notice The authorized minter address that can pause/unpause this dispatcher.
address internal _minter;
/// @notice Metadata fields for this dispatcher.
string private _name;
string private _image;
string private _description;
/// @notice Emitted when metadata is updated.
event MetadataUpdated(string name, string image, string description);
/// @notice Restricts function access to the authorized minter.
modifier onlyMinter() {
require(msg.sender == _minter, "ATokenDispatcher: caller is not minter");
_;
}
/// @param initialOwner The initial owner of this dispatcher.
constructor(address initialOwner) Ownable(initialOwner) {}
/// @notice Sets the metadata for this dispatcher. Only callable by the owner.
/// @param name_ The name metadata string.
/// @param image_ The image metadata string (URL or data URI).
/// @param description_ The description metadata string.
function setMetadata(string calldata name_, string calldata image_, string calldata description_) external onlyOwner {
_name = name_;
_image = image_;
_description = description_;
emit MetadataUpdated(name_, image_, description_);
}
/// @inheritdoc ITokenDispatcher
function name() external view returns (string memory) {
return _name;
}
/// @inheritdoc ITokenDispatcher
function image() external view returns (string memory) {
return _image;
}
/// @inheritdoc ITokenDispatcher
function description() external view returns (string memory) {
return _description;
}
/// @notice Sets the authorized minter address. Only callable by the owner.
/// @param minter_ The address of the NFTMinter contract.
function setMinter(address minter_) external onlyOwner {
_minter = minter_;
}
/// @notice Pauses the dispatcher. Only callable by the authorized minter.
function pause() external onlyMinter {
_pause();
}
/// @notice Unpauses the dispatcher. Only callable by the authorized minter.
function unpause() external onlyMinter {
_unpause();
}
/// @notice Executes the dispatch logic. Reverts if the dispatcher is paused.
/// @param minter The NFTMinter contract address.
/// @param amount The amount of prime token that was paid for this mint.
/// @param extraData Dispatcher-specific encoded data (unused in base; reserved for future use).
function dispatch(address minter, uint256 amount, bytes calldata extraData)
external
virtual
onlyMinter
whenNotPaused
{}
}
lib/yield-claim-nft/src/interfaces/ITokenDispatcher.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface ITokenDispatcher {
/// @notice Returns the primary token this dispatcher acts on.
function primeToken() external view returns (address);
/// @notice Returns the name metadata for this dispatcher.
function name() external view returns (string memory);
/// @notice Returns the image metadata for this dispatcher.
function image() external view returns (string memory);
/// @notice Returns the description metadata for this dispatcher.
function description() external view returns (string memory);
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 10000,
"enabled": true
},
"evmVersion": "prague",
"remappings": [
"@phlimbo-ea/=lib/phlimbo-ea/src/",
"@phUSD-stable-minter/=lib/phUSD-stable-minter/src/",
"@stable-yield-accumulator/=lib/stable-yield-accumulator/src/",
"@openzeppelin/contracts/=lib/phUSD-stable-minter/lib/openzeppelin-contracts/contracts/",
"@forge-std/=lib/forge-std/src/",
"@vault-interfaces/=lib/vault/src/interfaces/",
"@vault/=lib/vault/src/",
"@pauser/=lib/pauser/src/",
"pauser/=lib/pauser/src/",
"forge-std/=lib/forge-std/src/",
"lib/mutable/pauser/=lib/pauser/",
"vault/interfaces/=lib/vault/src/interfaces/",
"phlimbo-ea/=lib/phlimbo-ea/src/",
"lib/phUSD-stable-minter/lib/mutable/pauser/=lib/pauser/",
"lib/stable-yield-accumulator/lib/mutable/pauser/=lib/pauser/",
"lib/phlimbo-ea/lib/mutable/pauser/=lib/pauser/",
"lib/phUSD-stable-minter/lib/mutable/vault/=lib/vault/",
"openzeppelin-contracts/=lib/phUSD-stable-minter/lib/openzeppelin-contracts/",
"erc4626-tests/=lib/phUSD-stable-minter/lib/openzeppelin-contracts/lib/erc4626-tests/",
"halmos-cheatcodes/=lib/phUSD-stable-minter/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"v4-core/=lib/stable-yield-accumulator/lib/v4-periphery/lib/v4-core/src/",
"v4-periphery/=lib/stable-yield-accumulator/lib/v4-periphery/",
"@uniswap/v4-core/=lib/stable-yield-accumulator/lib/v4-periphery/lib/v4-core/",
"lib/stable-yield-accumulator/lib/openzeppelin-contracts/=lib/stable-yield-accumulator/lib/openzeppelin-contracts/",
"@flax-token/=lib/flax-token-v2/src/",
"yield-claim-nft/=lib/stable-yield-accumulator/lib/mutable/yield-claim-nft/src/",
"@yield-claim-nft/=lib/yield-claim-nft/src/",
"lib/yield-claim-nft/src/interfaces/IBurnable.sol=lib/pauser/src/interfaces/IBurnable.sol"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.