LogoLogo
WebsiteBlogApp↗
  • 〰️Introduction
    • 🔊Social Curation Protocol
    • 💬Curation Adds Context
    • Use Cases
    • "For You" Feeds
  • 💡Major Concepts
    • Reactions
    • Registration
    • RA! Like Tokens
    • Glossary of Terms
  • 🛠️Protocol Features
    • ✅Register
    • ❤️React
    • Optional Curation Incentives
      • Buy Reactions
      • Spend Reactions
      • Curation Tokens
      • Claiming ERC20 Rewards
  • 📋Protocol Data
    • GraphQL Subgraph
    • Event Diagram
  • 🚢Implementation
    • Permissions
    • Source Code
    • GraphQL Subgraph
  • ⚙️Integration Guide
    • Integration Guide
    • Protocol Interactions
  • Other
    • Security and Vulnerability Reporting
    • FAQ
Powered by GitBook

RARA, the Social Curation Protocol for NFTs. © 2020-2023 RARA Social Inc.

On this page
  • Parameters
  • Source Code
  1. Protocol Features

Register

Registering NFTs allow them to be used as reactions in the RARA protocol.

L1 registrations use the RootRegistrar ABI, L2 registrations use the MakerRegistar ABI

{
    nftContractAddress: Address, // The Address of the NFT you want to Register
    nftId: Uint256, // Token ID of the NFT you want to Register
    creatorAddress: Address, // The Address receiving a cut of Maker rewards
    creatorSaleBasisPoints: Uint256 // The basis points set aside for the Maker
    optionBits: Uint256, // Parameter version of the Reaction you're using
    ipfsMetadataHash: String // Additional metadata saved with registration
}

Maker Registrar Contract Addresses

// Polygon Mainnet
0x47CD3266FA94E40613B37a88D98196325Cd28412

// Polygon Mumbai
0x06493B0362b3892EEc7C63023e8bC0C0c64646eb

Maker Registrar Contract ABI

Maker Registrar Contract ABI
{
  address: "0x06493B0362b3892EEc7C63023e8bC0C0c64646eb", // Mumbai Address
  abi:[{
    name: 'registerNft',
    stateMutability: 'nonpayable',
    type: 'function',
    inputs: [{
        internalType: 'address',
        name: 'nftContractAddress',
        type: 'address',
      },
      {
        internalType: 'uint256',
        name: 'nftId',
        type: 'uint256',
      },
      {
        internalType: 'address',
        name: 'creatorAddress',
        type: 'address',
      },
      {
        internalType: 'uint256',
        name: 'creatorSaleBasisPoints',
        type: 'uint256',
      },
      {
        internalType: 'uint256',
        name: 'optionBits',
        type: 'uint256',
      },
      {
        internalType: 'string',
        name: 'ipfsMetadataHash',
        type: 'string',
      },
    ],
    outputs: [],
  }]
}

Root Registrar Contract Addresses

// Ethereum Mainnet
0x2665Aa3846EC61e6D28A0d9F76b70047719F3664

// Goerli Mumbai
0x33066F8848967a16FC27bc1b2f347c9345Ed8b33

Root Registrar Contract ABI

Root Registrar Contract ABI
{
  address: "0x33066F8848967a16FC27bc1b2f347c9345Ed8b33", // Goerli Address
  abi:[{
    name: 'registerNft',
    stateMutability: 'nonpayable',
    type: 'function',
    inputs: [
      {
        internalType: 'address',
        name: 'nftContractAddress',
        type: 'address',
      },
      {
        internalType: 'uint256',
        name: 'nftId',
        type: 'uint256',
      },
      {
        internalType: 'address',
        name: 'creatorAddress',
        type: 'address',
      },
      {
        internalType: 'uint256',
        name: 'creatorSaleBasisPoints',
        type: 'uint256',
      },
      {
        internalType: 'uint256',
        name: 'optionBits',
        type: 'uint256',
      },
      {
        internalType: 'string',
        name: 'ipfsMetadataHash',
        type: 'string',
      },
    ],
    outputs: [],
  }]
}

Register a Reaction with ethers.js and ipfs-http-client

See MakerRegistar ABI or RootRegistrar ABI tab for contract definitions

[Optional] Save Registration Metadata to IPFS

If you'd like to include a Reaction Name or Tags with your Reaction, you'll need to save that information to IPFS first. If you just want to register a Reaction you can skip this step.

import { client } from 'ipfs-http-client'

interface IRegistrationMetadata {
    name?: String;
    tags?: String[];
}

// Instantiate a new IPFS Client -- we use an IPFS node hosted by theGraph
const client = create(new URL('https://api.thegraph.com/ipfs/api/v0/'));

// Create a metadata blob to store comments and/or tags.
const registrationMetadata: IRegistrationMetadata = {
    name: "My Cool Reaction",
    tags: ["rara", "social", "curation"]
}

// Save registration metadata on IPFS to generate an ipfsCID.  Keep this ipfsCID handy as we'll use it in the next step.
const { ipfsCID } = await client.add(JSON.stringify(registrationMetadata));

Register an NFT for use as a Reaction

To register a Reaction for use in the protocol, you'll use the registerNft function of either the RootRegistrar (a bridge for L1 NFTs) or the MakerRegistrar (for L2 NFTs). All parameters are required (see the Parameters section for more details).

import { Contract, constants } from 'ethers'

// Select an NFT to register as a reaction
const NFT = {
    contractAddress: 0x2953399124f0cbb46d2cbacd8a89cf0599974963,
    tokenId: 107136376226630408484522358727913128313617592685310283300071728450490266025985
}

// Instantiate the MakerRegistrar contract and attach a signer 
const MakerRegistrar = new Contract(
    makerRegistar.address, 
    makerRegistar.abi,
    signer
);

// Call the registerNft function with required parameters 
const transaction = await MakerRegistar.registerNft(
    NFT.contractAddress, // Contract Address of the NFT to register
    NFT.tokenId, // Token ID of the NFT to register
    constants.AddressZero, // creatorAddress
    constants.Zero, // creatorSaleBasisPoints
    constants.Zero, // optionBits
    ipfsCID // "QmUgmdW3N8tgh5hZXna4p7sHxqTAhvf7CZhguoLhE7NsgV"
);

// await completion of registerNft function call
const receipt = await transaction.wait()

This example uses the MakerRegistrar to register an L2 NFT. If you'd like to register an L1 NFT, simply switch out the MakerRegistrar for the RootRegistrar.

Parameters

All parameters are required

nftContractAddress

Contract Address of the NFT receiving reactions

nftTokenId

Token ID of the NFT receiving reactions

creatorAddress

The address of the creator of this NFT. If a creatorAddress is set, they will receive a portion of the Maker Rewards generated each time this Reaction is spent based on the following creatorSaleBasisPoints parameter. Use addressZero to leave the creatorAddress parameter unset.

creatorSaleBasisPoints

Basis points allocated to the creator as a portion of the MakerRewards generated during a reaction sale. Use 0 if no basis points should be allocated to the creator.

optionBits

This parameter can be used to create different versions of the reaction NFT. Use 0 if optionBits are not set.

IPFSMetadataHash

This parameter can be used to embed additional data about the user interaction. Use maxInt256 if ipfsMetadataHash is not set.

Source Code

PreviousGlossary of TermsNextReact

Last updated 2 years ago

View the protocol on .

🛠️
✅
Github