0

Trying to create a type to represent the swap type here: https://github.com/madfish-solutions/quipuswap-core-v2/blob/master/contracts/partial/dex_core/dex_core_types.ligo#LL121-L121C5

Any idea what that list(operation) would be in SmartPY?

1 Answer 1

0

In SmartPy we manage operation for you so most of the time you don't need to manipulate the type TOperation. TOperation refers to the operation (transfer, create_contract, etc.) returned by a lambda, an entrypoint, etc. For example: sp.TLambda(sp.TUnit, sp.TNat, with_operation=True) is kinda a syntaxic sugar for something like sp.TLambda(sp.TUnit, sp.TPair(sp.TNat, sp.TList(sp.TOperation))). SmartPy unpairs the lambda's result and call sp.add_operations(...) for you with the list of returned operations.

SmartPy offers equivalent for everything that generates operation so you can manage them by yourself. For example sp.transfer_operation is the equivalent of sp.transfer where the resulting operation is returned instead of being automatically added to the list of operations managed by SmartPy and returned by the entrypoint.

Question and answer from Smartpy Telegram.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.