GithubHelp home page GithubHelp logo

dynamic-nft's Introduction

Random Number Generation Process:

  1. Mainly composed of ChainlinkClient.
  2. Initialize VRFCoordinatorV2Interface.
  3. Use requestRandomWords function to initiate the request.
  4. Obtain and utilize the random number in the callback function fulfillRandomWords.

Main Structs:

image

User Minting Sequence Diagram:

image

WeatherRequestConsumer Contract

Main functionalities:

  1. Off-chain data request: The contract utilizes functionalities provided by Chainlink to fetch weather data from an external API. By calling the requestCurrentWeather function, the contract sends a request to the specified API and retrieves the current weather temperature via Chainlink service.
  2. Off-chain data processing: The contract receives off-chain data responses from Chainlink and passes the weather temperature information from the response as a parameter to the changeERTStatus function of the Models contract, thereby updating the NFT status based on external weather temperature.
  3. Access control: The contract implements access control functionality, allowing only authorized users to call functions such as requestCurrentWeather to initiate weather data requests and other privileged operations.
  4. Event notification: The contract defines multiple events, including requesting weather data, receiving weather data responses, etc., for monitoring the contract's state changes and operation status.
  5. Security measures: The contract adopts security measures such as access control and event notification to enhance contract security and stability, preventing unauthorized operations and handling exceptional situations.
  6. Off-chain service configuration: The contract requires configuration of off-chain service parameters during deployment, including off-chain API addresses, Chainlink node addresses, etc.

Basic Architecture Diagrams:

image image

Temperature Retrieval Process:

  1. Construct request using buildChainlinkRequest.
  2. Send GET request to node using sendChainlinkRequestTo.
  3. Node callback triggers fulfillWeather function, returning weather temperature.
  4. Call changeERTStatus function of Models contract to alter temperature.

Sample Hardhat Project

This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a Hardhat Ignition module that deploys that contract.

Try running some of the following tasks:

npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat ignition deploy ./ignition/modules/Lock.js

dynamic-nft's People

Contributors

cxp-13 avatar

Watchers

 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.