Resource Switchboard
The resource that stores the multiple fungible token receiver capabilities, allowing the owner to add and remove them and anyone to deposit any fungible token among the available types.
Implemented Interfaces:
FungibleToken.Receiver
SwitchboardPublic
Initializer
Functions
fun addNewVault()
Adds a new fungible token receiver capability to the switchboard resource.
token vault deposit function through {FungibleToken.Receiver}
that
will be added to the switchboard.
Parameters:
- capability : The capability to expose a certain fungible
fun addNewVaultsByPath()
Adds a number of new fungible token receiver capabilities by using the paths where they are stored.
Parameters:
- paths : The paths where the public capabilities are stored.
- address : The address of the owner of the capabilities.
fun addNewVaultWrapper()
Adds a new fungible token receiver capability to the switchboard
resource specifying which Type
of @FungibleToken.Vault
can be
deposited to it. Use it to include in your switchboard "wrapper"
receivers such as a @TokenForwarding.Forwarder
. It can also be
used to overwrite the type attached to a certain capability without
having to remove that capability first.
token vault deposit function through {FungibleToken.Receiver}
that
will be added to the switchboard.
capability, rather than the Type
from the reference borrowed from
said capability
Parameters:
- capability : The capability to expose a certain fungible
- type : The type of fungible token that can be deposited to that
fun removeVault()
Removes a fungible token receiver capability from the switchboard resource.
removed from the switchboard.
Parameters:
- capability : The capability to a fungible token vault to be
fun deposit()
Takes a fungible token vault and routes it to the proper fungible token receiver capability for depositing it.
Parameters:
- from : The deposited fungible token vault resource.
fun safeDeposit()
Takes a fungible token vault and tries to route it to the proper fungible token receiver capability for depositing the funds, avoiding panicking if the vault is not available.
deposited.
funds if the deposit was successful, or still containing the funds if the reference to the needed vault was not found.
Parameters:
- vaultType : The type of the ft vault that wants to be
Returns: The deposited fungible token vault resource, without the
fun getVaultTypes()
A getter function to know which tokens a certain switchboard resource is prepared to receive.
{FungibleToken.Receiver}
capabilities that can be effectively
borrowed.
Returns: The keys from the dictionary of stored