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

[Subgraph] Remove eth_calls #2397

Merged
merged 3 commits into from
Aug 30, 2024
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
30 changes: 28 additions & 2 deletions packages/core/contracts/Escrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,26 @@ contract Escrow is IEscrow, ReentrancyGuard {
event TrustedHandlerAdded(address _handler);
event IntermediateStorage(string _url, string _hash);
event Pending(string manifest, string hash);
event PendingV2(
string manifest,
string hash,
address reputationOracle,
address recordingOracle,
address exchangeOracle
);
event BulkTransfer(
uint256 indexed _txId,
address[] _recipients,
uint256[] _amounts,
bool _isPartial
);
event BulkTransferV2(
uint256 indexed _txId,
address[] _recipients,
uint256[] _amounts,
bool _isPartial,
string finalResultsUrl
);
event Cancelled();
event Completed();

Expand Down Expand Up @@ -150,7 +164,13 @@ contract Escrow is IEscrow, ReentrancyGuard {
manifestUrl = _url;
manifestHash = _hash;
status = EscrowStatuses.Pending;
emit Pending(manifestUrl, manifestHash);
emit PendingV2(
manifestUrl,
manifestHash,
reputationOracle,
recordingOracle,
exchangeOracle
);
}

function abort() external override trusted notComplete notPaid {
Expand Down Expand Up @@ -293,7 +313,13 @@ contract Escrow is IEscrow, ReentrancyGuard {
isPartial = true;
}

emit BulkTransfer(_txId, _recipients, finalAmounts, isPartial);
emit BulkTransferV2(
_txId,
_recipients,
finalAmounts,
isPartial,
finalResultsUrl
);
}

function finalizePayouts(
Expand Down
10 changes: 8 additions & 2 deletions packages/core/test/Escrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,13 @@ describe('Escrow', function () {
)
)
.to.emit(escrow, 'Pending')
.withArgs(MOCK_URL, MOCK_HASH);
.withArgs(
MOCK_URL,
MOCK_HASH,
await reputationOracle.getAddress(),
await recordingOracle.getAddress(),
await exchangeOracle.getAddress()
);
});
});

Expand Down Expand Up @@ -659,7 +665,7 @@ describe('Escrow', function () {
.bulkPayOut(recepients, amounts, MOCK_URL, MOCK_HASH, '000')
)
.to.emit(escrow, 'BulkTransfer')
.withArgs(anyValue, recepients, [7], true);
.withArgs(anyValue, recepients, [7], true, MOCK_URL);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
escrow_statistics_fragment = """
fragment EscrowStatisticsFields on EscrowStatistics {
fundEventCount
setupEventCount
storeResultsEventCount
bulkPayoutEventCount
pendingStatusEventCount
Expand All @@ -31,7 +30,6 @@
fragment EventDayDataFields on EventDayData {
timestamp
dailyFundEventCount
dailySetupEventCount
dailyStoreResultsEventCount
dailyBulkPayoutEventCount
dailyPendingStatusEventCount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const HMTOKEN_STATISTICS_FRAGMENT = gql`
const ESCROW_STATISTICS_FRAGMENT = gql`
fragment EscrowStatisticsFields on EscrowStatistics {
fundEventCount
setupEventCount
storeResultsEventCount
bulkPayoutEventCount
pendingStatusEventCount
Expand All @@ -32,7 +31,6 @@ const EVENT_DAY_DATA_FRAGMENT = gql`
fragment EventDayDataFields on EventDayData {
timestamp
dailyFundEventCount
dailySetupEventCount
dailyStoreResultsEventCount
dailyBulkPayoutEventCount
dailyPendingStatusEventCount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export type HMTStatisticsData = {

export type EscrowStatisticsData = {
fundEventCount: string;
setupEventCount: string;
storeResultsEventCount: string;
bulkPayoutEventCount: string;
pendingStatusEventCount: string;
Expand All @@ -56,7 +55,6 @@ export type EscrowStatisticsData = {
export type EventDayData = {
timestamp: string;
dailyFundEventCount: string;
dailySetupEventCount: string;
dailyStoreResultsEventCount: string;
dailyBulkPayoutEventCount: string;
dailyPendingStatusEventCount: string;
Expand Down
4 changes: 1 addition & 3 deletions packages/sdk/typescript/subgraph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ type FundEvent @entity(immutable: true) {
amount: BigInt!
}

type SetupEvent @entity(immutable: true) {
type PendingEvent @entity(immutable: true) {
id: Bytes!
block: BigInt!
timestamp: BigInt!
Expand Down Expand Up @@ -323,7 +323,6 @@ type HMTokenStatistics @entity {
type EscrowStatistics @entity {
id: Bytes!
fundEventCount: BigInt!
setupEventCount: BigInt!
storeResultsEventCount: BigInt!
bulkPayoutEventCount: BigInt!
pendingStatusEventCount: BigInt!
Expand All @@ -339,7 +338,6 @@ type EventDayData @entity {
id: Bytes!
timestamp: Int!
dailyFundEventCount: BigInt!
dailySetupEventCount: BigInt!
dailyStoreResultsEventCount: BigInt!
dailyBulkPayoutEventCount: BigInt!
dailyPendingStatusEventCount: BigInt!
Expand Down
Loading