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

feat(pulse): add pulse contracts #2090

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
82 changes: 82 additions & 0 deletions target_chains/ethereum/contracts/contracts/pulse/IPulse.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// SPDX-License-Identifier: Apache 2

pragma solidity ^0.8.0;

import "./PulseEvents.sol";
import "./PulseState.sol";

interface IPulseConsumer {
function pulseCallback(
cctdaniel marked this conversation as resolved.
Show resolved Hide resolved
uint64 sequenceNumber,
address provider,
cctdaniel marked this conversation as resolved.
Show resolved Hide resolved
uint256 publishTime,
bytes32[] calldata priceIds
cctdaniel marked this conversation as resolved.
Show resolved Hide resolved
) external;
}

interface IPulse is PulseEvents {
// Core functions
function requestPriceUpdatesWithCallback(
address provider,
uint256 publishTime,
bytes32[] calldata priceIds,
uint256 callbackGasLimit
) external payable returns (uint64 sequenceNumber);

function executeCallback(
address provider,
uint64 sequenceNumber,
bytes32[] calldata priceIds,
bytes[] calldata updateData,
uint256 callbackGasLimit
) external payable;

// Provider management
function register(
uint128 feeInWei,
uint128 feePerGas,
bytes calldata uri
) external;

function setProviderFee(uint128 newFeeInWei) external;

function setProviderFeeAsFeeManager(
address provider,
uint128 newFeeInWei
) external;

function setProviderUri(bytes calldata uri) external;
cctdaniel marked this conversation as resolved.
Show resolved Hide resolved

function withdraw(uint128 amount) external;

function withdrawAsFeeManager(address provider, uint128 amount) external;

// Getters
function getFee(
address provider,
uint256 callbackGasLimit
) external view returns (uint128 feeAmount);

function getPythFeeInWei() external view returns (uint128 pythFeeInWei);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this?


function getAccruedPythFees()
external
view
returns (uint128 accruedPythFeesInWei);

function getDefaultProvider() external view returns (address);

function getProviderInfo(
address provider
) external view returns (PulseState.ProviderInfo memory info);

function getRequest(
address provider,
uint64 sequenceNumber
) external view returns (PulseState.Request memory req);

// Setters
function setFeeManager(address manager) external;

function setMaxNumPrices(uint32 maxNumPrices) external;
}
Loading
Loading