Skip to content

Commit 1504325

Browse files
committed
docs(solver): add setup explanation
1 parent c02d8d0 commit 1504325

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
@@ -49,3 +49,39 @@ It is also possible to configure the solver with an external omnievent endpoint
4949
[omnievent]
5050
endpoint = "https://omnievent:3284"
5151
```
52+
53+
## Initial setup
54+
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.
55+
This requires a one-time setup which consists of giving an unlimited token approval to the permit2 contract for each configured tokens.
56+
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.
57+
58+
The initial setup can be done with the following command:
59+
```bash
60+
> cargo run -p onlyswaps-solver -- --config ./path/to/my/config.toml --private-key $PRIV setup
61+
Loading app config from ./path/to/my/config.toml
62+
The following allowances are required:
63+
Chain Token Address Permit2
64+
------------------------------------------------------------------------------------------
65+
56 0x55d398326f99059fF775485246999027B3197955 Default
66+
314 0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 Custom (0x1Ea2dBcB20263a969A017022E8B1C1dc13BD2470)
67+
43114 0x1b0F6cF6f3185872a581BD2B5a738EB52CCd4d76 Default
68+
69+
Proceed? [y/n]: y
70+
Sending txs...
71+
> [Chain 56] sending approve for 0x55d398326f99059fF775485246999027B3197955...
72+
> [Chain 314] sending approve for 0x80B98d3aa09ffff255c3ba4A241111Ff1262F045...
73+
> [Chain 43114] sending approve for 0x1b0F6cF6f3185872a581BD2B5a738EB52CCd4d76...
74+
> [Chain 56] approval for 0x55d398326f99059fF775485246999027B3197955 sent successfully
75+
> [Chain 43114] approval for 0x1b0F6cF6f3185872a581BD2B5a738EB52CCd4d76 sent successfully
76+
> [Chain 314] approval for 0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 sent successfully
77+
78+
Transaction results:
79+
Chain Token Address Result
80+
------------------------------------------------------------------------------------------
81+
56 0x55d398326f99059fF775485246999027B3197955 mined in 0xc1fc22d51f3130574da2c2501ed10aca986ab5e3a388b9f9d57717d630374d1c
82+
314 0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 mined in 0xf2f206ed3439b80a43c08bfd042da99596f689cdc155243bea187e47f5cbeb5f
83+
43114 0x1b0F6cF6f3185872a581BD2B5a738EB52CCd4d76 mined in 0x4044eadc976bdd4546649e41e573eca30786593969b1ca4582d713892a1e4134
84+
```
85+
86+
After executing the command, the binary first checks which chain / token pairs require an approval, and ask for confirmation.
87+
Upon acceptance, a transaction per chain / token pair is sent, and the result is displayed.

0 commit comments

Comments
 (0)