Verified contractExactMIT
STRCToken
Address0xc3732e78d985c299e5e7688a03c92ca12402b027
- Balance
0 ETH
- Transactions
408
- Compiler
solc 0.8.25
- Same code
Only this contract
Details
- Compiler
- solc 0.8.25+commit.b61c2a91
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,115,961
- Creation transaction
- 0x79a17bfc49…f4138ad8f9
contracts/STRCToken.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
interface ISTRCDividendTracker {
function syncAccount(address account, uint256 newBalance) external;
function syncTwo(
address a, uint256 newBalanceA,
address b, uint256 newBalanceB
) external;
}
interface ICurveTiers {
function whitelistTier(address) external view returns (uint8);
function whitelistSellPenaltyBps(uint8 tier) external view returns (uint16);
}
contract STRCToken {
string public constant name = "STRC100";
string public constant symbol = "STRC";
uint8 public constant decimals = 18;
uint256 public constant TOTAL_SUPPLY = 1_000_000_000 ether;
address public owner;
address public dividendTracker;
address public curve; // one-shot set
mapping(address => bool) public vestTransferAllowed; // hardcoded named allowlist
bool public vestAllowlistLocked;
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event DividendTrackerSet(address indexed tracker);
event Burn(address indexed from, uint256 value);
event CurveSet(address indexed curve);
event VestTransferAllowlistSet(address[] addrs);
/// @dev Custom errors. Replaces 8 require strings.
error OnlyOwner();
error ZeroAddress();
error InsufficientAllowance();
error InsufficientBalance();
error ZeroAmount();
error AlreadySet();
error WhitelistVestActive();
error AlreadyLocked();
modifier onlyOwner() {
if (msg.sender != owner) revert OnlyOwner();
_;
}
constructor(address initialHolder, address initialOwner) {
if (initialHolder == address(0)) revert ZeroAddress();
if (initialOwner == address(0)) revert ZeroAddress();
owner = initialOwner;
emit OwnershipTransferred(address(0), initialOwner);
totalSupply = TOTAL_SUPPLY;
balanceOf[initialHolder] = TOTAL_SUPPLY;
emit Transfer(address(0), initialHolder, TOTAL_SUPPLY);
}
function transferOwnership(address newOwner) external onlyOwner {
if (newOwner == address(0)) revert ZeroAddress();
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/// @notice One-shot binding to the dividend tracker. After the smoke
/// deploy's first call, the tracker is permanently fixed.
/// @dev Prior to V16 this setter had NO one-shot guard — a compromised
/// owner key could rebind tracking to a malicious contract,
/// redirecting WBTC dividends and griefing transfers via the
/// tracker.syncAccount callback. Surfaced as Finding T-CRIT-1
/// in the V15 enterprise audit report.
function setDividendTracker(address tracker) external onlyOwner {
if (dividendTracker != address(0)) revert AlreadySet();
if (tracker == address(0)) revert ZeroAddress();
dividendTracker = tracker;
emit DividendTrackerSet(tracker);
}
function setCurve(address _curve) external onlyOwner {
if (curve != address(0)) revert AlreadySet();
if (_curve == address(0)) revert ZeroAddress();
curve = _curve;
emit CurveSet(_curve);
}
function setVestTransferAllowlist(address[] calldata addrs) external onlyOwner {
if (vestAllowlistLocked) revert AlreadyLocked();
for (uint256 i = 0; i < addrs.length; i++) {
if (addrs[i] != address(0)) {
vestTransferAllowed[addrs[i]] = true;
}
}
vestAllowlistLocked = true;
emit VestTransferAllowlistSet(addrs);
}
function approve(address spender, uint256 amount) external returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transfer(address to, uint256 amount) external returns (bool) {
_transfer(msg.sender, to, amount);
return true;
}
function transferFrom(address from, address to, uint256 amount) external returns (bool) {
uint256 allowed = allowance[from][msg.sender];
if (allowed < amount) revert InsufficientAllowance();
if (allowed != type(uint256).max) {
allowance[from][msg.sender] = allowed - amount;
emit Approval(from, msg.sender, allowance[from][msg.sender]);
}
_transfer(from, to, amount);
return true;
}
/// @notice Permanently destroy `amount` of caller's STRC. Reduces
/// circulating supply. Used by `STRCBondingCurve.pullMigrationAssets`
/// to burn the post-migration token leftover (mirror of the ETH
/// clip-and-refund — eliminates the stuck-tokens class of bug
/// without leaving the leftover anywhere recoverable).
/// @dev Permissionless by design — anyone can burn their own balance.
/// Tracker is updated so burner's `shares` drop by the burned
/// amount; their dividend stream stops on burned supply.
function burn(uint256 amount) external {
if (amount == 0) revert ZeroAmount();
uint256 bal = balanceOf[msg.sender];
if (bal < amount) revert InsufficientBalance();
unchecked {
balanceOf[msg.sender] = bal - amount;
totalSupply -= amount;
}
emit Burn(msg.sender, amount);
emit Transfer(msg.sender, address(0), amount);
address tracker = dividendTracker;
if (tracker != address(0)) {
// V19+ semantics — same gas-budget + OOG-reverts pattern as
// _transfer. See TrackerOutOfGas docstring for rationale.
try ISTRCDividendTracker(tracker).syncAccount{gas: TRACKER_SYNC_GAS}(
msg.sender, balanceOf[msg.sender]
) {} catch (bytes memory reason) {
if (reason.length == 0) revert TrackerOutOfGas();
}
}
}
/// @dev Gas budget reserved for the tracker.syncTwo callback. Sized to
/// cover the worst-case path: _drip + 2× _accrueAccount + 2× _setShares
/// with totalShares-mutate, debt-update, 2× Synced emit, AND the
/// forfeit-on-decrease leg (WBTC transfer + _stream). Measured upper
/// bound on Sepolia: ~150k. 200k provides ~33% headroom for future
/// tracker changes without breaking transfers.
uint256 internal constant TRACKER_SYNC_GAS = 200_000;
/// @notice Thrown when the sync sub-call runs out of gas. This makes
/// `eth_estimateGas` correctly fail when wallet gas is too low,
/// forcing the wallet to bump and submit with adequate gas
/// instead of silently emitting a transfer that desyncs the
/// tracker. Surfacing this — rather than swallowing under the
/// original `catch {}` — is the V19+ fix for the dividend-share
/// desync class observed live on Sepolia 2026-05-09.
error TrackerOutOfGas();
function _transfer(address from, address to, uint256 amount) internal {
if (from == address(0) || to == address(0)) revert ZeroAddress();
if (amount == 0) revert ZeroAmount();
// V28+ whitelist 48h vest enforcement.
// If `from` is a whitelisted wallet AND the sell-penalty window is still
// active (penalty > 0), block transfers EXCEPT to the named protocol
// allowlist (curve, V4 swap infrastructure, protocol contracts).
// The check is gated on `penalty > 0` so it auto-releases at t+48h.
// try/catch wraps the curve read so a curve revert (paused, ABI drift,
// unreachable) doesn't DOS every transfer — falls open to current
// behavior. This matches the V23 I2 hook pattern.
address _curve = curve;
if (_curve != address(0)) {
try ICurveTiers(_curve).whitelistTier(from) returns (uint8 tier) {
if (tier != 0) {
try ICurveTiers(_curve).whitelistSellPenaltyBps(tier) returns (uint16 penalty) {
if (penalty > 0 && !vestTransferAllowed[to]) {
revert WhitelistVestActive();
}
} catch {}
}
} catch {}
}
uint256 fromBal = balanceOf[from];
if (fromBal < amount) revert InsufficientBalance();
unchecked {
balanceOf[from] = fromBal - amount;
balanceOf[to] += amount;
}
emit Transfer(from, to, amount);
address tracker = dividendTracker;
if (tracker != address(0)) {
// V19+ semantics:
// • Cap the sub-call at TRACKER_SYNC_GAS so a buggy or malicious
// tracker cannot grief by consuming the entire transfer gas.
// • Distinguish out-of-gas reverts (empty `reason`) from custom
// reverts (non-empty `reason`):
// — Empty → revert outer transfer with `TrackerOutOfGas`.
// This is the FIX for the silent-desync bug:
// eth_estimateGas now correctly fails when the
// wallet's gas budget is insufficient, instead
// of returning the post-catch gas (which is
// smaller and locks the wallet into the broken
// path on every retry).
// — Non-empty → swallow (tracker is buggy / has a custom
// error / a `require` string). Preserves the
// "tracker cannot brick transfers" invariant
// for tracker-side bugs that aren't gas-related.
try ISTRCDividendTracker(tracker).syncTwo{gas: TRACKER_SYNC_GAS}(
from, balanceOf[from],
to, balanceOf[to]
) {} catch (bytes memory reason) {
if (reason.length == 0) revert TrackerOutOfGas();
// else: tracker reverted with a reason — defensive swallow.
}
}
}
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun"
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.