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

Commit 9c55814

Browse files
authored
Merge pull request #187 from zallo-labs/Z-215-activation
Z 215 activation
2 parents 666f565 + 4f74e1f commit 9c55814

File tree

132 files changed

+1739
-929
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1739
-929
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-2.24 MB
Binary file not shown.

.yarn/patches/viem-npm-1.20.3-dc6ceec8be.patch

-39
This file was deleted.

api/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.cpuprofile

api/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ COPY --from=builder --chown=node:node /build/api/package.json ./api/package.json
4343
COPY --from=edgedb/edgedb-cli:4.0.2 --chown=node:node /usr/bin/edgedb /usr/bin/edgedb
4444

4545
WORKDIR /build/api
46-
CMD ["yarn", "start:production"]
46+
CMD ["yarn", "serve"]

api/dbschema/default.esdl

+22-11
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ module default {
1818
}
1919
required implementation: Address;
2020
required salt: Bytes32;
21-
required isActive: bool;
22-
photoUri: str;
2321
required paymasterEthCredit: decimal { constraint min_value(0); default := 0; }
22+
activationEthFee: decimal { constraint min_value(0); }
23+
upgradedAtBlock: bigint { constraint min_value(0); }
24+
photoUri: str;
2425
required property chain := as_chain(.address);
26+
required property isActive := exists .upgradedAtBlock;
2527
multi link policies := (select .<account[is Policy] filter .isEnabled);
2628
multi link proposals := .<account[is Proposal];
2729
multi link transactionProposals := .<account[is TransactionProposal];
@@ -51,13 +53,13 @@ module default {
5153
multi link approvals := .<proposal[is Approval];
5254
multi link rejections := .<proposal[is Rejection];
5355
multi link potentialApprovers := (
54-
with potentialResponses := distinct ((select .policy) ?? .account.policies).state.approvers.id,
55-
ids := potentialResponses except .approvals.approver.id
56+
with approvers := distinct (.policy ?? .account.policies).stateOrDraft.approvers.id,
57+
ids := approvers except .approvals.approver.id
5658
select Approver filter .id in ids
5759
);
5860
multi link potentialRejectors := (
59-
with potentialResponses := distinct ((select .policy) ?? .account.policies).state.approvers.id,
60-
ids := potentialResponses except .rejections.approver.id
61+
with approvers := distinct (.policy ?? .account.policies).stateOrDraft.approvers.id,
62+
ids := approvers except .rejections.approver.id
6163
select Approver filter .id in ids
6264
);
6365
property riskLabel := assert_single((select .<proposal[is ProposalRiskLabel] filter .user = global current_user)).risk;
@@ -118,6 +120,11 @@ module default {
118120
data: Bytes;
119121
}
120122

123+
type PaymasterFees {
124+
required property total := .activation;
125+
required activation: decimal { constraint min_value(0); default := 0; }
126+
}
127+
121128
type TransactionProposal extending Proposal {
122129
required multi operations: Operation {
123130
constraint exclusive;
@@ -126,13 +133,14 @@ module default {
126133
required gasLimit: uint256 { default := 0; }
127134
required feeToken: Token;
128135
required paymaster: Address;
129-
required paymasterEthFee: decimal { constraint min_value(0); default := 0; }
136+
required maxPaymasterEthFees: PaymasterFees { constraint exclusive; default := (insert PaymasterFees {}); }
130137
simulation: Simulation { constraint exclusive; on target delete deferred restrict; }
131138
multi link transactions := .<proposal[is Transaction];
132139
link transaction := (select .transactions order by .submittedAt desc limit 1);
140+
required submitted: bool { default := false; }
133141
required property status := (
134142
select assert_exists((
135-
TransactionProposalStatus.Pending if (not exists .transaction) else
143+
TransactionProposalStatus.Pending if (not exists .transaction and not .submitted) else
136144
TransactionProposalStatus.Executing if (not exists .transaction.receipt) else
137145
TransactionProposalStatus.Successful if (.transaction.receipt.success) else
138146
TransactionProposalStatus.Failed
@@ -213,11 +221,14 @@ module default {
213221
required hash: Bytes32 { constraint exclusive; }
214222
required proposal: TransactionProposal;
215223
required maxEthFeePerGas: decimal { constraint min_value(0); }
216-
required ethDiscount: decimal { constraint min_value(0); default := 0; }
224+
required paymasterEthFees: PaymasterFees { constraint exclusive; default := (insert PaymasterFees {}); }
225+
required ethCreditUsed: decimal { constraint min_value(0); default := 0; }
226+
# required ethDiscount: decimal { constraint min_value(0); default := 0; }
227+
required property ethDiscount := .ethCreditUsed + (.proposal.maxPaymasterEthFees.total - .paymasterEthFees.total);
217228
required ethPerFeeToken: decimal { constraint min_value(0); }
218229
required usdPerFeeToken: decimal { constraint min_value(0); }
219230
required property maxNetworkEthFee := .maxEthFeePerGas * .proposal.gasLimit;
220-
required property maxEthFees := .maxNetworkEthFee + .proposal.paymasterEthFee - .ethDiscount;
231+
required property maxEthFees := .maxNetworkEthFee + .paymasterEthFees.total - .ethDiscount;
221232
required submittedAt: datetime { default := datetime_of_statement(); }
222233
receipt: Receipt { constraint exclusive; }
223234
multi link events := .<transaction[is Event];
@@ -237,7 +248,7 @@ module default {
237248
required gasUsed: bigint { constraint min_value(0); }
238249
required ethFeePerGas: decimal { constraint min_value(0); }
239250
required property networkEthFee := .ethFeePerGas * .transaction.proposal.gasLimit;
240-
required property ethFees := .networkEthFee + .transaction.proposal.paymasterEthFee - .transaction.ethDiscount;
251+
required property ethFees := .networkEthFee + .transaction.paymasterEthFees.total - .transaction.ethDiscount;
241252
multi link events := .transaction.events;
242253
multi link transferEvents := .events[is Transfer];
243254
multi link transferApprovalEvents := .events[is TransferApproval];

0 commit comments

Comments
 (0)