Skip to content

Commit

Permalink
[near] try to fix contract
Browse files Browse the repository at this point in the history
  • Loading branch information
Pe4enable committed Mar 13, 2022
1 parent 7eb86a8 commit 5449e7d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
11 changes: 6 additions & 5 deletions crypto/near/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,18 @@ impl Contract {
next_approval_id: 0,
//the map of perpetual royalties for the token (The owner will get 100% - total perpetual royalties)
royalty,
bundles
bundles,
isOwned: true,
};

for (int i = 0; i < bundles.len(); i++) {
for bundle in bundles {
//check ownerships
if(transferOwnership) {
bundles[i].nft_transfer_call({
bundle.nft_transfer_call({
receiver_id: receiver_id,
token_id: bundles[i].token_id,
token_id: bundle.token_id,
msg:"",});
bundles[i].isOwned = true;
bundle.isOwned = true;
}
}

Expand Down
2 changes: 2 additions & 0 deletions crypto/near/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ impl Contract {
next_approval_id: token.next_approval_id,
//we copy over the royalties from the previous token
royalty: token.royalty.clone(),
bundles: null,
isOwned: false
};
//insert that new token into the tokens_by_id, replacing the old entry
self.tokens_by_id.insert(token_id, &new_token);
Expand Down
4 changes: 2 additions & 2 deletions crypto/near/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub struct Token {
//keep track of the royalty percentages for the token in a hash map
pub royalty: HashMap<AccountId, u32>,
//set of tokens bundeled in this token
pub bundles: UnorderedSet<Token>,
pub bundles: Vector<Token>,
//flag which showed is token transfered to smart contract or not
pub isOwned: bool,
}
Expand All @@ -67,7 +67,7 @@ pub struct JsonToken {
//keep track of the royalty percentages for the token in a hash map
pub royalty: HashMap<AccountId, u32>,
//set of tokens bundeled in this token
pub bundles: UnorderedSet<Token>,
pub bundles: Vector<Token>,
//flag which showed is token transfered to smart contract or not
pub isOwned: bool,
}
Expand Down
2 changes: 2 additions & 0 deletions crypto/near/src/mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ impl Contract {
next_approval_id: 0,
//the map of perpetual royalties for the token (The owner will get 100% - total perpetual royalties)
royalty,
bundle: null,
isOwned: true,
};

//insert the token ID and token struct and make sure that the token doesn't exist
Expand Down
2 changes: 2 additions & 0 deletions crypto/near/src/nft_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ impl NonFungibleTokenCore for Contract {
metadata,
approved_account_ids: token.approved_account_ids,
royalty: token.royalty,
bundle: null,
isOwned: true
})
} else { //if there wasn't a token ID in the tokens_by_id collection, we return None
None
Expand Down

0 comments on commit 5449e7d

Please sign in to comment.