-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- upgrade ethers to v6 - upgrade hardhat tools - use npm install
- Loading branch information
Showing
24 changed files
with
8,132 additions
and
5,201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
contract PriceFeedMock { | ||
struct RoundData { | ||
uint80 roundId; | ||
int256 answer; | ||
uint256 startedAt; | ||
uint256 updatedAt; | ||
uint80 answeredInRound; | ||
} | ||
|
||
mapping(uint80 => RoundData) internal _roundData; | ||
RoundData internal _latestRound; | ||
uint8 internal _decimal; | ||
|
||
constructor(uint8 decimal_, RoundData[] memory rounds) { | ||
_decimal = decimal_; | ||
|
||
uint256 length = rounds.length; | ||
for (uint256 i = 0; i < length; ) { | ||
RoundData memory data = rounds[i]; | ||
_roundData[data.roundId] = data; | ||
|
||
unchecked { | ||
++i; | ||
} | ||
} | ||
|
||
_latestRound = rounds[length - 1]; | ||
} | ||
|
||
function decimals() external view returns (uint8) { | ||
return _decimal; | ||
} | ||
|
||
function latestRoundData() external view returns (RoundData memory data) { | ||
data = _latestRound; | ||
} | ||
|
||
function getRoundData( | ||
uint80 _roundId | ||
) public view returns (RoundData memory data) { | ||
data = _roundData[_roundId]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.