Skip to content
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

Collections: initial impementation #4

Merged
merged 21 commits into from
Aug 13, 2024

Conversation

gangov
Copy link
Collaborator

@gangov gangov commented Aug 13, 2024

No description provided.

@gangov gangov requested a review from ueco-jb August 13, 2024 06:11
@gangov gangov self-assigned this Aug 13, 2024
@gangov gangov linked an issue Aug 13, 2024 that may be closed by this pull request
contracts/collections/src/contract.rs Outdated Show resolved Hide resolved
contracts/collections/src/contract.rs Outdated Show resolved Hide resolved
Copy link
Member

@ueco-jb ueco-jb left a comment

Choose a reason for hiding this comment

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

A suggestion for better clarity

contracts/collections/src/storage.rs Outdated Show resolved Hide resolved
@gangov
Copy link
Collaborator Author

gangov commented Aug 13, 2024

     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _beforeTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity) internal virtual {}

this function is used as a reassurance in transfer, mint and burn methods with the appropriate usage of address(0)

// Returns the balance of the `account` for the token `id`
#[allow(dead_code)]
pub fn balance_of(env: Env, account: Address, id: u64) -> Result<u64, ContractError> {
Ok(get_balance_of(&env, &account, id))?
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Ok(get_balance_of(&env, &account, id))?
get_balance_of(&env, &account, id)

@gangov gangov merged commit 5f27794 into master Aug 13, 2024
3 checks passed
contracts/collections/src/contract.rs Show resolved Hide resolved
contracts/collections/src/storage.rs Show resolved Hide resolved
Comment on lines +14 to +16
#[contractimpl]
impl Collections {
// takes an address and uses it as an administrator
Copy link
Member

Choose a reason for hiding this comment

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

Implement update/upgrade entrypoint.

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.

Collections: initial implementation
2 participants