From 9560d0c5dfca7dd36292ab0357bb018d689199fe Mon Sep 17 00:00:00 2001 From: lash Date: Thu, 3 Aug 2023 17:23:36 +0100 Subject: [PATCH] Add swap description section --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2700a7c..be7620d 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,16 @@ The [erc20-limiter](https://holbrook.no/src/erc20-limiter/log.html) repository c This enables to publisher to use the same smart contract for both constructor arguments `tokenRegistry` and `tokenLimiter`. -## Handling values +## Swapping tokens + +The method used to execute token swaps is `withdraw(outToken, inToken, value)`. + +The `value` argument refers to the value of `inToken` that will be transferred to the pool contract, in exchange for some value of `outToken` (see below). + +In order to successfully execute the swap, an ERC20 "approval" must exist for the pool contract to spend at least the value of `inToken` specified by the `value` argument. + + +### Handling values The pool contract does no checking whatsoever regarding the sanity of allowing tokens in the pool.