FeeDistributor
0xcae4b162398490a9429fb1575d101287979cd5b6
Verification
Verified
v0.8.24+commit.e11b9ed9
Type
Contract
2,259 bytes
ABI entries
30
9 read · 8 write
License
none
Contract information
- Address
- 0xcae4b162398490a9429fb1575d101287979cd5b6
- Chain
- Robinhood Chain (4663)
- Compiler
- v0.8.24+commit.e11b9ed9
- Optimization
- Enabled
- Creator
- 0x847BC24350…bae092c4FA
- Creation tx
- 0x3b7a3b5ea2…f1904a70e5
Token
Not a token
This contract does not expose ERC-20 metadata.
Read contract (9)
owner() → address
pendingOwner() → address
referralBps() → uint16
referralPool() → address
stakerBps() → uint16
stakerPool() → address
treasury() → address
treasuryBps() → uint16
usdg() → address
Events (7)
DistributedOwnershipTransferStartedOwnershipTransferredReferralPoolSetSplitSetStakerPoolSetTreasurySet
ABI
[
{
"inputs": [
{
"internalType": "address",
"name": "usdg_",
"type": "address"
},
{
"internalType": "address",
"name": "stakerPool_",
"type": "address"
},
{
"internalType": "address",
"name": "treasury_",
"type": "address"
},
{
"internalType": "address",
"name": "referralPool_",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "BadSplit",
"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": "ZeroAddress",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "stakerAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "treasuryAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "referralAmount",
"type": "uint256"
}
],
"name": "Distributed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferStarted",
"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"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "referralPool",
"type": "address"
}
],
"name": "ReferralPoolSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint16",
"name": "stakerBps",
"type": "uint16"
},
{
"indexed": false,
"internalType": "uint16",
"name": "treasuryBps",
"type": "uint16"
},
{
"indexed": false,
"internalType": "uint16",
"name": "referralBps",
"type": "uint16"
}
],
"name": "SplitSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "stakerPool",
"type": "address"
}
],
"name": "StakerPoolSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "treasury",
"type": "address"
}
],
"name": "TreasurySet",
"type": "event"
},
{
"inputs": [],
"name": "acceptOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "distribute",
"outputs": [
{
"internalType": "uint256",
"name": "stakerAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "treasuryAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "referralAmount",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pendingOwner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "referralBps",
"outputs": [
{
"internalType": "uint16",
"name": "",
"type": "uint16"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "referralPool",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "referralPool_",
"type": "address"
}
],
"name": "setReferralPool",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint16",
"name": "stakerBps_",
"type": "uint16"
},
{
"internalType": "uint16",
"name": "treasuryBps_",
"type": "uint16"
},
{
"internalType": "uint16",
"name": "referralBps_",
"type": "uint16"
}
],
"name": "setSplit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "stakerPool_",
"type": "address"
}
],
"name": "setStakerPool",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "treasury_",
"type": "address"
}
],
"name": "setTreasury",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "stakerBps",
"outputs": [
{
"internalType": "uint16",
"name": "",
"type": "uint16"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "stakerPool",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "treasury",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "treasuryBps",
"outputs": [
{
"internalType": "uint16",
"name": "",
"type": "uint16"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "usdg",
"outputs": [
{
"internalType": "contract IERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
}
]Source code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {Ownable2Step, Ownable} from "@openzeppelin/contracts/access/Ownable2Step.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
contract FeeDistributor is Ownable2Step {
using SafeERC20 for IERC20;
IERC20 public immutable usdg;
address public stakerPool;
address public treasury;
address public referralPool;
uint16 public stakerBps;
uint16 public treasuryBps;
uint16 public referralBps;
error ZeroAddress();
error BadSplit();
event StakerPoolSet(address indexed stakerPool);
event TreasurySet(address indexed treasury);
event ReferralPoolSet(address indexed referralPool);
event SplitSet(uint16 stakerBps, uint16 treasuryBps, uint16 referralBps);
event Distributed(uint256 stakerAmount, uint256 treasuryAmount, uint256 referralAmount);
constructor(address usdg_, address stakerPool_, address treasury_, address referralPool_) Ownable(msg.sender) {
if (usdg_ == address(0) || stakerPool_ == address(0) || treasury_ == address(0) || referralPool_ == address(0))
{
revert ZeroAddress();
}
usdg = IERC20(usdg_);
stakerPool = stakerPool_;
treasury = treasury_;
referralPool = referralPool_;
stakerBps = 0;
treasuryBps = 10_000;
referralBps = 0;
}
function setStakerPool(address stakerPool_) external onlyOwner {
if (stakerPool_ == address(0)) revert ZeroAddress();
stakerPool = stakerPool_;
emit StakerPoolSet(stakerPool_);
}
function setTreasury(address treasury_) external onlyOwner {
if (treasury_ == address(0)) revert ZeroAddress();
treasury = treasury_;
emit TreasurySet(treasury_);
}
function setReferralPool(address referralPool_) external onlyOwner {
if (referralPool_ == address(0)) revert ZeroAddress();
referralPool = referralPool_;
emit ReferralPoolSet(referralPool_);
}
function setSplit(uint16 stakerBps_, uint16 treasuryBps_, uint16 referralBps_) external onlyOwner {
if (uint256(stakerBps_) + treasuryBps_ + referralBps_ != 10_000) revert BadSplit();
stakerBps = stakerBps_;
treasuryBps = treasuryBps_;
referralBps = referralBps_;
emit SplitSet(stakerBps_, treasuryBps_, referralBps_);
}
function distribute() external returns (uint256 stakerAmount, uint256 treasuryAmount, uint256 referralAmount) {
uint256 bal = usdg.balanceOf(address(this));
if (bal == 0) return (0, 0, 0);
stakerAmount = (bal * stakerBps) / 10_000;
referralAmount = (bal * referralBps) / 10_000;
treasuryAmount = bal - stakerAmount - referralAmount;
if (stakerAmount > 0) usdg.safeTransfer(stakerPool, stakerAmount);
if (treasuryAmount > 0) usdg.safeTransfer(treasury, treasuryAmount);
if (referralAmount > 0) usdg.safeTransfer(referralPool, referralAmount);
emit Distributed(stakerAmount, treasuryAmount, referralAmount);
}
}
Chain explorer2332msChain node72ms