background
logo

Security Audit Report for bitgetwallet's DeFiCard Contracts

DESCRIPTION

The target of this audit is the private code repository of DeFiCard Contracts of bitgetwallet. The DeFiCard Contracts project introduces an on-chain payment card infrastructure that connects card-based payment workflows with ERC20 token settlement and optional DeFi protocol actions. Its core business logic covers authorisation, settlement, and refund flows, allowing payment amounts to be escrowed, released to settlement recipients, cancelled back to users, or refunded through designated refund callers. The architecture is built around DeFiCard Router, an entry contract that routes calls through enabled core implementations such as DeFiCardCoreV1 via fallback delegatecall. Each card is backed by a dedicated DeFiCardSettlement contract, and a handler integrates with DeFi protocols so payment flows can optionally use DeFi actions.

Please refer to the report for the detailed audit scope.

Our audit methodology employs automated vulnerability scans, manual verification, and business logic analysis to uncover potential security issues coupled with gas and code quality optimization recommendations.

In summary, we did not find any critical issues within the audited codebase. However, we have identified some non-critical issues that should be addressed. Additionally, we have put forth recommendations and notes that should be taken into consideration. It is important to note that the scope of our audit was strictly limited to the specific code versions mentioned in the report. Any updates made subsequent to our review would require a re-evaluation.

KEY FINDINGS

In total, we find 4 potential issues in the smart contract. We also have 8 recommendations and 11 notes, as follows:

High Risk: 0
Medium Risk: 0
Low Risk: 4
Recommendation: 8
Note: 11
ID Severity Description Status
1 Low Lack of input token validation for Morpho withdrawals Fixed
2 Low Stale spent amount in function getAccountDailyLimitByCard() Fixed
3 Low Lack of delay restriction on function cancelOperation() Confirmed
4 Low Inconsistent timelock enforcement for selector risk level changes Confirmed
5 - Align maxBorrow calculation with Morpho’s health check implementation Confirmed
6 - Add validation for settlement configuration Fixed
7 - Adopt accurate variable naming Confirmed
8 - Add validation during action execution Fixed
9 - Support share-based withdrawal in the Morpho handler Confirmed
10 - Add allowance revocation logic Confirmed
11 - Align interface and event with implementation Fixed
12 - Add validations on action execution results Confirmed
13 - Potential centralization risks -
14 - Proxy deployment and implementation binding should be atomic -
15 - Assumptions on external protocols -
16 - Authorize the handler before specific Morpho operations -
17 - Trusted off-chain logic -
18 - Assumptions on whitelisted handlers -
19 - Ensure order resolution during settlement replacement -
20 - Storage layout consistency across core versions -
21 - Refund mechanism relies on off-chain logic -
22 - Weird ERC20 tokens -
23 - Cancel stale operations -

More details are provided in the audit report.

Take the first step towards a secure future

Reach out now for BlockSec's expert code audit services, elevate the security of your protocol before it goes live!