Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Update getUpdateFee signature to take updateData #30

Merged
merged 2 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions IPyth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ interface IPyth {
function updatePriceFeedsIfNecessary(bytes[] calldata updateData, bytes32[] calldata priceIds, uint64[] calldata publishTimes) external payable;

/// @notice Returns the required fee to update an array of price updates.
/// @param updateDataSize Number of price updates.
/// @param updateData Array of price update data.
/// @return feeAmount The required fee in Wei.
function getUpdateFee(uint updateDataSize) external view returns (uint feeAmount);
function getUpdateFee(bytes[] calldata updateData) external view returns (uint feeAmount);
}
6 changes: 3 additions & 3 deletions MockPyth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ contract MockPyth is AbstractPyth {
// You can create this data either by calling createPriceFeedData or
// by using web3.js or ethers abi utilities.
function updatePriceFeeds(bytes[] calldata updateData) public override payable {
uint requiredFee = getUpdateFee(updateData.length);
uint requiredFee = getUpdateFee(updateData);
require(msg.value >= requiredFee, "Insufficient paid fee amount");

if (msg.value > requiredFee) {
Expand Down Expand Up @@ -74,8 +74,8 @@ contract MockPyth is AbstractPyth {
emit UpdatePriceFeeds(msg.sender, 1, requiredFee);
}

function getUpdateFee(uint updateDataSize) public override view returns (uint feeAmount) {
return singleUpdateFeeInWei * updateDataSize;
function getUpdateFee(bytes[] calldata updateData) public override view returns (uint feeAmount) {
return singleUpdateFeeInWei * updateData.length;
}

function createPriceFeedUpdateData(
Expand Down
6 changes: 3 additions & 3 deletions abis/AbstractPyth.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,9 @@
{
"inputs": [
{
"internalType": "uint256",
"name": "updateDataSize",
"type": "uint256"
"internalType": "bytes[]",
"name": "updateData",
"type": "bytes[]"
}
],
"name": "getUpdateFee",
Expand Down
6 changes: 3 additions & 3 deletions abis/IPyth.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,9 @@
{
"inputs": [
{
"internalType": "uint256",
"name": "updateDataSize",
"type": "uint256"
"internalType": "bytes[]",
"name": "updateData",
"type": "bytes[]"
}
],
"name": "getUpdateFee",
Expand Down
6 changes: 3 additions & 3 deletions abis/MockPyth.json
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,9 @@
{
"inputs": [
{
"internalType": "uint256",
"name": "updateDataSize",
"type": "uint256"
"internalType": "bytes[]",
"name": "updateData",
"type": "bytes[]"
}
],
"name": "getUpdateFee",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-sdk-solidity",
"version": "1.0.1",
"version": "2.0.0",
"description": "Read prices from the Pyth oracle",
"repository": {
"type": "git",
Expand Down