Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AA V7 #207

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

AA V7 #207

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
2 changes: 1 addition & 1 deletion certora/conf/KintoID_Generic.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"verify": "KintoIDHarness:certora/spec/Generic.spec",
"packages": [
'node_modules/account-abstraction-0.7.0:@openzeppelin/contracts/=node_modules/openzeppelin-contracts-5.0.1',
'@aa-v7/=node_modules/account-abstraction-0.7.0/contracts/',
'@aa/=node_modules/account-abstraction-0.7.0/contracts/',

'ds-test/=node_modules/forge-std/lib/ds-test/src/',
'forge-std/=node_modules/forge-std/src/',
Expand Down
2 changes: 1 addition & 1 deletion certora/conf/KintoID_Monitor1.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"verify": "KintoIDHarness:certora/spec/KintoID/Monitor.spec",
"packages": [
'node_modules/account-abstraction-0.7.0:@openzeppelin/contracts/=node_modules/openzeppelin-contracts-5.0.1',
'@aa-v7/=node_modules/account-abstraction-0.7.0/contracts/',
'@aa/=node_modules/account-abstraction-0.7.0/contracts/',

'ds-test/=node_modules/forge-std/lib/ds-test/src/',
'forge-std/=node_modules/forge-std/src/',
Expand Down
2 changes: 1 addition & 1 deletion certora/conf/KintoID_Monitor2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"verify": "KintoIDHarness:certora/spec/KintoID/Monitor.spec",
"packages": [
'node_modules/account-abstraction-0.7.0:@openzeppelin/contracts/=node_modules/openzeppelin-contracts-5.0.1',
'@aa-v7/=node_modules/account-abstraction-0.7.0/contracts/',
'@aa/=node_modules/account-abstraction-0.7.0/contracts/',

'ds-test/=node_modules/forge-std/lib/ds-test/src/',
'forge-std/=node_modules/forge-std/src/',
Expand Down
2 changes: 1 addition & 1 deletion certora/conf/KintoID_SanctionsTraits.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"verify": "KintoIDHarness:certora/spec/KintoID/SanctionsTraits.spec",
"packages": [
'node_modules/account-abstraction-0.7.0:@openzeppelin/contracts/=node_modules/openzeppelin-contracts-5.0.1',
'@aa-v7/=node_modules/account-abstraction-0.7.0/contracts/',
'@aa/=node_modules/account-abstraction-0.7.0/contracts/',

'ds-test/=node_modules/forge-std/lib/ds-test/src/',
'forge-std/=node_modules/forge-std/src/',
Expand Down
2 changes: 1 addition & 1 deletion certora/conf/KintoID_Viewer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"verify":"KintoIDHarness:certora/spec/KintoID/Viewer.spec",
"packages": [
'node_modules/account-abstraction-0.7.0:@openzeppelin/contracts/=node_modules/openzeppelin-contracts-5.0.1',
'@aa-v7/=node_modules/account-abstraction-0.7.0/contracts/',
'@aa/=node_modules/account-abstraction-0.7.0/contracts/',

'ds-test/=node_modules/forge-std/lib/ds-test/src/',
'forge-std/=node_modules/forge-std/src/',
Expand Down
2 changes: 1 addition & 1 deletion certora/conf/KintoWallet.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"packages": [
'node_modules/account-abstraction-0.7.0:@openzeppelin/contracts/=node_modules/openzeppelin-contracts-5.0.1',
'@aa-v7/=node_modules/account-abstraction-0.7.0/contracts',
'@aa/=node_modules/account-abstraction-0.7.0/contracts',

'ds-test/=node_modules/forge-std/lib/ds-test/src',
'forge-std/=node_modules/forge-std/src',
Expand Down
2 changes: 1 addition & 1 deletion certora/conf/KintoWalletFactory.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"verify":"KintoWalletFactory:certora/spec/KintoWalletFactory/Factory.spec",
"packages": [
'node_modules/account-abstraction-0.7.0:@openzeppelin/contracts/=node_modules/openzeppelin-contracts-5.0.1',
'@aa-v7/=node_modules/account-abstraction-0.7.0/contracts/',
'@aa/=node_modules/account-abstraction-0.7.0/contracts/',

'ds-test/=node_modules/forge-std/lib/ds-test/src/',
'forge-std/=node_modules/forge-std/src/',
Expand Down
2 changes: 1 addition & 1 deletion certora/conf/SponsorPaymaster.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"packages": [
'node_modules/account-abstraction-0.7.0:@openzeppelin/contracts/=node_modules/openzeppelin-contracts-5.0.1',
'@aa-v7/=node_modules/account-abstraction-0.7.0/contracts/',
'@aa/=node_modules/account-abstraction-0.7.0/contracts/',

'ds-test/=node_modules/forge-std/lib/ds-test/src/',
'forge-std/=node_modules/forge-std/src/',
Expand Down
2 changes: 1 addition & 1 deletion certora/conf/SponsorPaymaster_additional.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"packages": [
'node_modules/account-abstraction-0.7.0:@openzeppelin/contracts/=node_modules/openzeppelin-contracts-5.0.1',
'@aa-v7/=node_modules/account-abstraction-0.7.0/contracts/',
'@aa/=node_modules/account-abstraction-0.7.0/contracts/',

'ds-test/=node_modules/forge-std/lib/ds-test/src/',
'forge-std/=node_modules/forge-std/src/',
Expand Down
8 changes: 5 additions & 3 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ ignored_warnings_from = ["lib/token-bridge-contracts/contracts/tokenbridge/libra
"lib/nitro-contracts/test/foundry/AbsInbox.t.sol", "lib/token-bridge-contracts/contracts/tokenbridge/libraries/gateway/GatewayRouter.sol"]
match-path = 'test/unit/**/*.sol'
ffi = true
solc_version = "0.8.24"
solc_version = "0.8.23"
optimizer = true
optimizer_runs = 200
viaIR = false
remappings = [
'node_modules/account-abstraction-0.7.0:@openzeppelin/contracts/=node_modules/openzeppelin-contracts-5.0.1',
'@aa-v7/=node_modules/account-abstraction-0.7.0/contracts/',
'@aa/=node_modules/account-abstraction-0.7.0/contracts/',

'ds-test/=node_modules/forge-std/lib/ds-test/src/',
'forge-std/=node_modules/forge-std/src/',
Expand All @@ -28,7 +31,6 @@ remappings = [
'@openzeppelin/contracts-upgradeable/=node_modules/openzeppelin-contracts-upgradeable/',

'node_modules/account-abstraction:@openzeppelin/contracts/=node_modules/openzeppelin-contracts',
'@aa/=node_modules/account-abstraction/contracts/',

'@solady/=node_modules/solady/src/',
'solady/=node_modules/solady/src/',
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
},
"dependencies": {
"@pimlico/alto": "^0.0.4",
"account-abstraction": "https://github.com/KintoXYZ/account-abstraction.git#61f677923ad7ed0ed5b87d2c20100a7079dba63a",
"account-abstraction-0.7.0": "https://github.com/eth-infinitism/account-abstraction.git#7af70c8993a6f42973f520ae0752386a5032abe7",
"forge-std": "https://github.com/foundry-rs/forge-std.git#bb4ceea94d6f10eeb5b41dc2391c6c8bf8e734ef",
"nitro-contracts": "npm:@arbitrum/nitro-contracts@1.2.1",
Expand Down
59 changes: 59 additions & 0 deletions script/actions/counter.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {SimpleAccount} from "@aa/samples/SimpleAccount.sol";
import {EntryPoint} from "@aa/core/EntryPoint.sol";
import {PackedUserOperation} from "@aa/interfaces/PackedUserOperation.sol";

import {Counter} from "../../src/sample/Counter.sol";
import {IKintoWallet} from "../../src/interfaces/IKintoWallet.sol";
import {IKintoWalletFactory} from "../../src/interfaces/IKintoWalletFactory.sol";
import {SponsorPaymaster} from "../../src/paymasters/SponsorPaymaster.sol";

import {MigrationHelper} from "@kinto-core-script/utils/MigrationHelper.sol";

import "forge-std/console.sol";
import "forge-std/Script.sol";

/// @notice This script executes a user operation that calls the `increment()` function using your smart account.
contract KintoCounterScript is MigrationHelper {
EntryPoint _entryPoint;

function setUp() public {}

function run() public override {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
address deployerPublicKey = vm.addr(deployerPrivateKey);
console.log("Deployer is", vm.addr(deployerPrivateKey));

Counter counter = Counter(_getChainDeployment("Counter"));
console.log("Before UserOp. Counter:", counter.count());

SimpleAccount account = SimpleAccount(payable(0xd1DA7E60F0f4480031C58986272EA8127E1073A9));
console2.log('account:', address(account));

// send a tx to the counter contract through our wallet
uint256 nonce = account.getNonce();
uint256[] memory privateKeys = new uint256[](1);
privateKeys[0] = deployerPrivateKey;

PackedUserOperation[] memory userOps = new PackedUserOperation[](1);

// increment counter
userOps[0] = _createUserOperation(
block.chainid,
address(account),
address(counter),
0,
nonce,
privateKeys,
abi.encodeWithSignature("increment()"),
address(0)
);

vm.broadcast(deployerPrivateKey);
EntryPoint(payable(_getChainDeployment("EntryPoint"))).handleOps(userOps, payable(vm.addr(privateKeys[0])));

console.log("After UserOp. Counter:", counter.count());
}
}
12 changes: 4 additions & 8 deletions script/actions/deploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import "@aa/core/EntryPoint.sol";
import {EntryPoint} from "@aa/core/EntryPoint.sol";

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

Expand All @@ -13,8 +13,9 @@ import "@kinto-core/viewers/KYCViewer.sol";
import "@kinto-core/viewers/WalletViewer.sol";
import "@kinto-core/wallet/KintoWallet.sol";
import "@kinto-core/wallet/KintoWalletFactory.sol";
import {BridgedKinto} from "@kinto-core/tokens/bridged/BridgedKinto.sol";
import {SponsorPaymaster} from "@kinto-core/paymasters/SponsorPaymaster.sol";
import {RewardsDistributor} from "@kinto-core/liquidity-mining/RewardsDistributor.sol";
import "@kinto-core/paymasters/SponsorPaymaster.sol";
import "@kinto-core/wallet/KintoWallet.sol";
import "@kinto-core/apps/KintoAppRegistry.sol";
import "@kinto-core/tokens/EngenCredits.sol";
Expand All @@ -23,10 +24,10 @@ import "@kinto-core/Faucet.sol";
import "@kinto-core/inflators/KintoInflator.sol";
import "@kinto-core/inflators/BundleBulker.sol";
import "@kinto-core/governance/EngenGovernance.sol";

import "@kinto-core-test/helpers/Create2Helper.sol";
import "@kinto-core-test/helpers/ArtifactsReader.sol";
import "@kinto-core-test/helpers/UUPSProxy.sol";
import {BridgedKinto} from "@kinto-core/tokens/bridged/BridgedKinto.sol";

import {DeployerHelper} from "@kinto-core-script/utils/DeployerHelper.sol";

Expand Down Expand Up @@ -302,11 +303,6 @@ contract DeployerScript is Create2Helper, DeployerHelper {

privateKey > 0 ? vm.broadcast(privateKey) : vm.broadcast();
_walletFactory.initialize();

// set wallet factory in EntryPoint
if (log) console.log("Setting wallet factory in entry point to: ", address(_walletFactory));
privateKey > 0 ? vm.broadcast(privateKey) : vm.broadcast();
entryPoint.setWalletFactory(address(_walletFactory));
}

function deployKintoWallet() public returns (KintoWallet _kintoWallet) {
Expand Down
39 changes: 39 additions & 0 deletions script/actions/fund-faucet.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import "@kinto-core/wallet/KintoWalletFactory.sol";
import "@kinto-core/wallet/KintoWallet.sol";
import {SponsorPaymaster} from "@kinto-core/paymasters/SponsorPaymaster.sol";

import "@kinto-core-test/helpers/Create2Helper.sol";
import "@kinto-core-test/helpers/ArtifactsReader.sol";
import "@kinto-core-test/helpers/UUPSProxy.sol";

import "forge-std/Script.sol";
import "forge-std/console.sol";

contract FundFaucetScript is Create2Helper, ArtifactsReader {
function setUp() public {}

// NOTE: this migration must be run from the ledger admin
function run() public {
console.log("RUNNING ON CHAIN WITH ID", vm.toString(block.chainid));
// Execute this script with the ledger admin but first we use the hot wallet
console.log("Executing with address", msg.sender, vm.envAddress("LEDGER_ADMIN"));
address factoryAddr = _getChainDeployment("KintoWalletFactory");
if (factoryAddr == address(0)) {
console.log("Need to execute main deploy script first", factoryAddr);
return;
}
// Start admin
vm.startBroadcast();
uint256 AMOUNT_TO_SEND = 0.1 ether;
KintoWalletFactory(address(factoryAddr)).sendMoneyToAccount{value: AMOUNT_TO_SEND}(
0xb539019776eF803E89EC062Ad54cA24D1Fdb008a
);
vm.stopBroadcast();
require(address(0xb539019776eF803E89EC062Ad54cA24D1Fdb008a).balance >= AMOUNT_TO_SEND, "amount was not sent");
// writes the addresses to a file
console.log("Faucet amount sent");
}
}
19 changes: 8 additions & 11 deletions script/actions/send-user-operation.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {IEntryPoint, UserOperation} from "@aa/core/BaseAccount.sol";
import {IEntryPoint} from "@aa/interfaces/IEntryPoint.sol";
import {PackedUserOperation} from "@aa/interfaces/PackedUserOperation.sol";

import {MigrationHelper} from "@kinto-core-script/utils/MigrationHelper.sol";

Expand All @@ -21,25 +22,21 @@ contract SendUserOperationScript is MigrationHelper {
uint256 nonce = json.readUint(".inflatedOp.nonce");
bytes memory callData = json.readBytes(".inflatedOp.callData");
bytes memory initCode = json.readBytes(".inflatedOp.initCode ");
uint256 callGasLimit = json.readUint(".inflatedOp.callGasLimit");
uint256 verificationGasLimit = json.readUint(".inflatedOp.verificationGasLimit");
bytes32 accountGasLimits = json.readBytes32(".inflatedOp.accountGasLimits");
bytes32 gasFees = json.readBytes32(".inflatedOp.gasFees");
uint256 preVerificationGas = json.readUint(".inflatedOp.preVerificationGas");
uint256 maxFeePerGas = json.readUint(".inflatedOp.maxFeePerGas");
uint256 maxPriorityFeePerGas = json.readUint(".inflatedOp.maxPriorityFeePerGas");
bytes memory paymasterAndData = json.readBytes(".inflatedOp.paymasterAndData");
bytes memory signature = json.readBytes(".inflatedOp.signature");

UserOperation[] memory userOps = new UserOperation[](1);
userOps[0] = UserOperation({
PackedUserOperation[] memory userOps = new PackedUserOperation[](1);
userOps[0] = PackedUserOperation({
sender: sender,
nonce: nonce,
initCode: initCode,
callData: callData,
callGasLimit: callGasLimit,
verificationGasLimit: verificationGasLimit,
preVerificationGas: preVerificationGas,
maxFeePerGas: maxFeePerGas,
maxPriorityFeePerGas: maxPriorityFeePerGas,
accountGasLimits: accountGasLimits,
gasFees: gasFees,
paymasterAndData: paymasterAndData,
signature: signature
});
Expand Down
12 changes: 6 additions & 6 deletions script/actions/test.s.sol
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {EntryPoint} from "@aa/core/EntryPoint.sol";
import {PackedUserOperation} from "@aa/interfaces/PackedUserOperation.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

import "@aa/core/EntryPoint.sol";

import "@kinto-core/KintoID.sol";
import "@kinto-core/interfaces/IKintoID.sol";
import "@kinto-core/sample/Counter.sol";
import "@kinto-core/sample/ETHPriceIsRight.sol";
import "@kinto-core/interfaces/IKintoWallet.sol";
import "@kinto-core/wallet/KintoWalletFactory.sol";
import "@kinto-core/paymasters/SponsorPaymaster.sol";
import {SponsorPaymaster} from "@kinto-core/paymasters/SponsorPaymaster.sol";

import "@kinto-core-script/utils/MigrationHelper.sol";

Expand Down Expand Up @@ -137,7 +137,7 @@ contract KintoDeployTestCounter is MigrationHelper {
uint256[] memory privateKeys = new uint256[](1);
privateKeys[0] = deployerPrivateKey;

UserOperation[] memory userOps = new UserOperation[](2);
PackedUserOperation[] memory userOps = new PackedUserOperation[](2);

// whitelist counter contract in the wallet
address[] memory targets = new address[](1);
Expand Down Expand Up @@ -235,7 +235,7 @@ contract KintoDeployETHPriceIsRight is MigrationHelper {
uint256 nonce = _newWallet.getNonce();
uint256[] memory privateKeys = new uint256[](1);
privateKeys[0] = deployerPrivateKey;
UserOperation[] memory userOps = new UserOperation[](2);
PackedUserOperation[] memory userOps = new PackedUserOperation[](2);

// whitelist ETHPriceIsRight contract in the wallet
address[] memory targets = new address[](1);
Expand Down Expand Up @@ -307,7 +307,7 @@ contract SendHanldeOps is MigrationHelper {
uint256[] memory privateKeys = new uint256[](1);
privateKeys[0] = deployerPrivateKey;

UserOperation[] memory userOps = new UserOperation[](1);
PackedUserOperation[] memory userOps = new PackedUserOperation[](1);

userOps[0] = _createUserOperation(
block.chainid,
Expand Down
4 changes: 2 additions & 2 deletions script/migrations/12-create_engen_app.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "../../src/wallet/KintoWallet.sol";
import "../../src/wallet/KintoWalletFactory.sol";
import "../../src/tokens/EngenCredits.sol";
import "../../src/apps/KintoAppRegistry.sol";
import "../../src/paymasters/SponsorPaymaster.sol";
import {SponsorPaymaster} from "@kinto-core/paymasters/SponsorPaymaster.sol";

import "../../test/helpers/ArtifactsReader.sol";
import "../../test/helpers/UUPSProxy.sol";
Expand Down Expand Up @@ -64,7 +64,7 @@ contract KintoMigration12DeployScript is ArtifactsReader, UserOp {
privateKeys[0] = deployerPrivateKey;
uint256 nonce = _kintoWallet.getNonce();

UserOperation[] memory userOps = new UserOperation[](3);
PackedUserOperation[] memory userOps = new PackedUserOperation[](3);

// whitelist Engen Credits & Registry
address[] memory apps = new address[](2);
Expand Down
2 changes: 1 addition & 1 deletion script/migrations/121-upgrade_access_protocol.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {IEntryPoint} from "@aa-v7/interfaces/IEntryPoint.sol";
import {IEntryPoint} from "@aa/interfaces/IEntryPoint.sol";
import {IBridger} from "@kinto-core/interfaces/bridger/IBridger.sol";

import {UpgradeableBeacon} from "@openzeppelin-5.0.1/contracts/proxy/beacon/UpgradeableBeacon.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/migrations/126-deploy-cross-chain-swap.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {IEntryPoint} from "@aa-v7/interfaces/IEntryPoint.sol";
import {IEntryPoint} from "@aa/interfaces/IEntryPoint.sol";
import {IBridger} from "@kinto-core/interfaces/bridger/IBridger.sol";

import {UpgradeableBeacon} from "@openzeppelin-5.0.1/contracts/proxy/beacon/UpgradeableBeacon.sol";
Expand Down
1 change: 1 addition & 0 deletions script/migrations/137-upgrade_wallet_factory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.8.18;

import "../../src/wallet/KintoWallet.sol";
import {KintoWalletFactory} from "../../src/wallet/KintoWalletFactory.sol";
import {RewardsDistributor} from "@kinto-core/liquidity-mining/RewardsDistributor.sol";

import {MigrationHelper} from "@kinto-core-script/utils/MigrationHelper.sol";

Expand Down
2 changes: 1 addition & 1 deletion script/migrations/145-upgrade_access_protocol.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {IEntryPoint} from "@aa-v7/interfaces/IEntryPoint.sol";
import {IEntryPoint} from "@aa/interfaces/IEntryPoint.sol";
import {IBridger} from "@kinto-core/interfaces/bridger/IBridger.sol";

import {UpgradeableBeacon} from "@openzeppelin-5.0.1/contracts/proxy/beacon/UpgradeableBeacon.sol";
Expand Down
Loading
Loading