Skip to content

chore: nft contract tests #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Apr 29, 2025
Merged

Conversation

daopunk
Copy link
Collaborator

@daopunk daopunk commented Apr 7, 2025

closes AZT-158

@daopunk daopunk mentioned this pull request Apr 7, 2025
5 tasks
Copy link
Collaborator

@xorsal xorsal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far, so good!

Comment on lines 2 to 5
// mod transfer_in_private;
// mod transfer_in_public;
// mod transfer_to_private;
// mod transfer_to_public;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enable all tests

@0xShaito 0xShaito marked this pull request as ready for review April 10, 2025 17:53
@@ -3,6 +3,7 @@ mod test;

use aztec::macros::aztec;

/// @dev NFT only supports public minting and public/private transfers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this mean?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no longer relevant

@daopunk daopunk changed the base branch from feat/nft-contract to refactor/nft-contract April 18, 2025 02:16
@@ -1,5 +1,6 @@
use aztec::{
context::{PrivateContext, UnconstrainedContext},
context::{PrivateContext, UtilityContext},
macros::functions::utility,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we using #[utility] in this file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes for:

#[utility]
    unconstrained fn get_private_nfts

Base automatically changed from refactor/nft-contract to feat/nft-contract April 25, 2025 18:51
Copy link

linear bot commented Apr 28, 2025

Copy link
Member

@0xShaito 0xShaito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking really really good! Some small comments and I'm good to approve!


// Verify initial state
utils::assert_owns_private_nft(nft_contract_address, owner, token_id);
assert(utils::get_nft_exists(nft_contract_address, token_id), "NFT should exist before burn");
Copy link
Collaborator

@0xmoebius 0xmoebius Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: get_nft_exists could be a method of utils (utils::assert_nft_exists) like assert_owns_private_nft is. just for consistency

Comment on lines 5 to 21
#[test]
unconstrained fn name_is_set() {
let (env, nft_contract_address, owner, minter, recipient) = utils::setup_with_minter(false);

let name = NFT::at(nft_contract_address).public_get_name().view(&mut env.public());
let expected_name = FieldCompressedString::from_string("TestNFT000000000000000000000000");
assert(name == expected_name, "name is not set correctly");
}

#[test]
unconstrained fn symbol_is_set() {
let (env, nft_contract_address, owner, minter, recipient) = utils::setup_with_minter(false);

let symbol = NFT::at(nft_contract_address).public_get_symbol().view(&mut env.public());
let expected_symbol = FieldCompressedString::from_string("TNFT000000000000000000000000000");
assert(symbol == expected_symbol, "symbol is not set correctly");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, we should add these tests (and getters) on the token @0xShaito u tracking this?

@daopunk daopunk requested a review from 0xShaito April 29, 2025 04:50
@0xShaito 0xShaito merged commit 2545e9b into feat/nft-contract Apr 29, 2025
3 checks passed
@0xShaito 0xShaito deleted the feat/nft-contract-tests branch April 29, 2025 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants