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

React

React to an NFT using a RARA reaction. This will generate an NFT (“Like Token”) for the Reactor. Add metadata to the reaction by including an IPFS hash.

PreviousRegisterNextOptional Curation Incentives

Last updated 2 years ago

{
    transformId: Uint256, // The ID of the Reaction Transform you want to use
    quantity: Uint256, // The number of Reactions you'd like to send
    referrerAddress: Address, // The Address that should receive referrer cuts
    optionBits: Uint256, // Parameter version of the Reaction you're using
    takerNFTChainId: Uint256, // Chain ID of the NFT receiving the Reaction
    takerNFTAddress: Address, // Contract Address of the NFT receiving the Reaction
    takerNFTId: Uint256, // Token ID of the NFT receiving the Reaction
    curatorVaultOverride: Address, // Override used for alternate Curator Vaults
    ipfsMetadataHash: String // Additional metadata to be saved with Reaction
}

Reaction Vault Contract Addresses

// Polygon Mainnet
0xE5BA5c73378BC8Da94738CB04490680ae3eab88C

// Polygon Mumbai
0xA374674F97885BD378059708e97f7117CB74683d

Reaction Vault Contract ABI

Reaction Vault ABI
{
  address: "0xA374674F97885BD378059708e97f7117CB74683d", // Mumbai Address
  abi:[{
    name: 'react',
    stateMutability: 'payable',
    type: 'function',
    inputs: [
      {
        internalType: 'uint256',
        name: 'transformId',
        type: 'uint256',
      },
      {
        internalType: 'uint256',
        name: 'quantity',
        type: 'uint256',
      },
      {
        internalType: 'address',
        name: 'referrer',
        type: 'address',
      },
      {
        internalType: 'uint256',
        name: 'optionBits',
        type: 'uint256',
      },
      {
        internalType: 'uint256',
        name: 'takerNftChainId',
        type: 'uint256',
      },
      {
        internalType: 'address',
        name: 'takerNftAddress',
        type: 'address',
      },
      {
        internalType: 'uint256',
        name: 'takerNftId',
        type: 'uint256',
      },
      {
        internalType: 'address',
        name: 'curatorVaultOverride',
        type: 'address',
      },
      {
        internalType: 'string',
        name: 'ipfsMetadataHash',
        type: 'string',
      },
    ],
    outputs: []
  }]
}

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

See ReactionVault tab for contract definitions

[Optional] Save Reaction Metadata to IPFS

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

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

interface IReactionMetadata {
    comment?: 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 reactionMetadata: IReactionMetadata = {
    comment: "My first comment using the RARA! Social Curation Protocol",
    tags: ["rara", "social", "curation"]
}

// Save reaction 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(reactionMetadata));

Send a Reaction and Reaction Metadata to an NFT

To send a Reaction to an NFT, use the react function of the ReactionVault. All parameters are required (see the Parameters section for more details).

import { Contract, constants } from 'ethers'

// Select an NFT to receive the reaction
const TakerNFT = {
    chainId: 80001,
    contractAddress: 0x2953399124f0cbb46d2cbacd8a89cf0599974963,
    tokenId: 107136376226630408484522358727913128313617592685310283300071728450490266025985
}

// Instantiate a Reaction Vault contract and attach a signer 
const ReactionVault = new Contract(
    reactionVault.address, 
    reactionVault.abi,
    signer
);

// Call the React function with required parameters 
const transaction = await ReactionVault.react(
    102265098525112739997130475423667270810501597805004267158805479941320194430532, //transformId,
    1, //quantity
    constants.AddressZero, // referrerAddress
    constants.Zero, // optionBits
    TakerNFT.chainId, // takerNFT Chain ID
    TakerNFT.contractAddress, // takerNFT Contract Address
    TakerNFT.tokenId, // takerNFT ID
    constants.AddressZero, // curatorVaultOverride
    ipfsCID // "QmV3wpfESJdZTaY262rZMqGSmH8cV9ThDDxRaKDm1ZmoWs"
);

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

Parameters

All parameters are required

transformId

The ID of the reaction to be used. Only reactions can be used.

quantity

The number of reactions to be sent. If value is sent, the reaction quantity must equal the value / reactionPrice

referrerAddress

The address of the referring party. If value is sent, the referrer will be rewarded with value * saleReferrerBasisPoints. Use addressZero if no referrerAddress is set.

optionBits

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

takerNFTChainId

Chain ID of the NFT receiving reactions

takerNFTContractAddress

Contract Address of the NFT receiving reactions

takerNFTTokenId

Token ID of the NFT receiving reactions

curatorVaultOverride

This parameter allows for multiple Curator Vaults. Use addressZero if curatorVaultOverride is 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

View the protocol on .

🛠️
❤️
registered
Github