Skip to content

Commit

Permalink
add test +account-abstraction submodule + test contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
livingrockrises committed May 2, 2023
1 parent be93d6c commit 6f59d52
Show file tree
Hide file tree
Showing 10 changed files with 452 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ typechain-types
#Hardhat files
cache
artifacts
account-abstraction

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "account-abstraction"]
path = account-abstraction
url = https://github.com/eth-infinitism/account-abstraction
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ coverage
walletUtils.*
coverage.json
arguments.js
typings/
typings/
account-abstraction
1 change: 1 addition & 0 deletions account-abstraction
Submodule account-abstraction added at abff2a
31 changes: 31 additions & 0 deletions contracts/test/helpers/MockPriceFeed.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

//@review againsnt chainlink reference PriceConverter https://docs.chain.link/docs/get-the-latest-price/
//@review decimals for individual feeds
contract MockPriceFeed {
AggregatorV3Interface internal priceFeed1;
AggregatorV3Interface internal priceFeed2;

constructor() {
// todo // do not hard code // polygon values
priceFeed1 = AggregatorV3Interface(
0xAB594600376Ec9fD91F8e885dADF0CE036862dE0
); // matic usd
priceFeed2 = AggregatorV3Interface(
0xfE4A8cc5b5B2366C1B58Bea3858e81843581b2F7
); // usdc usd
}

function decimals() public view returns (uint8) {
return 18;
}

function getThePrice() public view returns (int) {
// Always using decimals 18 for derived price feeds
int usdcMatic = 1043 * 1e15;
return usdcMatic;
}
}
4 changes: 2 additions & 2 deletions contracts/token/BiconomyTokenPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ contract BiconomyTokenPaymaster is BasePaymaster, ReentrancyGuard, TokenPaymaste

// Review it's basically same as above
// calculated cost of the postOp
uint256 private constant COST_OF_POST = 40000; // TBD
uint256 private constant COST_OF_POST = 45000; // TBD

// (Potentially) Always rely on verifyingSigner..
address public verifyingSigner;
Expand Down Expand Up @@ -129,7 +129,7 @@ contract BiconomyTokenPaymaster is BasePaymaster, ReentrancyGuard, TokenPaymaste
sstore(verifyingSigner.slot, _verifyingSigner)
}
oracleAggregator = _oracleAggregator;
unaccountedEPGasOverhead = 40000; // TBD
unaccountedEPGasOverhead = 45000; // TBD
feeReceiver = address(this); // initialize with self (could also be _owner)
}

Expand Down
6 changes: 6 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";

import * as dotenv from "dotenv";

import "@typechain/hardhat";
import "hardhat-gas-reporter";
import "solidity-coverage";

const config: HardhatUserConfig = {
solidity: {
compilers: [
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@
"typescript": "^5.0.4"
},
"dependencies": {
"@chainlink/contracts": "^0.6.0",
"@account-abstraction/contracts": "^0.6.0",
"@biconomy/account-contracts": "^2.0.0",
"@chainlink/contracts": "^0.6.0",
"@ethersproject/abstract-signer": "^5.6.2",
"@ethersproject/constants": "^5.6.1",
"@openzeppelin/contracts": "4.8.1",
"@openzeppelin/contracts-upgradeable": "4.8.1",
"@typechain/hardhat": "^2.3.0",
"@types/mocha": "^9.0.0",
"chai-as-promised": "^7.1.1",
"chai-string": "^1.5.0",
"dotenv": "^16.0.3",
"eth-gas-reporter": "^0.2.24",
"ethereumjs-util": "^7.1.0",
"ethereumjs-wallet": "^1.0.1",
Expand Down
Loading

0 comments on commit 6f59d52

Please sign in to comment.