Skip to content

UniqueNetwork/polkadot-events-contract

Repository files navigation

Polkadot App | EventManager contract

Demo

This contract was deployed to the Opal network at address 0x4aecf1b3a3f9ed8f2bf86a0e66955245ab38a2eb. Self-sponsoring is enabled, which means that the contract will cover all transaction fees.

One event registered. To claim NFT, use the collection address 0x17C4E6453Cc49aAAaeaCA894e6d9683e000011cD. Check the collection and minted NFTs on the Unique Scan.

API

Types

CrossAddress

This struct represents EVM or Substrate account. Only one field can be filled.

  • For the EVM account, set eth with the EVM address (0x...).
  • For the Substrate account, set the sub property with the substrate public key in decimal format
struct CrossAddress {
  address eth;
  uint256 sub;
}

Attribute

Key/value pair representing NFT's trait

struct Attribute {
  string trait_type;
  string value;
}

EventConfig

This struct represents the event's configuration.

  • startTimestamp: NFT cannot be minted if block.timestamp < startTimestamp
  • endTimestamp: NFT cannot be minted if block.timestamp > endTimestamp
  • accountLimit: How many NFTs a single account may have
  • collectionCoverImage: URL of a collection cover image
  • tokenImage: URL of an NFT image. All NFTs will have the same image
  • soulbound: if true NFT cannot be transferred
  • attributes: NFT attributes list, see Attributes
  • owner: Event owner. This address is a virtual owner of the event's NFT collection. Real ownership can be claimed
struct EventConfig {
  uint256 startTimestamp;
  uint256 endTimestamp;
  uint256 accountLimit;
  string collectionCoverImage;
  string tokenImage;
  bool soulbound;
  Attribute[] attributes;
  CrossAddress owner;
}

Creating event

Interface

function createCollection(string _name,string _description,string _symbol,EventConfig _eventConfig)

Events

  • event EventCreated(uint256 collectionId, address collectionAddress);

Creating NFT

Interface

function createToken(address _collectionAddress, CrossAddress _owner)

Events

  • event TokenClaimed(CrossAddress indexed owner, uint256 indexed colletionId, uint256 tokenId);

Using from Substrate

The contract can be called with a Substrate account using evm.call extrinsic.

Examples are coming soon.

Installation

Node.js, yarn, and forge should be installed.

yarn

Tests

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published