Companion to dump_governor (committed earlier this branch). Edit owner_pkh_hex + staked_amount in the source, then `cargo run` to print the inline datum CBOR for a wallet_plutus_mint_unsigned call that mints StakeST + sends to stakes_addr. No locks at bootstrap (locked_by = []) and no delegation (delegated_to = None). For a stake that's been used in proposals, locked_by would carry the ProposalLock entries; reuse this scaffold when reseeding a stake from a snapshot.
33 lines
1.1 KiB
Rust
33 lines
1.1 KiB
Rust
//! Print StakeDatum CBOR hex for a parametrized stake bootstrap.
|
|
//!
|
|
//! Usage: edit the values below, then
|
|
//! cargo run --example dump_stake -p aldabra-dao --release
|
|
//!
|
|
//! Used during preprod DAO bringup (Track B-fast) to construct the
|
|
//! inline datum for `wallet_plutus_mint_unsigned` calls that mint
|
|
//! StakeST and deposit at the stakes address.
|
|
|
|
use aldabra_dao::agora::stake::{Credential, ProposalLock, StakeDatum};
|
|
use pallas_codec::minicbor;
|
|
|
|
fn main() {
|
|
// Edit per stake.
|
|
let owner_pkh_hex = "4cd61bd67ed72c1cec160bf7de6103c6bddb397da6a500dc4ff805f8";
|
|
let staked_amount: i64 = 250;
|
|
|
|
let owner_bytes = hex::decode(owner_pkh_hex).expect("decode pkh hex");
|
|
assert_eq!(owner_bytes.len(), 28, "pkh must be 28 bytes");
|
|
|
|
let datum = StakeDatum {
|
|
staked_amount,
|
|
owner: Credential::PubKey(owner_bytes),
|
|
delegated_to: None,
|
|
locked_by: Vec::<ProposalLock>::new(),
|
|
};
|
|
|
|
let pd = datum.to_plutus_data().expect("encode");
|
|
let mut buf = Vec::new();
|
|
minicbor::encode(&pd, &mut buf).expect("cbor");
|
|
let hex: String = buf.iter().map(|b| format!("{:02x}", b)).collect();
|
|
println!("{}", hex);
|
|
}
|