Skip to content

Commit

Permalink
Added some deployments and fixed minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
KyrylR committed Oct 27, 2024
1 parent fca81b4 commit 95a0c30
Show file tree
Hide file tree
Showing 14 changed files with 172 additions and 288 deletions.
13 changes: 13 additions & 0 deletions DEPLOYMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Deployments

## Q Testnet

Entry Point: 0x820692eaD6ba469d76c6c443FA97fC8B5bef309A
Smart Account Factory: 0x76C9b5c8Bc736e58F5b54BA721571c77059CAa68
Some Token: 0x07ECE004fF33ce444f82F8d538A5687849Df67AC

## Q Mainnet

Entry Point: 0x64B38172fF8D960305a4B9cD372415fEb26aF676
Smart Account Factory: 0x3940bA27a50d28A98375Cc4E6Ae3db6e7E5c7BA0
Some Token: 0xa8c876e0312523071355d3AB667714c5E3A37290
7 changes: 6 additions & 1 deletion contracts/SmartAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ contract SmartAccount is IAccount, Initializable, UUPSUpgradeable, ERC1155Holder
}

event SessionAccountSet(address indexed account, uint256 timestamp);
event Executed(address indexed destination, uint256 value, bytes data);

error InvalidProof();
error CallFailed(bytes result);
Expand Down Expand Up @@ -89,6 +90,10 @@ contract SmartAccount is IAccount, Initializable, UUPSUpgradeable, ERC1155Holder
if (!success) {
revert CallFailed(result);
}

history.push(TransactionLog(destination_, block.timestamp, value_, functionData_));

emit Executed(destination_, value_, functionData_);
}

function validateUserOp(
Expand Down Expand Up @@ -140,7 +145,7 @@ contract SmartAccount is IAccount, Initializable, UUPSUpgradeable, ERC1155Holder
function getTransactionHistory(
uint256 offset_,
uint256 limit_
) internal view returns (TransactionLog[] memory list_) {
) external view returns (TransactionLog[] memory list_) {
uint256 to_ = Paginator.getTo(history.length, offset_, limit_);

list_ = new TransactionLog[](to_ - offset_);
Expand Down
20 changes: 10 additions & 10 deletions contracts/verifiers/IdentityAuthVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,26 @@ contract IdentityAuthVerifier {
uint256 public constant GAMMA_Y2 =
8495653923123431417604973247489272438418190587263600148770280649306958101930;
uint256 public constant DELTA_X1 =
19751153895790635199377012958568669024511527072859676625865153818733475771336;
7399001112309358388363463896157476285065070923164923171561253629405512433684;
uint256 public constant DELTA_X2 =
11031034117813473359187118048834108617446635378119944876104817895518053612706;
6699134209302932555916221643797720103595571024416613154586005204469933582902;
uint256 public constant DELTA_Y1 =
13708366762454028516776867454650697501972057631897364161257601312491535742851;
9529019162526694802351240092061489934590897459517965173305798641249976368250;
uint256 public constant DELTA_Y2 =
7765704022087598368766620815988062010746953481338857230447379693341539555028;
5710499183394008902093195827385602132942110932380305399054817472390888975560;

uint256 public constant IC0_X =
21029555936988346365736049036748712219216960868065573484355530273876470353811;
4278953738362456531177284742399218542710201189174793882434734697480408628216;
uint256 public constant IC0_Y =
901424059116605087243528934475122270000214644985471006079803537802022871055;
13128474744664460904734517114858957499237659279054734636679280541932553825544;
uint256 public constant IC1_X =
235157616531341545811539219014569802683877743510073682396126366647326595353;
16035286323633708254716796010711666419659789570488920862400045459874212298937;
uint256 public constant IC1_Y =
13746979507747839324465222361278180295907108716875698743625353973076924562818;
1047557365160996654044398738351873773108646754518128127731085552618517949817;
uint256 public constant IC2_X =
14411009894530908587763336188442379692296702436612920535199503077904971507457;
400266059310397576167249145300637558335473357446200744351724051170274252789;
uint256 public constant IC2_Y =
2560772288800603792867157667712811530678192222482358985578469440769502439527;
10034887272990681613070818199588660780426023285044719559062216463120334077526;

/// @dev memory pointer sizes
uint16 public constant P_PUBLIC_SIGNALS_ACCUMULATOR_SIZE = 128;
Expand Down
19 changes: 10 additions & 9 deletions deploy/_100_demo.migration.ts → deploy/100_demo.migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@ import {
getSignedPackedUserOperation,
sendSignedPackedUserOperation,
} from "@/test/helpers/aa-helper";
import { buildNullifier, EVENT_ID } from "@scripts";

const ENTRY_POINT = "0xC1ECEd7578cDcED435717BDF3a667D3cf418bE0C";
const SOME_TOKEN = "0xB7e34aEB1ba4E2C270d27e980Ba47BaABb34DD09";
const ACCOUNT_FACTORY = "0x9aEA6E9504cCA01B267dAc45e0cC2883F8c0ae31";
const ENTRY_POINT = "0x820692eaD6ba469d76c6c443FA97fC8B5bef309A";
const SOME_TOKEN = "0x07ECE004fF33ce444f82F8d538A5687849Df67AC";
const ACCOUNT_FACTORY = "0x76C9b5c8Bc736e58F5b54BA721571c77059CAa68";

export = async (deployer: Deployer) => {
const token = await deployer.deployed(ERC20Mock__factory, SOME_TOKEN);
const entryPoint = await deployer.deployed(EntryPoint__factory, ENTRY_POINT);
const accountFactory = await deployer.deployed(SmartAccountFactory__factory, ACCOUNT_FACTORY);

const signer = await deployer.getSigner();
const privateKey = BigInt("0x29176100eaa962bdc1fe6c654d6a3c130e96a4d1168b33848b897dc502820133");

const userOperation = await getEmptyPackedUserOperation();
const initCode = await getInitCode(accountFactory, await signer.getAddress());
const initCode = await getInitCode(accountFactory, buildNullifier(privateKey, EVENT_ID));

await deployer.sendNative(initCode.predictedAddress, ethers.parseEther("0.1"));
await deployer.sendNative(initCode.predictedAddress, ethers.parseEther("1"));

userOperation.sender = initCode.predictedAddress;
userOperation.initCode = initCode.initCode;
Expand All @@ -43,7 +44,7 @@ export = async (deployer: Deployer) => {
],
);

// const signedOp = await getSignedPackedUserOperation(entryPoint, signer as any, userOperation);
//
// await sendSignedPackedUserOperation(entryPoint, signedOp);
const signedOp = await getSignedPackedUserOperation(entryPoint, privateKey, EVENT_ID, userOperation);

await sendSignedPackedUserOperation(entryPoint, signedOp);
};
File renamed without changes.
2 changes: 1 addition & 1 deletion deploy/2_account.factory.migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SmartAccountFactory__factory,
} from "@ethers-v6";

const ENTRY_POINT = "0xC1ECEd7578cDcED435717BDF3a667D3cf418bE0C";
const ENTRY_POINT = "0x64B38172fF8D960305a4B9cD372415fEb26aF676";

export = async (deployer: Deployer) => {
let accountFactory = await deployer.deploy(SmartAccountFactory__factory);
Expand Down
35 changes: 35 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ const config: HardhatUserConfig = {
accounts: privateKey(),
gasMultiplier: 1.2,
},
"q-testnet": {
url: "https://rpc.qtestnet.org/",
accounts: privateKey(),
gasMultiplier: 1.2,
},
"q-mainnet": {
url: "https://rpc.q.org/",
accounts: privateKey(),
gasMultiplier: 1.2,
},
},
solidity: {
version: "0.8.26",
Expand All @@ -53,14 +63,39 @@ const config: HardhatUserConfig = {
etherscan: {
apiKey: {
sepolia: `${process.env.ETHERSCAN_KEY}`,
"q-testnet": "abc",
"q-mainnet": "abc",
},
customChains: [
{
network: "q-testnet",
chainId: 35443,
urls: {
apiURL: "https://explorer.qtestnet.org/api",
browserURL: "https://explorer.qtestnet.org",
},
},
{
network: "q-mainnet",
chainId: 35441,
urls: {
apiURL: "https://explorer.q.org/api",
browserURL: "https://explorer.q.org",
},
},
],
},
migrate: {
pathToMigrations: "./deploy/",
},
mocha: {
timeout: 1000000,
},
zkit: {
compilationSettings: {
c: true,
},
},
contractSizer: {
alphaSort: false,
disambiguatePaths: false,
Expand Down
Loading

0 comments on commit 95a0c30

Please sign in to comment.