h20liquidity / h20.communitystrats

Community strategies to share
0 stars 1 forks source link

DCA Univ3 community strategy - updated with DA inputs #6

Closed dcatki closed 3 months ago

dcatki commented 3 months ago

Updated community strat, oracle based DCA, uni v3

dcatki commented 3 months ago

Things to focus on

  1. Add updated uniswap subparser
  2. io-ratio, so max and min and relative to buy and sell
dcatki commented 3 months ago

In the rainlang

This will be max or min io-ratio

grid-min !Minimum dollar denominated price to trade distribution token for and against stable token.

grid-max !Maximum dollar denominated price to trade distribution token for and against stable token.

This should be in reference currency not USD

mean-usd-amount !Mean dollar denominated amount of stable tokens traded.

Change this to oracle-dca or something similar

ensure-grid-band-chart

ensure-grid-band-prod

what if this isnt in stables, like they want to liquidate eth for link?

calculate-io-ratio-buy

usd-amount18 token-amount18 ratio-multiplier time-since-cooldown: , io-ratio: div(token-amount18 add(usd-amount18 call<'bounty-auction>(time-since-cooldown))), :call<'calculate-twap-ratio>(io-ratio ratio-multiplier), / Add io-ratio and max-op on stack/ : usd-amount18, _: io-ratio;

calculate-io-ratio-sell

usd-amount18 token-amount18 ratio-multiplier time-since-cooldown: , io-ratio: div(saturating-sub(usd-amount18 call<'bounty-auction>(time-since-cooldown)) token-amount18), :call<'calculate-twap-ratio>(io-ratio inv(ratio-multiplier)), / Add io-ratio and max-op on stack/ : token-amount18, _: io-ratio;

calculate-exact-buy-quote

amount-usd18 ratio-multiplier: , _: uniswap-v3-quote-exact-input(reserve-token distribution-token mul(amount-usd18 ratio-multiplier) twap-io-fee);

why are these duplicated

tokens: token-link: network: h20-community-polygon address: 0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39 token-usdt: network: h20-community-polygon address: 0xc2132D05D31c914a87C6611C10748AEb04B58e8F token-usdc: network: h20-community-polygon address: 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 token-wmatic: network: h20-community-polygon address: 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270

      # Distribution token, i.e token that is bought or sold, for and against the stable token.
      distribution-token: 0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39
      # Stable token, token with price pegged to one dollar.
      stable-token: 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174

      # If the distribution token is paired with a stable token in a univ3 pool,
      # then address for this binding is same as the stable token address.
      # Eg: If the uniswap-v3 pair is LINK-USDC, then reserve token address is same as USDC address.
      #
      # If the distribution token is paired with native wrapped token in a univ3 pool,
      # then address for this binding is the address of the native wrapped token.
      # Eg: If the uniswap-v3 pair is LINK-WETH, then reserve token address is same as WETH address.
      # This reserve token will be compared against stable token to calculate the dollar
      # equivalent twap.
      reserve-token: 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174