Last updated
Dutch auction contract
This page outlines the Dutch Auction Contract, designed for conducting Dutch auctions on a blockchain platform. It details the contract's functionality, structure, and application.
Features
- Auction Management: Set up and manage dutch auctions with start and end dates, starting and reserve prices.
- Initial High Price: Begins with a high asking price, set above the expected market value.
- Price Reduction: Gradual reduction of the price over a predetermined period.
- First Bid Wins: The auction concludes with the first bid at the current price.
- Auction Finalization: Details the process for ending the auction and awarding the item to the bidder.
Technical specifications
The following sections provide reference information for writing a smart contract to conduct a dutch auction using Marmalade on the Kadena network.
Capabilities
You can define the following capabilities to manage permissions in conventional auctions:
GOVERNANCE
: Defines governance for the contract and is controlled by the keyset defined under theADMIN-KS
constant.AUCTION_CREATED
: Specifies the event emitted after the auction is created by the seller.PRICE_ACCEPTED
: Specifies the event emitted after the buyer successfully executes themarmalade.buy
function in a sales contract.DUMMY
: Acts as a placeholder capability for thebuyer-guard
field.
Schemas
auctions-schema
: Describes auction information includingtoken-id
,start-date
,end-date
,start-price
,reserve-price
,sell-price
,price-interval-seconds
,buyer
, andbuyer-guard
.
Tables
auctions
: Stores auction information.
Functions
enforce-quote-update
: Enforces a quote update when required for sale contracts. This function is called by thepolicy-manager.enforce-buy
function to validate that the buyer has transferred the fungible amount equal tocurrent-price
set by the dutch auction. The function updates theauctions
table with the winner information.enforce-withdrawal
: Enforces a withdrawal when required for sale contracts. This function is called by thepolicy-manager.enforce-withdraw
function to validate that the auction has expired, or that the bid has already been placed.validate-auction
: Validates that the auction information adheres to contract logic in thecreate-auction
andupdate-auction
functions.create-auction
: Allows sellers to create the dutch auction for their token after providing auction information.update-auction
: Allows sellers to update auction information before the auction start time.retrieve-auction
: Retrieves auction information from theauctions
table.get-current-price
: Calculates the current auction price by starting with thestart-price
and gradually reducing the price perprice-interval-seconds
, always ending with the last time interval at thereserve-price
.
Constants
-
ADMIN-KS
: Sets themarmalade-sale.marmalade-contract-admin
for theGOVERNANCE
capability. -
DUMMY_GUARD
: Acts as a placeholder guard constant for thebuyer-guard
field.