Verified contractPartialMIT
ObolTokenDistributor
Address0xfb640d61311a32cabafda5003f6b5ebe8a8f5d18
- Balance
0 ETH
- Transactions
6
- Compiler
solc 0.8.35
- Same code
1 more contract
Details
- Compiler
- solc 0.8.35+commit.47b9dedd
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,108,966
- Creation transaction
- 0x1ec0abcce3…5a6c391b60
- Main copy (most transactions)
- 0x5c476f8c…2b210fc5
token.sol
pragma solidity ^0.8.20;
/*
**$OBOL**
*The Ferryman’s Price.*
The cold coin placed beneath the tongue of the fallen.
Once the toll to cross the River Styx, now the toll to survive the Market.
$OBOL is the native token — the pulse, the fuel, the levy.
No battle begins without it.
No Crucible spins, no Vault seals, no evolution awakens.
Earned through Tolls.
Burned in the Pit.
Sacrificed on every secondary trade.
The Market does not accept prayers.
It only accepts $OBOL.
**Pay the Ferryman.**
Or remain stranded on the shores of the lost.
---
**Links**
Website: https://theferryman.xyz/
X: https://x.com/FerrymanTCG
*/
// SPDX-License-Identifier: MIT
interface IERC20 {
function transfer(address to, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
}
library SafeERC20 {
function safeTransfer(IERC20 token, address to, uint256 value) internal {
(bool success, bytes memory data) = address(token).call(
abi.encodeWithSelector(token.transfer.selector, to, value)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"SafeERC20: transfer failed"
);
}
}
contract ObolTokenDistributor {
using SafeERC20 for IERC20;
address public owner;
uint256 private nonce;
uint256 public constant VARIANCE_BPS = 1500; // ±15% → ~30% spread
uint256 public constant BPS_DENOMINATOR = 10000;
uint256 public constant MAX_BATCH = 250; // safe per-tx ceiling
event Distributed(address indexed token, uint256 totalAmount, uint256 recipientCount, uint256 batchStart, uint256 batchEnd);
event Withdrawn(address indexed token, address indexed to, uint256 amount);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
function _randomMultiplier(uint256 seed) private view returns (uint256) {
uint256 rand = uint256(keccak256(abi.encodePacked(
block.timestamp,
block.prevrandao,
msg.sender,
seed
)));
uint256 offset = rand % (2 * VARIANCE_BPS + 1);
return BPS_DENOMINATOR - VARIANCE_BPS + offset;
}
/// @notice Distribute roughly-equal amounts (±15%) to a batch of recipients
/// @param token ERC20 held by this contract
/// @param recipients Recipient batch (recommend ≤ 250 per call)
/// @param baseAmount Center value per recipient
/// @param batchId Tag this batch (use 0, 1, 2... when chunking 1000 across multiple txs)
function distributeVaried(
address token,
address[] calldata recipients,
uint256 baseAmount,
uint256 batchId
) external onlyOwner {
uint256 len = recipients.length;
require(len > 0, "No recipients");
require(len <= MAX_BATCH, "Batch too large");
require(baseAmount > 0, "Zero base amount");
uint256 maxTotal = (baseAmount * (BPS_DENOMINATOR + VARIANCE_BPS) * len) / BPS_DENOMINATOR;
require(IERC20(token).balanceOf(address(this)) >= maxTotal, "Insufficient balance");
uint256 actualTotal;
uint256 _nonce = nonce;
uint256 batchOffset = batchId * MAX_BATCH;
for (uint256 i = 0; i < len; i++) {
require(recipients[i] != address(0), "Zero address recipient");
uint256 multiplier = _randomMultiplier(_nonce + batchOffset + i);
uint256 amount = (baseAmount * multiplier) / BPS_DENOMINATOR;
IERC20(token).safeTransfer(recipients[i], amount);
actualTotal += amount;
}
nonce = _nonce + len;
emit Distributed(token, actualTotal, len, batchOffset, batchOffset + len);
}
function withdraw(address token, address to, uint256 amount) external onlyOwner {
require(to != address(0), "Zero address");
IERC20(token).safeTransfer(to, amount);
emit Withdrawn(token, to, amount);
}
function withdrawAll(address token, address to) external onlyOwner {
require(to != address(0), "Zero address");
uint256 balance = IERC20(token).balanceOf(address(this));
IERC20(token).safeTransfer(to, balance);
emit Withdrawn(token, to, balance);
}
function rescueETH(address payable to) external onlyOwner {
require(to != address(0), "Zero address");
(bool sent, ) = to.call{value: address(this).balance}("");
require(sent, "ETH transfer failed");
}
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0), "Zero address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
receive() external payable {}
}Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
},
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.