0

Let say I have a function that goes something like...

pub fun myFunction(): &{FungibleToken.Receiver}

If myFunction() returns for instance a &ExampleToken.Vault (a reference to a resource, a fungible token vault, that conforms to {FungibleToken.Receiver}), the returned value will be restricted to the interface, or it will be the whole Vault resource since the returning type is just checking that the value conforms to that restriction?

alilloig
  • 456
  • 1
  • 4
  • 11

1 Answers1

1

the returned value will be restricted to the interface, or it will be the whole Vault resource since the returning type is just checking that the value conforms to that restriction?

It will be restricted to the interface. The return type is not just checking that it conforms; it is only giving you back a type that is restricted to the interface.

Jacob Tucker
  • 132
  • 7