Skip to content
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
4 changes: 4 additions & 0 deletions backend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changelog
## [3.1.6] - 2025-04-02
### Fixes
- Fixed bug in paymaster estimation for multiTokenPaymaster getERC20Quotes API

Comment on lines +2 to +5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

The changelog entry clearly documents the bug fix.

The changelog appropriately includes the version, date, and a concise description of the fixed issue. However, there are some markdown formatting issues in the document.

According to markdown best practices, headings should be surrounded by blank lines for better readability:

1
# Changelog
+
## [3.1.6] - 2025-04-02
+
### Fixes
+
- Fixed bug in paymaster estimation for multiTokenPaymaster getERC20Quotes API
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## [3.1.6] - 2025-04-02
### Fixes
- Fixed bug in paymaster estimation for multiTokenPaymaster getERC20Quotes API
# Changelog
## [3.1.6] - 2025-04-02
### Fixes
- Fixed bug in paymaster estimation for multiTokenPaymaster getERC20Quotes API
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

2-2: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


2-2: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


3-3: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


3-3: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


4-4: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)

## [3.1.5] - 2025-03-24
### Fixes
- Added all tokens used in multiTokenPaymaster to have decimals in constants rather than fetching from rpc
Expand Down
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arka",
"version": "3.1.5",
"version": "3.1.6",
"description": "ARKA - (Albanian for Cashier's case) is the first open source Paymaster as a service software",
"type": "module",
"directories": {
Expand Down
18 changes: 18 additions & 0 deletions backend/src/paymaster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ export class Paymaster {
bundlerRpc: string,
oracleName: string,
nativeOracleAddress: string,
signer: Wallet,
log?: FastifyBaseLogger
) {
try {
Expand All @@ -574,6 +575,23 @@ export class Paymaster {
let ETHUSDPrice: any, ETHUSDPriceDecimal;
const paymasterKey = Object.keys(multiTokenPaymasters[chainId])[0];
let response, unaccountedCost;
const validUntil = new Date();
const validAfter = new Date();
const hex = (Number((validUntil.valueOf() / 1000).toFixed(0)) + 600).toString(16);
const hex1 = (Number((validAfter.valueOf() / 1000).toFixed(0)) - 60).toString(16);
let str = '0x'
let str1 = '0x'
for (let i = 0; i < 14 - hex.length; i++) {
str += '0';
}
for (let i = 0; i < 14 - hex1.length; i++) {
str1 += '0';
}
str += hex;
str1 += hex1;
const paymasterContract = new ethers.Contract(multiTokenPaymasters[chainId][paymasterKey], MultiTokenPaymasterAbi, provider);
// Assuming the token price is 1 USD since this is just used for the gas estimation and the paymasterAndData generated will not be sent on response
userOp.paymasterAndData = await this.getPaymasterAndDataForMultiTokenPaymaster(userOp, str, str1, paymasterKey, '100000000', paymasterContract, signer, chainId);
if (oracleName === "chainlink") {
const res = await this.getEstimateUserOperationGasAndData(
provider,
Expand Down
4 changes: 3 additions & 1 deletion backend/src/routes/paymaster-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ const paymasterRoutes: FastifyPluginAsync<PaymasterRoutesOpts> = async (server,
if (!multiTokenPaymasters[chainId]) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.MULTI_NOT_DEPLOYED + chainId })
if (networkConfig.MultiTokenPaymasterOracleUsed == "chainlink" && !NativeOracles[chainId])
throw new Error("Native Oracle address not set for this chainId")
result = await paymaster.getQuotesMultiToken(userOp, entryPoint, chainId, multiTokenPaymasters, tokens_list, multiTokenOracles, bundlerUrl, networkConfig.MultiTokenPaymasterOracleUsed, NativeOracles[chainId], server.log);
const provider = new providers.JsonRpcProvider(bundlerUrl);
const signer = new Wallet(privateKey, provider)
result = await paymaster.getQuotesMultiToken(userOp, entryPoint, chainId, multiTokenPaymasters, tokens_list, multiTokenOracles, bundlerUrl, networkConfig.MultiTokenPaymasterOracleUsed, NativeOracles[chainId], signer, server.log);
}
else {
if (gasToken && ethers.utils.isAddress(gasToken)) gasToken = ethers.utils.getAddress(gasToken)
Expand Down