Skip to content

Commit 75e38c3

Browse files
committed
add interfaces docs
1 parent 207cf7e commit 75e38c3

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed

docs/interfaces.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# EulerSwap interfaces
2+
3+
## **IEulerSwap interface**
4+
5+
### **Overview**
6+
7+
The `IEulerSwap` interface defines the core functionality for executing token swaps, activating the contract, and verifying the swapping curve invariant.
8+
9+
### **Functions**
10+
11+
#### `swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;`
12+
13+
- **description**: Optimistically sends the requested amounts of tokens to the `to` address, invokes `uniswapV2Call` callback on `to` (if `data` was provided), and then verifies that a sufficient amount of tokens were transferred to satisfy the swapping curve invariant.
14+
15+
#### `activate() external;`
16+
17+
- **description**: Approves the vaults to access the EulerSwap instance's tokens, and enables vaults as collateral. Can be invoked by anybody, and is harmless if invoked again. Calling this function is optional: EulerSwap can be activated on the first swap.
18+
19+
#### `verify(uint256 newReserve0, uint256 newReserve1) external view returns (bool);`
20+
21+
- **description**: Function that defines the shape of the swapping curve. Returns true if the specified reserve amounts would be acceptable (i.e., above and to-the-right of the swapping curve).
22+
23+
### **Accessors**
24+
25+
#### `curve() external view returns (bytes32);`
26+
27+
- **description**: Returns the identifier of the swapping curve.
28+
29+
#### `vault0() external view returns (address);`
30+
31+
- **description**: Returns the address of vault 0.
32+
33+
#### `vault1() external view returns (address);`
34+
35+
- **description**: Returns the address of vault 1.
36+
37+
#### `asset0() external view returns (address);`
38+
39+
- **description**: Returns the address of asset 0.
40+
41+
#### `asset1() external view returns (address);`
42+
43+
- **description**: Returns the address of asset 1.
44+
45+
#### `myAccount() external view returns (address);`
46+
47+
- **description**: Returns the address of the account managing EulerSwap.
48+
49+
#### `initialReserve0() external view returns (uint112);`
50+
51+
- **description**: Returns the initial reserve amount of asset 0.
52+
53+
#### `initialReserve1() external view returns (uint112);`
54+
55+
- **description**: Returns the initial reserve amount of asset 1.
56+
57+
#### `feeMultiplier() external view returns (uint256);`
58+
59+
- **description**: Returns the fee multiplier applied to transactions.
60+
61+
#### `getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 status);`
62+
63+
- **description**: Retrieves the current reserve amounts and contract status.
64+
65+
### **Curve accessors**
66+
67+
#### `priceX() external view returns (uint256);`
68+
69+
- **description**: Returns the price of asset X in terms of asset Y.
70+
71+
#### `priceY() external view returns (uint256);`
72+
73+
- **description**: Returns the price of asset Y in terms of asset X.
74+
75+
#### `concentrationX() external view returns (uint256);`
76+
77+
- **description**: Returns the liquidity concentration of asset X.
78+
79+
#### `concentrationY() external view returns (uint256);`
80+
81+
- **description**: Returns the liquidity concentration of asset Y.
82+
83+
---
84+
85+
## **IEulerSwapPeriphery interface**
86+
87+
### **Overview**
88+
89+
The `IEulerSwapPeriphery` interface provides auxiliary functions for quoting token swap amounts before execution.
90+
91+
### **Functions**
92+
93+
#### `quoteExactInput(address eulerSwap, address tokenIn, address tokenOut, uint256 amountIn) external view returns (uint256);`
94+
95+
- **description**: Calculates how much `tokenOut` can be received for `amountIn` of `tokenIn`.
96+
97+
#### `quoteExactOutput(address eulerSwap, address tokenIn, address tokenOut, uint256 amountOut) external view returns (uint256);`
98+
99+
- **description**: Calculates how much `tokenIn` is required to receive `amountOut` of `tokenOut`.
100+
101+
---
102+
103+
## **IUniswapV2Callee interface**
104+
105+
### **Overview**
106+
107+
The `IUniswapV2Callee` interface defines the callback function used for executing swaps on EulerSwap.
108+
109+
### **Functions**
110+
111+
#### `uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external;`
112+
113+
- **description**: Callback function invoked by EulerSwap during a swap operation, allowing the contract to perform additional logic.

0 commit comments

Comments
 (0)