LogoLogo
Summer.fiContact us
  • Summer.fi
    • Overview
    • Basic Concepts
    • Audits
  • Lazy Summer Protocol
    • Lazy Summer Protocol
      • ARKs
        • Buffer ARK
        • RAFT
          • Dutch Auctions
      • Fees
      • Contracts Addresses
    • Rebalancer
    • Governance
      • Cross-Chain Governance
      • Rewards
      • Tip Streams
      • $SUMR Token
        • Delegation
        • Voting Power Decay
  • Summer.fi pro
    • General
      • Smart Contracts and Documentation
      • Costs and Fees
      • Address Compliance Check
      • Security
      • Referrals Program
        • FAQ
        • How to refer a friend
    • Products
      • Borrow
        • Frequently Asked Questions
      • Multiply
        • The difference between Borrow and Multiply Vaults
        • Frequently Asked Questions
      • Swap and Bridge
      • Earn
        • Aave v2 stETH
        • Aave v3 stETH
        • Dai Savings Rate (DSR)
          • sDAI
          • What is sDAI Conversion?
      • $RAYS
        • FAQ
    • Automation
      • Stop-Loss
        • How to setup your Stop-Loss
        • Trailing Stop-Loss
      • Auto-Buy
      • Auto-Sell
      • Take Profit
        • Auto Take Profit
          • How to setup Auto Take Profit
  • LEGAL
    • UK Disclaimer
    • Risks of using our products
  • Get in touch
    • Contact Us
Powered by GitBook
LogoLogo

Products

  • Borrow
  • Multiply
  • Earn

About

  • Team
  • Security
  • Terms
  • Privacy

Resources

  • Blog
  • Bug Bounty
  • Brand Assets

Oazo Apps 2023

On this page
  • Core Auction Functions
  • Auction Creation:
  • Price Calculation:
  • Token Purchase:
  • Integration with RAFT
  • The RAFT contract handles auction automation:
  • Price Decay Functions
  • Two decay functions are available:

Was this helpful?

Export as PDF
  1. Lazy Summer Protocol
  2. Lazy Summer Protocol
  3. ARKs
  4. RAFT

Dutch Auctions

Dutch auctions in the Lazy Summer Protocol facilitate efficient reward token sales. When ARKs harvest rewards, RAFT automatically auctions these tokens using a Dutch auction mechanism where prices decline over time until meeting a buyer or reaching the end price.

The auction process is fully automated:

  1. ARK harvests rewards

  2. RAFT initiates auction

  3. Price declines according to chosen curve

  4. Tokens are purchased or auction concludes

  5. Proceeds are converted to vault tokens to enhance yields

Here's how a typical auction flow looks in code:

// Example auction creation by RAFT
function _startAuction(address ark, address rewardToken) internal {
    uint256 totalTokens = obtainedTokens[ark][rewardToken] + 
                         unsoldTokens[ark][rewardToken];
                         
    DutchAuctionLibrary.Auction memory newAuction = _createAuctionWithParams(
        IERC20(rewardToken),
        IERC20(IArk(ark).asset()),
        totalTokens,
        address(this),
        arkAuctionParameters[ark][rewardToken]
    );
}

Core Auction Functions

Auction Creation:

function createAuction(
    IERC20 _auctionToken,
    IERC20 _paymentToken,
    uint256 _duration,
    uint256 _startPrice,
    uint256 _endPrice,
    uint256 _totalTokens,
    Percentage _kickerRewardPercentage,
    address _unsoldTokensRecipient,
    DecayFunctions.DecayType _decayType
) external returns (uint256 auctionId)

Price Calculation:

function getCurrentPrice(uint256 _auctionId) public view returns (uint256) {
    return DutchAuctionLibrary.getCurrentPrice(auctions[_auctionId]);
}

Token Purchase:

function buyTokens(
    address ark,
    address rewardToken,
    uint256 amount
) external returns (uint256 paymentAmount) {
    DutchAuctionLibrary.Auction storage auction = auctions[ark][rewardToken];
    paymentAmount = auction.buyTokens(amount);
    
    // Board payment tokens for yield generation
    paymentTokensToBoard[ark][rewardToken] += paymentAmount;
}

Integration with RAFT

The RAFT contract handles auction automation:

function harvestAndStartAuction(
    address ark,
    bytes calldata rewardData
) external {
    (address[] memory harvestedTokens, ) = _harvest(ark, rewardData);
    
    for (uint256 i = 0; i < harvestedTokens.length; i++) {
        _startAuction(ark, harvestedTokens[i]);
    }
}

Price Decay Functions

Two decay functions are available:

// Linear decay
function linearDecay(
    uint256 initialValue,
    uint256 decayRatePerSecond,
    uint256 decayTimeInSeconds
) internal pure returns (uint256)

// Exponential decay  
function exponentialDecay(
    uint256 initialValue,
    uint256 decayRatePerSecond,
    uint256 decayTimeInSeconds
) internal pure returns (uint256)

The chosen decay function determines how price decreases over the auction duration.

PreviousRAFTNextFees

Last updated 4 months ago

Was this helpful?