Skip to content

Sundae

SundaeSwap DEX module.

AmountOut dataclass

Bases: PlutusData

Minimum amount to receive.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
48
49
50
51
52
53
@dataclass
class AmountOut(PlutusData):
    """Minimum amount to receive."""

    CONSTR_ID = 0
    min_receive: int

AtoB dataclass

Bases: PlutusData

A to B swap direction.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
34
35
36
37
38
@dataclass
class AtoB(PlutusData):
    """A to B swap direction."""

    CONSTR_ID = 0

BtoA dataclass

Bases: PlutusData

B to A swap direction.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
41
42
43
44
45
@dataclass
class BtoA(PlutusData):
    """B to A swap direction."""

    CONSTR_ID = 1

DepositConfig dataclass

Bases: PlutusData

Deposit configuration.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
84
85
86
87
88
89
90
@dataclass
class DepositConfig(PlutusData):
    """Deposit configuration."""

    CONSTR_ID = 2

    deposit_pair: DepositPair

DepositPair dataclass

Bases: PlutusData

Deposit pair.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
76
77
78
79
80
81
@dataclass
class DepositPair(PlutusData):
    """Deposit pair."""

    CONSTR_ID = 1
    assets: DepositPairQuantity

DepositPairQuantity dataclass

Bases: PlutusData

Deposit pair quantity.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
67
68
69
70
71
72
73
@dataclass
class DepositPairQuantity(PlutusData):
    """Deposit pair quantity."""

    CONSTR_ID = 0
    amount_a: int
    amount_b: int

LPFee dataclass

Bases: PlutusData

Liquidity pool fee.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
378
379
380
381
382
383
384
@dataclass
class LPFee(PlutusData):
    """Liquidity pool fee."""

    CONSTR_ID = 0
    numerator: int
    denominator: int

LiquidityPoolAssets dataclass

Bases: PlutusData

Liquidity pool assets.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
387
388
389
390
391
392
393
@dataclass
class LiquidityPoolAssets(PlutusData):
    """Liquidity pool assets."""

    CONSTR_ID = 0
    asset_a: AssetClass
    asset_b: AssetClass

SundaeAddressWithDatum dataclass

Bases: PlutusData

SundaeSwap address with datum.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
@dataclass
class SundaeAddressWithDatum(PlutusData):
    """SundaeSwap address with datum."""

    CONSTR_ID = 0

    address: Union[PlutusFullAddress, PlutusScriptAddress]
    datum: Union[
        ReceiverDatum,
        PlutusNone,
    ]

    @classmethod
    def from_address(cls, address: Address) -> "SundaeAddressWithDatum":
        """Create a new address with datum."""
        return cls(address=PlutusFullAddress.from_address(address), datum=PlutusNone())

from_address(address: Address) -> SundaeAddressWithDatum classmethod

Create a new address with datum.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
133
134
135
136
@classmethod
def from_address(cls, address: Address) -> "SundaeAddressWithDatum":
    """Create a new address with datum."""
    return cls(address=PlutusFullAddress.from_address(address), datum=PlutusNone())

SundaeAddressWithDestination dataclass

Bases: PlutusData

For now, destination is set to none, should be updated.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
158
159
160
161
162
163
164
165
166
167
168
169
170
171
@dataclass
class SundaeAddressWithDestination(PlutusData):
    """For now, destination is set to none, should be updated."""

    CONSTR_ID = 0

    address: SundaeAddressWithDatum
    destination: Union[PlutusPartAddress, PlutusNone]

    @classmethod
    def from_address(cls, address: Address) -> "SundaeAddressWithDestination":
        """Create a new address with destination."""
        null = SundaeAddressWithDatum.from_address(address)
        return cls(address=null, destination=PlutusNone())

from_address(address: Address) -> SundaeAddressWithDestination classmethod

Create a new address with destination.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
167
168
169
170
171
@classmethod
def from_address(cls, address: Address) -> "SundaeAddressWithDestination":
    """Create a new address with destination."""
    null = SundaeAddressWithDatum.from_address(address)
    return cls(address=null, destination=PlutusNone())

SundaeOrderDatum dataclass

Bases: OrderDatum

SundaeSwap order datum.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
@dataclass
class SundaeOrderDatum(OrderDatum):
    """SundaeSwap order datum."""

    ident: bytes
    address: SundaeAddressWithDestination
    fee: int
    swap: Union[DepositConfig, SwapConfig, WithdrawConfig]

    @classmethod
    def create_datum(
        cls,
        ident: bytes,
        address_source: Address,
        in_assets: Assets,
        out_assets: Assets,
        fee: int,
    ) -> "SundaeOrderDatum":
        """Create a new order datum."""
        full_address = SundaeAddressWithDestination.from_address(address_source)
        merged = in_assets + out_assets
        if in_assets.unit() == merged.unit():
            direction = AtoB()
        else:
            direction = BtoA()
        swap = SwapConfig(
            direction=direction,
            amount_in=in_assets.quantity(),
            amount_out=AmountOut(min_receive=out_assets.quantity()),
        )

        return cls(ident=ident, address=full_address, fee=fee, swap=swap)

    def address_source(self) -> Address:
        """Get the source address."""
        return self.address.address.address.to_address()

    def requested_amount(self) -> Assets:
        """Get the requested amount."""
        if isinstance(self.swap, SwapConfig):
            if isinstance(self.swap.direction, AtoB):
                return Assets({"asset_b": self.swap.amount_out.min_receive})
            else:
                return Assets({"asset_a": self.swap.amount_out.min_receive})
        else:
            return Assets({})

    def order_type(self) -> OrderType | None:
        """Get the order type."""
        order_type = None
        if isinstance(self.swap, SwapConfig):
            order_type = OrderType.swap
        elif isinstance(self.swap, DepositConfig):
            order_type = OrderType.deposit
        elif isinstance(self.swap, WithdrawConfig):
            order_type = OrderType.withdraw

        return order_type

address_source() -> Address

Get the source address.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
207
208
209
def address_source(self) -> Address:
    """Get the source address."""
    return self.address.address.address.to_address()

create_datum(ident: bytes, address_source: Address, in_assets: Assets, out_assets: Assets, fee: int) -> SundaeOrderDatum classmethod

Create a new order datum.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
@classmethod
def create_datum(
    cls,
    ident: bytes,
    address_source: Address,
    in_assets: Assets,
    out_assets: Assets,
    fee: int,
) -> "SundaeOrderDatum":
    """Create a new order datum."""
    full_address = SundaeAddressWithDestination.from_address(address_source)
    merged = in_assets + out_assets
    if in_assets.unit() == merged.unit():
        direction = AtoB()
    else:
        direction = BtoA()
    swap = SwapConfig(
        direction=direction,
        amount_in=in_assets.quantity(),
        amount_out=AmountOut(min_receive=out_assets.quantity()),
    )

    return cls(ident=ident, address=full_address, fee=fee, swap=swap)

order_type() -> OrderType | None

Get the order type.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
221
222
223
224
225
226
227
228
229
230
231
def order_type(self) -> OrderType | None:
    """Get the order type."""
    order_type = None
    if isinstance(self.swap, SwapConfig):
        order_type = OrderType.swap
    elif isinstance(self.swap, DepositConfig):
        order_type = OrderType.deposit
    elif isinstance(self.swap, WithdrawConfig):
        order_type = OrderType.withdraw

    return order_type

requested_amount() -> Assets

Get the requested amount.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
211
212
213
214
215
216
217
218
219
def requested_amount(self) -> Assets:
    """Get the requested amount."""
    if isinstance(self.swap, SwapConfig):
        if isinstance(self.swap.direction, AtoB):
            return Assets({"asset_b": self.swap.amount_out.min_receive})
        else:
            return Assets({"asset_a": self.swap.amount_out.min_receive})
    else:
        return Assets({})

SundaePoolDatum dataclass

Bases: PoolDatum

SundaeSwap pool datum.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
396
397
398
399
400
401
402
403
404
405
406
@dataclass
class SundaePoolDatum(PoolDatum):
    """SundaeSwap pool datum."""

    assets: LiquidityPoolAssets
    ident: bytes
    last_swap: int
    fee: LPFee

    def pool_pair(self) -> Assets | None:
        return self.assets.asset_a.assets + self.assets.asset_b.assets

SundaeSwapCPPState

Bases: AbstractConstantProductPoolState

SundaeSwap constant product pool state.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
class SundaeSwapCPPState(AbstractConstantProductPoolState):
    """SundaeSwap constant product pool state."""

    fee: int = 0
    _batcher = Assets(lovelace=2500000)
    _deposit = Assets(lovelace=2000000)
    _stake_address: ClassVar[Address] = Address.from_primitive(
        "addr1wxaptpmxcxawvr3pzlhgnpmzz3ql43n2tc8mn3av5kx0yzs09tqh8",
    )

    @classmethod
    def dex(cls) -> str:
        """Get the DEX name."""
        return "SundaeSwap"

    @classmethod
    def order_selector(self) -> list[str]:
        """Get the order selector."""
        return [self._stake_address.encode()]

    @classmethod
    def pool_selector(cls) -> PoolSelector:
        return PoolSelector(
            addresses=["addr1w9qzpelu9hn45pefc0xr4ac4kdxeswq7pndul2vuj59u8tqaxdznu"],
        )

    @property
    def swap_forward(self) -> bool:
        """Check if swap forwarding is enabled."""
        return False

    @property
    def stake_address(self) -> Address:
        """Get the stake address."""
        return self._stake_address

    @classmethod
    def order_datum_class(self) -> type[SundaeOrderDatum]:
        """Get the order datum class."""
        return SundaeOrderDatum

    @classmethod
    def pool_datum_class(cls) -> type[SundaePoolDatum]:
        """Get the pool datum class."""
        return SundaePoolDatum

    @property
    def pool_id(self) -> str:
        """A unique identifier for the pool."""
        return self.pool_nft.unit()

    @classmethod
    def skip_init(cls, values) -> bool:
        """Skip the initialization process."""
        if "pool_nft" in values and "dex_nft" in values and "fee" in values:
            try:
                super().extract_pool_nft(values)
            except InvalidPoolError:
                raise NotAPoolError("No pool NFT found.")
            if len(values["assets"]) == 3:
                # Send the ADA token to the end
                if isinstance(values["assets"], Assets):
                    values["assets"].root["lovelace"] = values["assets"].root.pop(
                        "lovelace",
                    )
                else:
                    values["assets"]["lovelace"] = values["assets"].pop("lovelace")
            values["assets"] = Assets.model_validate(values["assets"])
            return True
        else:
            return False

    @classmethod
    def extract_pool_nft(cls, values) -> Assets:
        """Extract the pool NFT."""
        try:
            super().extract_pool_nft(values)
        except InvalidPoolError:
            if len(values["assets"]) == 0:
                raise NoAssetsError
            else:
                raise NotAPoolError("No pool NFT found.")

    @classmethod
    def pool_policy(cls) -> list[str]:
        """Get the pool policy."""
        return ["0029cb7c88c7567b63d1a512c0ed626aa169688ec980730c0473b91370"]

    @classmethod
    def post_init(cls, values):
        """Post initialization."""
        super().post_init(values)

        assets = values["assets"]
        datum = SundaePoolDatum.from_cbor(values["datum_cbor"])

        if len(assets) == 2:
            assets.root[assets.unit(0)] -= 2000000
        elif len(assets) == 1:
            msg = "Reserves contains only 1 token."
            raise InvalidPoolError(msg)

        numerator = datum.fee.numerator
        denominator = datum.fee.denominator
        values["fee"] = int(numerator * 10000 / denominator)

    def swap_datum(
        self,
        address_source: Address,
        in_assets: Assets,
        out_assets: Assets,
        extra_assets: Assets | None = None,
        address_target: Address | None = None,
        datum_target: PlutusData | None = None,
    ) -> PlutusData:
        """Create a swap datum."""
        if self.swap_forward and address_target is not None:
            print(f"{self.__class__.__name__} does not support swap forwarding.")

        ident = bytes.fromhex(self.pool_nft.unit()[60:])

        return SundaeOrderDatum.create_datum(
            ident=ident,
            address_source=address_source,
            in_assets=in_assets,
            out_assets=out_assets,
            fee=self.batcher_fee(in_assets=in_assets, out_assets=out_assets).quantity(),
        )

pool_id: str property

A unique identifier for the pool.

stake_address: Address property

Get the stake address.

swap_forward: bool property

Check if swap forwarding is enabled.

dex() -> str classmethod

Get the DEX name.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
458
459
460
461
@classmethod
def dex(cls) -> str:
    """Get the DEX name."""
    return "SundaeSwap"

extract_pool_nft(values) -> Assets classmethod

Extract the pool NFT.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
520
521
522
523
524
525
526
527
528
529
@classmethod
def extract_pool_nft(cls, values) -> Assets:
    """Extract the pool NFT."""
    try:
        super().extract_pool_nft(values)
    except InvalidPoolError:
        if len(values["assets"]) == 0:
            raise NoAssetsError
        else:
            raise NotAPoolError("No pool NFT found.")

order_datum_class() -> type[SundaeOrderDatum] classmethod

Get the order datum class.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
484
485
486
487
@classmethod
def order_datum_class(self) -> type[SundaeOrderDatum]:
    """Get the order datum class."""
    return SundaeOrderDatum

order_selector() -> list[str] classmethod

Get the order selector.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
463
464
465
466
@classmethod
def order_selector(self) -> list[str]:
    """Get the order selector."""
    return [self._stake_address.encode()]

pool_datum_class() -> type[SundaePoolDatum] classmethod

Get the pool datum class.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
489
490
491
492
@classmethod
def pool_datum_class(cls) -> type[SundaePoolDatum]:
    """Get the pool datum class."""
    return SundaePoolDatum

pool_policy() -> list[str] classmethod

Get the pool policy.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
531
532
533
534
@classmethod
def pool_policy(cls) -> list[str]:
    """Get the pool policy."""
    return ["0029cb7c88c7567b63d1a512c0ed626aa169688ec980730c0473b91370"]

post_init(values) classmethod

Post initialization.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
@classmethod
def post_init(cls, values):
    """Post initialization."""
    super().post_init(values)

    assets = values["assets"]
    datum = SundaePoolDatum.from_cbor(values["datum_cbor"])

    if len(assets) == 2:
        assets.root[assets.unit(0)] -= 2000000
    elif len(assets) == 1:
        msg = "Reserves contains only 1 token."
        raise InvalidPoolError(msg)

    numerator = datum.fee.numerator
    denominator = datum.fee.denominator
    values["fee"] = int(numerator * 10000 / denominator)

skip_init(values) -> bool classmethod

Skip the initialization process.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
@classmethod
def skip_init(cls, values) -> bool:
    """Skip the initialization process."""
    if "pool_nft" in values and "dex_nft" in values and "fee" in values:
        try:
            super().extract_pool_nft(values)
        except InvalidPoolError:
            raise NotAPoolError("No pool NFT found.")
        if len(values["assets"]) == 3:
            # Send the ADA token to the end
            if isinstance(values["assets"], Assets):
                values["assets"].root["lovelace"] = values["assets"].root.pop(
                    "lovelace",
                )
            else:
                values["assets"]["lovelace"] = values["assets"].pop("lovelace")
        values["assets"] = Assets.model_validate(values["assets"])
        return True
    else:
        return False

swap_datum(address_source: Address, in_assets: Assets, out_assets: Assets, extra_assets: Assets | None = None, address_target: Address | None = None, datum_target: PlutusData | None = None) -> PlutusData

Create a swap datum.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
def swap_datum(
    self,
    address_source: Address,
    in_assets: Assets,
    out_assets: Assets,
    extra_assets: Assets | None = None,
    address_target: Address | None = None,
    datum_target: PlutusData | None = None,
) -> PlutusData:
    """Create a swap datum."""
    if self.swap_forward and address_target is not None:
        print(f"{self.__class__.__name__} does not support swap forwarding.")

    ident = bytes.fromhex(self.pool_nft.unit()[60:])

    return SundaeOrderDatum.create_datum(
        ident=ident,
        address_source=address_source,
        in_assets=in_assets,
        out_assets=out_assets,
        fee=self.batcher_fee(in_assets=in_assets, out_assets=out_assets).quantity(),
    )

SundaeSwapV3CPPState

Bases: AbstractConstantProductPoolState

Source code in src/charli3_dendrite/dexs/amm/sundae.py
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
class SundaeSwapV3CPPState(AbstractConstantProductPoolState):
    fee: int | list[int] = [30, 30]
    _batcher = Assets(lovelace=1000000)
    _deposit = Assets(lovelace=2000000)
    _stake_address: ClassVar[Address] = Address.from_primitive(
        "addr1z8ax5k9mutg07p2ngscu3chsauktmstq92z9de938j8nqa7zcka2k2tsgmuedt4xl2j5awftvqzmmv3vs2yduzqxfcmsyun6n3",
    )

    @classmethod
    def dex(cls) -> str:
        return "SundaeSwapV3"

    @classmethod
    def default_script_class(self) -> type[PlutusV1Script] | type[PlutusV2Script]:
        return PlutusV2Script

    @classmethod
    def order_selector(self) -> list[str]:
        return [self._stake_address.encode()]

    @classmethod
    def pool_selector(cls) -> PoolSelector:
        return PoolSelector(
            addresses=["addr1w8srqftqemf0mjlukfszd97ljuxdp44r372txfcr75wrz2cp9h6f8"],
        )

    @classmethod
    def pool_policy(cls) -> list[str]:
        return ["e0302560ced2fdcbfcb2602697df970cd0d6a38f94b32703f51c312b"]

    @property
    def swap_forward(self) -> bool:
        return False

    @property
    def stake_address(self) -> Address:
        return self._stake_address

    @classmethod
    def order_datum_class(self) -> type[SundaeV3OrderDatum]:
        return SundaeV3OrderDatum

    @classmethod
    def pool_datum_class(self) -> type[SundaeV3PoolDatum]:
        return SundaeV3PoolDatum

    @property
    def pool_id(self) -> str:
        """A unique identifier for the pool."""
        return self.pool_nft.unit()

    @classmethod
    def skip_init(cls, values) -> bool:
        if "pool_nft" in values:
            try:
                super().extract_pool_nft(values)
            except InvalidPoolError:
                raise NotAPoolError("No pool NFT found.")
            if len(values["assets"]) == 3:
                # Send the ADA token to the end
                if isinstance(values["assets"], Assets):
                    values["assets"].root["lovelace"] = values["assets"].root.pop(
                        "lovelace",
                    )
                else:
                    values["assets"]["lovelace"] = values["assets"].pop("lovelace")

            datum = SundaeV3PoolDatum.from_cbor(values["datum_cbor"])
            values["fee"] = datum.bid_fees_per_10_thousand
            values["assets"] = Assets.model_validate(values["assets"])

            settings = get_backend().get_datum_from_address(
                Address.decode(
                    "addr1w9680rk7hkue4e0zkayyh47rxqpg9gzx445mpha3twge75sku2mg0",
                ),
            )

            datum = SundaeV3Settings.from_cbor(settings.datum_cbor)
            cls._batcher_fee = Assets(lovelace=datum.simple_fee + datum.base_fee)
            return True
        else:
            return False

    @classmethod
    def extract_pool_nft(cls, values) -> Assets:
        try:
            super().extract_pool_nft(values)
        except InvalidPoolError:
            if len(values["assets"]) == 0:
                raise NoAssetsError
            else:
                raise NotAPoolError("No pool NFT found.")

    @classmethod
    def post_init(cls, values):
        super().post_init(values)

        assets = values["assets"]
        datum = SundaeV3PoolDatum.from_cbor(values["datum_cbor"])

        if len(assets) == 2:
            assets.root[assets.unit(0)] -= datum.protocol_fees

        values["fee"] = [datum.bid_fees_per_10_thousand, datum.ask_fees_per_10_thousand]

        settings = get_backend().get_datum_from_address(
            Address.decode(
                "addr1w9680rk7hkue4e0zkayyh47rxqpg9gzx445mpha3twge75sku2mg0",
            ),
        )

        datum = SundaeV3Settings.from_cbor(settings.datum_cbor)
        cls._batcher_fee = Assets(lovelace=datum.simple_fee + datum.base_fee)

    def swap_datum(
        self,
        address_source: Address,
        in_assets: Assets,
        out_assets: Assets,
        extra_assets: Assets | None = None,
        address_target: Address | None = None,
        datum_target: PlutusData | None = None,
    ) -> PlutusData:
        if self.swap_forward and address_target is not None:
            print(f"{self.__class__.__name__} does not support swap forwarding.")

        ident = bytes.fromhex(self.pool_nft.unit()[64:])

        datum = SundaeV3OrderDatum.create_datum(
            ident=ident,
            address_source=address_source,
            in_assets=in_assets,
            out_assets=out_assets,
            fee=self.batcher_fee(in_assets=in_assets, out_assets=out_assets).quantity(),
        )

        return datum

pool_id: str property

A unique identifier for the pool.

SwapConfig dataclass

Bases: PlutusData

Swap configuration.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
56
57
58
59
60
61
62
63
64
@dataclass
class SwapConfig(PlutusData):
    """Swap configuration."""

    CONSTR_ID = 0

    direction: Union[AtoB, BtoA]
    amount_in: int
    amount_out: AmountOut

WithdrawConfig dataclass

Bases: PlutusData

Withdraw configuration.

Source code in src/charli3_dendrite/dexs/amm/sundae.py
93
94
95
96
97
98
99
@dataclass
class WithdrawConfig(PlutusData):
    """Withdraw configuration."""

    CONSTR_ID = 1

    amount_lp: int