Skip to content

Commit cbdebd2

Browse files
committed
docs(solver): add setup explanation
1 parent bbebdb7 commit cbdebd2

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

bin/onlyswaps-solver/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,39 @@ router_address = "0x83b2dFc83E41a2398e28e31C352E1053805e4C16"
4242
permit2_relayer_address = "0x862acc167842c72B6f5B6b4091573dDE91A5AcfB"
4343

4444
```
45+
46+
## Initial setup
47+
The current version of the solver relies on [Uniswap's permit2 contract](https://docs.uniswap.org/contracts/permit2/overview) for EIP-712 (i.e., gasless) token approvals for any ERC20 tokens.
48+
This requires a one-time setup which consists of giving an unlimited token approval to the permit2 contract for each configured tokens.
49+
Given that the contracts have been audited (see [here](https://github.com/Uniswap/permit2/tree/main/audits)), and have undergone public scrutiny for several years, the risk of an unlimited approval to permit2 is very low.
50+
51+
The initial setup can be done with the following command:
52+
```bash
53+
> cargo run -p onlyswaps-solver -- --config ./path/to/my/config.toml --private-key $PRIV setup
54+
Loading app config from ./path/to/my/config.toml
55+
The following allowances are required:
56+
Chain Token Address Permit2
57+
------------------------------------------------------------------------------------------
58+
56 0x55d398326f99059fF775485246999027B3197955 Default
59+
314 0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 Custom (0x1Ea2dBcB20263a969A017022E8B1C1dc13BD2470)
60+
43114 0x1b0F6cF6f3185872a581BD2B5a738EB52CCd4d76 Default
61+
62+
Proceed? [y/n]: y
63+
Sending txs...
64+
> [Chain 56] sending approve for 0x55d398326f99059fF775485246999027B3197955...
65+
> [Chain 314] sending approve for 0x80B98d3aa09ffff255c3ba4A241111Ff1262F045...
66+
> [Chain 43114] sending approve for 0x1b0F6cF6f3185872a581BD2B5a738EB52CCd4d76...
67+
> [Chain 56] approval for 0x55d398326f99059fF775485246999027B3197955 sent successfully
68+
> [Chain 43114] approval for 0x1b0F6cF6f3185872a581BD2B5a738EB52CCd4d76 sent successfully
69+
> [Chain 314] approval for 0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 sent successfully
70+
71+
Transaction results:
72+
Chain Token Address Result
73+
------------------------------------------------------------------------------------------
74+
56 0x55d398326f99059fF775485246999027B3197955 mined in 0xc1fc22d51f3130574da2c2501ed10aca986ab5e3a388b9f9d57717d630374d1c
75+
314 0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 mined in 0xf2f206ed3439b80a43c08bfd042da99596f689cdc155243bea187e47f5cbeb5f
76+
43114 0x1b0F6cF6f3185872a581BD2B5a738EB52CCd4d76 mined in 0x4044eadc976bdd4546649e41e573eca30786593969b1ca4582d713892a1e4134
77+
```
78+
79+
After executing the command, the binary first checks which chain / token pairs require an approval, and ask for confirmation.
80+
Upon acceptance, a transaction per chain / token pair is sent, and the result is displayed.

0 commit comments

Comments
 (0)