Is it possible to create/link a valut path for a contract to receive a fun token?
ie contract.save(<-Duck.createEmptyVault(), to: Duck.VaultStoragePath);
If anyone wanted to do this I created a Resource and assigned a vault to that in a way itβs connected to a user
pub resource Pool: PoolManager {
pub var amount: UFix64;
pub var vault: @FungibleToken.Vault;
init(amount: UFix64, from: @FungibleToken.Vault) {
let vaultRef <- from as! @Duck.Vault
self.vault <- vaultRef.withdraw(amount: amount);
self.amount = amount;
destroy vaultRef;
}
destroy() {
destroy self.vault;
}
}
Great job! Appreciate you sharing the knowledge on the forum for other developers looking to do the same thing ![]()
Thanks! Really enjoying building in flow. Converting all my Solidity contracts into Cadence!!
you could use:
self.account.link<&{FungibleToken.Receiver}>(
/public/DuckReceiver,
target: Duck.VaultStoragePath
)