evm/Pool/Interface

examples/evm/Pool/Interface.omg

examples/evm/Pool/Interface.omg53 lines
1-- Constructor, signals and operation boundaries. No storage or handlers.
2let S = std:EVM/Solidity
3let Args = { token0 : S.Address, token1 : S.Address }
4let Imm = S.Value Args
5let Swap = { amountIn : Word 112, minOut : Word 112, to : S.Address }
6let Events =
7      < Swap :
8          { sender : S.Indexed S.Address
9          , to : S.Indexed S.Address
10          , zeroForOne : Bool
11          , amountIn : Word 256
12          , amountOut : Word 256
13          }
14      | Mint :
15          { to : S.Indexed S.Address, amount0 : Word 256, amount1 : Word 256, shares : Word 256 }
16      | Burn :
17          { from : S.Indexed S.Address
18          , to : S.Indexed S.Address
19          , amount0 : Word 256
20          , amount1 : Word 256
21          , shares : Word 256
22          }
23      >
24let Errors =
25      < Liquidity
26      | Slippage : { minOut : Word 256, out : Word 256 }
27      | Overflow
28      | NoShares
29      | TransferFailed
30      >
31let O = std:EVM/Operations
32let swap = O.writing { Args = Swap, Result = Word 112 }
33let operations
34    : O.Schema
35    = O.interface
36        { swapExact0For1 = swap
37        , swapExact1For0 = swap
38        , addLiquidity =
39            O.writing
40              { Args = { amount0 : Word 112, amount1 : Word 112, to : S.Address }
41              , Result = Word 112
42              }
43        , removeLiquidity =
44            O.writing
45              { Args = { shares : Word 112, to : S.Address }
46              , Result = { amount0 : Word 112, amount1 : Word 112 }
47              }
48        , getReserves =
49            O.reading { Args = {}, Result = { reserve0 : Word 112, reserve1 : Word 112 } }
50        , sharesOf = O.reading { Args = { owner : S.Address }, Result = Word 256 }
51        , totalShares = O.reading { Args = {}, Result = Word 256 }
52        }
53in  { Args, Imm, Events, Errors, operations }
Your result
Complete file: examples/evm/Pool/Interface.omg · with imports