Skip to content

Spaces Registry smart contract allows Creators to register their Experiences as a L1 Space

Notifications You must be signed in to change notification settings

lamina1/spaces-registry

Repository files navigation

LAMINA1 Spaces

Build and deploy Experiences (aka Spaces) on LAMINA1.

This repo contains the LAMINA1 Spaces Registry smart contract, which allows Creators to deploy and register their Experiences as a LAMINA1 compatible Space.

In order to be compatible with the LAMINA1 Metaverse Asset Dispenser and Spaces Registry, any items used in a Space have to implement the ISpaceItem interface, which can be found here.

The BaseItem contract is a simple template for an ERC1155 standard item that implements this interface, which can be found here.

Item types

The Space Lasers Experience showcases different types of items that can be used within a Space.

Fungible

The MultipleItem contract builds upon BaseItem and adds the ERC1155URIStorage extension, which allows for multiple fungible items to exist in the same contract. The items are differentiated by a idx which is passed in as a parameter to the mint function. Each item minted has a unique ID, and the ERC1155URIStorage extension is used to set the metadata URI for each item, by appending the idx to the baseURI of the collection. This allows for a single contract to be used to mint multiple fungible items, but still maintain a unique ID for each individual item.

This is used by Space Lasers to create different colored lasers in the same collection, with indexes from 0 to 4.

Soul-Bound

The Trophy contract uses the ERC5633 extension to create soul-bound items. These items cannot be transferred, so this type of collection is useful for creating items that are only meant to be minted to a specific address, such as a trophy that is awarded to a player for completing a specific task.

Random

The UniqueItem contract builds upon BaseItem, overriding the mint function in order to always create a unique ID for each item minted. This is useful for creating items that are meant to be random, but that share a single metadata URI, with some sort of randomization happening client side (e.g. some attribute in the metadata depends on the item ID).

The Space Lasers experience contains a random laser, but for ease of deployment, instead of UniqueItem, the same MultipleItem collection is used as for the base color lasers. The random laser attributes are generated by the LAMINA1 Metaverse Asset Dispenser, by using the item ID as a seed. The random laser metadata is read from the collection with index 5.

Local deployment

To deploy Spaces Registry locally for development purposes use the following command:

npm run start

This will spin up a local 5 node network and then deploy the Spaces Registry + Space Lasers example.

To stop the local running network, run the following command:

npm run stop

LAMINA1 Betanet

The Spaces Registry is deployed at the following address in the C chain

Spaces Registry: 0xc79c66969fff7d09bf9DB40E549DA2b3858f7ADf

The items for Space Lasers are deployed at the following addresses in the C chain

Space Lasers Items: 0x673a0e68062035c66F8c6D8BC719B9615150dF4b
Space Lasers Trophy: 0x05959221Fd2A8d048cdB49a2500379502213534C

Deploying to LAMINA1 Betanet

WARNING: The Space Registry is currently paused, no new Spaces can be registered.

Deploy + Register Space

In order to deploy a space to the LAMINA1 Betanet, first you will need to have a LAMINA1 account with some L1 Betanet tokens.

Then, you can set the private key for this account in the .env file. Please see the hardat config file for the environment variable name.

Finally, edit the deploy_space.ts script in order to set the correct parameters for your Space.

The script will do all the necessary transactions in order to deploy and register your Space with LAMINA1 Space Registry:

  1. Deploy each Item and Trophy
  2. Set Spaces Registry as allowed minter
  3. Register the Space with the Spaces Registry

To run the script, use the following command:

npm run deploy:space

Register Space only

If you already have items deployed in LAMINA1 Betanet for your Space (as long as the contracts implement the ISpaceItem interface), you can register your Space with the Spaces Registry by editting the register_space.ts script and setting the correct parameters for your Space.

To run the script, use the following command:

npm run register:space

About

Spaces Registry smart contract allows Creators to register their Experiences as a L1 Space

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published