Skip to main content
AuctionYield pays USDG to auction buyers who keep their won STK staked, for a fixed term. After every auction bid has exited, the post-auction script writes a merkle root of (buyer, won amount) and locks it here once. A buyer proves their leaf and stakes STK up to that amount. Every harvest from ProtocolSupply calls notifyReward, and stakers share it pro rata. Unstaking stops future yield. After termEnd, new stakes and new rewards revert; unstake and claim stay open forever. AuctionYield lets you:
  • Stake won STK against a merkle proof, up to the won amount
  • Earn a pro rata share of every harvest while staked
  • Claim pending USDG, or unstake and claim in one call
  • Read the root, the term end, and what an account is owed
This contract is not deployed on a listed network yet. Watch Addresses. The source code is src/token/AuctionYield.sol on GitHub. The ABI is /abis/AuctionYield.json.

Write methods

setRoot

Locks the buyer merkle root. Only the root setter (the deployer) can call it, once. Reverts with RootAlreadySet on a second call and InvalidRoot for zero.
One shot. The root cannot change after this.
Input parameters

stake

Verifies (msg.sender, wonAmount_) against the root, then pulls amount STK and adds it to the stake. Total staked per account cannot exceed the won amount. Harvests pending yield first. Reverts with TermEnded after termEnd, RootNotSet before the root, InvalidProof, WonAmountMismatch if a later call passes a different won amount, and StakeCapExceeded above the cap.
The caller must approve AuctionYield for amount. Rewards distributed while nobody was staked go to the first staker after that gap.
Input parameters

unstake

Harvests pending yield, then returns amount STK to the caller. Reverts with InsufficientStake above the staked balance and ZeroAmount for 0.
Unstaked STK earns nothing. Restaking is allowed until termEnd, up to the won amount.
Input parameters

notifyReward

Pulls amount USDG from the caller and distributes it across current stakers. If nobody is staked, the amount is held as pending for the next staker. Reverts with TermEnded after termEnd. Permissionless, but in practice only ProtocolSupply.harvest calls it. Input parameters

claim

Transfers all pending USDG to the caller. Does nothing if nothing is owed.

Read methods

pending

Returns the USDG account could claim right now. Input parameters Return values

Events

RootSet

Fires once when the merkle root is locked.

Staked

Fires when an account stakes STK, with the won amount proven.

Unstaked

Fires when an account withdraws STK.

Distributed

Fires on every notifyReward.

Claimed

Fires when USDG is paid out, by claim or by the harvest inside stake and unstake.

Errors

ZeroAddress

A constructor address was zero.

ZeroAmount

An amount was zero.

InvalidTerm

termEnd was not in the future at deployment.

NotRootSetter

Only the root setter can call setRoot.

RootAlreadySet

setRoot was called twice.

RootNotSet

stake was called before the root was locked.

InvalidRoot

setRoot got a zero root.

TermEnded

stake or notifyReward was called after termEnd.

InvalidProof

The merkle proof does not match the root.

WonAmountMismatch

The won amount differs from the one recorded on the first stake.

StakeCapExceeded

The stake would exceed the won amount.

InsufficientStake

The unstake amount exceeds the staked balance.