-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: more tests and examples in docs
- Loading branch information
Showing
8 changed files
with
341 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//! Implementations of NEP standards | ||
//! Implementations of NEP standards. | ||
|
||
pub mod nep141; | ||
pub mod nep148; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ pub mod fungible_token; | |
pub mod nep141; | ||
pub mod nep148; | ||
pub mod nep171; | ||
pub mod non_fungible_token; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use near_sdk::{ | ||
borsh::{self, *}, | ||
*, | ||
}; | ||
use near_sdk_contract_tools::{standard::nep171::*, Nep171}; | ||
|
||
#[derive(BorshSerialize, BorshDeserialize, PanicOnDefault, Nep171)] | ||
#[near_bindgen] | ||
pub struct Contract { | ||
transfers: u32, | ||
} | ||
|
||
impl Nep171Hook for Contract { | ||
fn before_nft_transfer(_contract: &Self, transfer: &Nep171Transfer) { | ||
log!( | ||
"{} is transferring {} to {}", | ||
transfer.sender_id, | ||
transfer.token_id, | ||
transfer.receiver_id, | ||
); | ||
} | ||
|
||
fn after_nft_transfer(contract: &mut Self, _transfer: &Nep171Transfer, _: ()) { | ||
contract.transfers += 1; | ||
} | ||
} | ||
|
||
#[derive(BorshSerialize, BorshDeserialize, PanicOnDefault, Nep171)] | ||
#[nep171(no_hooks)] | ||
#[near_bindgen] | ||
pub struct Contract1 {} |
Oops, something went wrong.