Similarly to other Plutus v1 DEXes, Sundaeswap Orders also require an embedded datum (see Minswap).
Since Sundaeswap's source code is not open source, we will only highlight certain typescript types that can be used to construct an order datum.
The order datum type is called IOrderDatum
which is defined as following:
export interface IOrderDatum extends Encodable {
poolIdentifier: string;
orderAddress: IOrderAddress;
scooperFee: BigInt;
action: IOrderAction;
}
export interface IOrderAddress extends Encodable {
destination: IOrderDestination;
/** Hex encoded public key hash that can cancel order in case destination is script */
pubKeyHash?: string;
}
export interface IOrderDestination extends Encodable {
/** Bech32 encoded destination address */
address: string;
datumHash?: string;
}
export type IOrderAction = ISwapAction | IOrderWithdraw | IOrderDeposit;
The poolIdentifier
is used by off-chain batchers to identify what token pair a specific order corresponds to.
An orderAddress
defines the destination of the swapped token and may be represented as simple wallet address or a script address (including a datum hash).
The scooperFee
is the amount of lovelace
paid to order batchers. Last but not least, action
defines what a user intends to do, whereby the ISwapAction
& IOrderWithdraw
is currently only implemented.
Similarly to Minswap, there are two redeemers. One, OrderScoop
which is the redeemer used by Sundaeswap's off-chain batcher (scooper) to execute the swap transaction that interacts with a liquidity pool.
Second, the OrderCancel
redeemer which can be used by the owner of the order to cancel the swap before the batcher processed it.
export type IOrderRedeemerType = 'OrderScoop' | 'OrderCancel';
SundaeswapOrderAddressBuilder
SundaeswapOrderDatumBuilder
SundaeswapOrderDestinationBuilder
SundaeswapOrderDepositSingleBuilder
(untested)SundaeswapOrderDepositMixedBuilder
(not implemented)SundaeswapOrderSwapBuilder
SundaeswapOrderActionDecoder
SundaeswapOrderAddressDecoder
SundaeswapOrderDestinationDecoder
SundaeswapOrderDepositMixedDecoder
(not implemented)SundaeswapOrderSwapDecoder