Skip to content

Commit

Permalink
Allow a yield account (treasury account) to be a non-system-owned acc…
Browse files Browse the repository at this point in the history
…ount and switch to the offset bridge as the yield spender
  • Loading branch information
dankelleher committed Aug 1, 2023
1 parent 250fb5a commit b51b0c9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) | |
Expand Down
10 changes: 6 additions & 4 deletions packages/scripts/updateState.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion programs/sunrise-stake/src/instructions/init_epoch_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Account<'info, State>>,

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion programs/sunrise-stake/src/instructions/order_unstake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down

0 comments on commit b51b0c9

Please sign in to comment.