// Builds governance with a staked, but unclaimed, neuron.
Builds governance with a staked, but unclaimed, neuron.
Builds governance with a staked but unclaimed neuron .
fn governance_with_staked_unclaimed_neuron(
    from: &PrincipalId,
    nonce: u64,
    stake: Tokens,
) -> (fake::FakeDriver, Governance, Subaccount) {
    let to_subaccount = Subaccount({
        let mut sha = Sha256::new();
        sha.write(&[0x0c]);
        sha.write(b"neuron-stake");
        sha.write(from.as_slice());
        sha.write(&nonce.to_be_bytes());
        sha.finish()
    });
    let driver = fake::FakeDriver::default()
        .at(56)
        .with_ledger_accounts(vec![fake::FakeAccount {
            id: AccountIdentifier::new(
                ic_base_types::PrincipalId::from(GOVERNANCE_CANISTER_ID),
                Some(to_subaccount),
            ),
            amount_e8s: stake.get_e8s(),
        }])
        .with_supply(Tokens::from_tokens(400_000_000).unwrap());
    let gov = Governance::new(
        empty_fixture(),
        driver.get_fake_env(),
        driver.get_fake_ledger(),
    );
    (driver, gov, to_subaccount)
}
fn governance_with_staked_unclaimed_neuron ( from : & PrincipalId , nonce : u64 , stake : Tokens , ) -> ( fake :: FakeDriver , Governance , Subaccount ) { let to_subaccount = Subaccount ( { let mut sha = Sha256 :: new ( ) ; sha . write ( & [ 0x0c ] ) ; sha . write ( b" " ) ; sha . write ( from . as_slice ( ) ) ; sha . write ( & nonce . to_be_bytes ( ) ) ; sha . finish ( ) } ) ; let driver = fake :: FakeDriver :: default ( ) . at ( 56 ) . with_ledger_accounts ( vec ! [ fake FakeAccount { id AccountIdentifier new ( ic_base_types PrincipalId from ( GOVERNANCE_CANISTER_ID ) Some ( to_subaccount ) ) amount_e8s stake get_e8s ( ) } ] ) . with_supply ( Tokens :: from_tokens ( 400_000_000 ) . unwrap ( ) ) ; let gov = Governance :: new ( empty_fixture ( ) , driver . get_fake_env ( ) , driver . get_fake_ledger ( ) , ) ; ( driver , gov , to_subaccount ) }
Builds governance with a staked, but unclaimed, neuron.
Builds governance with a staked but unclaimed neuron .
from
&PrincipalId
nonce
u64
stake
Tokens