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

Merge develop #263

Merged
merged 16 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Chore: Release 0.23.0 (#262)
Deployed v.0.23.0

---------

Co-authored-by: Nuno Boavida <[email protected]>
  • Loading branch information
Suficio and kaizu-xyz authored Feb 16, 2023
commit a9523ee235bc69f6eaa4997428ef9f934d666bb7
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The format is based on [Keep a
Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## [0.23.0] - 2023-02-16

### Added

Expand All @@ -25,7 +25,9 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to

### Changed

- Updated to Devnet 0.26.0
- `transfer_allowlist::remove_itself` is now an entry function.
- Revamped NFT domain permissions and control over them
- `Collection` and `Nft` were reverted to use dynamic fields instead of dynamic object fields.
- Migrated all domains not requiring `key` property after loosening `key` requirement on `Nft` and `Collection` domains.

Expand Down
4 changes: 2 additions & 2 deletions Move.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "NftProtocol"
version = "0.22.0"
version = "0.23.0"

[dependencies.Sui]
git = "https://github.com/MystenLabs/sui.git"
Expand All @@ -14,4 +14,4 @@ git = "https://github.com/Origin-Byte/originmate.git"
rev = "86ff9808166af83695df9cbadd9eef44ba0f4d59"

[addresses]
nft_protocol = "0x0"
nft_protocol = "0xde886c0410106e811bc4a67957fed77e456831d2"
169 changes: 15 additions & 154 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,174 +1,35 @@
- Sui v0.24.0
<a href="https://originbyte.io/">
<h1><img src="./assets/logo.svg" alt="OriginByte" width="50%"></h1>
</a>

Checkout our:
<h3>A new approach to NFTs</h3>

- Contract on the [Sui Explorer](https://explorer.sui.io/object/0x5db59b623554ef931b23c07ed4f7d577942bd52d)
- [Official Documentation](https://docs.originbyte.io/origin-byte/)
- [Developer Documentation](https://origin-byte.github.io/)

# OriginByte

A new approach to NFTs.

Origin-Byte is an ecosystem of tools, standards and smart contracts designed to
make life easier for Web3 Game Developers and NFT creators. From simple artwork
to complex gaming assets, we want to help you reach the public, and provide
on-chain market infrastructure.
Origin-Byte is an ecosystem of tools, standards, and smart contracts designed to make life easier for Web3 Game Developers and NFT creators.
From simple artwork to complex gaming assets, we want to help you reach the public, and provide on-chain market infrastructure.

The ecosystem is partitioned into three critical components:

- The NFT standard, encompassing the core `Nft`, `Collection`, and `Safe` types,
controlling the lifecycle and properties of each NFT.
- Primary markets, encompassing `Marketplace`, `Listing`, and numerous markets which
control the initial minting of NFTs.
control the initial minting and sale of NFTs.
- Secondary markets, encompassing principally the `Orderbook` which allows you
to trade existing NFTs.

## Resources

- Devnet contract on the [Sui Explorer](https://explorer.sui.io/object/0xde886c0410106e811bc4a67957fed77e456831d2?network=devnet)
- [Official Documentation](https://docs.originbyte.io/origin-byte/)
- [Developer Documentation](https://origin-byte.github.io/)

# Install

This codebase requires installation of the [Sui CLI](https://docs.sui.io/build/install).

If you are running on Linux you can use [suivm](https://github.com/Origin-Byte/suivm) to handle installation for you.

# Built and Test

1. `$ sui move build` to build the available move modules
2. `$ sui move test` to run the move tests
3. `./bin/publish.sh` to publish the modules on localnet or devnet

# Deploy an NFT collection

To deploy an NFT collection you will need to create a SUI [Move](https://docs.sui.io/build/move) contract, which plugs into our protocol.

We provide an example on how to build such collection in the examples folder. Additionally below follows an example of an NFT Collection, the SUIMARINES!

```move
module nft_protocol::suimarines {
use std::string::{Self, String};

use sui::url;
use sui::balance;
use sui::transfer;
use sui::tx_context::{Self, TxContext};

use nft_protocol::nft;
use nft_protocol::tags;
use nft_protocol::royalty;
use nft_protocol::display;
use nft_protocol::creators;
use nft_protocol::inventory::{Self, Inventory};
use nft_protocol::royalties::{Self, TradePayment};
use nft_protocol::collection::{Self, Collection, MintCap};

/// One time witness is only instantiated in the init method
struct SUIMARINES has drop {}

/// Can be used for authorization of other actions post-creation. It is
/// vital that this struct is not freely given to any contract, because it
/// serves as an auth token.
struct Witness has drop {}

fun init(witness: SUIMARINES, ctx: &mut TxContext) {
let (mint_cap, collection) = collection::create(
&witness, ctx,
);

collection::add_domain(
&mut collection,
&mut mint_cap,
creators::from_address(tx_context::sender(ctx))
);

// Register custom domains
display::add_collection_display_domain(
&mut collection,
&mut mint_cap,
string::utf8(b"Suimarines"),
string::utf8(b"A unique NFT collection of Suimarines on Sui"),
);

display::add_collection_url_domain(
&mut collection,
&mut mint_cap,
sui::url::new_unsafe_from_bytes(b"https://originbyte.io/"),
);

display::add_collection_symbol_domain(
&mut collection,
&mut mint_cap,
string::utf8(b"SUIM")
);

let royalty = royalty::from_address(tx_context::sender(ctx), ctx);
royalty::add_proportional_royalty(&mut royalty, 100);
royalty::add_royalty_domain(&mut collection, &mut mint_cap, royalty);

let tags = tags::empty(ctx);
tags::add_tag(&mut tags, tags::art());
tags::add_collection_tag_domain(&mut collection, &mut mint_cap, tags);

transfer::transfer(mint_cap, tx_context::sender(ctx));
transfer::share_object(collection);
}

/// Calculates and transfers royalties to the `RoyaltyDomain`
public entry fun collect_royalty<FT>(
payment: &mut TradePayment<SUIMARINES, FT>,
collection: &mut Collection<SUIMARINES>,
ctx: &mut TxContext,
) {
let b = royalties::balance_mut(Witness {}, payment);

let domain = royalty::royalty_domain(collection);
let royalty_owed =
royalty::calculate_proportional_royalty(domain, balance::value(b));

royalty::collect_royalty(collection, b, royalty_owed);
royalties::transfer_remaining_to_beneficiary(Witness {}, payment, ctx);
}

public entry fun mint_nft(
name: String,
description: String,
url: vector<u8>,
attribute_keys: vector<String>,
attribute_values: vector<String>,
_mint_cap: &MintCap<SUIMARINES>,
inventory: &mut Inventory,
ctx: &mut TxContext,
) {
let nft = nft::new<SUIMARINES, Witness>(
&Witness {}, tx_context::sender(ctx), ctx
);

display::add_display_domain(
&mut nft,
name,
description,
ctx,
);

display::add_url_domain(
&mut nft,
url::new_unsafe_from_bytes(url),
ctx,
);

display::add_attributes_domain_from_vec(
&mut nft,
attribute_keys,
attribute_values,
ctx,
);

inventory::deposit_nft(inventory, nft);
}
}
```

and in your `Move.toml`, define the following dependency:

```toml
[dependencies.NftProtocol]
git = "https://github.com/Origin-Byte/nft-protocol.git"
# v0.20.0
rev = "06ddf96d151227b989210d5771b02b198b85c2fe"
```
26 changes: 26 additions & 0 deletions assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.