1 of 129

Reimagining the AMM with 1inch Aqua

Tanner Moore

2 of 129

Overview

  • Current landscape of DEXes
  • What Aqua is and how it reimagines AMM design
  • Tools we have built to streamline Aqua development
  • Extending beyond AMMs
  • Benefits for LPs, traders, and builders alike

3 of 129

Bob (LP)

4 of 129

WETH/USDC

Bob (LP)

5 of 129

WETH/USDC

Bob (LP)

6 of 129

WETH/USDC

Bob (LP)

7 of 129

WETH/USDC

Alice (Trader)

Bob (LP)

8 of 129

WETH/USDC

Bob (LP)

Alice (Trader)

9 of 129

WETH/USDC

Bob (LP)

Alice (Trader)

10 of 129

WETH/USDC

Bob (LP)

Alice (Trader)

11 of 129

WETH/USDC

Bob (LP)

Alice (Trader)

12 of 129

WETH/USDC

Bob (LP)

Alice (Trader)

13 of 129

Alice (Trader)

Bob (LP)

(LP 2)

14 of 129

Alice (Trader)

Bob (LP 1)

(LP 2)

(LP n+1)

15 of 129

Alice (Trader)

?

(LP 2)

(LP n+1)

Bob (LP 1)

16 of 129

Alice (Trader)

(LP 2)

(LP n+1)

Bob (LP 1)

17 of 129

Alice (Trader)

(LP 2)

(LP n+1)

Bob (LP 1)

18 of 129

Outcome

  • Liquidity "feels" unified to the user
  • In reality, fragmentation accelerated
  • Contracts reimplement custody, accounting, settlement, etc.

19 of 129

Drawbacks

20 of 129

Drawbacks

(From an LP perspective)

21 of 129

Drawbacks

  • Choosing where to deposit sucks

22 of 129

Bob (LP)

23 of 129

?

Bob (LP)

24 of 129

Drawbacks

  • Choosing where to deposit sucks

25 of 129

Drawbacks

  • Choosing where to deposit sucks
  • LP participation has high opportunity cost

26 of 129

Bob (LP)

27 of 129

Bob (LP)

28 of 129

Bob (LP)

29 of 129

Bob (LP)

30 of 129

DAO

Governance

Bob (LP)

31 of 129

Drawbacks

  • Choosing where to deposit sucks
  • LP participation has high opportunity cost

32 of 129

Drawbacks

  • Choosing where to deposit sucks
  • LP participation has high opportunity cost
  • Moving funds is high-friction

33 of 129

Bob (LP)

34 of 129

Bob (LP)

35 of 129

Bob (LP)

36 of 129

Bob (LP)

37 of 129

Bob (LP)

38 of 129

Bob (LP)

39 of 129

Bob (LP)

40 of 129

Bob (LP)

41 of 129

Drawbacks

  • Choosing where to deposit sucks
  • LP participation has high opportunity cost
  • Moving funds is high-friction

42 of 129

Drawbacks

  • Choosing where to deposit sucks
  • LP participation has high opportunity cost
  • Moving funds is high-friction
  • New projects increase fragmentation
    • And materially incentivise it!

43 of 129

Bob (LP)

44 of 129

?

Bob (LP)

45 of 129

?

?

Bob (LP)

46 of 129

?

?

Bob (LP)

47 of 129

Alice (Trader)

Bob (LP)

AMM

48 of 129

Alice (Trader)

Bob (LP)

AMM

49 of 129

Alice (Trader)

Bob (LP)

AMM

50 of 129

Bob (LP)

Alice (Trader)

AMM

51 of 129

Bob (LP)

Alice (Trader)

AMM

52 of 129

1inch Aqua

53 of 129

1inch Aqua

  • Liquidity stays in the LP's wallet
  • Liquidity is not bound to trading strategies
  • Settlement is atomic

54 of 129

Architecture

55 of 129

Architecture

  • Aqua Router
  • Aqua Apps
  • Strategies

56 of 129

Aqua Router

57 of 129

Aqua Router

  • 80-line smart contract
  • Responsible for 3 core functions
    • LP registrations
    • Balances
    • Swap settlement

58 of 129

Aqua Apps

59 of 129

Aqua Apps

  • Swap logic implementations
    • Constant product
    • Concentrated liquidity
    • Stableswap

60 of 129

Strategies

61 of 129

Strategies

  • LP commitments to Aqua Apps
    • Constant product, WETH/USDC, 1ETH/1500
    • Stableswap, USDT/USDS, 1000 each

62 of 129

WETH/USDC

Alice (Trader)

Bob (LP)

63 of 129

Bob (LP)

Alice (Trader)

64 of 129

Bob (LP)

Alice (Trader)

Aqua Router

65 of 129

Bob (LP)

Alice (Trader)

AMM

Aqua Router

Aqua App

Constant Product

66 of 129

Bob (LP)

Approve/

Permit

Alice (Trader)

Aqua Router

AMM

Aqua App

Constant Product

67 of 129

Bob (LP)

Aqua.Ship(...)

Alice (Trader)

Aqua Router

AMM

Aqua App

Constant Product

68 of 129

Bob (LP)

Alice (Trader)

AMM

Bob (LP)

Aqua Router

AMM

Strategy

Aqua App

Constant Product

69 of 129

Bob (LP)

Alice (Trader)

(emit)�strategy data

AMM

AMM

Bob (LP)

Aqua Router

Strategy

Aqua App

Constant Product

70 of 129

Bob (LP)

Alice (Trader)

(emit)�strategy data

Indexer�(offchain)

AMM

Bob (LP)

AMM

AMM

Bob (LP)

Aqua Router

Strategy

Strategy

Aqua App

Constant Product

71 of 129

Bob (LP)

Alice (Trader)

Indexer�(offchain)

Bob (LP)

AMM

AMM

Bob (LP)

Aqua Router

Strategy

AMM

Strategy

Aqua App

Constant Product

72 of 129

Bob (LP)

Alice (Trader)

Bob's balance information

Indexer�(offchain)

Bob (LP)

AMM

AMM

Bob (LP)

Aqua Router

Strategy

AMM

Strategy

Aqua App

Constant Product

73 of 129

Bob (LP)

Alice (Trader)

Indexer�(offchain)

Bob (LP)

Quote

AMM

AMM

Bob (LP)

Aqua Router

Strategy

AMM

Strategy

Aqua App

Constant Product

74 of 129

Bob (LP)

Alice (Trader)

Indexer�(offchain)

Bob (LP)

AMM

AMM

Bob (LP)

Aqua Router

Strategy

AMM

Strategy

Aqua App

Constant Product

75 of 129

Bob (LP)

Alice (Trader)

Verify Bob's commitment

Indexer�(offchain)

Bob (LP)

AMM

AMM

Bob (LP)

Aqua Router

Strategy

AMM

Strategy

Aqua App

Constant Product

76 of 129

Bob (LP)

Alice (Trader)

Indexer�(offchain)

Bob (LP)

AMM

AMM

Bob (LP)

Aqua Router

Strategy

AMM

Strategy

Aqua App

Constant Product

77 of 129

Bob (LP)

Alice (Trader)

Indexer�(offchain)

Bob (LP)

AMM

AMM

Bob (LP)

Aqua Router

Strategy

AMM

Strategy

Aqua App

Constant Product

78 of 129

Bob (LP)

Alice (Trader)

Indexer�(offchain)

Bob (LP)

AMM

AMM

Bob (LP)

Aqua Router

Strategy

AMM

Strategy

Aqua App

Constant Product

79 of 129

Bob (LP)

Alice (Trader)

Indexer�(offchain)

Bob (LP)

AMM

AMM

Bob (LP)

Aqua Router

Strategy

AMM

Strategy

Aqua App

Constant Product

80 of 129

What do we get?

81 of 129

What do we get?

  • LPs can send/sell committed tokens whenever
  • LPs can participate in governance
  • LPs can reuse tokens for other Aqua apps / strategies

82 of 129

Bob (LP)

83 of 129

Bob (LP)

$1000

$1000

$1000

$1000

84 of 129

Bob (LP)

$4000

85 of 129

Bob (LP)

Aqua Router

86 of 129

Bob (LP)

Aqua Router

$1000

$1000

87 of 129

Bob (LP)

Aqua Router

$2000

88 of 129

Bob (LP)

Aqua Router

Bob (LP)

$2000

$2000

89 of 129

Bob (LP)

Aqua Router

Bob (LP)

Bob (LP)

$2000

$2000

$2000

90 of 129

Bob (LP)

Aqua Router

Bob (LP)

Bob (LP)

$2000

$2000

$2000

$4000

Bob's actual liquidity:

91 of 129

Bob (LP)

Aqua Router

Bob (LP)

Bob (LP)

$2000

$2000

$2000

$6000

$4000

Bob's effective liquidity:

Bob's actual liquidity:

92 of 129

Bob (LP)

Aqua Router

Bob (LP)

Bob (LP)

$2000

$2000

$2000

93 of 129

Bob (LP)

Alice (Trader)

AMM

Aqua Router

Bob (LP)

Bob (LP)

$2000

$2000

$2000

Aqua App

Constant Product

94 of 129

Bob (LP)

Aqua Router

Bob (LP)

Tony (Trader)

Bob (LP)

$2000

$2000

$2000

Alice (Trader)

AMM

Aqua App

Constant Product

95 of 129

Bob (LP)

Alice (Trader)

Aqua Router

Bob (LP)

Craig (Trader)

Tony (Trader)

Bob (LP)

$2000

$2000

$2000

AMM

Aqua App

Constant Product

96 of 129

Aqua Router

Bob (LP)

Craig (Trader)

Tony (Trader)

Bob (LP)

$2000

$2000

Large trades in same block

AMM

Aqua App

Constant Product

97 of 129

Aqua Router

Bob (LP)

Craig (Trader)

Tony (Trader)

Bob (LP)

$2000

$2000

Large trades in same block

AMM

Aqua App

Constant Product

98 of 129

Constant Product

Aqua App

99 of 129

Concentrated Liquidity

Aqua App

100 of 129

Stableswap

Aqua App

101 of 129

Stableswap

Aqua App

Constant Product

Aqua App

Concentrated Liquidity

Aqua App

102 of 129

Stableswap

Constant Product

Concentrated Liquidity

Aqua App

SwapVM

103 of 129

SwapVM

  • Building block functions for swaps
    • Price curves
    • Taker restrictions
    • Fees
    • Deadlines

104 of 129

Constant Product - Aqua App

Constant Product - SwapVM

105 of 129

SwapVM

  • Building blocks are opcodes under the hood

106 of 129

SwapVM

  • Building blocks are opcodes under the hood
  • Can call to external contracts for additional data
    • Oracle data

107 of 129

SwapVM

  • Building blocks are opcodes under the hood
  • Can call to external contracts for additional data
  • Custom opcodes can be written*

108 of 129

Aqua extends beyond AMMs

109 of 129

Aqua Apps extend beyond AMMs

  • Prediction markets
  • Privacy pools
  • Flash loans

110 of 129

Aqua Apps extend beyond AMMs

  • Prediction markets
  • Privacy pools
  • Flash loans
  • SwapVM can be used in most projects!

111 of 129

Bob (LP)

Alice (Trader)

AMM

AMM

Bob (LP)

Aqua Router

Strategy

Aqua App

Constant Product

112 of 129

Bob (LP)

Alice (Trader)

Flash Loans

Flash Loans

Bob (LP)

Aqua Router

Strategy

Aqua App

113 of 129

Bob (LP)

Alice (Trader)

Flash Loans

Flash Loans

Bob (LP)

Aqua Router

Strategy

Borrow amount + payload

Aqua App

114 of 129

Bob (LP)

Alice (Trader)

Flash Loans

Flash Loans

Bob (LP)

Aqua Router

Strategy

Verify Bob's commitment

Aqua App

115 of 129

Bob (LP)

Alice (Trader)

Flash Loans

Flash Loans

Bob (LP)

Aqua Router

Strategy

Aqua App

116 of 129

Bob (LP)

Alice (Trader)

Flash Loans

Flash Loans

Bob (LP)

Aqua Router

Strategy

Aqua App

117 of 129

Bob (LP)

Alice (Trader)

Flash Loans

Flash Loans

Bob (LP)

Aqua Router

Strategy

Execute flash loan payload

Aqua App

118 of 129

Bob (LP)

Alice (Trader)

Flash Loans

Flash Loans

Bob (LP)

Aqua Router

Strategy

Aqua App

119 of 129

Bob (LP)

Alice (Trader)

Flash Loans

Flash Loans

Bob (LP)

Aqua Router

Strategy

Aqua App

120 of 129

Bob (LP)

Alice (Trader)

Flash Loans

Flash Loans

Bob (LP)

Aqua Router

Strategy

Aqua App

121 of 129

Bob (LP)

Aqua

Flash loans

122 of 129

Bob (LP)

Aqua

Constant Product

123 of 129

Bob (LP)

Aqua

Stableswap

124 of 129

Bob (LP)

Aqua

Flash loans

Bob (LP)

Aqua

Constant Product

Bob (LP)

Aqua

Stableswap

125 of 129

Impact on the DeFi market

126 of 129

Impact on the DeFi market

  • For LPs
    • Higher utilization of funds / better yields
  • For DeFi users
    • Better prices for DeFi apps
  • For builders
    • Fast path to production / users

127 of 129

Bounties!

  • Build a new Aqua app on 1inch
    • $5000 split across top 3
  • Extend an existing app to include Aqua
    • $2000 split across top 2

128 of 129

Thank You

129 of 129

Get Hacking!