Contracts

In this guide we will explain web3 - web2 integrations. It is important to understand the primary key elements of both layers. In essence, Web2 is a traditional server - client programming and Web3 is decentralized - public and immutable. These are the key ingredients and we will explain how we handled the SELF project across these layers.

Self NFT - Smart Contract Description

This contract contains the core logic and state of SELF and is compliant with [ERC721], the OpenZeppelin standard NFT implementation. The SELF NFT is deployed on BNB Smart Chain at address 0x125Bb13F77f3565d421bD22e92aaFfC795D97a72

The primary function for registration is registerName(name) which handles the minting of an NFT and registering a name as an ID. It computes the SHA256 hash of a provided name and converts it into a unit which acts as a token id. Once a name is registered by a user, it cannot be registered by anyone else, however, the owner of a name can transfer it to anew owner. It also reverts if a name contains invalid characters.

Valid characters: a-z(lowercase letters)

Valid characters can be easily redefined by updating the isLegal(str) modifier.

The contract model

The contract model contains all the information about your contracts, such as their username, avatar, and phone number. It also contains a reference to the conversation between you and the contract and information about when they were last active on SELF. We have created a web2 counterpart for the web3 contract. This counterpart we titled : web3_record.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the contract.

  • Name
    chain
    Type
    string
    Description

    The chain for the contract.

  • Name
    chain adress
    Type
    string
    Description

    The chain address for the contract.

  • Name
    web2_url
    Type
    string
    Description

    The web2 URL for the contract.

  • Name
    contract_title
    Type
    string
    Description

    The contract display name in the contract list..

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the contract was created.


GET/v1/contracts

List contracts

contracts list

{
"Public_StakePool" : "0xEA4ca74E159Cf3a083129B89291d3a25858E4A2B",
"Presellers_StakePool" : "0x5422115F38484C82FE09734d54abC7eA1954Fc26",
"Token" : "0x50c34995a273075a80c23625F69F40d56CE414DE",
"selfAddr" : "0x238B05632f8c8D934d022C114CAaf9218D73838d",
"oracleAddr" : "0x58b5824B71190a1BF7D0a95295C0E71ea38EB097"
}