Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.sail.exchange/llms.txt

Use this file to discover all available pages before exploring further.

The order settler is called by the transaction script when something is executed on the exchange. It calls Sway’s built-in log function to create a reciept that can be seen by an indexer. Below is something resembling the order settler code for Sail Exchange:
order_settler.sw
    contract;

    use std::logging::log;
    use order::{LimitOrder, OrderSettler};


    struct MakeOrder {
        id: u64,
        order: LimitOrder,
    }
    struct TakeOrder {
        id: u64,
        order: LimitOrder,
    }
    struct CancelOrder {
        id: u64,
        order: LimitOrder,
    }


    impl OrderSettler for Contract {
        fn take(id: u64, order: LimitOrder) {
            log(TakeOrder { id, order })
        }
        fn make(id: u64,order: LimitOrder) {
            log(MakeOrder { id, order })
        }
        fn cancel(id: u64, order: LimitOrder) {
            log(CancelOrder { id, order })
        }
    }