Interest Protocol
  • 👋Welcome to Interest Protocol
  • Overview
    • Sui💧
      • Contracts
        • Memez
        • Libs 📚
      • Suicoins
        • Swap
        • Dollar-Cost Averaging (DCA)
        • Airdrop
          • Suiplay Airdrop
        • Incinerator
        • Send
        • Merger
        • Suicoins Terminal
      • Memez.gg
        • Coins on Memez.GG
        • Memez.Fun
          • SDK
            • Pump API
            • Interfaces
          • Configuration
          • Migrators
          • Bonding Curve
          • Fees
      • IPX Coin Standard
    • Movement
      • Interest Protocol Decentralized Exchange (DEX)
        • Key Features
        • Core Innovations
      • sr-AMM
      • Token
        • Tokenomics
        • Utility
      • GTM
    • Audits
    • Security
    • Deprecated
      • Coin X Oracle 🔮
        • Pyth Network
        • Switchboard
      • Sui Tears 💧
        • Airdrop
          • Airdrop
          • Airdrop Utils
          • Linear Vesting Airdrop
        • Capabilities
          • Access Control
          • Owner
          • Quest
          • Timelock
        • Collections
          • Bitmap
          • Coin Decimals
        • DeFi
          • Oracle
          • Farm
          • Fund
          • Linear Vesting Wallet
          • Linear Clawback Vesting Wallet
          • Vesting
        • Governance
          • DAO
          • DAO Admin
          • DAO Treasury
        • Utils
          • ASCII
          • Comparator
          • Merkle Proof
          • Vectors
        • Math
          • Fixed Point 64
          • Fixed Point Roll
          • Fixed Point Wad
          • Int
          • Math64
          • Math128
          • Math256
      • CLAMM🐚
        • Hooks
      • Whitepapers
  • Glossary
Powered by GitBook
On this page
  • Structs
  • DaoTreasury
  • DaoTreasury
  • Interface
  • dao
  • balance
  • donate
  • transfer
  • transfer_linear_vesting_wallet
  • flash_loan
  • fee
  • amount
  • repay_flash_loan

Was this helpful?

Export as PDF
  1. Overview
  2. Deprecated
  3. Sui Tears 💧
  4. Governance

DAO Treasury

A Treasury for DAOs. It can receive and send sui::coin::Coin.

Structs

DaoTreasury

struct DaoTreasury<phantom DaoWitness: drop> has key, store {
    id: UID,
    coins: Bag,
    dao: ID,
}
  • coins - Stores the treasury coins

  • dao- The sui::object::ID of the DAO.

DaoTreasury

struct FlashLoan<phantom DaoWitness, phantom CoinType> {
    amount: u64,
    fee: u64,
    type: TypeName
}
  • amounts: The amount being borrowed

  • fee- The fee amount to be repaid.

  • type: The std::type_name::TypeName of the CoinType to repay the loan.

Interface

dao

Returns the sui::object::ID of the Dao that owns the treasury.

public fun dao<DaoWitness: drop>(treasury: &DaoTreasury<DaoWitness>): ID 
  • @param treasury: A DaoTreasury.

  • @return ID

balance

Returns the amount of Coin in the treasury.

public fun balance<DaoWitness: drop, CoinType>(treasury: &DaoTreasury<DaoWitness>): u64
  • @param treasury: A DaoTreasury.

  • @return u64

donate

Adds token to the treasury.

public fun donate<DaoWitness: drop, CoinType>(treasury: &mut DaoTreasury<DaoWitness>, token: Coin<CoinType>, ctx: &mut TxContext)
  • @param treasury A DaoTreasury.

  • @param token It will be donated to the treasury.

transfer

Withdraws a coin from the treasury.

public fun transfer<DaoWitness: drop, CoinType, TransferCoin>(
    treasury: &mut DaoTreasury<DaoWitness>,
    _: &DaoAdmin<DaoWitness>,
    value: u64,
    ctx: &mut TxContext
): Coin<CoinType>
  • @param treasury: A DaoTreasury.

  • @param _ : Immutable reference to the DaoAdmin.

  • @param value : The amount to withdraw.

  • @return Coin

transfer_linear_vesting_wallet

Withdraws a LinearWallet from the treasury.

public fun transfer_linear_vesting_wallet<DaoWitness: drop, CoinType, TransferCoin>(
    treasury: &mut DaoTreasury<DaoWitness>,
    _: &DaoAdmin<DaoWitness>,
    c: &Clock,
    value: u64,
    start: u64,
    duration: u64,
    ctx: &mut TxContext    
): LinearWallet<CoinType>
  • @param treasury: A DaoTreasury.

  • @param _ : Immutable reference to the DaoAdmin.

  • @param c: The sui::clock::Clock

  • @param value : The amount to withdraw.

  • @param start : The amount to withdraw.

  • @param duration : The duration of the vesting schedule.

  • @return LinearWallet.

flash_loan

Requests a Flash Loan from the treasury.

public fun flash_loan<DaoWitness: drop, CoinType>(
    treasury: &mut DaoTreasury<DaoWitness>, 
    value: u64, 
    ctx: &mut TxContext
): (Coin<CoinType>, FlashLoan<DaoWitness, CoinType>)
  • @param treasury: A DaoTreasury.

  • @param value : The amount of the loan.

  • @return Coin<CoinType>. The coin that is being borrowed.

  • @return FlashLoan<DaoWitness, CoinType>. Hot potato to ensure that the coin is returned within the same transaction block.

fee

Returns the service fee amount that must be paid.

public fun fee<DaoWitness: drop, CoinType>(flash_loan: &FlashLoan<DaoWitness, CoinType>): u64
  • @param flash_loan: A FlashLoan hot potato.

  • @return u64.

amount

Returns the amount of the loan without the fees.

public fun amount<DaoWitness: drop, CoinType>(flash_loan: &FlashLoan<DaoWitness, CoinType>): u64
  • @param flash_loan: A FlashLoan hot potato.

  • @return u64.

repay_flash_loan

Repays the flash_loan to the treasury.

public fun repay_flash_loan<DaoWitness: drop, CoinType>(
    treasury: &mut DaoTreasury<DaoWitness>, 
    flash_loan: FlashLoan<DaoWitness, CoinType>,
    token: Coin<CoinType>
)
  • @param treasury: A DaoTreasury.

  • @param flash_loan: A FlashLoan hot potato.

  • @param token: The borrowed coin + fee.

Aborts

  • token.value is smaller than the initial loan amount + fee amount.

PreviousDAO AdminNextUtils

Last updated 1 year ago

Was this helpful?