At the moment, the yield earned by sunrise is being sent to a DAO treasury, to be used to manually purchase carbon tokens or be routed to climate projects. Spending from this treasury account, therefore, needs to happen via a DAO proposal.
The plan is for spending to be automatic and permissionless, i.e. a "crank" operation that buys and burns carbon tokens from a market every x days, or when the balance reaches a certain amount.
For this task:
create a program called YieldController.
this program has an "Initialize" instruction which sets up the following config:
market (a CLOB or AMM market used to purchase carbon tokens e.g. NCT)
purchase threshold (when the treasury reaches this value, make a purchase)
purchase proportion (amount of the treasury to spend on buying tokens. the rest is held back and sent to the DAO)
treasury address (the address controlled by the DAO to send the rest of the funds to)
and a "crank" instruction, which does the following
if the treasury balance is below the purchase threshold * purchase proportion, do nothing
if the treasury balance exceeds the threshold proportion, make a CPI into the AMM/CLOB to purchase NCT for the value balance proportion
(in the case of a CLOB) withdraw any NCT previously purchased
burn the NCT
send the rest (balance * (1 - proportion)) to the treasury address
Note, if the market is denominated in USDC, the program will need to swap SOL for USDC before purchasing NCT.
Intermediary step:
Initially, rather than adding the complexity around markets, we manually purchase NCT, and store them in a Token Account. A PDA owned by the program would be a delegate on this account, and each crank, the program would just burn balance * proportion of them.
For the intermediary step above, is the token account which stores the NCT for burning owned by the treasury, or would we still want to transfer the leftover tokens to a different address?
At the moment, the yield earned by sunrise is being sent to a DAO treasury, to be used to manually purchase carbon tokens or be routed to climate projects. Spending from this treasury account, therefore, needs to happen via a DAO proposal.
The plan is for spending to be automatic and permissionless, i.e. a "crank" operation that buys and burns carbon tokens from a market every x days, or when the balance reaches a certain amount.
For this task:
Note, if the market is denominated in USDC, the program will need to swap SOL for USDC before purchasing NCT.
Intermediary step: Initially, rather than adding the complexity around markets, we manually purchase NCT, and store them in a Token Account. A PDA owned by the program would be a delegate on this account, and each crank, the program would just burn balance * proportion of them.