title |
---|
Examples of Sui Smart Contracts |
Find sample Sui smart contract implementations in the sui_programmability/examples directory. Also see Sui by Example for a feature-by-feature guide to Sui Move.
Here is a list of existing examples in the Sui repository.
In the Basics example, explore object creation, update, and exchange.
In the Cryptography example, employ a simple contract to:
- Hash a piece of data using keccak256 and output an object with hashed data.
- Recover a Secp256k1 signature to its public key and output an object with the public key.
- Verify a Secp256k1 signature and produce an event indicating whether it is verified.
In the DeFi example, find an atomic swap leveraging an escrow agent that is trusted for liveness, but not safety.
In the Fungible Tokens example, see a token managed by a treasurer trusted for minting and burning for how (e.g.) a fiat-backed stablecoin would work.
In the Games example, try out and modify toy games built on top of Sui! These include classic Tic Tac Toe, rock paper scissors, and various versions of an adventure game (Hero).
In the NFTs example, browse non-fungible tokens of various types and see NFTs representing assets in a game.