Skip to main content
2 of 2
added 171 characters in body
Chrismo
  • 524
  • 2
  • 8

There is an interesting example in one of the Pioneer lectures which implements Uniswap on Cardano.

A redeemer is not only used to justify that a UTxO can be spent, but also the manner in which it will be spent. The validation script will then place the necessary constraints on the creation of the transaciton based on who is trying to spend it and how they are trying to spend it.

In the screenshot attached from lecture 10 of the first iteration of the Plutus Pioneer Program, the blue lines represent the redeemer as an input to the UTxO's validation script (represented by the blue and red circles) which, in this case, is validating the consumption of a UTxO which represents a liquidity pool.

You can see four different labels on four of the blue lines - Create, Swap, Add and Remove. These represent different constructors for the redeemer data type being used and tell the script what action the user is trying to take.

For further details of exactly what each redeemer does, you can read more and find a link to the video here.

Uniswap on Cardano Example

Chrismo
  • 524
  • 2
  • 8