Giter Club home page Giter Club logo

smc-dcoa's Introduction

Silver Mare Coin Digital Certificate of Authenticity

This project is to create a Digital Certificate of Authenticity (DCoA) for the Silver Mare Coin Project thread on /mlp/. This DCoA will be created using an ERC-721 token contract on the Polygon blockchain (subject to change).

In order to claim a certificate, a claim code will need to be provided. These claim codes will consist of your coin serial number(s) and a hash of a signed message by a predetermined address (TBD); verifying the signature originated from the predetermined address will prevent tampering and prove the claimant was the original purchaser of the Silver Mare Coin. Claim codes will be provided by a Silver Mare Coin Project manager to the purchasers.

Thus each certificate generated by this contract will only be claimable by a purchaser of a Silver Mare Coin, and each purchaser will be issued as many claim codes to match the number of Silver Mare Coins they purchased (if they so desire). In addition to the serial number, each certificate will also contain the following metadata:

  • Year the coin was minted (2022)
  • Composition of the coin (99.9% Ag)
  • Weight of the coin (31.10 g)
  • Diameter of the coin (39 mm)
  • Thickness of the coin (3.05 mm)
  • Orientation of the coin (Coin alignment โ†‘โ†“)
  • Location where the coin was minted (United States)
  • Shape of the coin (round)
  • An image representation of the coin (based on the final design submitted to the mint)

If you would like to suggest additional metadata, please be sure to do so before this contract goes live; once it does, all metadata is baked into the blockchain and can never be updated!

Deployment

Here is the contract address of the official Silver Mare Coin Digital Certificate of Authenticity (only the one on the Polygon network counts; there may be deployments to test networks for testing purposes). All of these contracts will be verified on Polygonscan in order to make interacting with them very easy. Click the link below, then click on Read Contract to get data and Write Contract to execute functions that modify the block chain (you will need a wallet like Metamask if you are using the Write Contract functions).

  • Polygon: TBD
  • Mumbai (test network): TBD

If you need to claim your tokens and need a small amount of MATIC, please send your wallet address to [email protected] and I will send you some. (TBD looking into a way to make these claims gasless.)

How to claim your certificate(s)

TBD This may be a Web site (if I or another volunteer has time) or a guide on how to make the claim using Polygonscan.


Complete documentation

Please note below that the terms tokenId, certificate number, certificate ID, and serial number all refer to the same number.

Functions

  • Custom data structures
    ClaimDetails(uint16 number, bytes signature)
    Encapsulates the data needed for each certificate claim: The certificate number and the signature. Used when claiming multiple certificates with the claimCertificates function.
  • Custom functions
    cap() returns (uint16)
    Returns the total possible number of certificates that can be claimed.
    certificateSigningHash(uint16 number) returns bytes32
    Returns the certificate signing hash which is then signed by the proper signer; this is of limited utility to anyone except the signer when creating the claim signatures.
    claimCertificate(uint16 number, bytes signature)
    Verifies that the given signature matches the one generated for the given certificate number and was signed by the proper signer. If this is all correct, it then issues the matching certificate and a CertificateClaimed event is emitted.
    claimCertificates(ClaimDetails[] claims)
    Verifies that each given signature match the one generated for the respective given certificate number and was signed by the proper signer. If this is all correct for all claims, it then issues matching certificates and CertificateClaimed events are emitted.
    contractURI() returns (string)
    Returns the Uniform Resource Indicator (URI) for this contract. This is used by token metadata sites to display overall collection metadata related to all the certificates issued by this contract.
    floor() returns (uint16)
    Returns the smallest possible certificate number that can be claimed (should always be 1).
    isCertificateClaimed(uint16 number) returns (bool)
    Returns true if the certificate with the given number has already been claimed; otherwise, returns false.
    isValidSignature(uint16 number, bytes signature) returns (bool)
    Returns true if the given signature matches the one generated for the given certificate number and was signed by the proper signer.
    SIGNER() returns (address)
    Returns the address of the proper signer.
    versionRecipient() returns (string memory)
    Returns the compatible OpenGSN recipient version.
  • ERC-721 standard functions
    approve(address approved, uint256 tokenId)
    Sets an approved address that is allowed to transfer the certificate specified by the tokenId. Only use this if you need to transfer your certificate to another address using an external smart contract. Set to the zero address to clear this approval when you are done.
    balanceOf(address owner) returns (uint256)
    Returns the number of certificates held by an owner address
    getApproved(uint256 tokenId) returns (address)
    Gets the approved address for a single certificate specified by the tokenId. Will return the zero address if there is no approved address.
    isApprovedForAll(address owner, address operator) returns (bool)
    Returns true if the given operator is approved to transfer all of owner's certificates. Otherwise, returns false.
    ownerOf(uint256 tokenId) returns (address)
    Returns the address of the owner of the certificate specified by the tokenId
    safeTransferFrom(address from, address to, uint256 tokenId, bytes data)
    safeTransferFrom(address from, address to, uint256 tokenId)
    Transfers the ownership of the certificate specified by tokenId from one address to another, along with optional data in no specified format.
    setApprovalForAll(address operator, bool approved)
    Allows a third party operator to manage all of your Silver Mare Coin certificates. This opeartor is added to a list of operators with such approval. Be sure to call this function again with a false value for approved once your are done. This should only be used when you need to transfer your certificate to another address using an external smart contract.
    transferFrom(address from, address to, uint256 tokenId)
    Transfers the ownership of the certificate specified by tokenId from one address to another, along with optional data in no specified format. Please note that if the recipient wallet is not able to receive ERC-721 tokens, the transfer may fail and the certificate may be lost. For this reason, it's highly recommended you use safeTransferFrom() instead.
  • ERC-721 metadata extension functions
    name() returns (string)
    Returns the name of this certificate; i.e., Silver Mare Coin Digital Certificate of Authenticity.
    symbol() returns (string)
    Returns the symbol of this certificate; i.e., SMC DCoA (TBD).
    tokenURI(uint256 tokenId) returns (string)
    Returns a ipfs:// URI corresponding to the JSON document that defines the metadata for the certificate specified by tokenId. This JSON document also contains an ipfs:// URI corresponding to the SVG image depicting the coin. This is used by external sites to display the image and metadata for this certificate.
  • ERC-721 enumeration extension functions
    tokenOfOwnerByIndex(address owner, uint256 index) returns (uint256)
    Returns the certificate number at the specified index of the given owner. Allows for enumeration of all certificates held by an address.
    tokenByIndex(uint256 index) returns (uint256)
    Returns the certificate number at the specified index. Allows for enumeration of all certificates issued by this contract.
    totalSupply() returns (uint256)
    Returns the total number of valid certificates issued by this contract (this number may increase but will never be higher than the cap.
  • ERC-165 (required by ERC-721) standard functions
    supportsInterface(bytes4 interfaceId) returns (bool)
    Returns true if this contract supports the interface specified by interfaceId (as defined in ERC-165). Otherwise, returns false.
  • ERC-173 (TBD conformance to this may or may not be required by this contract; if not, all related functions will be removed) standard functions
    owner() returns (address)
    Returns the address that owns the Silver Mare Coin certificate contract.
    transferOwnership(address newOwner)
    Sets the owner of this contract to the address specified by newOwner. Only callable by the address specified in owner()
  • ERC-2771 standard functions
    setTrustedForwarder(address forwarder)
    Only callable by the owner of the contract; sets the trusted forwarder contract to forwarder.

Events

  • Custom events
    CertificateClaimed(address indexed by, uint16 indexed id)
    Emitted when certificate numbered id is successfully claimed by the address by.
    PermanentURI(string uri, uint256 indexed tokenId)
    Emitted at certificate creation to signal to token metadata aggregators that the metadata for this certificate is frozen and can never be changed.
  • ERC-721 standard events
    Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)
    Emitted when an approved address for a certificate is changed or reaffirmed. The zero address indicates there is no approved address. When a Transfer event is emitted, it also indicates that the approved address for that certificate has reset to the zero address.
    ApprovalForAll(address indexed owner, address indexed operator, bool approved)
    Emitted when an operator is enabled or disabled for an owner.
    Transfer(address indexed from, address indexed to, uint256 indexed tokenId)
    Emitted whenever the ownership of a certificate changes by any mechanism, including creation and destruction.
  • ERC-173 standard events
    OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
    Emitted whenever ownership of this contract has changed.

Errors

  • Custom errors
    CertificateAlreadyClaimed(uint16 number)
    Thrown when attempting to claim certificate with number number that has already been claimed.
    CertificateNumberOutOfRange(uint16 number, uint16 floor, uint16 cap)
    Thrown when attempting to claim certificate with number number that is less than floor or greater than cap.
    InvalidSignature(uint16 number, bytes signature)
    Thrown when attemptinmg to claim certificate with number number with an invalid signature.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.