How it Works

Bench is made up of two kinds of smart contracts:

  • The Bench Registry: a single contract per network. It creates benches, keeps an on-chain directory of all of them, and holds platform-wide settings such as fees and asset eligibility rules.
  • Bench instances: one dedicated escrow contract per sale. It holds the tokens for sale, accepts payments, delivers tokens to buyers, and tracks proceeds and fees.

Lifecycle of a bench

1. Creation

The seller (the creator) submits a transaction group to the registry containing the setup fee and escrow seed in ALGO, and the tokens to sell. The registry deploys a fresh bench contract, opts it into the relevant assets, moves the tokens in and configures it: owner, price, amount, schedule and purchase limit. See Creating a Bench.

The new bench is recorded in the registry's directory so that the frontend and the SDK can discover it.

2. Sale

Buyers send the purchase asset (ALGO or the configured ASA) to the bench together with a buy call, and receive tokens at the fixed price within the same atomic transaction group. See Buying.

  • If a start time was set, purchases before it are rejected.
  • If no start time was set, the bench opens immediately, and the time of the first sale is recorded as its start time.
  • Each sale accrues the platform fee inside the bench, in the purchase asset.

The owner may withdraw proceeds at any point during the sale.

3. End

A bench ends when any of the following happens:

  • It sells out. As soon as the remaining amount is too small to be bought (see dust), the bench ends automatically.
  • Its end time (if one was set) passes.
  • The owner ends it manually.

Once ended, no further purchases are possible.

4. Close

After a bench has ended, the owner closes it. Closing pays out accrued platform fees, returns unsold tokens and all remaining proceeds to the owner, opts the contract out of the assets and refunds the ALGO escrow seed to the owner. The empty contract stays on-chain and is removed from the registry directory.

Roles at a glance

RoleWhoWhat
CreatorAny accountPays for the creation and supplies the tokens
Owner (beneficiary)Chosen by the creator, defaults to the creatorReceives proceeds, manages the bench and its metadata
BuyerAny accountBuys tokens
Fee adminMyth FinanceWithdraws platform fees, can lower a bench's fee, can perform management actions on behalf of the owner
Registry adminMyth FinancePlatform-wide settings

See Roles for the complete list of privileged actions.