likelion-liquidity / liquidity-contract

MIT License
7 stars 1 forks source link

DataHolder 내, klaytn 기준 FloorPrice 추가 #22

Closed myungjunChae closed 2 years ago

jjgob commented 2 years ago

다음과 같이 생각하고 있는데, 검토 부탁 드립니다~

nftKlayPrice = 500.12345klay(nft의 klay가격) *(10 18(klay의 decimals)) klayExchange= 1.24500000(stable token unit/1klay) * (10 * 18(stable token의 decimals)) floorPrice = nftKlayPrice klayExchange /1018

function setFloorPrice(
    address targetNftAddress,
    uint256 nftKlayPrice ,
    uint256 klayExchange
) public onlyOwner onlyWhiteList(targetNftAddress) {
    whiteListNftData[targetNftAddress].nftKlayPrice= nftKlayPrice;
    whiteListNftData[targetNftAddress].floorPrice = nftKlayPrice*klayExchange/10**18;
    setAvailableLoanAmount(
        targetNftAddress,
        _calcAvailableLoanAmount(floorPrice)
    );
}   

* 일단은 setKlayPrice 따로 작성해서 pr했습니다.

myungjunChae commented 2 years ago
function setFloorPrice(
   address targetNftAddress,
   uint256 _klayPrice,
   uint256 _nftKlayPrice,
) public onlyOwner onlyWhiteList(targetNftAddress) {
   klayPrice = _ klayPrice;
   whiteListNftData[targetNftAddress].nftKlayPrice = _nftKlayPrice;
   whiteListNftData[targetNftAddress].floorPrice = _nftKlayPrice * _klayPrice / (10 **18)
   setAvailableLoanAmount(
       targetNftAddress,
       _calcAvailableLoanAmount(whiteListNftData[targetNftAddress].floorPrice)
   );
}