Giter VIP home page Giter VIP logo

contract-4's Introduction

Starknet.id Contract

This contract is written in Cairo. It allows to mint identity nfts. The nft contains fields associated to values. To each field, value can be bound, certified by a user or other contracts. For the same field there can be multiple values from multiple contracts.

Official addresses of deployment:

  • Goerli: 0x783a9097b26eae0586373b2ce0ed3529ddc44069d1e0fbc4f66d42b69d6850d
  • Mainnet: 0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af

Usage

Note: When rewriting extended data, you might want to add a zero at the end to tell to unbounded read where to stop.

For users

// mint a nft with id token_id (can be random, must not be already minted)
mint(token_id);

// write a data (my discord id) associated to a token_id of a NFT I own and a type (here the felt 'discord')
set_user_data(token_id, 'discord', 707979046952239197);

// write multiple felts
set_extended_user_data(token_id, 'avatar', 3, new('my', 'avatar', 'url'));

For verifiers

// confirm this data is correct for this specific type and token_id (e.g. you got a proof)
set_verifier_data(token_id, 'discord', 707979046952239197);

// same with multiple felts
set_extended_verifier_data(token_id, 'avatar', 3, new('my', 'avatar', 'url'));

For external services

// get data written by the nft owner
get_user_data(token_id, 'discord');

// retrieving an array knowing its size (will return zeros if not written)
get_extended_user_data(token_id, 'avatar', 3);

// retrieving an array up to zero (not included)
get_unbounded_user_data(token_id, 'avatar');

// get data written by the specified verifier
get_verifier_data(token_id, 'discord', verifier_addr);
get_extended_verifier_data(token_id, 'avatar', 3, verifier_addr);
get_unbounded_verifier_data(token_id, 'avatar', verifier_addr);

Building/testing

Setup: protostar install Testing: protostar test Building: protostar build Deploying: python deploy.py <private_key>

contract-4's People

Contributors

th0rgal avatar fricoben avatar omahs avatar

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.