Sui Concepts Overview
Sui is different than other blockchains. The concepts explored in this section provide a background to the Sui blockchain and web3 in general.
If you see this, delete it and the example below used for testing:
/// We have a requirement that this promotion will run for a specified amount of time (30 Days).
/// I believe it's better to deauthorize the app when we do not want to have it any more,
/// instead of hard-coding the limits here.
public fun claim(
day_one_nft: &mut DayOne,
suins: &mut SuiNS,
domain_nft: &mut SuinsRegistration,
domain_name: String,
clock: &Clock,
ctx: &mut TxContext,
): SuinsRegistration {
// verify we can register names using this app.
suins.assert_app_is_authorized<BogoApp>();
// check that domain_nft hasn't been already used in this deal.
assert!(!used_in_promo(domain_nft), EDomainAlreadyUsed);
// Verify that the domain was bought in an auction.
// We understand if a domain was bought in an auction if the expiry date is less than the last day of auction + 1 year.
assert!(domain_nft.expiration_timestamp_ms() <= LAST_VALID_EXPIRATION_DATE, ENotPurchasedInAuction);
// generate a domain out of the input string.
let new_domain = domain::new(domain_name);
let new_domain_size = domain_length(&new_domain);
let domain_size = domain_length(&domain_nft.domain());
// make sure the domain is valid.
config::assert_valid_user_registerable_domain(&new_domain);
// if size < 5, we need to make sure we're getting a domain name of the same size.
assert!(!((domain_size < 5 || new_domain_size < 5) && domain_size != new_domain_size), ESizeMissMatch);
// activate the day_one_nft if it's not activated.
// This will grant it access to future promotions.
if(!day_one::is_active(day_one_nft)) day_one::activate(day_one_nft);
let registry = suins::app_registry_mut<BogoApp, Registry>(BogoApp {}, suins);
let mut nft = registry.add_record(new_domain, DEFAULT_DURATION, clock, ctx);
// mark both the new and the current domain presented as used, so that they can't
// be redeemed twice in this deal.
mark_domain_as_used(domain_nft);
mark_domain_as_used(&mut nft);
nft
}
Move
Move overview
Move is an open source language for writing safe packages to manipulate on-chain objects
Package upgrades
Sui provides a method of upgrading your packages while still retaining their immutable properties.
Objects
Object Model
Everything on the Sui blockchain is an object, with metadata, type of ownership, and a referencing scheme.
Dynamic Fields
Dynamic fields and dynamic object fields on Sui are added and removed dynamically, affect gas only when accessed, and store heterogeneous values.
Transfer to Object
On Sui, you can transfer objects to objects in the same way you can transfer objects to addresses.
Cryptography
zkLogin
zkLogin is a Sui primitive that enables you to send transactions from a Sui address using an OAuth credential, without publicly linking the two.
Transaction authentication
Transaction security is arguably the most important feature of a blockchain. Sui provides multiple features to secure your transactions, whether on chain or off.
Tokenomics
SUI token
The native asset on Sui is called SUI. The coin uses the capitalized version of SUI to distinguish the coin from the Sui network.
Gas in Sui
A Sui transaction must pay for both the computational cost of execution and the long-term cost of storing the objects a transaction creates or mutates.
Storage fund
Sui includes an efficient and sustainable economic mechanism for financing data storage, which is important given the ability of Sui to store arbitrarily large amounts of on-chain data.