Skip to content

Commit

Permalink
allow create series only for owner_id
Browse files Browse the repository at this point in the history
  • Loading branch information
emarai committed Oct 13, 2021
1 parent 2c32955 commit b14659c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions paras-nft-contract/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,11 @@ impl Contract {
token_metadata: TokenMetadata,
price: Option<U128>,
royalty: Option<HashMap<AccountId, u32>>,
creator_id: ValidAccountId
) -> TokenSeriesJson {
let initial_storage_usage = env::storage_usage();
let creator_id = env::predecessor_account_id();

assert_eq!(env::predecessor_account_id(), self.tokens.owner_id, "Paras: Only owner");

let token_series_id = format!("{}", (self.token_series_by_id.len() + 1));

Expand Down Expand Up @@ -1070,8 +1072,8 @@ mod tests {

fn setup_contract() -> (VMContextBuilder, Contract) {
let mut context = VMContextBuilder::new();
testing_env!(context.predecessor_account_id(accounts(0)).build());
let contract = Contract::new_default_meta(accounts(0), accounts(4));
testing_env!(context.predecessor_account_id(accounts(1)).build());
let contract = Contract::new_default_meta(accounts(1), accounts(4));
(context, contract)
}

Expand Down Expand Up @@ -1125,6 +1127,7 @@ mod tests {
},
price,
Some(royalty.clone()),
accounts(1),
);
}

Expand Down

0 comments on commit b14659c

Please sign in to comment.