Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[contract] geth 네크워크의 표준 priceOracle 컨트랙트 #292

Open
bbabi0901 opened this issue Feb 10, 2023 · 4 comments
Open

[contract] geth 네크워크의 표준 priceOracle 컨트랙트 #292

bbabi0901 opened this issue Feb 10, 2023 · 4 comments

Comments

@bbabi0901
Copy link
Collaborator

BTC, ETH, LINK 세가지 자산 종류에 대한 모킹 priceOracle 컨트랙트 주소입니다.
0xc6632bad92Ae7600D75d2c376dd21f0997877891

초기값은
BTC - 2500000000000
ETH - 160000000000
LINK - 750000000
입니다

@bbabi0901
Copy link
Collaborator Author

컨트랙트 상세 내용은 다음과 같습니다

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

contract PriceOracleMock {
  uint256 public btcPrice;
  uint256 public ethPrice;
  uint256 public linkPrice;

  constructor(
    uint256 _initialBTCPrice,
    uint256 _initialETHPrice,
    uint256 _initialLinkPrice
  ) {
    btcPrice = _initialBTCPrice;
    ethPrice = _initialETHPrice;
    linkPrice = _initialLinkPrice;
  }

  function setBTCPrice(uint256 _price) public returns (uint256) {
    btcPrice = _price;
    return btcPrice;
  }

  function setETHPrice(uint256 _price) public returns (uint256) {
    ethPrice = _price;
    return ethPrice;
  }

  function setLinkPrice(uint256 _price) public returns (uint256) {
    linkPrice = _price;
    return linkPrice;
  }
}

발행은 Admin 주소로 하였습니다

@bbabi0901
Copy link
Collaborator Author

초기값을 인자로 받지 않고 생성자에 포함하는 형식으로 바꾸었습니다
주소와 세부 내용는 다음과 같습니다
0xB35cB83eA5b247576bCAfE4298aC1211aA4c3BEe

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

contract PriceOracleMock {
  uint256 public btcPrice;
  uint256 public ethPrice;
  uint256 public linkPrice;

  constructor(
  ) {
    btcPrice = 2500000000000;
    ethPrice = 160000000000;
    linkPrice = 750000000;
  }

  function setBTCPrice(uint256 _price) public returns (uint256) {
    btcPrice = _price;
    return btcPrice;
  }

  function setETHPrice(uint256 _price) public returns (uint256) {
    ethPrice = _price;
    return ethPrice;
  }

  function setLinkPrice(uint256 _price) public returns (uint256) {
    linkPrice = _price;
    return linkPrice;
  }
}

@atoye1
Copy link
Contributor

atoye1 commented Feb 10, 2023

decimal이 기본 8인가요?

@bbabi0901
Copy link
Collaborator Author

네 체인링크의 /USDT 가격호출 단위에 맞추었습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants