상세 컨텐츠

본문 제목

체인링크 NFT 가격 피드 - NFT Floor Price Feeds

Blockchain/Oracle - Chainlink

by Yongari 2023. 4. 14. 09:56

본문

 

NFT Floor Price Feeds

체인링크 NFT 플로어 가격 피드는 NFT 컬렉션에 대한 보수적이고 위험 회피적인 플로어 가격 추정치를 제공합니다. 이 피드는 다른 체인링크 데이터 피드와 동일한 방식으로 작동합니다. NFT 플로어 가격 피드는  Coinbase Cloud’s 의 집계 알고리즘과 체인링크의 오라클 인프라를 통해 지원되며, 극단적인 가격 이상값을 제거하고 시장 조작에 대한 저항력을 갖출 수 있도록 도와줍니다. 대출 및 차입, 온체인 파생상품, 동적 NFT, 게임 길드, CeFi 상품, 예측 시장 등 고품질 NFT 데이터에 의존하는 사용 사례에 NFT 플로어 프라이스 피드를 사용할 수 있습니다.

 Contract Addresses  페이지에서 테스트넷 피드 목록을 확인하세요. 이더리움 메인넷의 NFT 플로어 프라이스 피드에 액세스하려면 이 use this TypeForm.을 사용하세요.

 

Using NFT Floor Price Feeds

다른 데이터 피드를 읽는 것과 같은 방식으로 NFT 플로어 가격 피드의 답변을 읽습니다. 가격 피드 주소를 지정하는 대신 읽으려는 NFT Floor Price Feed Address 를 지정하세요. 자세한 내용은 Using Data Feeds페이지를 참조하세요.

솔리디티를 사용하는 스마트 콘트랙트는 데이터 피드가 구현하는 외부 기능을 정의하는 AggregatorV3Interface, 를 참조해야 합니다.

 

다음은 크립토펑크의 NFT 가격 피드를 조회하는 스마트 컨트랙트입니다.

 

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

contract NFTFloorPriceConsumerV3 {
    AggregatorV3Interface internal nftFloorPriceFeed;

    /**
     * Network: Goerli - No Sepolia feeds available at this time
     * Aggregator: CryptoPunks
     * Address: 0x5c13b249846540F81c093Bc342b5d963a7518145
     */
    constructor() {
        nftFloorPriceFeed = AggregatorV3Interface(
            0x5c13b249846540F81c093Bc342b5d963a7518145
        );
    }

    /**
     * Returns the latest price
     */
    function getLatestPrice() public view returns (int) {
        // prettier-ignore
        (
            /*uint80 roundID*/,
            int nftFloorPrice,
            /*uint startedAt*/,
            /*uint timeStamp*/,
            /*uint80 answeredInRound*/
        ) = nftFloorPriceFeed.latestRoundData();
        return nftFloorPrice;
    }
}

 

remix에서 배포하면 다음과 같습니다.

컨트랙트 주소 : 0x11d8A37add9635883FbEf14e0e90482e93217431

 

1번째 가격 호출시 스크린샷

가격을 가져오는 함수 호출

2번째 가격 호출시 스크린샷

가격을 가져오는 함수 호출 위의 1번째와 가격이 달라졌습니다. 

 

위의 출력된 숫자 즉, getLatestPrice 함수로 호출한 데이터를 10^18으로 나누면 ETH 단위가 됩니다.

숫자가 너무 크다고 당황하지 마세요~

 

 

이더스캔에서 배포한 컨트랙트 트랜잭션입니다.

https://goerli.etherscan.io/tx/0x001d16a32ac508a5eba47a1abad3b039bd22289c7a106ec4abce7f0711a4c103

 

Goerli Transaction Hash (Txhash) Details | Etherscan

Goerli (GTH) detailed transaction info for txhash 0x001d16a32ac508a5eba47a1abad3b039bd22289c7a106ec4abce7f0711a4c103. The transaction status, block confirmation, gas fee, Ether (ETH), and token transfer are shown.

goerli.etherscan.io

 


NFT Floor Price Feeds 컨트랙트 

https://docs.chain.link/data-feeds/nft-floor-price/addresses

 

NFT Floor Price Feed Addresses | Chainlink Documentation

Chainlink is the most widely used oracle network for powering universally connected smart contracts, enabling any blockchain to access real-world data & APIs.

docs.chain.link

 

출처 : https://docs.chain.link/data-feeds/nft-floor-price

 

NFT Floor Price Feeds | Chainlink Documentation

Chainlink is the most widely used oracle network for powering universally connected smart contracts, enabling any blockchain to access real-world data & APIs.

docs.chain.link

 

 

관련글 더보기