[][src]Function marketplace::dtoken_seller_publish

pub fn dtoken_seller_publish(
    resource_id: &[u8],
    resource_ddo: ResourceDDO,
    item: DTokenItem,
    split_policy_param: &[u8]
) -> bool

seller publish product, need seller signature

resource_id used to mark the only commodity in the chain

resource_ddo_bytes is the result of ResourceDDO struct serialization

item_bytes is the result of DTokenItem struct serialization

split_policy_param_bytes is the result of RegisterParam struct serialization

Example

use common::{Fee,TokenType};
let resource_id = b"resource_id";
let ddo = ResourceDDO {
       token_resource_ty_endpoints: vec![],
       item_meta_hash: H256::repeat_byte(1),
       manager: manager.clone(),
       dtoken_contract_address: Some(dtoken_contract_address.clone()),
       mp_contract_address: None,
       split_policy_contract_address: None,
   };
let contract_addr = Address::repeat_byte(4);
   let fee = Fee {
       contract_addr,
       contract_type: TokenType::ONG,
       count: 0,
   };
   let mut templates = vec![];
   templates.push(token_template.clone());
   let dtoken_item = DTokenItem {
       fee,
       expired_date: 1,
       stocks: 1,
       templates,
   };
 let split_param = b"test";
 assert!(supper::dtoken_seller_publish(
       resource_id,
       &ddo.to_bytes(),
       &dtoken_item.to_bytes(),
       split_param
   ));