Skip to content

Commit

Permalink
Merge pull request #73 from etherspot/remove-eip712-from-validator-mo…
Browse files Browse the repository at this point in the history
…dule

Remove EIP712 from validator module, remove timestamp checks from session key, redeploy contracts, add scripts
  • Loading branch information
cryptonoyaiba authored Aug 21, 2024
2 parents 9d12265 + e0d2fb0 commit fe8aa6d
Show file tree
Hide file tree
Showing 84 changed files with 8,266 additions and 3,214 deletions.
32 changes: 31 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,34 @@ LINEASCAN_API_KEY=
FLARE_API_KEY='default'

# 7579 specific
ALCHEMY_GOERLI_RPC_URL=
AMOY_RPC_URL=https://polygon-amoy-bor-rpc.publicnode.com
ANCIENT8_RPC_URL=https://rpc.ancient8.gg
ANCIENT8_TESTNET_RPC_URL=https://rpcv2-testnet.ancient8.gg/
ARBITRUM_RPC_URL=https://arbitrum-one.publicnode.com
ARBITRUM_SEPOLIA_RPC_URL=https://sepolia-rollup.arbitrum.io/rpc/
AVALANCHE_RPC_URL=https://avalanche-c-chain.publicnode.com
BASE_RPC_URL=https://base.publicnode.com
BASE_SEPOLIA_RPC_URL=https://sepolia.base.org
BINANCE_RPC_URL=https://bsc.publicnode.com
BINANCE_TESTNET_RPC_URL=https://bsc-testnet.publicnode.com
CHIADO_RPC_URL=https://rpc.chiadochain.net
ETHEREUM_RPC_URL=https://eth.llamarpc.com
FLARE_RPC_URL=https://flare-api-tracer.flare.network/ext/C/rpc?auth=${FLARE_API_KEY}
FLARE_COSTON2_RPC_URL=https://coston2-api.flare.network/ext/C/rpc
FUJI_RPC_URL=https://avalanche-fuji-c-chain.publicnode.com
FUSE_RPC_URL=https://fuse-pokt.nodies.app
FUSE_SPARKNET_RPC_URL=https://rpc.fusespark.io
GNOSIS_RPC_URL=https://rpc.ankr.com/gnosis
LINEA_RPC_URL=https://linea.blockpi.network/v1/rpc/public
LINEA_SEPOLIA_RPC_URL=https://rpc.sepolia.linea.build
MANTLE_RPC_URL=https://rpc.mantle.xyz
MANTLE_SEPOLIA_RPC_URL=https://rpc.sepolia.mantle.xyz
OPTIMISM_RPC_URL=https://rpc.ankr.com/optimism
OPTIMISM_SEPOLIA_RPC_URL=https://sepolia.optimism.io/
POLYGON_RPC_URL=https://rpc.ankr.com/polygon
ROOTSTOCK_RPC_URL=https://public-node.rsk.co
ROOTSTOCK_TESTNET_RPC_URL=https://public-node.testnet.rsk.co
SCROLL_RPC_URL=https://rpc.scroll.io
SCROLL_SEPOLIA_RPC_URL=https://sepolia-rpc.scroll.io/
SEPOLIA_RPC_URL=https://ethereum-sepolia-rpc.publicnode.com
XDC_APOTHEM_RPC_URL=https://erpc.apothem.network
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ broadcast
forge_cache/
.gas-snapshot

yarn-error.log
yarn.lock
2 changes: 1 addition & 1 deletion DEPLOYMENTS_MODULAR.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@
| `ModularEtherspotWalletFactory` | `xdc_apothem` | [0xB7361924B4F56af570680d56A03895A16bC54Be0](https://apothem.blocksscan.io/address/0xB7361924B4F56af570680d56A03895A16bC54Be0) | [0xeb7cf28ebbb525d83cb839544ed92d9ffce79956f3cb3289b54a43899d5fc3ad](https://explorer.apothem.network/txs/0xeb7cf28ebbb525d83cb839544ed92d9ffce79956f3cb3289b54a43899d5fc3ad#overview) |
| `Bootstrap` | `xdc_apothem` | [0x805650ce74561C85baA44a8Bd13E19633Fd0F79d](https://apothem.blocksscan.io/address/0x805650ce74561C85baA44a8Bd13E19633Fd0F79d) | [0x6ae3544d40f293c1baa02d6951bc87f379470e1dc064fff64f4f4b759c193ab5](https://explorer.apothem.network/tx/0x6ae3544d40f293c1baa02d6951bc87f379470e1dc064fff64f4f4b759c193ab5#overview) |
| `MultipleOwnerECDSAValidator` | `xdc_apothem` | [0x68BA597bf6B9097b1D89b8E0D34646D30997f773](https://apothem.blocksscan.io/address/0x68BA597bf6B9097b1D89b8E0D34646D30997f773) | [0x1869c0444df1ca62e1357e78bfd9db8790d192abaa880ab85d93de4ba1b7440e](https://explorer.apothem.network/tx/0x1869c0444df1ca62e1357e78bfd9db8790d192abaa880ab85d93de4ba1b7440e#overview) |
| `ERC20SessionKeyValidator` | `xdc_apothem` | [0x4ebd86AAF89151b5303DB072e0205C668e31E5E7](https://apothem.blocksscan.io/address/0x4ebd86AAF89151b5303DB072e0205C668e31E5E7) | [0xe538eecff81075228e25497029904e3d454ef2ae011d353232ae72e45ad7622d](https://explorer.apothem.network/tx/0xe538eecff81075228e25497029904e3d454ef2ae011d353232ae72e45ad7622d#overview) |
| `ERC20SessionKeyValidator` | `xdc_apothem` | [0x4ebd86AAF89151b5303DB072e0205C668e31E5E7](https://apothem.blocksscan.io/address/0x4ebd86AAF89151b5303DB072e0205C668e31E5E7) | [0xe538eecff81075228e25497029904e3d454ef2ae011d353232ae72e45ad7622d](https://explorer.apothem.network/tx/0xe538eecff81075228e25497029904e3d454ef2ae011d353232ae72e45ad7622d#overview) |
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"type": "error"
}
],
"bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220034d81ebbd34204c06273abe4c222f047ea90b24e5f3f671650e01cc48de00cb64736f6c63430008170033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220034d81ebbd34204c06273abe4c222f047ea90b24e5f3f671650e01cc48de00cb64736f6c63430008170033",
"bytecode": "0x60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e6b485ff676c5ae70b5495352f8a9c9b61590709fbbb33dd25443cf439e7a2c464736f6c63430008170033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e6b485ff676c5ae70b5495352f8a9c9b61590709fbbb33dd25443cf439e7a2c464736f6c63430008170033",
"linkReferences": {},
"deployedLinkReferences": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"contractName": "StorageSlot",
"sourceName": "@openzeppelin/contracts/utils/StorageSlot.sol",
"abi": [],
"bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ce59b99db3900209d2e15242df5b91c06fa29c023399d4a5fd14ecb7f3022d0364736f6c63430008170033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ce59b99db3900209d2e15242df5b91c06fa29c023399d4a5fd14ecb7f3022d0364736f6c63430008170033",
"bytecode": "0x60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e100a044126e83e6826809cafeb8709a701b8295f40a2b165b658ffa1ff1f93a64736f6c63430008170033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e100a044126e83e6826809cafeb8709a701b8295f40a2b165b658ffa1ff1f93a64736f6c63430008170033",
"linkReferences": {},
"deployedLinkReferences": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"type": "error"
}
],
"bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ecb6677cf278a4db1852c4103abae136e17195b410725b6c5b137dfe6ffe435064736f6c63430008170033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ecb6677cf278a4db1852c4103abae136e17195b410725b6c5b137dfe6ffe435064736f6c63430008170033",
"bytecode": "0x60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220278478cbbe5308bcd5d806a3801590d349ae0e25caadf82018877d31440d217a64736f6c63430008170033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220278478cbbe5308bcd5d806a3801590d349ae0e25caadf82018877d31440d217a64736f6c63430008170033",
"linkReferences": {},
"deployedLinkReferences": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"type": "error"
}
],
"bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122006c3e2ed461cdc19d2727e92a49295d7e29448fdd839336635cf0e827d0eb7c864736f6c63430008170033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122006c3e2ed461cdc19d2727e92a49295d7e29448fdd839336635cf0e827d0eb7c864736f6c63430008170033",
"bytecode": "0x60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220095d9bc6ba30522a8ef18771a1546ffb246e52669027aef4753ae8b0696ebbdd64736f6c63430008170033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220095d9bc6ba30522a8ef18771a1546ffb246e52669027aef4753ae8b0696ebbdd64736f6c63430008170033",
"linkReferences": {},
"deployedLinkReferences": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"type": "error"
}
],
"bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122000f215a5d34261abc4b9733d0b3b270044a339cc1d403961da195a2a1c49f91964736f6c63430008170033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122000f215a5d34261abc4b9733d0b3b270044a339cc1d403961da195a2a1c49f91964736f6c63430008170033",
"bytecode": "0x60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212209d9e23699756c052f5c0d29d6a70d27ed70b5f3b9b1335963742b4dfa142edc864736f6c63430008170033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212209d9e23699756c052f5c0d29d6a70d27ed70b5f3b9b1335963742b4dfa142edc864736f6c63430008170033",
"linkReferences": {},
"deployedLinkReferences": {}
}
110 changes: 110 additions & 0 deletions deploy/012_deploy_modular.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import { ethers } from 'ethers';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { DeployFunction } from 'hardhat-deploy/types';

const deployModular: DeployFunction = async function (
hre: HardhatRuntimeEnvironment
) {
const { deployments, getNamedAccounts } = hre;
const { deploy, execute, read } = deployments;
const { from } = await getNamedAccounts();
const ENTRYPOINT_07 = '0x0000000071727De22E5E9d8BAf0edAc6f37da032';

console.log('starting deployments...');

console.log('deploying ModularEtherspotWallet...');
const implementation = await deploy('ModularEtherspotWallet', {
from,
args: [],
gasLimit: 6e6,
log: true,
});
console.log(`ModularEtherspotWallet deployed at: ${implementation.address}`);

// Wait for 5 blocks
let currentBlock = await hre.ethers.provider.getBlockNumber();
while (currentBlock + 5 > (await hre.ethers.provider.getBlockNumber())) {}

console.log('deploying ModularEtherspotWalletFactory...');
const factory = await deploy('ModularEtherspotWalletFactory', {
from,
args: [implementation.address, from],
log: true,
});
console.log('ModularEtherspotWalletFactory deployed at:', factory.address);

// Wait for 5 blocks
currentBlock = await hre.ethers.provider.getBlockNumber();
while (currentBlock + 5 > (await hre.ethers.provider.getBlockNumber())) {}

// check implementation set correctly
console.log('Checking implementation in ModularEtherspotWalletFactory...');
console.log(
`check implementation matches: ${await read(
'ModularEtherspotWalletFactory',
'implementation'
)} == ${implementation.address}`
);

// Wait for 5 blocks
currentBlock = await hre.ethers.provider.getBlockNumber();
while (currentBlock + 5 > (await hre.ethers.provider.getBlockNumber())) {}

console.log('deploying Bootstrap...');
const bootstrap = await deploy('Bootstrap', {
from,
args: [],
log: true,
});
console.log('Bootstrap deployed at:', bootstrap.address);

// Wait for 5 blocks
currentBlock = await hre.ethers.provider.getBlockNumber();
while (currentBlock + 5 > (await hre.ethers.provider.getBlockNumber())) {}

console.log('deploying MultipleOwnerECDSAValidator...');
const ecdsaValidator = await deploy('MultipleOwnerECDSAValidator', {
from,
args: [],
log: true,
});
console.log(
'MultipleOwnerECDSAValidator deployed at:',
ecdsaValidator.address
);

// Wait for 5 blocks
currentBlock = await hre.ethers.provider.getBlockNumber();
while (currentBlock + 5 > (await hre.ethers.provider.getBlockNumber())) {}

console.log('deploying ERC20SessionKeyValidator...');
const sessionKeyValidator = await deploy('ERC20SessionKeyValidator', {
from,
args: [],
log: true,
});
console.log(
'ERC20SessionKeyValidator deployed at:',
sessionKeyValidator.address
);

console.log('Staking ModularEtherspotWalletFactory with EntryPoint...');
await execute(
'ModularEtherspotWalletFactory',
{
from,
value: await ethers.utils.parseEther('0.1'),
log: true,
gasLimit: 6e6,
},
'addStake',
ENTRYPOINT_07,
86400
);

console.log(`Done!`);
};

deployModular.tags = ['deploy-modular'];

export default deployModular;
57 changes: 57 additions & 0 deletions deploy/013_verify_modular.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { DeployFunction } from 'hardhat-deploy/types';

const verifyModular: DeployFunction = async function (
hre: HardhatRuntimeEnvironment
) {
const { getNamedAccounts } = hre;
const { from } = await getNamedAccounts();

const FACTORY_ADDRESS = '0x5952653F151e844346825050d7157A9a6b46A23A';
const IMPLEMENTATION_ADDRESS = '0x9A54329dCEc6b961F788bE5017110ac30c76b107';
const BOOTSTRAP_ADDRESS = '0x805650ce74561C85baA44a8Bd13E19633Fd0F79d';
const ECDSA_VALIDATOR_ADDRESS = '0x68BA597bf6B9097b1D89b8E0D34646D30997f773';
const SESSION_KEY_VALIDATOR_ADDRESS =
'0x4ebd86AAF89151b5303DB072e0205C668e31E5E7';

console.log('starting verification...');

await hre.run('verify:verify', {
address: FACTORY_ADDRESS,
contract:
'src/modular-etherspot-wallet/wallet/ModularEtherspotWalletFactory.sol:ModularEtherspotWalletFactory',
constructorArguments: [IMPLEMENTATION_ADDRESS, from],
});

await hre.run('verify:verify', {
address: IMPLEMENTATION_ADDRESS,
contract:
'src/modular-etherspot-wallet/wallet/ModularEtherspotWallet.sol:ModularEtherspotWallet',
constructorArguments: [],
});

await hre.run('verify:verify', {
address: BOOTSTRAP_ADDRESS,
contract:
'src/modular-etherspot-wallet/erc7579-ref-impl/utils/Bootstrap.sol:Bootstrap',
constructorArguments: [],
});

await hre.run('verify:verify', {
address: ECDSA_VALIDATOR_ADDRESS,
contract:
'src/modular-etherspot-wallet/modules/validators/MultipleOwnerECDSAValidator.sol:MultipleOwnerECDSAValidator',
constructorArguments: [],
});

await hre.run('verify:verify', {
address: SESSION_KEY_VALIDATOR_ADDRESS,
contract:
'src/modular-etherspot-wallet/modules/validators/ERC20SessionKeyValidator.sol:ERC20SessionKeyValidator',
constructorArguments: [],
});
};

verifyModular.tags = ['verify-modular'];

export default verifyModular;
Loading

0 comments on commit fe8aa6d

Please sign in to comment.