Contracts
This catalog covers every non-test protocol contract under contracts/ and the launch-only pair seeder under script/. Deployment addresses are in Networks and addresses.
BrilaDAT
contracts/BrilaDAT.sol
Deployed behind proxy
Rebasing DAT token
BrilaDATRebaser
contracts/BrilaDATRebaser.sol
Deployed
TWAP/oracle rebase policy
BrilaDATIncentivizer
contracts/rewards/BrilaDATIncentivizer.sol
Deployed
DAT/WHYPE LP farm
BrilaDATDistributionPool
contracts/rewards/BrilaDATDistributionPool.sol
Not deployed
Generic pre-funded reward pool
LPTokenWrapper
contracts/rewards/LPTokenWrapper.sol
Inherited, not standalone
Shared staking accounting
HyperCoreOracleAdapter
contracts/oracles/HyperCoreOracleAdapter.sol
Two instances deployed
HyperCore price to IPriceOracle
BrilaDATZap
contracts/zaps/BrilaDATZap.sol
Deployed
Single-asset DAT/WHYPE LP entry
UniswapV2OracleLibrary
contracts/libraries/UniswapV2OracleLibrary.sol
Embedded in rebaser bytecode
Cumulative-price helper
BrilaDATPairSeeder
script/CreateAndSeedBrilaDATPair.s.sol
Deployed launch helper
Create and seed the initial pair
BrilaDAT — DAT token
UUPS-upgradeable rebasing ERC-20. It uses Ownable2StepUpgradeable and is deployed behind an ERC-1967 proxy.
balanceOf(account)
View
Display balance in 18-decimal fragments; changes with the scaling factor.
balanceOfInternal(account)
View
Stored, rebase-invariant balance in 1e24 internal units.
initSupply()
View
Sum of internal units; increases when DAT is minted.
totalSupply()
View
initSupply × brilaDatScalingFactor / 1e24.
brilaDatScalingFactor()
View
Global multiplier; starts at 1e18.
maxScalingFactor()
View
Overflow bound derived from current initSupply.
transfer / transferFrom / approve
Public
Standard ERC-20 behavior, denominated in fragments.
increaseAllowance / decreaseAllowance
Public
Allowance helpers.
mint(to, amount)
Rebaser or incentivizer
Mints fragments and increases initSupply.
rebase(epoch, indexDelta, positive)
Rebaser
Changes the scaling factor within its bounds.
setRebaser(address)
Owner
Sets a nonzero rebaser.
setIncentivizer(address)
Owner
Sets or clears the incentivizer.
upgradeToAndCall(implementation, data)
Owner
UUPS upgrade; no protocol timelock.
Because minting increases initSupply, balanceOfInternal(account) / initSupply is the useful ownership fraction and can be diluted by later mints.
BrilaDATRebaser — rebase policy
Ownable2Step policy contract with immutable DAT, reserve token, DAT/WHYPE pair, token ordering, and peg mode. Mainnet uses USD mode: pool TWAP in WHYPE per DAT multiplied by WHYPE/USD.
Reads
getCurrentTWAP()
Reserve-token units per DAT. Returns zero when no time has elapsed since the stored sample.
getReserveUsdPrice()
Reads and validates the primary reserve/USD feed.
getCurrentExchangeRate()
TWAP × primary reserve/USD price in USD mode. This view does not run the secondary-feed bracket used during a rebase.
computeOffPegPerc(rate)
Returns capped deviation and direction relative to targetRate.
inRebaseWindow()
Reports whether the current timestamp is inside the configured window.
Execution
init_twap()
Owner
Initializes the TWAP snapshot once.
activate_rebasing()
Anyone
Activates after the configured warmup; one-way.
commitRebase(hash)
Keeper
Commits keccak256(abi.encodePacked(keeper, salt, minReserveOut)) in-window.
revealAndRebase(salt, minReserveOut)
Keeper
Reveals 25–50 blocks later and executes if all checks pass.
cancelCommit()
Committer or owner
Cancels the current commitment.
cancelExpiredCommit()
Anyone
Clears an expired commitment.
forceRebase(minReserveOut)
Owner
Bypasses commit/reveal, but still requires timing and policy checks.
The caller supplies minReserveOut. Commit/reveal prevents changing that floor after commitment, but does not guarantee the keeper chose a strong floor.
Owner setters cover keepers, treasury, rebase parameters, timing, optional TWAP-leg oracle checks, and oracle age/deviation bounds. USD feed replacement uses proposeReserveUsdOracles → applyReserveUsdOracles after 24 hours. setTargetRate reverts in USD mode.
BrilaDATIncentivizer — live LP farm
Ownable staking pool for the DAT/WHYPE LP token. It inherits LPTokenWrapper.
stake(amount)
Public
Stakes LP; also starts the next halved reward period if the prior period ended.
withdraw(amount)
Public
Withdraws LP; does not trigger period rollover.
exit()
Public
Withdraws the full stake, then calls getReward(). A zero stake makes the withdrawal revert.
earned(account)
View
Pending reward in pre-scaling accounting units.
getReward()
Public
Pays earned × current scaling factor / 1e18; also triggers overdue rollover.
notifyRewardAmount(reward)
Reward distributor
Bootstraps or updates a reward period.
setRewardDistribution(address)
Owner
Sets the authorized notifier.
governanceRecoverUnsupported(token, amount, to)
Owner
Recovers tokens other than DAT and the staked LP token.
At rollover, initreward halves and the pool mints the scaling-adjusted DAT backing it needs. DAT must therefore keep this contract assigned as incentivizer; otherwise rollover transactions revert.
BrilaDATDistributionPool — generic reward pool
Source exists, but no mainnet deployment is recorded. Unlike the incentivizer, this contract never mints DAT: it must be pre-funded before notifyRewardAmount, which applies a rebase-aware solvency check.
It adds MIN_STAKED_BLOCKS: getReward() requires that many blocks after the account's latest stake, and every new stake resets the account's depositBlock. A direct withdraw() is not block-gated. exit() withdraws then claims, so the whole transaction reverts when the reward gate is not satisfied.
LPTokenWrapper — staking base
Abstract accounting and custody base inherited by both reward pools. It stores one immutable staking token, total staked supply, and per-account stake; stake transfers tokens in and withdraw transfers them out. It is not deployed independently.
HyperCoreOracleAdapter — native price adapter
Ownerless, immutable adapter exposing a HyperCore price precompile through IPriceOracle. latestRoundData() scales the raw value to 8 decimals and rejects zero, malformed, or out-of-band answers. It reports the current block timestamp because it reads current precompile state on every call. Mainnet uses separate perp and spot instances.
BrilaDATZap — single-asset LP entry
Ownerless, immutable, pair-direct helper accepting native HYPE, WHYPE, or DAT. It synchronizes the pair, swaps an optimal portion, adds liquidity, sends LP directly to the recipient, and returns dust.
zapInHYPE(minLpOut, deadline, to)
Wraps native HYPE, then enters the DAT/WHYPE pool.
zapIn(tokenIn, amountIn, minLpOut, deadline, to)
Accepts DAT or WHYPE after approval.
pair() / whype() / brilaDat()
Immutable address getters.
minLpOut = 0 disables the caller's LP-output protection.
UniswapV2OracleLibrary
Internal library used by the rebaser to read current cumulative Uniswap V2 prices, including the counterfactual update since the pair's last reserve timestamp. It has no standalone address.
BrilaDATPairSeeder — launch helper
Contract defined in the launch script. createAndSeed creates or resolves the DAT/WHYPE pair, wraps the supplied HYPE, transfers both assets to the pair, and mints LP to the chosen recipient. It is not part of ongoing protocol operation.
Interfaces
The production interfaces are IBrilaDAT, IBrilaDATRebaser, IBrilaDATIncentivizer, IBrilaDATDistributionPool, ILPTokenWrapper, IPriceOracle, IRewardDistributionRecipient, and IUniswapV2Pair, all under contracts/interfaces/.
Last updated
Was this helpful?