From 9cc35a06abdd75eb7c546913e9684cb966199d6e Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Thu, 21 Jul 2022 04:06:29 -0400 Subject: [PATCH] Add authenticated calls to Ethereum Also uses numbered lists for function descriptions. --- docs/integrations/Ethereum.md | 22 ++++++++++++++++++++++ docs/integrations/Instructions.md | 16 ++++++++-------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/docs/integrations/Ethereum.md b/docs/integrations/Ethereum.md index 3a563859..48dbec75 100644 --- a/docs/integrations/Ethereum.md +++ b/docs/integrations/Ethereum.md @@ -14,3 +14,25 @@ is the caller. `data` is limited to 255 bytes. ### Out Instructions `data` is limited to 255 bytes. + +If `data` is provided, the Ethereum Router will call a contract-calling child +contract in order to sandbox it. The first byte of `data` designates which child +child contract to call. After this byte is read, `data` is solely considered as +`data`, post its first byte. The child contract is sent the funds before this +call is performed. + +##### Child Contract 0 + +This contract is intended to enable connecting with other protocols, and should +be used to convert withdrawn assets to other assets on Ethereum. + + 1) Transfers the asset to `destination`. + 2) Calls `destination` with `data`. + +##### Child Contract 1 + +This contract is intended to enable authenticated calls from Serai. + + 1) Transfers the asset to `destination`. + 2) Calls `destination` with `data[.. 4], serai_address, data[4 ..]`, where +`serai_address` is the address which triggered this Out Instruction. diff --git a/docs/integrations/Instructions.md b/docs/integrations/Instructions.md index a0861f75..4a78e399 100644 --- a/docs/integrations/Instructions.md +++ b/docs/integrations/Instructions.md @@ -78,10 +78,10 @@ In Instruction { where `swap` is a function which: - - Swaps the incoming funds for SRI. - - Swaps the SRI for `coin`. - - Checks the amount of `coin` received is greater than `minimum`. - - Executes `out` with the amount of `coin` received. + 1) Swaps the incoming funds for SRI. + 2) Swaps the SRI for `coin`. + 3) Checks the amount of `coin` received is greater than `minimum`. + 4) Executes `out` with the amount of `coin` received. For a Bitcoin to Monero swap, Swap Shorthand is expected to generally take: @@ -115,11 +115,11 @@ In Instruction { where `swap_and_add_liquidity` is a function which: - - Swaps half of the incoming funds for SRI. - - Checks the amount of SRI received is greater than `minimum`. - - Calls `swap_and_add_liquidity` with the amount of SRI received - `gas`, and + 1) Swaps half of the incoming funds for SRI. + 2) Checks the amount of SRI received is greater than `minimum`. + 3) Calls `swap_and_add_liquidity` with the amount of SRI received - `gas`, and a matching amount of the incoming asset. - - Transfers any leftover funds to `address`. + 4) Transfers any leftover funds to `address`. For adding liquidity from Bitcoin, Add Liquidity Shorthand is expected to generally take: