Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
livingrockrises committed Dec 2, 2023
1 parent 89fe946 commit 2131924
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
24 changes: 4 additions & 20 deletions contracts/token/BiconomyTokenPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,6 @@ contract BiconomyTokenPaymaster is
entryPoint.withdrawTo(withdrawAddress, amount);
}

/**
* @dev Returns the exchange price of the token in wei.
* @param _token ERC20 token address
*/
function exchangePrice(
address _token
) internal view virtual returns (uint256 exchangeRate) {
exchangeRate = getTokenValueOfOneNativeToken(_token);
}

/**
* @dev pull tokens out of paymaster in case they were sent to the paymaster at any point.
* @param token the token deposit to withdraw
Expand Down Expand Up @@ -572,22 +562,16 @@ contract BiconomyTokenPaymaster is

userOpHash := calldataload(offset)
}
// console.log("gas used for context decode: %s", gas - gasleft());

// console.log("account: %s", account);
// console.log("feeToken: %s", address(feeToken));
// console.log("priceSource: %s", uint8(priceSource));
// console.log("exchangeRate: %s", exchangeRate);
// console.log("priceMarkup: %s", priceMarkup);
// console.log("userOpHash: %s", uint256(userOpHash));

uint256 effectiveExchangeRate = exchangeRate;

if (
priceSource == ExchangeRateSource.ORACLE_BASED
) {
uint256 result = exchangePrice(address(feeToken));
if (result != 0) effectiveExchangeRate = result;
effectiveExchangeRate = getTokenValueOfOneNativeToken(address(feeToken));
// uint256 result = getTokenValueOfOneNativeToken(address(feeToken));
// Review
// if (result != 0) effectiveExchangeRate = result;
}

// We could either touch the state for BASEFEE and calculate based on maxPriorityFee passed (to be added in context along with maxFeePerGas) or just use tx.gasprice
Expand Down
2 changes: 1 addition & 1 deletion lib/scw-contracts
Submodule scw-contracts updated 28 files
+1 −0 .gitignore
+ audits/Biconomy Account Recovery Module - Zellic Audit Report.pdf
+ audits/Biconomy Batched Session Router Module - Kawach Audit report.pdf
+ audits/Biconomy Multichain Validator - Kawach Audit report.pdf
+ audits/Biconomy Session Keys and Passkey Registry - Zellic Audit Report.pdf
+ audits/Biconomy Smart Account And Session Keys - Kawach Audit Report.pdf
+12 −3 contracts/smart-account/base/ModuleManager.sol
+3 −3 contracts/smart-account/interfaces/IAccountRecoveryModule.sol
+7 −1 contracts/smart-account/interfaces/base/IModuleManager.sol
+2 −3 contracts/smart-account/interfaces/modules/IMultiOwnedECDSAModule.sol
+6 −0 contracts/smart-account/interfaces/modules/ISessionKeyManagerModule.sol
+24 −19 contracts/smart-account/modules/AccountRecoveryModule.sol
+2 −3 contracts/smart-account/modules/MultiOwnedECDSAModule.sol
+8 −1 contracts/smart-account/modules/PasskeyRegistryModule.sol
+55 −45 contracts/smart-account/modules/PasskeyValidationModules/Secp256r1.sol
+4 −2 contracts/smart-account/modules/SecurityPolicyManagerPlugin.sol
+1 −1 contracts/smart-account/modules/SessionKeyManagerModule.sol
+377 −0 contracts/smart-account/test/TestSecp256r1.sol
+9 −5 test/bundler-integration/module/AccountRecovery.Module.specs.ts
+85 −31 test/module/AccountRecovery.Module.specs.ts
+0 −18 test/module/PasskeyFlow.module.specs.ts
+4,578 −0 test/module/PasskeyModule/ecdsa_secp256r1_sha256_test.json
+230 −0 test/module/Secp256r1.specs.ts
+104 −0 test/module/Wycheproof.specs.ts
+34 −2 test/smart-account/SA.Modules.specs.ts
+1 −1 test/smart-account/SA.Setup.specs.ts
+68 −2 test/utils/accountRecovery.ts
+6 −3 tsconfig.json

0 comments on commit 2131924

Please sign in to comment.