
Research
Security News
Malicious npm Packages Use Telegram to Exfiltrate BullX Credentials
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
@unique-nft/contracts
Advanced tools
This repository contains smart contracts for minting collections and tokens using Solidity in the Unique Schema V2.
Install packages:
npm install @unique-nft/contracts
Find the RPC endpoint in the official documentation. You can get OPL
(Opal testnet) tokens for free at https://t.me/unique2faucet_opal_bot
[!IMPORTANT] Configure your project:
- Compatible Solidity versions are
>=0.8.18 <=0.8.24
- Use via-IR compilation pipeline.
In hardhat.config file set:
solidity: { version: "0.8.24", settings: { viaIR: true }, },
Represents an attribute of a token.
Parameter | Type | Description |
---|---|---|
trait_type | string | Type of the attribute. |
value | string | Value of the attribute. |
Represents ethereum or substrate account. Only one property can be filled out to consider the structure valid. Learn more about EVM in Unique Network and compatibility with substrate accounts in the official documentation.
The AddressUtils
library provides helper methods to work with the CrossAddress
struct.
Parameter | Type | Description |
---|---|---|
eth | address | Ethereum address or address(0) if the origin is substrate account |
sub | uin256 | Substrate public key or 0 if the caller is ethereum account |
CollectionMinter.sol
import "@unique-nft/contracts/CollectionMinter.sol";
Provides functions to create collections in the Unique Schema V2.
constructor(bool _mutable, bool _admin, bool _tokenOwner)
Initializes the contract and sets the default permissions for token properties mutation
_createCollection(string _name, string _description, string _symbol, string _collectionCover)
Creates a collection with specified name, description, symbol, collection cover, and allowed nesting permissions.
TokenMinter.sol
import "@unique-nft/contracts/TokenMinter.sol";
Provides functions to create tokens in the Unique Schema V2.
_createToken(address _collectionAddress, string _name, string _description, string _image, Attribute[] _attributes, CrossAddress _to) internal returns (uint256)
Internal function to create a new token with specified image and attributes in a given collection.
TokenManager.sol
import "@unique-nft/contracts/TokenManager.sol";
Provides utility functions for managing token data, such as setting and retrieving images and traits for tokens within a collection.
_setImage(address _collection, uint256 _tokenId, bytes memory _newImage) internal
Sets a new image for a specific token in a collection.
_setTrait(address _collection, uint256 _tokenId, bytes memory _traitType, bytes memory _traitValue) internal
Sets a new trait (attribute) for a specific token in a collection.
_getImage(address _collection, uint256 _tokenId) internal view returns (bytes memory)
Retrieves the image data of a specific token in a collection.
_getTraitValue(address _collection, uint256 _tokenId, bytes memory _traitType) internal view returns (bytes memory)
Retrieves the value of a specific trait for a token in a collection.
AddressValidator.sol
import "@unique-nft/contracts/AddressValidator.sol";
Provides modifiers for validating addresses in token-related operations, ensuring that the caller is authorized.
onlyTokenOwner(uint256 _tokenId, address collectionAddress
Restricts access to the owner of the token with ID _tokenId
in the collection at collectionAddress
. Reverts if msg.sender
is not the token owner.
onlyMessageSender(CrossAddress memory _crossAddress)
Restricts access to the address represented by _crossAddress
. Reverts if _crossAddress
does not match msg.sender
.
Minter.sol
: Demonstrates how to create a gasless experience for minting collections and NFTs.POAP.sol
: Demonstrates how to create a POAP contract. Tokens minting sponsored by the POAP contract itself. Every account can mint only one NFT that cannot be transferred.BreedingGame.sol
: Demonstrates how contracts can mutate token's attributes and image.yarn
yarn compile
Create .env
file from .env.example
Set at least two private keys with OPL
balance to TEST_ACCOUNTS_ETH
env. You can get OPL
tokens for free at https://t.me/unique2faucet_opal_bot
Run tests
yarn test
FAQs
Smart Contract library for Unique Network
The npm package @unique-nft/contracts receives a total of 1,028 weekly downloads. As such, @unique-nft/contracts popularity was classified as popular.
We found that @unique-nft/contracts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.
Security News
AI-generated slop reports are making bug bounty triage harder, wasting maintainer time, and straining trust in vulnerability disclosure programs.