-
Notifications
You must be signed in to change notification settings - Fork 222
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
Showing
6 changed files
with
1,075 additions
and
0 deletions.
There are no files selected for viewing
144 changes: 144 additions & 0 deletions
144
target_chains/ethereum/contracts/contracts/pulse/IPulse.sol
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,144 @@ | ||
// SPDX-License-Identifier: Apache 2 | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import "./PulseState.sol"; | ||
|
||
interface IPulseConsumer { | ||
function pulseCallback( | ||
uint64 sequenceNumber, | ||
address provider, | ||
uint256 publishTime, | ||
bytes32[] calldata priceIds | ||
) external; | ||
} | ||
|
||
interface IPulse { | ||
// Events | ||
event PriceUpdateRequested( | ||
uint64 indexed sequenceNumber, | ||
address indexed provider, | ||
uint256 publishTime, | ||
bytes32[] priceIds, | ||
address requester | ||
); | ||
|
||
event PriceUpdateExecuted( | ||
uint64 indexed sequenceNumber, | ||
address indexed provider, | ||
uint256 publishTime, | ||
bytes32[] priceIds | ||
); | ||
|
||
event ProviderRegistered( | ||
address indexed provider, | ||
uint128 feeInWei, | ||
bytes uri | ||
); | ||
|
||
event ProviderFeeUpdated( | ||
address indexed provider, | ||
uint128 oldFeeInWei, | ||
uint128 newFeeInWei | ||
); | ||
|
||
event ProviderWithdrawn( | ||
address indexed provider, | ||
address indexed recipient, | ||
uint128 amount | ||
); | ||
|
||
event ProviderFeeManagerUpdated( | ||
address indexed provider, | ||
address oldFeeManager, | ||
address newFeeManager | ||
); | ||
|
||
event ProviderUriUpdated( | ||
address indexed provider, | ||
bytes oldUri, | ||
bytes newUri | ||
); | ||
|
||
event ProviderMaxNumPricesUpdated( | ||
address indexed provider, | ||
uint32 oldMaxNumPrices, | ||
uint32 maxNumPrices | ||
); | ||
|
||
event PriceUpdateCallbackFailed( | ||
uint64 indexed sequenceNumber, | ||
address indexed provider, | ||
uint256 publishTime, | ||
bytes32[] priceIds, | ||
address requester, | ||
string reason | ||
); | ||
|
||
// Core functions | ||
function requestPriceUpdatesWithCallback( | ||
address provider, | ||
uint256 publishTime, | ||
bytes32[] calldata priceIds, | ||
bytes[] calldata updateData, | ||
uint256 callbackGasLimit | ||
) external payable returns (uint64 sequenceNumber); | ||
|
||
function executeCallback( | ||
uint64 sequenceNumber, | ||
uint256 publishTime, | ||
bytes32[] calldata priceIds, | ||
bytes[] calldata updateData, | ||
uint256 callbackGasLimit | ||
) external; | ||
|
||
// Provider management | ||
function register(uint128 feeInWei, bytes calldata uri) external; | ||
|
||
function setProviderFee(uint128 newFeeInWei) external; | ||
|
||
function withdraw(uint128 amount) external; | ||
|
||
// Add to interface | ||
function withdrawAsFeeManager(address provider, uint128 amount) external; | ||
|
||
// Add to Provider management section | ||
function setProviderUri(bytes calldata uri) external; | ||
|
||
// Getters | ||
function getFee(address provider) external view returns (uint128 feeAmount); | ||
|
||
function getDefaultProvider() external view returns (address); | ||
|
||
// Add to interface | ||
function setFeeManager(address manager) external; | ||
|
||
// Add to interface | ||
function setProviderFeeAsFeeManager( | ||
address provider, | ||
uint128 newFeeInWei | ||
) external; | ||
|
||
// Add to Getters section | ||
function getAccruedPythFees() | ||
external | ||
view | ||
returns (uint128 accruedPythFeesInWei); | ||
|
||
// Add to Getters section | ||
function getProviderInfo( | ||
address provider | ||
) external view returns (PulseState.ProviderInfo memory info); | ||
|
||
function getAdmin() external view returns (address admin); | ||
|
||
function getPythFeeInWei() external view returns (uint128 pythFeeInWei); | ||
|
||
function setMaxNumPrices(uint32 maxNumPrices) external; | ||
|
||
// Add to Getters section | ||
function getRequest( | ||
address provider, | ||
uint64 sequenceNumber | ||
) external view returns (PulseState.Request memory req); | ||
} |
Oops, something went wrong.