Provides API for deploying new contracts on-chain.
Provides DecimalRatio type, for on-chain floating point calculations.
Provides API and Interfaces for building contract calls(interactions).
There is two ways how a contract call can be built using this API.
- By implementing
IntoShortnameRPCEventtrait on your own. Example:
#[derive(ReadWriteRPC, CreateTypeSpec, Clone, PartialEq, Eq, Debug)]
pub struct TestTransferMsg {
pub to: Address,
pub amount: u128,
pub memo: String,
pub amounts: Vec<u128>,
}
impl IntoShortnameRPCEvent for TestTransferMsg {
fn action_shortname(&self) -> u32 {
0x01
}
fn as_interaction(
&self,
builder: &mut pbc_contract_common::events::EventGroupBuilder,
dest: &Address,
) {
builder
.call(*dest, Shortname::from_u32(self.action_shortname()))
.argument(self.to.clone())
.argument(self.amount.clone())
.argument(self.memo.clone())
.argument(self.amounts.clone())
.done();
}
}- By using derive macro from
../rpc-msg-derivecrate. Example:
#[derive(ReadWriteRPC, CreateTypeSpec, IntoShortnameRPCEvent, Clone, PartialEq, Eq, Debug)]
#[rpc_msg(action = 0x01)]
pub struct TestTransferMsgDerive {
pub to: Address,
pub amount: u128,
pub memo: String,
pub amounts: Vec<u128>,
}Both examples will build the same event.
Provides a set of functions for verifying merkle root and merkle proofs.
Provides API for interacting with Native MPC token.