Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vault standard; SRC-6 #24

Merged
merged 79 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
fb9e76f
initial commit
SwayStar123 Sep 17, 2023
bdbc811
Update readme
SwayStar123 Sep 25, 2023
d99d57b
forc fmt
SwayStar123 Sep 25, 2023
90fef86
Improve wording
SwayStar123 Oct 3, 2023
eaae21d
req changes
SwayStar123 Oct 3, 2023
614a197
add space between fn docs
SwayStar123 Oct 3, 2023
2967abc
remove tab
SwayStar123 Oct 3, 2023
0a25bf9
remove preview functions
SwayStar123 Oct 10, 2023
ac2f913
init
SwayStar123 Oct 17, 2023
8d9f65e
specs
SwayStar123 Oct 17, 2023
ad9d835
specs
SwayStar123 Oct 17, 2023
f7a804c
add example
SwayStar123 Oct 26, 2023
5b07a7c
move file out of folder
SwayStar123 Oct 30, 2023
2b7ebf3
fix imports
SwayStar123 Oct 31, 2023
610bfca
fmt
SwayStar123 Oct 31, 2023
0573079
move impl block up
SwayStar123 Oct 31, 2023
56f2a44
Merge pull request #28 from FuelLabs/vault-standard-with-subvaults
SwayStar123 Oct 31, 2023
5458c9b
Merge branch 'master' into vault_standard
SwayStar123 Oct 31, 2023
e3ae07e
fmted moved ex
SwayStar123 Nov 2, 2023
9fb0e64
Merge branch 'vault_standard' of https://github.com/FuelLabs/sway-sta…
SwayStar123 Nov 2, 2023
a49f725
update banners
SwayStar123 Nov 30, 2023
e82ed1a
resolve some req changes
SwayStar123 Nov 30, 2023
c2821d6
address some of the req changes
SwayStar123 Dec 1, 2023
9a248c8
remove unnecessary funcs
SwayStar123 Dec 4, 2023
7d202c7
fmt
SwayStar123 Dec 4, 2023
789b449
add second example
SwayStar123 Dec 4, 2023
c015568
fmt
SwayStar123 Dec 4, 2023
505f119
use if instead of match
SwayStar123 Dec 4, 2023
0aa72b7
add third example
SwayStar123 Dec 4, 2023
80a651d
finishing touches
SwayStar123 Dec 5, 2023
b9733f1
Update examples/src_6/multi_token_vault/Forc.toml
SwayStar123 Dec 6, 2023
c3bcd22
Update examples/src_6/multi_token_vault/src/main.sw
SwayStar123 Dec 6, 2023
e069a72
Update examples/src_6/multi_token_vault/src/main.sw
SwayStar123 Dec 6, 2023
96780da
Update examples/src_6/single_token_single_sub_vault/Forc.toml
SwayStar123 Dec 6, 2023
e071263
Update examples/src_6/single_token_single_sub_vault/src/main.sw
SwayStar123 Dec 6, 2023
4d4e87b
Update examples/src_6/single_token_single_sub_vault/src/main.sw
SwayStar123 Dec 6, 2023
2ab2c86
Update examples/src_6/single_token_vault/Forc.toml
SwayStar123 Dec 6, 2023
4efbc42
Update examples/src_6/single_token_vault/src/main.sw
SwayStar123 Dec 6, 2023
f84708b
Update examples/src_6/single_token_vault/src/main.sw
SwayStar123 Dec 6, 2023
8a92553
Update standards/src_6/README.md
SwayStar123 Dec 6, 2023
6fc1d91
Update standards/src_6/README.md
SwayStar123 Dec 6, 2023
c03c459
Update examples/src_6/multi_token_vault/src/main.sw
SwayStar123 Dec 6, 2023
c49c545
Update examples/src_6/multi_token_vault/src/main.sw
SwayStar123 Dec 6, 2023
cbb1ad4
Update examples/src_6/multi_token_vault/src/main.sw
SwayStar123 Dec 6, 2023
ab37a33
Update examples/src_6/multi_token_vault/src/main.sw
SwayStar123 Dec 6, 2023
35310ca
Update examples/src_6/single_token_single_sub_vault/src/main.sw
SwayStar123 Dec 6, 2023
8289539
Add documentation and fix bug
SwayStar123 Dec 7, 2023
6cb7bd0
remove unnecessary into
SwayStar123 Dec 7, 2023
18361e5
unsafe reads fixed
SwayStar123 Dec 7, 2023
00062e2
remove doubling
SwayStar123 Dec 7, 2023
a012f66
forc fmt
SwayStar123 Dec 7, 2023
1602385
remove unncessary braces
SwayStar123 Dec 8, 2023
c71f8ba
fmt
SwayStar123 Dec 8, 2023
3c02c47
change logo
SwayStar123 Dec 12, 2023
88c4a78
modify a line to remove ambiguity
SwayStar123 Dec 12, 2023
3f85686
Update standards/src_6/README.md
SwayStar123 Dec 12, 2023
60d7860
Update standards/src_6/README.md
SwayStar123 Dec 12, 2023
f7ee8ba
Update standards/src_6/README.md
SwayStar123 Dec 12, 2023
e09d6ce
Update standards/src_6/README.md
SwayStar123 Dec 12, 2023
3256873
Update standards/src_6/README.md
SwayStar123 Dec 12, 2023
b1af20e
Update standards/src_6/README.md
SwayStar123 Dec 12, 2023
3e7535f
Update standards/src_6/README.md
SwayStar123 Dec 12, 2023
9d87ba9
Update standards/src_6/README.md
SwayStar123 Dec 12, 2023
82c4e13
remove unnecessary line
SwayStar123 Dec 12, 2023
8b5d969
rem,ove unnecessary line
SwayStar123 Dec 12, 2023
c16209f
abstract elaboration
SwayStar123 Dec 12, 2023
db03515
This function
SwayStar123 Dec 12, 2023
ecb4ec3
Update standards/src_6/README.md
SwayStar123 Dec 13, 2023
9e447b6
Update standards/src_6/README.md
SwayStar123 Dec 13, 2023
2713412
Update standards/src_6/README.md
SwayStar123 Dec 13, 2023
e34bf56
change par names
SwayStar123 Dec 15, 2023
3242e5d
Merge branch 'vault_standard' of https://github.com/FuelLabs/sway-sta…
SwayStar123 Dec 15, 2023
1b8d424
fix position of params
SwayStar123 Dec 15, 2023
8c019fb
fix some descriptions
SwayStar123 Dec 15, 2023
fa3b660
changed log var names
SwayStar123 Dec 15, 2023
b0a5928
standardize readme
SwayStar123 Dec 15, 2023
d498552
fmt
SwayStar123 Dec 15, 2023
0f321c5
add periods
SwayStar123 Dec 15, 2023
e4f843a
period.
SwayStar123 Dec 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added standards/src_6/.docs/src-5-logo-dark-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added standards/src_6/.docs/src-5-logo-light-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions standards/src_6/Forc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[project]
authors = ["Fuel Labs <contact@fuel.sh>"]
entry = "src_6.sw"
license = "Apache-2.0"
name = "src_6"
146 changes: 146 additions & 0 deletions standards/src_6/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset=".docs/src-5-logo-dark-theme.png">
<img alt="SRC-5 logo" width="400px" src=".docs/src-5-logo-light-theme.png">
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
</picture>
</p>

# Abstract
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
The following standard allows for the implementation of a standard API for token vaults such as yield bearing token vaults. This standard is an optional add-on to the SRC-20 standard.
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved

# Motivation
Token vaults allow users to own shares of variable amount of assets, such as lending protocols which may have growing assets due to profits from interest. This pattern is highly useful and would greatly benefit from standardisation
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe mention how a standardized vault increases composability, such as an AMM that allows trading assets based on the underlying assets... wallets that are aware of assets held in a vault, etc.

SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved

# Prior Art
Token vaults have been thoroughly explored on Ethereum and with [EIP 4626](https://eips.ethereum.org/EIPS/eip-4626) they have their own standard for it. However as Fuel's native assets are fundamentally different to Ethereum's ERC-20 tokens, the implementation will differ, but the interface may be used as reference.
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved

# Specification
## Required public functions
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
The following functions MUST be implemented (on top of the SRC-20 functions) to follow the SRC-6 standard
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved

### `fn deposit(receiver: Identity) -> u64`
Method that allows depositing of the underlying asset in exchange for shares of the vault.
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
This function takes the receiver's identity as an argument and returns the amount of shares minted.
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved

MUST revert if any AssetId other than the underlying is forwarded.
MUST mint `preview_deposit(deposited_assets)` amount of shares to `receiver`.
MUST increase `managed_assets` by `deposited_assets` (through any means including `std::context::this_balance(ASSET_ID)` if applicable).
MUST increase `total_supply` of the share's AssetId by newly minted shares.
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
MUST increase `total_assets` by one if the the AssetId is minted for the first time.
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
MUST emit a `Deposit` log.
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved

### `fn withdraw(asset: AssetId, receiver: Identity) -> u64`
Method that allows the redeeming of the vault shares in exchange for a pro-rata amount of the underlying asset
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
This function takes the asset's AssetId and the receiver's identity as arguments and returns the amount of assets transferred.
The AssetId of the asset, and the AssetId of the shares MUST be one-to-one, meaning every deposited AssetId shall have a unique corresponding shares AssetId.

MUST revert if any AssetId other than the AssetId corresponding to the deposited asset is forwarded.
MUST send `preview_withdraw(redeemed_shares)` amount of assets to `receiver`.
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
MUST burn the received shares.
MUST reduce `managed_assets` by `preview_withdraw(redeemed_shares)`.
MUST reduce `total_supply` of the shares's AssetId by amount of burnt shares.
MUST emit a `Withdraw` log.

### `fn managed_assets(asset: AssetId) -> u64`
Method that returns the total assets under management by vault. Includes assets controlled by the vault but not directly possessed by vault.
This function takes the asset's AssetId as an argument and returns the total amount of assets of AssetId under management by vault.

MUST return total amount of assets of underlying AssetId under management by vault.
MUST return 0 if there are no assets of underlying AssetId under management by vault.
MUST NOT revert under any circumstances.
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved

### `fn convert_to_shares(asset: AssetId, assets: u64) -> Option<u64>`
Helper method for converting assets to shares.
This function takes the asset's AssetId and the amount of assets as arguments and returns the amount of shares that would be minted for the given amount of assets, in an ideal condition without slippage.

MUST return an Option::Some of the amount of shares that would be minted for the given amount of assets, without accounting for any slippage, if the given asset is supported.
MUST return an Option::None if the given asset is not supported.
MUST NOT revert under any circumstances.

### `fn convert_to_assets(asset: AssetId, shares: u64) -> Option<u64>`
Helper method for converting shares to assets.
This function takes the asset's AssetId and the amount of shares as arguments and returns the amount of assets that would be transferred for the given amount of shares, in an ideal condition without slippage.

MUST return an Option::Some of the amount of assets that would be transferred for the given amount of shares, if the given asset is supported.
MUST return an Option::None if the asset is not supported.
MUST NOT revert under any circumstances.

### `fn preview_deposit(asset: AssetId, assets: u64) -> u64`
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
Helper method for previewing deposit.
This function takes the asset's AssetId and the amount of assets as arguments and returns the amount of shares that would have been minted for the given amount of assets.

MUST return the amount of shares that would have been minted for the given amount of assets.
MUST revert for any reason the `deposit` function would revert given the same conditions.

### `fn preview_withdraw(asset: AssetId, shares: u64) -> u64`
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
Helper method for previewing withdraw
This function takes the asset's AssetId and the amount of shares as arguments and returns the amount of assets that would have been transferred for the given amount of shares.

MUST return the amount of assets that would have been transferred for the given amount of shares.
MUST revert for any reason the `withdraw` function would revert given the same conditions.

### `fn max_depositable(asset: AssetId) -> Option<u64>`
Helper method for getting maximum depositable
This function takes the asset's AssetId as an argument and returns the maximum amount of assets that can be deposited into the contract, for the given asset.

MUST return the maximum amount of assets that can be deposited into the contract, for the given asset.

### `fn max_withdrawable(asset: AssetId) -> Option<u64>`
Helper method for getting maximum withdrawable
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
This function takes the asset's AssetId as an argument and returns the maximum amount of assets that can be withdrawn from the contract, for the given asset.

MUST return the maximum amount of assets that can be withdrawn from the contract, for the given asset.

## Required logs
The following logs MUST be emitted at the specified occasions
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved

```
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
/// Event logged when a deposit is made.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an example, not the specification. Should be listed out such as here: https://github.com/FuelLabs/sway-standards/tree/master/standards/src_5#state

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im confused, thats also just the specification enum, just without comments

SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
pub struct Deposit {
/// The caller of the deposit function.
caller: Identity,
/// The receiver of the deposit.
receiver: Identity,
/// The asset being deposited.
asset: AssetId,
dmihal marked this conversation as resolved.
Show resolved Hide resolved
/// The amount of assets being deposited.
assets: u64,
/// The amount of shares being minted.
shares: u64,
}
```
`caller` has called the `deposit` method sending `assets` assets of the `asset` AssetId, in exchange for `shares` shares sent to the receiver `receiver`
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved

The `Deposit` struct MUST be logged whenever new shares are minted via the `deposit` method
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved

```
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
/// Event logged when a withdrawal is made.
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
pub struct Withdraw {
/// The caller of the withdrawal function.
caller: Identity,
/// The receiver of the withdrawal.
receiver: Identity,
/// The asset being withdrawn.
asset: AssetId,
/// The amount of assets being withdrawn.
assets: u64,
/// The amount of shares being burned.
shares: u64,
}
```
`caller` has called the `withdraw` method sending `shares` shares in exchange for `assets` assets of the `asset` AssetId to the receiver `receiver`
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved

The `Withdraw` struct MUST be logged whenever shares are redeemed for assets via the `withdraw` method
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved

# Rationale
The ABI discussed is simple and covers the known use cases of token vaults while allowing safe implementations
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved

# Backwards compatibility
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
This standard is fully compatible with the SRC-20 standard
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved

# Security Considerations
Incorrect implementation of token vaults could allow attackers to steal underlying assets. It is recommended to properly audit any code using this standard to ensure exploits are not possible.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should include something about how a vault can "lie" about the underlying?

Ex, if a vault says some asset represents USDC, there's no guarantee that the vault actually represents USDC (may be a consideration for wallets)


# Reference implementation
Full reference implementation can be seen [here](https://github.com/SwayStar123/vault-standard-reference-implementation/blob/master/src/main.sw)

185 changes: 185 additions & 0 deletions standards/src_6/src/src_6.sw
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
library;

// Required logs:

SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
/// Event logged when a deposit is made.
pub struct Deposit {
/// The caller of the deposit function.
caller: Identity,
/// The receiver of the deposit.
receiver: Identity,
/// The asset being deposited.
asset: AssetId,
/// The amount of assets being deposited.
assets: u64,
/// The amount of shares being minted.
shares: u64,
}

/// Event logged when a withdrawal is made.
pub struct Withdraw {
/// The caller of the withdrawal function.
caller: Identity,
/// The receiver of the withdrawal.
receiver: Identity,
/// The asset being withdrawn.
asset: AssetId,
/// The amount of assets being withdrawn.
assets: u64,
/// The amount of shares being burned.
shares: u64,
}

abi SRC6 {
// SRC-6
// Deposit/Withdrawal
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
/// Deposits assets into the contract and mints shares to the receiver.
///
/// # Additional Information
///
/// * Assets must be forwarded to the contract in the contract call.
///
/// # Arguments
///
/// * `receiver`: [Identity] - The receiver of the shares.
///
/// # Returns
///
/// * [u64] - The amount of shares minted.
///
/// # Reverts
///
/// * If the asset is not supported by the contract.
/// * If the amount of assets is zero.
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
/// * The user crosses any global or user specific deposit limits.
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
#[storage(read, write)]
fn deposit(receiver: Identity) -> u64;
/// Burns shares from the sender and transfers assets to the receiver.
///
/// # Additional Information
///
/// * Shares must be forwarded to the contract in the contract call.
///
/// # Arguments
///
/// * `asset`: [AssetId] - The asset for which the shares should be burned.
/// * `receiver`: [Identity] - The receiver of the assets.
///
/// # Returns
///
/// * [u64] - The amount of assets transferred.
///
/// # Reverts
///
/// * If the asset is not supported by the contract.
/// * If the amount of shares is zero.
/// * If the transferred shares do not corresspond to the given asset.
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
/// * The user crosses any global or user specific withdrawal limits.
#[storage(read, write)]
fn withdraw(asset: AssetId, receiver: Identity) -> u64;

// Accounting
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
/// Returns the amount of managed assets of the given asset.
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
///
/// # Arguments
///
/// * `asset`: [AssetId] - The asset for which the amount of managed assets should be returned.
///
/// # Returns
///
/// * [u64] - The amount of managed assets of the given asset.
#[storage(read)]
fn managed_assets(asset: AssetId) -> u64;
/// Returns how many shares would be minted for the given amount of assets, in an ideal scenario (No accounting for slippage, or any limits).
///
/// # Arguments
///
/// * `asset`: [AssetId] - The asset for which the amount of shares should be returned.
/// * `assets`: [u64] - The amount of assets for which the amount of shares should be returned.
///
/// # Returns
///
/// * [Some(u64)] - The amount of shares that would be minted for the given amount of assets.
/// * [None] - If the asset is not supported by the contract.
#[storage(read)]
fn convert_to_shares(asset: AssetId, assets: u64) -> Option<u64>;
/// Returns how many assets would be transferred for the given amount of shares, in an ideal scenario (No accounting for slippage, or any limits).
///
/// # Arguments
///
/// * `asset`: [AssetId] - The asset for which the amount of assets should be returned.
/// * `shares`: [u64] - The amount of shares for which the amount of assets should be returned.
///
/// # Returns
///
/// * [Some(u64)] - The amount of assets that would be transferred for the given amount of shares.
/// * [None] - If the asset is not supported by the contract.
#[storage(read)]
fn convert_to_assets(asset: AssetId, shares: u64) -> Option<u64>;
/// Returns how many shares would have been minted for the given amount of assets, if this was a deposit call.
///
/// # Arguments
///
/// * `asset`: [AssetId] - The asset for which the amount of shares should be returned.
/// * `assets`: [u64] - The amount of assets for which the amount of shares should be returned.
///
/// # Returns
///
/// * [u64] - The amount of shares that would have been minted for the given amount of assets.
///
/// # Reverts
///
/// * For any reason a deposit would revert.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a poor comment. It does not inform the user in any way. It's too broad. Also, isn't this supposed to return 0 if it would not return a value i.e. revert? Similar to withdrawal below

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What makes you think its supposed to return 0? I dont think i mentioned that anywhere

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about usage.
If you attempt to view what value it would return it shouldn't crash. It should return some value such as an error or 0 if that 0 makes sense as a default.

#[storage(read)]
fn preview_deposit(asset: AssetId, assets: u64) -> u64;
/// Returns how many assets would have been transferred for the given amount of shares, if this was a withdrawal call.
///
/// # Arguments
///
/// * `asset`: [AssetId] - The asset for which the amount of assets should be returned.
/// * `shares`: [u64] - The amount of shares for which the amount of assets should be returned.
///
/// # Returns
///
/// * [u64] - The amount of assets that would have been transferred for the given amount of shares.
///
/// # Reverts
///
/// * For any reason a withdrawal would revert.
#[storage(read)]
fn preview_withdraw(asset: AssetId, shares: u64) -> u64;

// Deposit/Withdrawal Limits
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
/// Returns the maximum amount of assets that can be deposited into the contract, for the given asset.
///
/// # Additional Information
///
/// Does not account for any user or global limits.
///
/// # Arguments
///
/// * `asset`: [AssetId] - The asset for which the maximum amount of depositable assets should be returned.
///
/// # Returns
///
/// * [Some(u64)] - The maximum amount of assets that can be deposited into the contract, for the given asset.
/// * [None] - If the asset is not supported by the contract.
#[storage(read)]
fn max_depositable(asset: AssetId) -> Option<u64>;
/// Returns the maximum amount of assets that can be withdrawn from the contract, for the given asset.
///
/// # Additional Information
///
/// Does not account for any user or global limits.
///
/// # Arguments
///
/// * `asset`: [AssetId] - The asset for which the maximum amount of withdrawable assets should be returned.
///
/// # Returns
///
/// * [Some(u64)] - The maximum amount of assets that can be withdrawn from the contract, for the given asset.
/// * [None] - If the asset is not supported by the contract.
#[storage(read)]
fn max_withdrawable(asset: AssetId) -> Option<u64>;
SwayStar123 marked this conversation as resolved.
Show resolved Hide resolved
}
Loading