GithubHelp home page GithubHelp logo

leonasdev / city-weather-nft Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 168.82 MB

Dynamic NFTs that visually transform based on real-time weather data of randomly selected cities.

Solidity 83.13% TypeScript 16.87%

city-weather-nft's Introduction

🏞️City Weather NFT

This project is a smart contract for a dynamic NFT. The token starts as an Earth when initially minted. However, whenever the token is transferred to another address, it will randomly select a city and transform its appearance based on the weather conditions of that city.

💫Showcase

Earth (Initial Minted)

Variants Clear Drizzle Rain Thunderstorm
Taipei
Tokyo

🚀Getting Started

  1. Clone the project

    • git clone https://github.com/leonasdev/city-weather-nft
  2. Install dependencies

    • pnpm install
  3. Compile contracts

    • pnpm compile
  4. Setting the .env file

    • Adjust values in .env.example and rename it to .env
  5. Deploy contract to sepolia test network

    • npx hardhat run scripts/deploy.ts --network sepolia
  6. Minting token

    • const contractAddress = "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; // replace it with contract address
      const DNFT = await ethers.getContractFactory("CityWeatherNFT");
      const dnft = DNFT.attach(contractAddress);
      console.log("Minting...");
      await dnft.mint();
      console.log("Done.");
    • npx hardhat run scripts/index.ts --network sepolia
  7. Checking your NFT

    • Import nft contract in Matamask to observe your NFT token
    • Token ID must start with 1
  8. Fund contract LINK token

  9. Transfer your NFT token to another accoount

  10. Waitting for fulfillment

    • You can check status of request by:
      const contractAddress = "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; // replace it with contract address
      const DNFT = await ethers.getContractFactory("CityWeatherNFT");
      const dnft = DNFT.attach(contractAddress);
      console.log("Last request status:");
      console.log(await dnft.s_requests(await dnft.requestIds(await dnft.lastRequestId())));
    • npx hardhat run scripts/index.ts --network sepolia
    • Wait fulfilled to true
  11. Checking your NFT in another account

    • You need import NFT contract again in another account
  12. Observe that NFT transform its appearance!

  13. Withdraw your LINK token

    • const contractAddress = "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; // replace it with contract address
      const DNFT = await ethers.getContractFactory("CityWeatherNFT");
      const dnft = DNFT.attach(contractAddress);
      await dnft.withdrawLink();
    • npx hardhat run scripts/index.ts --network sepolia

🛠️Tools used in this project

  • Sodility Solidity is an object-oriented, high-level language for implementing smart contracts. Smart contracts are programs that govern the behavior of accounts within the Ethereum state.
  • Sepolia Testnet Sepolia was a proof-of-authority testnet created in October 2021 by Ethereum core developers and maintained ever since.
  • Hardhat Hardhat is a development environment for Ethereum software. It consists of different components for editing, compiling, debugging and deploying your smart contracts and dApps, all of which work together to create a complete development environment.
  • OpenZeppelin Contracts OpenZeppelin Contracts helps you minimize risk by using battle-tested libraries of smart contracts for Ethereum and other blockchains. It includes the most used implementations of ERC standards.
  • Chainlink
    • Chainlink VRFv2 Chainlink VRF provides cryptographically secure randomness for your blockchain-based applications.
    • Chainlink Any API Connecting to any API with Chainlink enables your contracts to access to any external data source through our decentralized oracle network.
  • OpenWeatherAPI Access current weather data for any location including over 200,000 cities
  • IPFS A peer-to-peer hypermedia protocol designed to preserve and grow humanity's knowledge by making the web upgradeable, resilient, and more open.
  • Metamask Available as a browser extension and as a mobile app, MetaMask equips you with a key vault, secure login, token wallet, and token exchange—everything you need to manage your digital assets.

✅TODO

  • Auto fund LINK token when deployed
  • Handle secret key on chain (openweather api key)

city-weather-nft's People

Contributors

leonasdev 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.