Skip to content

Commit 00e777b

Browse files
committed
fix: add remapping to abi gen
1 parent f96c4b1 commit 00e777b

File tree

8 files changed

+604
-361
lines changed

8 files changed

+604
-361
lines changed

target_chains/ethereum/abi_generator/src/index.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ function generateAbi(contracts) {
2525
sources,
2626
settings: {
2727
outputSelection,
28+
remappings: [
29+
// Needed for @pythnetwork/pulse-sdk-solidity since it depends on @pythnetwork/pyth-sdk-solidity
30+
"@pythnetwork/=./node_modules/@pythnetwork/",
31+
],
2832
},
2933
};
3034

@@ -42,9 +46,28 @@ function generateAbi(contracts) {
4246
fs.mkdirSync("abis");
4347
}
4448

49+
// Report compilation failures
50+
if (output.errors) {
51+
// We can still generate ABIs with warnings, only throw for errors
52+
const errors = output.errors.filter((e) => e.severity === "error");
53+
if (errors.length > 0) {
54+
console.error("Compilation errors:");
55+
for (const error of errors) {
56+
console.error(error.formattedMessage || error.message);
57+
}
58+
throw new Error("Compilation failed due to errors");
59+
}
60+
}
61+
4562
for (let contract of contracts) {
4663
const contractFile = `${contract}.sol`;
4764

65+
if (!output.contracts[contractFile]) {
66+
throw new Error(`Unable to produce ABI for ${contractFile}.`);
67+
}
68+
if (!output.contracts[contractFile][contract]) {
69+
throw new Error(`Unable to produce ABI for ${contractFile}:${contract}.`);
70+
}
4871
const abi = output.contracts[contractFile][contract].abi;
4972
fs.writeFileSync(
5073
`abis/${contract}.json`,

target_chains/ethereum/pulse_sdk/solidity/SchedulerErrors.sol

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,39 @@
22

33
pragma solidity ^0.8.0;
44

5-
// Authorization errors
6-
error Unauthorized();
5+
library SchedulerErrors {
6+
// Authorization errors
7+
error Unauthorized();
78

8-
// Subscription state errors
9-
error InactiveSubscription();
10-
error InsufficientBalance();
11-
error CannotUpdatePermanentSubscription();
9+
// Subscription state errors
10+
error InactiveSubscription();
11+
error InsufficientBalance();
12+
error CannotUpdatePermanentSubscription();
1213

13-
// Price feed errors
14-
error InvalidPriceId(bytes32 providedPriceId, bytes32 expectedPriceId);
15-
error InvalidPriceIdsLength(uint256 providedLength, uint256 expectedLength);
16-
error EmptyPriceIds();
17-
error TooManyPriceIds(uint256 provided, uint256 maximum);
18-
error DuplicatePriceId(bytes32 priceId);
19-
error PriceSlotMismatch();
14+
// Price feed errors
15+
error InvalidPriceId(bytes32 providedPriceId, bytes32 expectedPriceId);
16+
error InvalidPriceIdsLength(uint256 providedLength, uint256 expectedLength);
17+
error EmptyPriceIds();
18+
error TooManyPriceIds(uint256 provided, uint256 maximum);
19+
error DuplicatePriceId(bytes32 priceId);
20+
error PriceSlotMismatch();
2021

21-
// Update criteria errors
22-
error InvalidUpdateCriteria();
23-
error UpdateConditionsNotMet();
24-
error TimestampTooOld(
25-
uint256 providedUpdateTimestamp,
26-
uint256 currentTimestamp
27-
);
28-
error TimestampOlderThanLastUpdate(
29-
uint256 providedUpdateTimestamp,
30-
uint256 lastUpdatedAt
31-
);
22+
// Update criteria errors
23+
error InvalidUpdateCriteria();
24+
error UpdateConditionsNotMet();
25+
error TimestampTooOld(
26+
uint256 providedUpdateTimestamp,
27+
uint256 currentTimestamp
28+
);
29+
error TimestampOlderThanLastUpdate(
30+
uint256 providedUpdateTimestamp,
31+
uint256 lastUpdatedAt
32+
);
3233

33-
// Whitelist errors
34-
error TooManyWhitelistedReaders(uint256 provided, uint256 maximum);
35-
error DuplicateWhitelistAddress(address addr);
34+
// Whitelist errors
35+
error TooManyWhitelistedReaders(uint256 provided, uint256 maximum);
36+
error DuplicateWhitelistAddress(address addr);
3637

37-
// Payment errors
38-
error KeeperPaymentFailed();
38+
// Payment errors
39+
error KeeperPaymentFailed();
40+
}

target_chains/ethereum/pulse_sdk/solidity/abis/AbstractPulse.json

Lines changed: 0 additions & 206 deletions
This file was deleted.

0 commit comments

Comments
 (0)