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

Z 215 activation #187

Merged
merged 32 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9d93766
refactor(contracts,lib): signature validation and typed data hashing
hbriese Jan 9, 2024
55adaaf
feat(contracts): allow refunding the deployer when deploying an accou…
hbriese Jan 9, 2024
7176d79
test(contracts): DeploymentRefunder tests
hbriese Jan 9, 2024
7931630
chore(contracts): update deps
hbriese Jan 9, 2024
b95752d
chore: update abitype, viem and remove patch
hbriese Jan 9, 2024
280cf4a
refactor(api): account activation handling
hbriese Jan 9, 2024
12d7ab7
fix(api): sentry profiling
hbriese Jan 10, 2024
0f2913c
perf(api): corectly type event log data and remove unnecessary additi…
hbriese Jan 10, 2024
940d72a
misc(api): ignore .cpuprofile files
hbriese Jan 10, 2024
5c797c7
fix(api): linking tokens ttl not being set
hbriese Jan 10, 2024
d3ebe19
perf(api): improve events processor performance by tracking block times
hbriese Jan 11, 2024
fc7d503
feat(api): actvate account when executing first transaction
hbriese Jan 11, 2024
f8593e8
feat(api,app): track activation fee and account credit
hbriese Jan 12, 2024
7cea9bb
fix(api): SIWE message verification error not being passed as Unautho…
hbriese Jan 13, 2024
3ebd492
fix(app): update fee token mutation
hbriese Jan 14, 2024
56c7f4e
fix(api): show transactions as executing as soon as the flow starts
hbriese Jan 15, 2024
767ce8c
fix(api): wait for pricefeed update to be confirmed before executing …
hbriese Jan 15, 2024
f03fa4b
fix(contracts): incorrect paymaster token conversion
hbriese Jan 15, 2024
9e2fcd8
refactor(api): apply db migrations with fly release_command
hbriese Jan 22, 2024
6d4ab25
test(contracts): PriceOracle
hbriese Jan 23, 2024
fe63126
chore(contracts): update zksolc version and redeploy contracts
hbriese Jan 23, 2024
2f18d49
fix(api): activation fees being completely discounted
hbriese Jan 24, 2024
93ea03f
fix(app): show activation fee as negative
hbriese Jan 24, 2024
8651d31
feat(app): show error message when proposal fails
hbriese Jan 24, 2024
22e2cb8
fix(api): subscription authorization connection param being ignored w…
hbriese Jan 24, 2024
1fd6e56
feat(app): persist getting started expansion (closed by default)
hbriese Jan 24, 2024
474c9a6
feat(app): reduce request policy TLL to 30s
hbriese Jan 24, 2024
ca45550
chore(api): db migration
hbriese Jan 24, 2024
89ce81a
tests(api): fix tests
hbriese Jan 24, 2024
4166e45
test(api): run tests db migration without dev-mode by default
hbriese Jan 24, 2024
2599a2f
chore: upgrade to edgedb 4.4
hbriese Jan 24, 2024
4f74e1f
refactor: remove DeploymentRefunder
hbriese Jan 24, 2024
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
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.
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 removed .yarn/cache/viem-patch-4beda9c657-e858f24e12.zip
Binary file not shown.
39 changes: 0 additions & 39 deletions .yarn/patches/viem-npm-1.20.3-dc6ceec8be.patch

This file was deleted.

1 change: 1 addition & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.cpuprofile
2 changes: 1 addition & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ COPY --from=builder --chown=node:node /build/api/package.json ./api/package.json
COPY --from=edgedb/edgedb-cli:4.0.2 --chown=node:node /usr/bin/edgedb /usr/bin/edgedb

WORKDIR /build/api
CMD ["yarn", "start:production"]
CMD ["yarn", "serve"]
33 changes: 22 additions & 11 deletions api/dbschema/default.esdl
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ module default {
}
required implementation: Address;
required salt: Bytes32;
required isActive: bool;
photoUri: str;
required paymasterEthCredit: decimal { constraint min_value(0); default := 0; }
activationEthFee: decimal { constraint min_value(0); }
upgradedAtBlock: bigint { constraint min_value(0); }
photoUri: str;
required property chain := as_chain(.address);
required property isActive := exists .upgradedAtBlock;
multi link policies := (select .<account[is Policy] filter .isEnabled);
multi link proposals := .<account[is Proposal];
multi link transactionProposals := .<account[is TransactionProposal];
Expand Down Expand Up @@ -51,13 +53,13 @@ module default {
multi link approvals := .<proposal[is Approval];
multi link rejections := .<proposal[is Rejection];
multi link potentialApprovers := (
with potentialResponses := distinct ((select .policy) ?? .account.policies).state.approvers.id,
ids := potentialResponses except .approvals.approver.id
with approvers := distinct (.policy ?? .account.policies).stateOrDraft.approvers.id,
ids := approvers except .approvals.approver.id
select Approver filter .id in ids
);
multi link potentialRejectors := (
with potentialResponses := distinct ((select .policy) ?? .account.policies).state.approvers.id,
ids := potentialResponses except .rejections.approver.id
with approvers := distinct (.policy ?? .account.policies).stateOrDraft.approvers.id,
ids := approvers except .rejections.approver.id
select Approver filter .id in ids
);
property riskLabel := assert_single((select .<proposal[is ProposalRiskLabel] filter .user = global current_user)).risk;
Expand Down Expand Up @@ -118,6 +120,11 @@ module default {
data: Bytes;
}

type PaymasterFees {
required property total := .activation;
required activation: decimal { constraint min_value(0); default := 0; }
}

type TransactionProposal extending Proposal {
required multi operations: Operation {
constraint exclusive;
Expand All @@ -126,13 +133,14 @@ module default {
required gasLimit: uint256 { default := 0; }
required feeToken: Token;
required paymaster: Address;
required paymasterEthFee: decimal { constraint min_value(0); default := 0; }
required maxPaymasterEthFees: PaymasterFees { constraint exclusive; default := (insert PaymasterFees {}); }
simulation: Simulation { constraint exclusive; on target delete deferred restrict; }
multi link transactions := .<proposal[is Transaction];
link transaction := (select .transactions order by .submittedAt desc limit 1);
required submitted: bool { default := false; }
required property status := (
select assert_exists((
TransactionProposalStatus.Pending if (not exists .transaction) else
TransactionProposalStatus.Pending if (not exists .transaction and not .submitted) else
TransactionProposalStatus.Executing if (not exists .transaction.receipt) else
TransactionProposalStatus.Successful if (.transaction.receipt.success) else
TransactionProposalStatus.Failed
Expand Down Expand Up @@ -213,11 +221,14 @@ module default {
required hash: Bytes32 { constraint exclusive; }
required proposal: TransactionProposal;
required maxEthFeePerGas: decimal { constraint min_value(0); }
required ethDiscount: decimal { constraint min_value(0); default := 0; }
required paymasterEthFees: PaymasterFees { constraint exclusive; default := (insert PaymasterFees {}); }
required ethCreditUsed: decimal { constraint min_value(0); default := 0; }
# required ethDiscount: decimal { constraint min_value(0); default := 0; }
required property ethDiscount := .ethCreditUsed + (.proposal.maxPaymasterEthFees.total - .paymasterEthFees.total);
required ethPerFeeToken: decimal { constraint min_value(0); }
required usdPerFeeToken: decimal { constraint min_value(0); }
required property maxNetworkEthFee := .maxEthFeePerGas * .proposal.gasLimit;
required property maxEthFees := .maxNetworkEthFee + .proposal.paymasterEthFee - .ethDiscount;
required property maxEthFees := .maxNetworkEthFee + .paymasterEthFees.total - .ethDiscount;
required submittedAt: datetime { default := datetime_of_statement(); }
receipt: Receipt { constraint exclusive; }
multi link events := .<transaction[is Event];
Expand All @@ -237,7 +248,7 @@ module default {
required gasUsed: bigint { constraint min_value(0); }
required ethFeePerGas: decimal { constraint min_value(0); }
required property networkEthFee := .ethFeePerGas * .transaction.proposal.gasLimit;
required property ethFees := .networkEthFee + .transaction.proposal.paymasterEthFee - .transaction.ethDiscount;
required property ethFees := .networkEthFee + .transaction.paymasterEthFees.total - .transaction.ethDiscount;
multi link events := .transaction.events;
multi link transferEvents := .events[is Transfer];
multi link transferApprovalEvents := .events[is TransferApproval];
Expand Down
Loading
Loading