KlimaDAO / klimadao

Monorepo for the official KlimaDAO site, dApp, components and design system.
https://klimadao.finance
MIT License
90 stars 71 forks source link

Simple Cross-chain Retirement Interface #2334

Open 0xAurelius opened 3 months ago

0xAurelius commented 3 months ago

Is your feature request related to a problem? Please describe. Simple UX for retiring pool tokens using $KLIMA from any chain using pre-populated parameters as much as possible

Describe the solution you'd like A new app, integrating latest cross-chain functionality via Axelar to issue retirements from multiple chains to underlying Polygon carbon credit tokens.

As a first pass, simply retire the default project from BCT pool, meaning we hard-code those addresses into the function call:

This initial implementation should pre-populate as many fields as possible in the retireExactCarbonDefault function: https://docs.klimadao.finance/developers/contracts/retirement/v2-diamond/generalized-retirement#retire-exact-carbon

For retirement message, offer the user a generic pre-filled value (e.g. "Doing my part to support climate action") with the opportunity to override if they want

Screenshots from optima about requirements: offset1 offset2

Other notes on requirements:

Describe alternatives you've considered This doesn't really fit into Carbonmark's roadmap so having it as a standalone application within the KlimaDAO app is the quickest path forward - but we won't offer the full marketplace functionality that Carbonmark has as that's way too much scope

Additional context To create and deploy a new app within this repo:

Atmosfearful commented 2 months ago

Overview:

Notes: We don't know if the final polygon retirement transaction will succeed or fail until after:

  1. Confirmed in a block on Base
  2. Communicated across the Axelar network
  3. Initiated (via the Axelar relayer) on Polygon This can take between 5-20 minutes.
    • [ ] When a txn fails it is funded to the fallbackRecipient on polygon. So we must make sure to prefill that address, and the beneficiary address, as the connected users wallet (not configurable).

User needs a way to track the above 3 steps:

Constructing the retirement data:

Remaining work to be done on the Contract side:

  1. Make $KLIMA bridgeable to and from base via Axelar
  2. Update contract to use $KLIMA as payment in addition to $USDC (the frontend will only support Base Native USDC)
jabby09 commented 2 weeks ago

@0xMakka please checkin with @Atmosfearful before you start on this because he did some work in a local PR related to completing this work

0xMakka commented 1 week ago

@Atmosfearful @cujowolf a few quick questions

1) Max slippage requirements - in the legacy offset app, the slippage/aggregation fee looks to be 1%, should this slippage be 1% or 2% for base? Also this still needs to be included right, the fact we are only supporting KLIMA as the payment token and not USDC?

2) Approvals - does the Axelar contract still require an approval step? i.e. approval to spend the users Base KLIMA?

3) @Atmosfearful On the UI, it's mentioned above that a retirement can take up to 20 minutes. After submitting the transaction, we receive a transaction hash from axelar. Is it enough to display this axelar transaction link to the user or should we be putting both this link and a link to the /retirements page on carbonmark with the user address?