-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
JoscelynFarr
committed
Mar 28, 2024
1 parent
fd7598d
commit ce27ef0
Showing
2 changed files
with
53 additions
and
29 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,32 @@ | ||
/* | ||
Copyright 2022 JOJO Exchange | ||
SPDX-License-Identifier: BUSL-1.1 | ||
*/ | ||
|
||
pragma solidity ^0.8.19; | ||
|
||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
import "@pythnetwork/pyth-sdk-solidity/IPyth.sol"; | ||
import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol"; | ||
|
||
contract PythOracleAdaptor is Ownable { | ||
IPyth public pyth; | ||
|
||
constructor(address _pythContract) { | ||
pyth = IPyth(_pythContract); | ||
} | ||
|
||
function setMarkPrice( | ||
bytes[] calldata updateData, | ||
bytes32[] calldata priceIds, | ||
uint64[] calldata publishTimes | ||
) | ||
external | ||
payable | ||
onlyOwner | ||
{ | ||
// Update the on-chain Pyth price(s) | ||
uint256 fee = pyth.getUpdateFee(updateData); | ||
pyth.updatePriceFeedsIfNecessary{ value: fee }(updateData, priceIds, publishTimes); | ||
} | ||
} |