Verified contractExactMIT
CIRC
Address0x861ec61df696f2ca07c266471340df8fea0deec9
- Balance
0 ETH
- Transactions
29
- Compiler
solc 0.8.26
- Same code
Only this contract
Details
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- Via IR
- yes
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,200,690
- Creation transaction
- 0xd34a9ef9f4…3b71fb902a
100 files
The source code is large: one file is shown at a time. Choose a file in the list.
- contracts/CIRC.solmain8.18 KB
- contracts/CIRCHook.sol9.48 KB
- contracts/Create2Factory.sol846 B
- lib/openzeppelin-contracts/contracts/access/Ownable.sol3.1 KB
- lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol6.54 KB
- lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol10.8 KB
- lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol2.78 KB
- lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol684 B
- lib/openzeppelin-contracts/contracts/utils/Context.sol963 B
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/Base.sol1.79 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/StdAssertions.sol23.36 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/StdChains.sol12.8 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/StdCheats.sol31.49 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/StdError.sol1.01 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/StdInvariant.sol3.98 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/StdJson.sol9.7 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/StdMath.sol1.36 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/StdStorage.sol17.84 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/StdStyle.sol10.46 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/StdToml.sol9.7 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/StdUtils.sol10.66 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/Test.sol1.05 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/Vm.sol108.08 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/console.sol69.27 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/console2.sol117 B
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/interfaces/IERC165.sol537 B
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/interfaces/IERC20.sol2.07 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/interfaces/IERC721.sol9.03 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/interfaces/IMulticall3.sol2.19 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/mocks/MockERC20.sol8.32 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/mocks/MockERC721.sol7.9 KB
- lib/v4-periphery/lib/v4-core/lib/forge-std/src/safeconsole.sol427.54 KB
- lib/v4-periphery/lib/v4-core/lib/solmate/src/auth/Owned.sol1.48 KB
- lib/v4-periphery/lib/v4-core/lib/solmate/src/test/utils/mocks/MockERC20.sol487 B
- lib/v4-periphery/lib/v4-core/lib/solmate/src/tokens/ERC20.sol6.81 KB
- lib/v4-periphery/lib/v4-core/src/ERC6909.sol3.5 KB
- lib/v4-periphery/lib/v4-core/src/ERC6909Claims.sol958 B
- lib/v4-periphery/lib/v4-core/src/Extsload.sol2.61 KB
- lib/v4-periphery/lib/v4-core/src/Exttload.sol1.6 KB
- lib/v4-periphery/lib/v4-core/src/NoDelegateCall.sol1.25 KB
- lib/v4-periphery/lib/v4-core/src/PoolManager.sol17.62 KB
- lib/v4-periphery/lib/v4-core/src/ProtocolFees.sol3.04 KB
- lib/v4-periphery/lib/v4-core/src/interfaces/IExtsload.sol1.02 KB
- lib/v4-periphery/lib/v4-core/src/interfaces/IExttload.sol699 B
- lib/v4-periphery/lib/v4-core/src/interfaces/IHooks.sol8.3 KB
- lib/v4-periphery/lib/v4-core/src/interfaces/IPoolManager.sol13.06 KB
- lib/v4-periphery/lib/v4-core/src/interfaces/IProtocolFees.sol2.49 KB
- lib/v4-periphery/lib/v4-core/src/interfaces/callback/IUnlockCallback.sol488 B
- lib/v4-periphery/lib/v4-core/src/interfaces/external/IERC20Minimal.sol3.04 KB
- lib/v4-periphery/lib/v4-core/src/interfaces/external/IERC6909Claims.sol3.16 KB
- lib/v4-periphery/lib/v4-core/src/libraries/BitMath.sol2.61 KB
- lib/v4-periphery/lib/v4-core/src/libraries/CurrencyDelta.sol1.61 KB
- lib/v4-periphery/lib/v4-core/src/libraries/CurrencyReserves.sol1.29 KB
- lib/v4-periphery/lib/v4-core/src/libraries/CustomRevert.sol5.17 KB
- lib/v4-periphery/lib/v4-core/src/libraries/FixedPoint128.sol297 B
- lib/v4-periphery/lib/v4-core/src/libraries/FixedPoint96.sol366 B
- lib/v4-periphery/lib/v4-core/src/libraries/FullMath.sol5.46 KB
- lib/v4-periphery/lib/v4-core/src/libraries/Hooks.sol16.49 KB
- lib/v4-periphery/lib/v4-core/src/libraries/LPFeeLibrary.sol3.6 KB
- lib/v4-periphery/lib/v4-core/src/libraries/LiquidityMath.sol742 B
- lib/v4-periphery/lib/v4-core/src/libraries/Lock.sol930 B
- lib/v4-periphery/lib/v4-core/src/libraries/NonzeroDeltaCount.sol1.46 KB
- lib/v4-periphery/lib/v4-core/src/libraries/ParseBytes.sol1.2 KB
- lib/v4-periphery/lib/v4-core/src/libraries/Pool.sol29.73 KB
- lib/v4-periphery/lib/v4-core/src/libraries/Position.sol4.81 KB
- lib/v4-periphery/lib/v4-core/src/libraries/ProtocolFeeLibrary.sol2.11 KB
- lib/v4-periphery/lib/v4-core/src/libraries/SafeCast.sol2.27 KB
- lib/v4-periphery/lib/v4-core/src/libraries/SqrtPriceMath.sol14.08 KB
- lib/v4-periphery/lib/v4-core/src/libraries/StateLibrary.sol15.73 KB
- lib/v4-periphery/lib/v4-core/src/libraries/SwapMath.sol6.97 KB
- lib/v4-periphery/lib/v4-core/src/libraries/TickBitmap.sol6.27 KB
- lib/v4-periphery/lib/v4-core/src/libraries/TickMath.sol12.38 KB
- lib/v4-periphery/lib/v4-core/src/libraries/TransientStateLibrary.sol2.36 KB
- lib/v4-periphery/lib/v4-core/src/libraries/UnsafeMath.sol1.17 KB
- lib/v4-periphery/lib/v4-core/src/test/ActionsRouter.sol6.61 KB
- lib/v4-periphery/lib/v4-core/src/test/PoolClaimsTest.sol1.87 KB
- lib/v4-periphery/lib/v4-core/src/test/PoolDonateTest.sol2.85 KB
- lib/v4-periphery/lib/v4-core/src/test/PoolModifyLiquidityTest.sol3.77 KB
- lib/v4-periphery/lib/v4-core/src/test/PoolModifyLiquidityTestNoChecks.sol2.76 KB
- lib/v4-periphery/lib/v4-core/src/test/PoolNestedActionsTest.sol11.02 KB
- lib/v4-periphery/lib/v4-core/src/test/PoolSwapTest.sol4.98 KB
- lib/v4-periphery/lib/v4-core/src/test/PoolTakeTest.sol2.27 KB
- lib/v4-periphery/lib/v4-core/src/test/PoolTestBase.sol1.02 KB
- lib/v4-periphery/lib/v4-core/src/test/SwapRouterNoChecks.sol1.79 KB
- lib/v4-periphery/lib/v4-core/src/types/BalanceDelta.sol2.34 KB
- lib/v4-periphery/lib/v4-core/src/types/BeforeSwapDelta.sol1.47 KB
- lib/v4-periphery/lib/v4-core/src/types/Currency.sol5.46 KB
- lib/v4-periphery/lib/v4-core/src/types/PoolId.sol539 B
- lib/v4-periphery/lib/v4-core/src/types/PoolKey.sol805 B
- lib/v4-periphery/lib/v4-core/src/types/Slot0.sol3.4 KB
- lib/v4-periphery/lib/v4-core/test/utils/Constants.sol1.72 KB
- lib/v4-periphery/lib/v4-core/test/utils/CurrencySettler.sol2.41 KB
- lib/v4-periphery/lib/v4-core/test/utils/Deployers.sol11.85 KB
- lib/v4-periphery/lib/v4-core/test/utils/LiquidityAmounts.sol6.74 KB
- lib/v4-periphery/lib/v4-core/test/utils/SortTokens.sol655 B
- lib/v4-periphery/src/base/ImmutableState.sol818 B
- lib/v4-periphery/src/interfaces/IImmutableState.sol365 B
- lib/v4-periphery/src/utils/BaseHook.sol7.18 KB
- lib/v4-periphery/src/utils/HookMiner.sol3.18 KB
- test/CIRC.t.sol16.74 KB
contracts/CIRC.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title CIRC
* @notice Recirculate ($CIRC) — 1,000,000,000 (1B) fixed-supply ERC-20 with a built-in,
* pull-based reward accumulator (MasterChef-style "accTokensPerShare").
*
* ─────────────────────────────────────────────────────────────────────────────────────────
* REWARD MECHANISM (how holders earn $CIRC just by holding — value "recirculates" to them)
* ─────────────────────────────────────────────────────────────────────────────────────────
*
* The CIRCHook is the only "circulator" (set once via setCirculator). On every BUY of $CIRC,
* the hook mints a reward — 6% of the tokens the buyer received — and calls injectFlow(amount).
* Those freshly minted tokens are distributed pro-rata to every holder still *in circulation*
* (i.e. not stagnant). Holding $CIRC therefore recirculates a share of all buy pressure back
* to you. Sells are not rewarded.
*
* The accumulator (no loops, O(1) per holder):
*
* • accTokensPerShare — a running total of "reward tokens earned per 1 token held", scaled
* by 1e18. injectFlow(amount) mints `amount` into THIS contract (a holding vault) and bumps:
* accTokensPerShare += amount * 1e18 / eligibleSupply
* where eligibleSupply = totalSupply - excludedSupply (the stagnant balances).
*
* • rewardDebt[user] — the portion of accTokensPerShare a user has *already* accounted for.
* Set to (balance * accTokensPerShare / 1e18) whenever their balance changes. It is the
* "high-water mark" so a holder only earns on accumulator growth that happened while they
* held their tokens — not retroactively.
*
* • pendingFlow(user) = balance * accTokensPerShare / 1e18 - rewardDebt[user]
* i.e. everything accrued since their debt was last set. recirculate() pays it out from the
* vault and resets the debt to zero-out pending.
*
* Auto-settle: _update() (every mint/burn/transfer) calls _settle() on both parties BEFORE
* moving tokens, paying out any pending reward and then resetting rewardDebt to the new
* balance. This keeps the debt math exact across transfers — you never need to recirculate()
* "before" moving tokens; receiving or sending $CIRC settles you automatically. (Consequence:
* a buyer's own reward is auto-settled when they receive their swap output, so standing
* pendingFlow only accrues to holders who are passive during a *later* buy.)
*
* Stagnant addresses (the hook, this contract, 0xdead, PoolManager, PositionManager, LP) are
* excluded from rewards: they don't earn and their balances are removed from eligibleSupply
* via excludedSupply, so rewards aren't wasted on the pool/system. If eligibleSupply is ever
* zero at the moment of a buy (e.g. 100% of supply still in the LP, no holders yet), that
* buy's reward is minted to 0xdead instead of being distributed.
* ─────────────────────────────────────────────────────────────────────────────────────────
*/
contract CIRC is ERC20, Ownable {
uint256 public accTokensPerShare;
mapping(address => uint256) public rewardDebt;
mapping(address => uint256) public totalClaimed;
mapping(address => bool) public isStagnant;
uint256 public excludedSupply;
address public circulator;
event FlowInjected(uint256 amount, uint256 newAccPerShare);
event Recirculated(address indexed user, uint256 amount);
event CirculatorSet(address indexed circulator);
event StagnantSet(address indexed account, bool stagnant);
error NotCirculator();
error NothingToRecirculate();
error CirculatorAlreadySet();
constructor(address initialHolder_) ERC20("Recirculate", "CIRC") Ownable(msg.sender) {
_mint(initialHolder_, 1_000_000_000 ether);
}
function setCirculator(address circulator_) external onlyOwner {
if (circulator != address(0)) revert CirculatorAlreadySet();
circulator = circulator_;
_setStagnant(circulator_, true);
_setStagnant(address(this), true);
emit CirculatorSet(circulator_);
}
function setStagnant(address account, bool stagnant) external onlyOwner {
_setStagnant(account, stagnant);
}
function _setStagnant(address account, bool stagnant) internal {
if (isStagnant[account] == stagnant) return;
_settle(account);
isStagnant[account] = stagnant;
uint256 bal = balanceOf(account);
if (stagnant) {
excludedSupply += bal;
} else {
excludedSupply -= bal;
rewardDebt[account] = (bal * accTokensPerShare) / 1e18;
}
emit StagnantSet(account, stagnant);
}
/// @notice Circulator mints reward tokens into this contract and bumps the accumulator.
function injectFlow(uint256 amount) external {
if (msg.sender != circulator) revert NotCirculator();
if (amount == 0) return;
uint256 eligibleSupply = totalSupply() - excludedSupply;
if (eligibleSupply == 0) {
_mint(address(0xdead), amount);
return;
}
_mint(address(this), amount);
accTokensPerShare += (amount * 1e18) / eligibleSupply;
emit FlowInjected(amount, accTokensPerShare);
}
/// @notice Print flow — uncapped, circulator-only. Goes straight to recipient (no accumulator).
function printFlow(address recipient, uint256 amount) external {
if (msg.sender != circulator) revert NotCirculator();
if (amount == 0) return;
_mint(recipient, amount);
}
function recirculate() external returns (uint256 recirculated) {
recirculated = pendingFlow(msg.sender);
if (recirculated == 0) revert NothingToRecirculate();
rewardDebt[msg.sender] = (balanceOf(msg.sender) * accTokensPerShare) / 1e18;
totalClaimed[msg.sender] += recirculated;
_transfer(address(this), msg.sender, recirculated);
emit Recirculated(msg.sender, recirculated);
}
function pendingFlow(address user) public view returns (uint256) {
if (isStagnant[user]) return 0;
uint256 bal = balanceOf(user);
uint256 accrued = (bal * accTokensPerShare) / 1e18;
if (accrued <= rewardDebt[user]) return 0;
return accrued - rewardDebt[user];
}
function _update(address from, address to, uint256 value) internal override {
if (from != address(0)) _settle(from);
if (to != address(0)) _settle(to);
super._update(from, to, value);
if (from != address(0) && isStagnant[from]) excludedSupply -= value;
if (to != address(0) && isStagnant[to]) excludedSupply += value;
if (from != address(0) && !isStagnant[from]) {
rewardDebt[from] = (balanceOf(from) * accTokensPerShare) / 1e18;
}
if (to != address(0) && !isStagnant[to]) {
rewardDebt[to] = (balanceOf(to) * accTokensPerShare) / 1e18;
}
}
function _settle(address account) internal {
if (isStagnant[account]) return;
uint256 bal = balanceOf(account);
if (bal == 0) return;
uint256 accrued = (bal * accTokensPerShare) / 1e18;
uint256 debt = rewardDebt[account];
if (accrued <= debt) return;
uint256 owed = accrued - debt;
rewardDebt[account] = accrued;
totalClaimed[account] += owed;
_transfer(address(this), account, owed);
emit Recirculated(account, owed);
}
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@uniswap/v4-core/=lib/v4-periphery/lib/v4-core/",
"v4-core/=lib/v4-periphery/lib/v4-core/",
"v4-periphery/=lib/v4-periphery/",
"permit2/=lib/v4-periphery/lib/permit2/",
"solmate/=lib/v4-periphery/lib/v4-core/lib/solmate/",
"forge-std/=lib/v4-periphery/lib/v4-core/lib/forge-std/src/",
"ds-test/=lib/v4-periphery/lib/v4-core/lib/forge-std/lib/ds-test/src/",
"@ensdomains/=lib/v4-core/node_modules/@ensdomains/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-gas-snapshot/=lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"hardhat/=lib/v4-core/node_modules/hardhat/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.