From b51b0c98948dbb7c5a78d12a1a0258b080298dcb Mon Sep 17 00:00:00 2001 From: dankelleher Date: Tue, 1 Aug 2023 08:59:05 +0200 Subject: [PATCH 1/2] Allow a yield account (treasury account) to be a non-system-owned account and switch to the offset bridge as the yield spender --- README.md | 2 +- packages/scripts/updateState.ts | 10 ++++++---- .../src/instructions/extract_to_treasury.rs | 2 +- .../src/instructions/init_epoch_report.rs | 3 ++- .../sunrise-stake/src/instructions/order_unstake.rs | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 54b740ac..1a937878 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ yarn test | TreasuryController Program | [sbnbpcN3HVfcj9jTwzncwLeNvCzSwbfMwNmdAgX36VW](https://explorer.solana.com/address/sbnbpcN3HVfcj9jTwzncwLeNvCzSwbfMwNmdAgX36VW) | [stcGmoLCBsr2KSu2vvcSuqMiEZx36F32ySUtCXjab5B](https://explorer.solana.com/address/stcGmoLCBsr2KSu2vvcSuqMiEZx36F32ySUtCXjab5B?cluster=devnet) | Program address for the [treasury controller](https://github.com/sunrise-stake/treasury-controller) | | | TreasuryController State | [DzyP73X4TWnh5jarfjapaNBxtjeEVsfknWVfToRYARDL](https://explorer.solana.com/address/DzyP73X4TWnh5jarfjapaNBxtjeEVsfknWVfToRYARDL) | [8Z8BwUqZTD8XyJ6sdEEeWLaZ9Bg1J7TRDoYPfhkGS9Hr](https://explorer.solana.com/address/8Z8BwUqZTD8XyJ6sdEEeWLaZ9Bg1J7TRDoYPfhkGS9Hr?cluster=devnet) | State PDA describing the configuration of the treasury controller - includes references to the token mint to purchase, proportion to pass to the treasury (currently 0) etc. | | | TreasuryController Update Authority | [48V9nmW9awiR9BmihdGhUL3ZpYJ8MCgGeUoSWbtqjicv](https://explorer.solana.com/address/48V9nmW9awiR9BmihdGhUL3ZpYJ8MCgGeUoSWbtqjicv) | [48V9nmW9awiR9BmihdGhUL3ZpYJ8MCgGeUoSWbtqjicv](https://explorer.solana.com/address/48V9nmW9awiR9BmihdGhUL3ZpYJ8MCgGeUoSWbtqjicv?cluster=devnet) | Update authority for the treasury controller state. In future this will be controlled by the [DAO](https://app.realms.today/dao/sunrisestake) | | -| Yield Account | [E7BjB9UQp814RsMPq7U6S4fy6wRzn6tFTYt31kJoskoq](https://explorer.solana.com/address/E7BjB9UQp814RsMPq7U6S4fy6wRzn6tFTYt31kJoskoq) | [GRrWR48gthj53CpmdvThjh3Nh5XtjNJLsxqdKtNpJyDp](https://explorer.solana.com/address/GRrWR48gthj53CpmdvThjh3Nh5XtjNJLsxqdKtNpJyDp?cluster=devnet) | PDA, owned by the treasury controller, that yield from Sunrise is deposited into, pending spending. | | +| Yield Account | [4XTLzYF3kteTbb3a9NYYjeDAYwNoEGSkjoqJYkiLCnmm](https://explorer.solana.com/address/4XTLzYF3kteTbb3a9NYYjeDAYwNoEGSkjoqJYkiLCnmm) | [GRrWR48gthj53CpmdvThjh3Nh5XtjNJLsxqdKtNpJyDp](https://explorer.solana.com/address/GRrWR48gthj53CpmdvThjh3Nh5XtjNJLsxqdKtNpJyDp?cluster=devnet) | PDA, owned by the treasury controller, that yield from Sunrise is deposited into, pending spending via [offset.sunrisestake.com](https://offset.sunrisestake.com) | | | Treasury Account | [Bup7DZk56XwQUDzuvBz9nzbr8e2iLPVrBpha1KTfEbbJ](https://explorer.solana.com/address/Bup7DZk56XwQUDzuvBz9nzbr8e2iLPVrBpha1KTfEbbJ) | [stdeYBs3MUtQN7zqgAQaxvsYemxncJKNDMJhciHct9M](https://explorer.solana.com/address/stdeYBs3MUtQN7zqgAQaxvsYemxncJKNDMJhciHct9M?cluster=devnet) | [Sunrise DAO](https://app.realms.today/dao/sunrisestake) treasury account | | | NCT Mint | [7sbtAMfAuSfsUvZKPWiXUXaizYCnpLL2BBnKNTU3wjfT](https://explorer.solana.com/address/7sbtAMfAuSfsUvZKPWiXUXaizYCnpLL2BBnKNTU3wjfT) | [tnct1RC5jg94CJLpiTZc2A2d98MP1Civjh7o6ShmTP6](https://explorer.solana.com/address/tnct1RC5jg94CJLpiTZc2A2d98MP1Civjh7o6ShmTP6?cluster=devnet) | Carbon token bought and burned by the treasury controller: [Toucan NCT](https://blog.toucan.earth/announcing-nct-nature-carbon-tonne/) - bridged via Wormhole from Polygon. | | | Holding Account SOL | [shcFT8Ur2mzpX61uWQRL9KyERZp4w2ehDEvA7iaAthn](https://explorer.solana.com/address/shcFT8Ur2mzpX61uWQRL9KyERZp4w2ehDEvA7iaAthn) | [dhcB568T3skiP2D9ujf4eAJEnW2gACaaA9BUCVbwbXD](https://explorer.solana.com/address/dhcB568T3skiP2D9ujf4eAJEnW2gACaaA9BUCVbwbXD?cluster=devnet) | Recipient account for SOL used to purchase NCT. (Temporary, until a liquid market for NCT exists on Solana) | | diff --git a/packages/scripts/updateState.ts b/packages/scripts/updateState.ts index 94838fe4..3cc9b30d 100644 --- a/packages/scripts/updateState.ts +++ b/packages/scripts/updateState.ts @@ -1,5 +1,5 @@ -import { SunriseStakeClient } from "../client/"; -import "./util"; +import { SunriseStakeClient } from "../client/src/index.js"; +import "./util.js"; import { AnchorProvider } from "@coral-xyz/anchor"; import { PublicKey } from "@solana/web3.js"; import {WalletAdapterNetwork} from "@solana/wallet-adapter-base"; @@ -18,8 +18,10 @@ import {WalletAdapterNetwork} from "@solana/wallet-adapter-base"; }); await client.update({ // dev - newTreasury: new PublicKey("GRrWR48gthj53CpmdvThjh3Nh5XtjNJLsxqdKtNpJyDp"), - // prod + // newTreasury: new PublicKey("GRrWR48gthj53CpmdvThjh3Nh5XtjNJLsxqdKtNpJyDp"), + // prod old treasury (Yield Controller) // newTreasury: new PublicKey("E7BjB9UQp814RsMPq7U6S4fy6wRzn6tFTYt31kJoskoq"), + // prod new treasury (Offset Bridge) + newTreasury: new PublicKey("4XTLzYF3kteTbb3a9NYYjeDAYwNoEGSkjoqJYkiLCnmm"), }); })().catch(console.error); diff --git a/programs/sunrise-stake/src/instructions/extract_to_treasury.rs b/programs/sunrise-stake/src/instructions/extract_to_treasury.rs index 1fd90a3c..709a3053 100644 --- a/programs/sunrise-stake/src/instructions/extract_to_treasury.rs +++ b/programs/sunrise-stake/src/instructions/extract_to_treasury.rs @@ -87,7 +87,7 @@ pub struct ExtractToTreasury<'info> { #[account(mut)] /// CHECK: Matches state.treasury - pub treasury: SystemAccount<'info>, // sunrise-stake treasury + pub treasury: UncheckedAccount<'info>, // sunrise-stake treasury #[account( mut, diff --git a/programs/sunrise-stake/src/instructions/init_epoch_report.rs b/programs/sunrise-stake/src/instructions/init_epoch_report.rs index 6b33d423..7a1c8874 100644 --- a/programs/sunrise-stake/src/instructions/init_epoch_report.rs +++ b/programs/sunrise-stake/src/instructions/init_epoch_report.rs @@ -14,6 +14,7 @@ pub struct InitEpochReport<'info> { has_one = marinade_state, has_one = blaze_state, has_one = update_authority, + has_one = treasury, )] pub state: Box>, @@ -78,7 +79,7 @@ pub struct InitEpochReport<'info> { pub get_bsol_from_authority: SystemAccount<'info>, // sunrise-stake PDA /// CHECK: Matches state.treasury - pub treasury: SystemAccount<'info>, // sunrise-stake treasury + pub treasury: UncheckedAccount<'info>, // sunrise-stake treasury #[account( init, diff --git a/programs/sunrise-stake/src/instructions/order_unstake.rs b/programs/sunrise-stake/src/instructions/order_unstake.rs index 730a6171..6dc25b92 100644 --- a/programs/sunrise-stake/src/instructions/order_unstake.rs +++ b/programs/sunrise-stake/src/instructions/order_unstake.rs @@ -72,7 +72,7 @@ pub struct OrderUnstake<'info> { #[account()] /// CHECK: Matches state.treasury - pub treasury: SystemAccount<'info>, // sunrise-stake treasury + pub treasury: UncheckedAccount<'info>, // sunrise-stake treasury pub clock: Sysvar<'info, Clock>, pub rent: Sysvar<'info, Rent>, From 0c713897bab0140f0d7d2ae34880d1d633504410 Mon Sep 17 00:00:00 2001 From: dankelleher Date: Wed, 30 Aug 2023 10:33:07 +0200 Subject: [PATCH 2/2] Update yield account on production --- README.md | 2 +- packages/scripts/updateState.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1a937878..6cf15103 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ yarn test | TreasuryController Program | [sbnbpcN3HVfcj9jTwzncwLeNvCzSwbfMwNmdAgX36VW](https://explorer.solana.com/address/sbnbpcN3HVfcj9jTwzncwLeNvCzSwbfMwNmdAgX36VW) | [stcGmoLCBsr2KSu2vvcSuqMiEZx36F32ySUtCXjab5B](https://explorer.solana.com/address/stcGmoLCBsr2KSu2vvcSuqMiEZx36F32ySUtCXjab5B?cluster=devnet) | Program address for the [treasury controller](https://github.com/sunrise-stake/treasury-controller) | | | TreasuryController State | [DzyP73X4TWnh5jarfjapaNBxtjeEVsfknWVfToRYARDL](https://explorer.solana.com/address/DzyP73X4TWnh5jarfjapaNBxtjeEVsfknWVfToRYARDL) | [8Z8BwUqZTD8XyJ6sdEEeWLaZ9Bg1J7TRDoYPfhkGS9Hr](https://explorer.solana.com/address/8Z8BwUqZTD8XyJ6sdEEeWLaZ9Bg1J7TRDoYPfhkGS9Hr?cluster=devnet) | State PDA describing the configuration of the treasury controller - includes references to the token mint to purchase, proportion to pass to the treasury (currently 0) etc. | | | TreasuryController Update Authority | [48V9nmW9awiR9BmihdGhUL3ZpYJ8MCgGeUoSWbtqjicv](https://explorer.solana.com/address/48V9nmW9awiR9BmihdGhUL3ZpYJ8MCgGeUoSWbtqjicv) | [48V9nmW9awiR9BmihdGhUL3ZpYJ8MCgGeUoSWbtqjicv](https://explorer.solana.com/address/48V9nmW9awiR9BmihdGhUL3ZpYJ8MCgGeUoSWbtqjicv?cluster=devnet) | Update authority for the treasury controller state. In future this will be controlled by the [DAO](https://app.realms.today/dao/sunrisestake) | | -| Yield Account | [4XTLzYF3kteTbb3a9NYYjeDAYwNoEGSkjoqJYkiLCnmm](https://explorer.solana.com/address/4XTLzYF3kteTbb3a9NYYjeDAYwNoEGSkjoqJYkiLCnmm) | [GRrWR48gthj53CpmdvThjh3Nh5XtjNJLsxqdKtNpJyDp](https://explorer.solana.com/address/GRrWR48gthj53CpmdvThjh3Nh5XtjNJLsxqdKtNpJyDp?cluster=devnet) | PDA, owned by the treasury controller, that yield from Sunrise is deposited into, pending spending via [offset.sunrisestake.com](https://offset.sunrisestake.com) | | +| Yield Account | [6HQrvpMJFqMj35JqMReyhnUrRXNucAAB6FywdDu7xPKA](https://explorer.solana.com/address/6HQrvpMJFqMj35JqMReyhnUrRXNucAAB6FywdDu7xPKA) | [GRrWR48gthj53CpmdvThjh3Nh5XtjNJLsxqdKtNpJyDp](https://explorer.solana.com/address/GRrWR48gthj53CpmdvThjh3Nh5XtjNJLsxqdKtNpJyDp?cluster=devnet) | PDA, owned by the treasury controller, that yield from Sunrise is deposited into, pending spending via [offset.sunrisestake.com](https://offset.sunrisestake.com) | | | Treasury Account | [Bup7DZk56XwQUDzuvBz9nzbr8e2iLPVrBpha1KTfEbbJ](https://explorer.solana.com/address/Bup7DZk56XwQUDzuvBz9nzbr8e2iLPVrBpha1KTfEbbJ) | [stdeYBs3MUtQN7zqgAQaxvsYemxncJKNDMJhciHct9M](https://explorer.solana.com/address/stdeYBs3MUtQN7zqgAQaxvsYemxncJKNDMJhciHct9M?cluster=devnet) | [Sunrise DAO](https://app.realms.today/dao/sunrisestake) treasury account | | | NCT Mint | [7sbtAMfAuSfsUvZKPWiXUXaizYCnpLL2BBnKNTU3wjfT](https://explorer.solana.com/address/7sbtAMfAuSfsUvZKPWiXUXaizYCnpLL2BBnKNTU3wjfT) | [tnct1RC5jg94CJLpiTZc2A2d98MP1Civjh7o6ShmTP6](https://explorer.solana.com/address/tnct1RC5jg94CJLpiTZc2A2d98MP1Civjh7o6ShmTP6?cluster=devnet) | Carbon token bought and burned by the treasury controller: [Toucan NCT](https://blog.toucan.earth/announcing-nct-nature-carbon-tonne/) - bridged via Wormhole from Polygon. | | | Holding Account SOL | [shcFT8Ur2mzpX61uWQRL9KyERZp4w2ehDEvA7iaAthn](https://explorer.solana.com/address/shcFT8Ur2mzpX61uWQRL9KyERZp4w2ehDEvA7iaAthn) | [dhcB568T3skiP2D9ujf4eAJEnW2gACaaA9BUCVbwbXD](https://explorer.solana.com/address/dhcB568T3skiP2D9ujf4eAJEnW2gACaaA9BUCVbwbXD?cluster=devnet) | Recipient account for SOL used to purchase NCT. (Temporary, until a liquid market for NCT exists on Solana) | | diff --git a/packages/scripts/updateState.ts b/packages/scripts/updateState.ts index 3cc9b30d..236faf7f 100644 --- a/packages/scripts/updateState.ts +++ b/packages/scripts/updateState.ts @@ -22,6 +22,6 @@ import {WalletAdapterNetwork} from "@solana/wallet-adapter-base"; // prod old treasury (Yield Controller) // newTreasury: new PublicKey("E7BjB9UQp814RsMPq7U6S4fy6wRzn6tFTYt31kJoskoq"), // prod new treasury (Offset Bridge) - newTreasury: new PublicKey("4XTLzYF3kteTbb3a9NYYjeDAYwNoEGSkjoqJYkiLCnmm"), + newTreasury: new PublicKey("6HQrvpMJFqMj35JqMReyhnUrRXNucAAB6FywdDu7xPKA"), }); })().catch(console.error);