Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DCA Univ3 community strategy - updated with DA inputs #6

Merged
merged 8 commits into from
Jun 30, 2024
Merged

Conversation

dcatki
Copy link
Contributor

@dcatki dcatki commented Jun 27, 2024

Updated community strat, oracle based DCA, uni v3

@dcatki
Copy link
Contributor Author

dcatki commented Jun 27, 2024

Things to focus on

  1. Add updated uniswap subparser
  2. io-ratio, so max and min and relative to buy and sell

@dcatki dcatki changed the title updated with DA inputs DCA Univ3 community strategy - updated with DA inputs Jun 27, 2024
@dcatki
Copy link
Contributor Author

dcatki commented Jun 27, 2024

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

Siddharth2207 and others added 7 commits June 28, 2024 22:29
tokens:
  tkn-link:
    network: h20-community-polygon
    address: 0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39
  tkn-usdt:
    network: h20-community-polygon
    address: 0xc2132D05D31c914a87C6611C10748AEb04B58e8F
  tkn-usdc:
    network: h20-community-polygon
    address: 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
  tkn-wmatic:
    network: h20-community-polygon
    address: 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270
@dcatki dcatki merged commit 6fc7742 into main Jun 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants