1 of 7

Writing an Auction Smart Contract

Using PyTeal and Beaker

Footer sample to go here

May 4, 2022

2 of 7

English Auction

  • Start auction
    • Define asset being auctioned
    • Define amount being auctioned
    • Define starting price
    • Define end time

  • Bid
    • Place bid
    • Return previous bid

  • End
    • Give winner the asset
    • Giver auctioneer the highest bid

2

3 of 7

Algorand L1 Features

  • Fees
    • 0.001 ALGO per transaction
    • Only increases during congestion

  • Minimum Balance Requirement
    • Accounts must have at least 0.1 ALGO
    • Increases per app/asset created/opted in

  • Atomic Transactions
    • 16 transactions can be grouped together
    • Smart contract can read transactions in group
    • Can pool fees

3

4 of 7

Algorand Asset Features

  • Algorand Standard Asset (ASA)
    • Tokens are native, not smart contracts

  • Opt In
    • Allow ledger to track asset balance for given account
    • Increase MBR by 0.1 ALGO
    • Asset transfer fails if receiver is not opted in

4

5 of 7

Algorand Smart Contract Features

  • Contract Account
    • A account in the ledger associated with contract
    • Only contract logic can spend from account

  • Storage
    • Global storage: key/value pairs in contract

  • Resource Access
    • Must pre-defined touched assets, apps, and accounts

  • ABI: Application Binary Interface (ARC-0004)
    • Standard for method definition
    • Standard for type encoding/decoding

5

6 of 7

Auction Smart Contract

  • Start auction
    • Save parameters in global storage
    • Fund contract to meet MBR
    • Opt contract into asset
    • Send asset to contract in atomic transaction

  • Bid
    • Send bid in atomic transaction
    • Return previous bid with inner transaction

  • End
    • Attempt to transfer asset to winner with inner transaction
    • Send ALGO to auction creator with inner transaction

6

7 of 7

The Code

7