DAO Treasury
A Treasury for DAOs. It can receive and send sui::coin::Coin
.
Structs
DaoTreasury
coins - Stores the treasury coins
dao- The
sui::object::ID
of the DAO.
DaoTreasury
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
.
@param treasury: A DaoTreasury.
@return ID
balance
Returns the amount of Coin in the treasury
.
@param treasury: A DaoTreasury.
@return u64
donate
Adds token
to the treasury
.
@param treasury A DaoTreasury.
@param token It will be donated to the
treasury
.
transfer
Withdraws a coin from the treasury
.
@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
.
@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
.
@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.
@param flash_loan: A FlashLoan hot potato.
@return u64.
amount
Returns the amount of the loan without the fees.
@param flash_loan: A FlashLoan hot potato.
@return u64.
repay_flash_loan
Repays the flash_loan
to the treasury
.
@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.
Last updated