Please describe your proposed solution.
WingRiders will develop a new Plutarch script that will serve as an intermediary script for request outputs with datum hash forwarding capabilities. This allows extending the core protocol with functionalities such as routed swaps or zap-in.
This will enable several use cases such as routed swaps, zap-in functionality, and improved interoperability with other DApps and DEX aggregators in the Cardano ecosystem. Use cases can involve advanced exchange strategies as well as multi-asset checkouts.DeFi projects can leverage the intermediary script for advanced integrations, while the open-source datum hash forwarding script benefits developers and projects within the ecosystem. Users experience a streamlined process, and Stake Pool Operators witness improved blockchain utility, potentially attracting more users and transactions. Investors benefit from a more robust DeFi ecosystem, contributing to increased adoption and ADA value. The solution aligns with the goals of developers and researchers, fostering collaboration and contributing to the growth of the Cardano ecosystem.
Let’s demonstrate a potential usage on routed swaps.
Imagine a user who wants to swap WRTs for SHEN. The best route to do this is first to swap WRT for ADA and then wait for the first swap to process and then manually do a second swap of ADA for SHEN. This is not the best UX possible, it requires the user to submit 2 transactions and wait in between them.
With the intermediary script, it would be possible for the user to submit one swap request (WRT -> ADA), when it gets processed it creates an output on the intermediary script. This output then gets immediately spent by the batching agent, at no extra cost to the user, creating a new swap request (ADA -> SHEN). That then gets processed and the user receives the SHEN they want. In this case, the user still needs to pay the agent fee twice, but the overall experience is much more seamless, as the user only submits one request and everything else is handled by the batching agent.
Also with sufficient modifications to the WingRiders batching agent, it should be even possible to achieve routed swaps or zap-in, under ideal blockchain conditions, in the same block, making it similar in speed to a normal simple interaction with the core protocol. The agent would simply submit the first batch TX, the spending of the intermediary script, and the second batch TX at the same time, making a TX chain, that has a high probability of getting accepted into one block.
Currently, the design limitations of the WingRiders protocol only allow script outputs with a predefined datum hash. To enable datum hash forwarding, the intermediary script would be parametrized with the script address and datum hash beforehand. They would get stored in the transaction metadata.
That enables the script to retain the necessary data while conforming to the requirements of a predefined datum hash on a request output. Spending this intermediary request output would require creating an output on the script address with the datum hash defined in the parametrization process.
Why Plutarch and not Aiken?
With the advent of Aiken bringing easier and faster development cycles bundled together with smaller script sizes and undeniable performance benefits, it seems like an obvious choice compared to using PlutusTx. However, the decision isn't as clear-cut when it comes to comparing Aiken and Plutarch. Yes, the former offers significantly better tooling support and can be a great choice for developers just starting with the Cardano ecosystem, but ultimately Plutarch allows far greater control over the generated code because of how close it is to the underlying Plutus Core language. Plutarch is the most efficient way of writing smart contracts on Cardano available today if you prioritize performance and want to offer the smallest fees possible.