//! 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::::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); }