How It Works
The user makes a tx (the only tx that the user makes in the whole flow) which creates a
Request
on Autonomy that asks Autonomy to call the limits/stops contract. Initially thisRequest
is impossible to execute, because the condition is codified in arequire
statement - any tx that tries to execute theRequest
will revert. This check is done on the actual input/output amounts of the trade, and is therefore a guarantee that the user will always get the trade they want, and doesn't need to rely on an oracle. The user still has their tokens in their wallet.The price on the DEX drops to $900 as 3rd parties trade on it.
The Autonomy bots are constantly simulating whether executing a
Request
will succeed or revert. If they see it would succeed, that means that the condition for the trade is now true, and therequire
statement won't make the tx revert. This means the bot can know when a trade can be executed without knowing anything about tokens or prices or oracles. The bot now executes theRequest
, which atomically swaps the user's input token to the output token and it shows up in their wallet. At no point does the bot ever have control over the user's tokens.
Last updated