diff --git a/framework/cached-packages/src/libra_framework_sdk_builder.rs b/framework/cached-packages/src/libra_framework_sdk_builder.rs index a2fdf941e..3c4909b23 100644 --- a/framework/cached-packages/src/libra_framework_sdk_builder.rs +++ b/framework/cached-packages/src/libra_framework_sdk_builder.rs @@ -2413,7 +2413,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::AccountOfferRotationCapability { - rotation_capability_sig_bytes: bcs::from_bytes(script.args().get(0)?).ok()?, + rotation_capability_sig_bytes: bcs::from_bytes(script.args().first()?).ok()?, account_scheme: bcs::from_bytes(script.args().get(1)?).ok()?, account_public_key_bytes: bcs::from_bytes(script.args().get(2)?).ok()?, recipient_address: bcs::from_bytes(script.args().get(3)?).ok()?, @@ -2428,7 +2428,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::AccountOfferSignerCapability { - signer_capability_sig_bytes: bcs::from_bytes(script.args().get(0)?).ok()?, + signer_capability_sig_bytes: bcs::from_bytes(script.args().first()?).ok()?, account_scheme: bcs::from_bytes(script.args().get(1)?).ok()?, account_public_key_bytes: bcs::from_bytes(script.args().get(2)?).ok()?, recipient_address: bcs::from_bytes(script.args().get(3)?).ok()?, @@ -2463,7 +2463,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::AccountRevokeRotationCapability { - to_be_revoked_address: bcs::from_bytes(script.args().get(0)?).ok()?, + to_be_revoked_address: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -2475,7 +2475,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::AccountRevokeSignerCapability { - to_be_revoked_address: bcs::from_bytes(script.args().get(0)?).ok()?, + to_be_revoked_address: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -2487,7 +2487,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::AccountRotateAuthenticationKey { - from_scheme: bcs::from_bytes(script.args().get(0)?).ok()?, + from_scheme: bcs::from_bytes(script.args().first()?).ok()?, from_public_key_bytes: bcs::from_bytes(script.args().get(1)?).ok()?, to_scheme: bcs::from_bytes(script.args().get(2)?).ok()?, to_public_key_bytes: bcs::from_bytes(script.args().get(3)?).ok()?, @@ -2505,7 +2505,7 @@ mod decoder { if let TransactionPayload::EntryFunction(script) = payload { Some( EntryFunctionCall::AccountRotateAuthenticationKeyWithRotationCapability { - rotation_cap_offerer_address: bcs::from_bytes(script.args().get(0)?).ok()?, + rotation_cap_offerer_address: bcs::from_bytes(script.args().first()?).ok()?, new_scheme: bcs::from_bytes(script.args().get(1)?).ok()?, new_public_key_bytes: bcs::from_bytes(script.args().get(2)?).ok()?, cap_update_table: bcs::from_bytes(script.args().get(3)?).ok()?, @@ -2519,7 +2519,7 @@ mod decoder { pub fn burn_set_send_community(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::BurnSetSendCommunity { - community: bcs::from_bytes(script.args().get(0)?).ok()?, + community: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -2529,7 +2529,7 @@ mod decoder { pub fn code_publish_package_txn(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::CodePublishPackageTxn { - metadata_serialized: bcs::from_bytes(script.args().get(0)?).ok()?, + metadata_serialized: bcs::from_bytes(script.args().first()?).ok()?, code: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -2540,8 +2540,8 @@ mod decoder { pub fn coin_transfer(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::CoinTransfer { - coin_type: script.ty_args().get(0)?.clone(), - to: bcs::from_bytes(script.args().get(0)?).ok()?, + coin_type: script.ty_args().first()?.clone(), + to: bcs::from_bytes(script.args().first()?).ok()?, amount: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -2555,7 +2555,7 @@ mod decoder { if let TransactionPayload::EntryFunction(script) = payload { Some( EntryFunctionCall::CommunityWalletInitChangeSignerCommunityMultisig { - multisig_address: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_address: bcs::from_bytes(script.args().first()?).ok()?, new_signer: bcs::from_bytes(script.args().get(1)?).ok()?, is_add_operation: bcs::from_bytes(script.args().get(2)?).ok()?, n_of_m: bcs::from_bytes(script.args().get(3)?).ok()?, @@ -2572,7 +2572,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::CommunityWalletInitFinalizeAndCage { - num_signers: bcs::from_bytes(script.args().get(0)?).ok()?, + num_signers: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -2584,7 +2584,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::CommunityWalletInitInitCommunity { - initial_authorities: bcs::from_bytes(script.args().get(0)?).ok()?, + initial_authorities: bcs::from_bytes(script.args().first()?).ok()?, check_threshold: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -2597,7 +2597,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::CommunityWalletInitProposeOffer { - new_signers: bcs::from_bytes(script.args().get(0)?).ok()?, + new_signers: bcs::from_bytes(script.args().first()?).ok()?, num_signers: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -2611,7 +2611,7 @@ mod decoder { if let TransactionPayload::EntryFunction(script) = payload { Some( EntryFunctionCall::DiemGovernanceAddApprovedScriptHashScript { - proposal_id: bcs::from_bytes(script.args().get(0)?).ok()?, + proposal_id: bcs::from_bytes(script.args().first()?).ok()?, }, ) } else { @@ -2624,7 +2624,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::DiemGovernanceAssertCanResolve { - proposal_id: bcs::from_bytes(script.args().get(0)?).ok()?, + proposal_id: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -2636,7 +2636,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::DiemGovernanceCreateProposalV2 { - execution_hash: bcs::from_bytes(script.args().get(0)?).ok()?, + execution_hash: bcs::from_bytes(script.args().first()?).ok()?, metadata_location: bcs::from_bytes(script.args().get(1)?).ok()?, metadata_hash: bcs::from_bytes(script.args().get(2)?).ok()?, is_multi_step_proposal: bcs::from_bytes(script.args().get(3)?).ok()?, @@ -2651,7 +2651,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::DiemGovernanceOlCreateProposalV2 { - execution_hash: bcs::from_bytes(script.args().get(0)?).ok()?, + execution_hash: bcs::from_bytes(script.args().first()?).ok()?, metadata_location: bcs::from_bytes(script.args().get(1)?).ok()?, metadata_hash: bcs::from_bytes(script.args().get(2)?).ok()?, is_multi_step_proposal: bcs::from_bytes(script.args().get(3)?).ok()?, @@ -2664,7 +2664,7 @@ mod decoder { pub fn diem_governance_ol_vote(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::DiemGovernanceOlVote { - proposal_id: bcs::from_bytes(script.args().get(0)?).ok()?, + proposal_id: bcs::from_bytes(script.args().first()?).ok()?, should_pass: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -2695,7 +2695,7 @@ mod decoder { pub fn diem_governance_vote(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::DiemGovernanceVote { - proposal_id: bcs::from_bytes(script.args().get(0)?).ok()?, + proposal_id: bcs::from_bytes(script.args().first()?).ok()?, should_pass: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -2708,7 +2708,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::DonorVoiceTxsProposeLiquidateTx { - multisig_address: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_address: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -2720,7 +2720,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::DonorVoiceTxsProposePaymentTx { - multisig_address: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_address: bcs::from_bytes(script.args().first()?).ok()?, payee: bcs::from_bytes(script.args().get(1)?).ok()?, value: bcs::from_bytes(script.args().get(2)?).ok()?, description: bcs::from_bytes(script.args().get(3)?).ok()?, @@ -2735,7 +2735,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::DonorVoiceTxsProposeVetoTx { - multisig_address: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_address: bcs::from_bytes(script.args().first()?).ok()?, id: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -2748,7 +2748,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::DonorVoiceTxsVoteLiquidationTx { - multisig_address: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_address: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -2758,7 +2758,7 @@ mod decoder { pub fn donor_voice_txs_vote_veto_tx(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::DonorVoiceTxsVoteVetoTx { - multisig_address: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_address: bcs::from_bytes(script.args().first()?).ok()?, id: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -2779,7 +2779,7 @@ mod decoder { pub fn jail_unjail_by_voucher(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::JailUnjailByVoucher { - addr: bcs::from_bytes(script.args().get(0)?).ok()?, + addr: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -2801,7 +2801,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::LibraCoinDelegateMintCapability { - to: bcs::from_bytes(script.args().get(0)?).ok()?, + to: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -2811,7 +2811,7 @@ mod decoder { pub fn libra_coin_mint_to_impl(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::LibraCoinMintToImpl { - dst_addr: bcs::from_bytes(script.args().get(0)?).ok()?, + dst_addr: bcs::from_bytes(script.args().first()?).ok()?, amount: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -2822,7 +2822,7 @@ mod decoder { pub fn multi_action_claim_offer(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultiActionClaimOffer { - multisig_address: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_address: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -2844,7 +2844,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultiActionMigrationMigrateOffer { - multisig_address: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_address: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -2854,7 +2854,7 @@ mod decoder { pub fn multisig_account_add_owner(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultisigAccountAddOwner { - new_owner: bcs::from_bytes(script.args().get(0)?).ok()?, + new_owner: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -2864,7 +2864,7 @@ mod decoder { pub fn multisig_account_add_owners(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultisigAccountAddOwners { - new_owners: bcs::from_bytes(script.args().get(0)?).ok()?, + new_owners: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -2876,7 +2876,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultisigAccountApproveTransaction { - multisig_account: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_account: bcs::from_bytes(script.args().first()?).ok()?, sequence_number: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -2887,7 +2887,7 @@ mod decoder { pub fn multisig_account_create(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultisigAccountCreate { - num_signatures_required: bcs::from_bytes(script.args().get(0)?).ok()?, + num_signatures_required: bcs::from_bytes(script.args().first()?).ok()?, metadata_keys: bcs::from_bytes(script.args().get(1)?).ok()?, metadata_values: bcs::from_bytes(script.args().get(2)?).ok()?, }) @@ -2901,7 +2901,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultisigAccountCreateTransaction { - multisig_account: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_account: bcs::from_bytes(script.args().first()?).ok()?, payload: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -2915,7 +2915,7 @@ mod decoder { if let TransactionPayload::EntryFunction(script) = payload { Some( EntryFunctionCall::MultisigAccountCreateTransactionWithHash { - multisig_account: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_account: bcs::from_bytes(script.args().first()?).ok()?, payload_hash: bcs::from_bytes(script.args().get(1)?).ok()?, }, ) @@ -2930,7 +2930,7 @@ mod decoder { if let TransactionPayload::EntryFunction(script) = payload { Some( EntryFunctionCall::MultisigAccountCreateWithExistingAccount { - multisig_address: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_address: bcs::from_bytes(script.args().first()?).ok()?, owners: bcs::from_bytes(script.args().get(1)?).ok()?, num_signatures_required: bcs::from_bytes(script.args().get(2)?).ok()?, account_scheme: bcs::from_bytes(script.args().get(3)?).ok()?, @@ -2951,7 +2951,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultisigAccountCreateWithOwners { - additional_owners: bcs::from_bytes(script.args().get(0)?).ok()?, + additional_owners: bcs::from_bytes(script.args().first()?).ok()?, num_signatures_required: bcs::from_bytes(script.args().get(1)?).ok()?, metadata_keys: bcs::from_bytes(script.args().get(2)?).ok()?, metadata_values: bcs::from_bytes(script.args().get(3)?).ok()?, @@ -2967,7 +2967,7 @@ mod decoder { if let TransactionPayload::EntryFunction(script) = payload { Some( EntryFunctionCall::MultisigAccountExecuteRejectedTransaction { - multisig_account: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_account: bcs::from_bytes(script.args().first()?).ok()?, }, ) } else { @@ -2980,7 +2980,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultisigAccountMigrateWithOwners { - additional_owners: bcs::from_bytes(script.args().get(0)?).ok()?, + additional_owners: bcs::from_bytes(script.args().first()?).ok()?, num_signatures_required: bcs::from_bytes(script.args().get(1)?).ok()?, metadata_keys: bcs::from_bytes(script.args().get(2)?).ok()?, metadata_values: bcs::from_bytes(script.args().get(3)?).ok()?, @@ -2995,7 +2995,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultisigAccountRejectTransaction { - multisig_account: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_account: bcs::from_bytes(script.args().first()?).ok()?, sequence_number: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -3008,7 +3008,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultisigAccountRemoveOwner { - owner_to_remove: bcs::from_bytes(script.args().get(0)?).ok()?, + owner_to_remove: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -3020,7 +3020,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultisigAccountRemoveOwners { - owners_to_remove: bcs::from_bytes(script.args().get(0)?).ok()?, + owners_to_remove: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -3032,7 +3032,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultisigAccountUpdateMetadata { - keys: bcs::from_bytes(script.args().get(0)?).ok()?, + keys: bcs::from_bytes(script.args().first()?).ok()?, values: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -3045,7 +3045,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultisigAccountUpdateSignaturesRequired { - new_num_signatures_required: bcs::from_bytes(script.args().get(0)?).ok()?, + new_num_signatures_required: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -3057,7 +3057,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::MultisigAccountVoteTransanction { - multisig_account: bcs::from_bytes(script.args().get(0)?).ok()?, + multisig_account: bcs::from_bytes(script.args().first()?).ok()?, sequence_number: bcs::from_bytes(script.args().get(1)?).ok()?, approved: bcs::from_bytes(script.args().get(2)?).ok()?, }) @@ -3069,7 +3069,7 @@ mod decoder { pub fn object_transfer_call(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::ObjectTransferCall { - object: bcs::from_bytes(script.args().get(0)?).ok()?, + object: bcs::from_bytes(script.args().first()?).ok()?, to: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -3080,7 +3080,7 @@ mod decoder { pub fn ol_account_create_account(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::OlAccountCreateAccount { - auth_key: bcs::from_bytes(script.args().get(0)?).ok()?, + auth_key: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -3092,7 +3092,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::OlAccountSetAllowDirectCoinTransfers { - allow: bcs::from_bytes(script.args().get(0)?).ok()?, + allow: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -3102,7 +3102,7 @@ mod decoder { pub fn ol_account_transfer(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::OlAccountTransfer { - to: bcs::from_bytes(script.args().get(0)?).ok()?, + to: bcs::from_bytes(script.args().first()?).ok()?, amount: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -3129,7 +3129,7 @@ mod decoder { pub fn proof_of_fee_pof_update_bid(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::ProofOfFeePofUpdateBid { - bid: bcs::from_bytes(script.args().get(0)?).ok()?, + bid: bcs::from_bytes(script.args().first()?).ok()?, epoch_expiry: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -3142,7 +3142,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::ProofOfFeePofUpdateBidNetReward { - net_reward: bcs::from_bytes(script.args().get(0)?).ok()?, + net_reward: bcs::from_bytes(script.args().first()?).ok()?, epoch_expiry: bcs::from_bytes(script.args().get(1)?).ok()?, }) } else { @@ -3153,7 +3153,7 @@ mod decoder { pub fn safe_init_payment_multisig(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::SafeInitPaymentMultisig { - authorities: bcs::from_bytes(script.args().get(0)?).ok()?, + authorities: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -3165,7 +3165,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::SlowWalletSmokeTestVmUnlock { - user_addr: bcs::from_bytes(script.args().get(0)?).ok()?, + user_addr: bcs::from_bytes(script.args().first()?).ok()?, unlocked: bcs::from_bytes(script.args().get(1)?).ok()?, transferred: bcs::from_bytes(script.args().get(2)?).ok()?, }) @@ -3185,7 +3185,7 @@ mod decoder { pub fn stake_initialize_validator(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::StakeInitializeValidator { - consensus_pubkey: bcs::from_bytes(script.args().get(0)?).ok()?, + consensus_pubkey: bcs::from_bytes(script.args().first()?).ok()?, proof_of_possession: bcs::from_bytes(script.args().get(1)?).ok()?, network_addresses: bcs::from_bytes(script.args().get(2)?).ok()?, fullnode_addresses: bcs::from_bytes(script.args().get(3)?).ok()?, @@ -3198,7 +3198,7 @@ mod decoder { pub fn stake_rotate_consensus_key(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::StakeRotateConsensusKey { - validator_address: bcs::from_bytes(script.args().get(0)?).ok()?, + validator_address: bcs::from_bytes(script.args().first()?).ok()?, new_consensus_pubkey: bcs::from_bytes(script.args().get(1)?).ok()?, proof_of_possession: bcs::from_bytes(script.args().get(2)?).ok()?, }) @@ -3212,7 +3212,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::StakeUpdateNetworkAndFullnodeAddresses { - validator_address: bcs::from_bytes(script.args().get(0)?).ok()?, + validator_address: bcs::from_bytes(script.args().first()?).ok()?, new_network_addresses: bcs::from_bytes(script.args().get(1)?).ok()?, new_fullnode_addresses: bcs::from_bytes(script.args().get(2)?).ok()?, }) @@ -3226,7 +3226,7 @@ mod decoder { ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::ValidatorUniverseRegisterValidator { - consensus_pubkey: bcs::from_bytes(script.args().get(0)?).ok()?, + consensus_pubkey: bcs::from_bytes(script.args().first()?).ok()?, proof_of_possession: bcs::from_bytes(script.args().get(1)?).ok()?, network_addresses: bcs::from_bytes(script.args().get(2)?).ok()?, fullnode_addresses: bcs::from_bytes(script.args().get(3)?).ok()?, @@ -3239,7 +3239,7 @@ mod decoder { pub fn version_set_version(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::VersionSetVersion { - major: bcs::from_bytes(script.args().get(0)?).ok()?, + major: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -3249,7 +3249,7 @@ mod decoder { pub fn vouch_insist_vouch_for(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::VouchInsistVouchFor { - friend_account: bcs::from_bytes(script.args().get(0)?).ok()?, + friend_account: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -3259,7 +3259,7 @@ mod decoder { pub fn vouch_revoke(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::VouchRevoke { - friend_account: bcs::from_bytes(script.args().get(0)?).ok()?, + friend_account: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None @@ -3269,7 +3269,7 @@ mod decoder { pub fn vouch_vouch_for(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { Some(EntryFunctionCall::VouchVouchFor { - friend_account: bcs::from_bytes(script.args().get(0)?).ok()?, + friend_account: bcs::from_bytes(script.args().first()?).ok()?, }) } else { None diff --git a/tools/txs/src/txs_cli_vals.rs b/tools/txs/src/txs_cli_vals.rs index d12ec7f1c..bfd34ce70 100644 --- a/tools/txs/src/txs_cli_vals.rs +++ b/tools/txs/src/txs_cli_vals.rs @@ -79,25 +79,23 @@ impl ValidatorTxs { } => { if *retract { ProofOfFeePofRetractBid {} + } else if let Some(b) = bid_pct { + // TODO: the u64 will truncate, but without rounding it will drop the last digit. + let scaled_bid = (b * 1000.0).round() as u64; // scale to 10ˆ3. + if scaled_bid > 1100 { + bail!( + "a bid amount at 110.0% or above the epoch's reward, will be rejected" + ); + } + ProofOfFeePofUpdateBid { + bid: scaled_bid, + epoch_expiry: *expiry, + } } else { - if let Some(b) = bid_pct { - // TODO: the u64 will truncate, but without rounding it will drop the last digit. - let scaled_bid = (b * 1000.0).round() as u64; // scale to 10ˆ3. - if scaled_bid > 1100 { - bail!( - "a bid amount at 110.0% or above the epoch's reward, will be rejected" - ); - } - ProofOfFeePofUpdateBid { - bid: scaled_bid, - epoch_expiry: *expiry, - } - } else { - // Default path is to update based on the expected net reward - ProofOfFeePofUpdateBidNetReward { - net_reward: *net_reward, - epoch_expiry: *expiry, - } + // Default path is to update based on the expected net reward + ProofOfFeePofUpdateBidNetReward { + net_reward: *net_reward, + epoch_expiry: *expiry, } } }