Ride Execution
Last updated
Last updated
Once the Admin decides to depart the ride, it informs the Operator to stop accepting new join requests from users.
In the analogy of a bus ride, the ride can only depart once all passengers are physically standing on the bus.
Pre-departure, the collated DeFi Pooling funds must exist onchain in order to execute an onchain operation to trade them. Therefore, the admin waits until the Multipli smart contract state includes all settlements by users joining the ride. Once this is done, the funds of all the passengers are available on-chain in the Multipli smart-contract for the Pool Manager to use.
Next, the admin calls the Pool Manager Ride Departure function. This function executes the following operations:
The Pool Manager withdraws funds from the Multipli smart contract and applies them to the Pool Manager smart contract.
The Pool Manager buys strategy tokens for the entire value of deployed tokens it controls. This operation succeeds only if the price of this trade is lower than or equal to the price that the users agreed to when they joined the ride.
If the trade succeeds, the Pool Manager smart contract deposits the entire value of the strategy tokens it controls back to the Multipli smart contract; and submits an on-chain limit order to sell them for ride tickets. The price to buy one strategy token should be exactly the total amount of ride tickets divided by the total amount of strategy tokens.
If the trade doesn’t succeed, i.e., the price to buy strategy tokens was higher than the price the users agreed to pay, the Pool Manager smart contract deposits the capital tokens and submits an on-chain limit order to sell them back to the users in exchange for their ride tickets.