LFG.CLUB
  • Hello there
  • Bonding Curve
    • How it works
    • Displayed Token
    • Create Token
    • Metadata
    • Buy and Sell
    • Bonding Curve Math
    • Migration
    • Slightly Deflationary
    • Locks
  • Deposit Contract
    • Deposit, Claim, and Withdraw
  • LFG Token
    • Tokenomics
  • Deployments and liquidity lock
  • Locks
  • Deployment Addresses
    • Testnet
    • All Chains
  • Links
    • Links
Powered by GitBook
On this page
  1. Bonding Curve

Metadata

Apart from the name and symbol the metadata is not stored on the token itself. We only store the metadata hash.

We actually emit following event on EVM level:

event CreateToken(bytes32 indexed metadataHash, address indexed token, uint256 indexed tokenId, string name, string symbol, string description, string image, string web, string twitter, string telegram)

Where the metadata is "logged", i.e. not directly retrievable via storage on the actual token, but it can be searched via the event logs. Together with the saved metadata hash and the provided metadata from the log you can verify that it really is the same metadata if you hash the logged metadata in the following combination:

function combineInputs(
        string memory str0,
        string memory str1,
        string memory str2,
        string memory str3,
        string memory str4,
        string memory str5,
        string memory str6,
        uint256 number
    ) public pure returns (string memory) {
        return string(
            abi.encodePacked(
                "ID:",
                uintToString(number),
                "|Name:",
                str0,
                "|Symbol:",
                str1,
                "|Description:",
                str2,
                "|Image:",
                str3,
                "|Web:",
                str4,
                "|X:",
                str5,
                "|Telegram:",
                str6
            )
        );
    }

Hashing this in solidity with

hash = keccak256(abi.encode(combinedInputs));

will give you the correct metadata hash. Instead of using solidity you can also use JS, Python, or whatever you want to generate the metadata hash.

This saves a lot of gas while still ensuring that the data is actually on the blockchain.

PreviousCreate TokenNextBuy and Sell

Last updated 1 month ago