Skip to content

Commit

Permalink
Update governance (#171)
Browse files Browse the repository at this point in the history
* update governing token source

* clean up
  • Loading branch information
enzotar authored Nov 13, 2024
1 parent 43142bc commit d1a6fe3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@
"tooltip": "",
"passthrough": true
},
{
"name": "governing_token_source",
"type_bounds": ["pubkey"],
"required": true,
"defaultValue": null,
"tooltip": "",
"passthrough": true
},
{
"name": "governing_token_owner",
"type_bounds": ["keypair"],
Expand Down
13 changes: 8 additions & 5 deletions crates/cmds-solana/src/governance/deposit_governing_tokens.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::str::FromStr;

use solana_sdk::{instruction::AccountMeta, system_program};
use tracing::info;

use crate::prelude::*;

Expand All @@ -26,11 +27,7 @@ pub struct Input {
pub fee_payer: Wallet,
#[serde(with = "value::pubkey")]
pub realm: Pubkey,
#[serde(with = "value::pubkey")]
pub governing_token_source: Pubkey,

pub governing_token_owner: Wallet,

pub governing_token_source_authority: Wallet,
pub amount: u64,
#[serde(with = "value::pubkey")]
Expand Down Expand Up @@ -102,11 +99,17 @@ pub fn deposit_governing_tokens(
async fn run(mut ctx: Context, input: Input) -> Result<Output, CommandError> {
let program_id = Pubkey::from_str(SPL_GOVERNANCE_ID).unwrap();

let governing_token_source = spl_associated_token_account::get_associated_token_address(
&input.governing_token_owner.pubkey(),
&input.governing_token_mint,
);
info!("governing_token_source: {governing_token_source}");

let (ix, realm_config_address, governing_token_holding_address, token_owner_record_address) =
deposit_governing_tokens(
&program_id,
&input.realm,
&input.governing_token_source,
&governing_token_source,
&input.governing_token_owner.pubkey(),
&input.governing_token_source_authority.pubkey(),
&input.fee_payer.pubkey(),
Expand Down

0 comments on commit d1a6fe3

Please sign in to comment.