Skip to content

Commit

Permalink
- Added scripts, FactoryStaker.sol and deployed and staked new factories
Browse files Browse the repository at this point in the history
- Created scripts for deploying ModularEtherspotWalletFactory solely, staking, unlocking and withdrawing stake from EntryPoint.
- Created ethers script for deploying ModularEtherspotWalletFactory and staking it with EntryPoint (for XDC).
- Updated typings.
- Added FactoryStaker contract for importing to ModularEtherspotWalletFactory (allows staking functionality for wallet factory).
- Added network configs for XDC.
- Deployed new factory to all chains.
  • Loading branch information
cryptonoyaiba committed Aug 5, 2024
1 parent c7c519e commit d40c857
Show file tree
Hide file tree
Showing 54 changed files with 4,221 additions and 76 deletions.
173 changes: 165 additions & 8 deletions DEPLOYMENTS_MODULAR.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../build-info/7810ea4a0b1001fe4f85cee7595e8e6b.json"
"buildInfo": "../../../../build-info/47dc323db6fafbe3d93a9be5111ed9f5.json"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../build-info/7810ea4a0b1001fe4f85cee7595e8e6b.json"
"buildInfo": "../../../../build-info/47dc323db6fafbe3d93a9be5111ed9f5.json"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../../build-info/7810ea4a0b1001fe4f85cee7595e8e6b.json"
"buildInfo": "../../../../../build-info/47dc323db6fafbe3d93a9be5111ed9f5.json"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../../build-info/7810ea4a0b1001fe4f85cee7595e8e6b.json"
"buildInfo": "../../../../../build-info/47dc323db6fafbe3d93a9be5111ed9f5.json"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../../build-info/7810ea4a0b1001fe4f85cee7595e8e6b.json"
"buildInfo": "../../../../../build-info/47dc323db6fafbe3d93a9be5111ed9f5.json"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../build-info/7810ea4a0b1001fe4f85cee7595e8e6b.json"
"buildInfo": "../../../../build-info/47dc323db6fafbe3d93a9be5111ed9f5.json"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../build-info/7810ea4a0b1001fe4f85cee7595e8e6b.json"
"buildInfo": "../../../../build-info/47dc323db6fafbe3d93a9be5111ed9f5.json"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../build-info/7810ea4a0b1001fe4f85cee7595e8e6b.json"
"buildInfo": "../../../../build-info/47dc323db6fafbe3d93a9be5111ed9f5.json"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../build-info/7810ea4a0b1001fe4f85cee7595e8e6b.json"
"buildInfo": "../../../../build-info/47dc323db6fafbe3d93a9be5111ed9f5.json"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../../build-info/7810ea4a0b1001fe4f85cee7595e8e6b.json"
"buildInfo": "../../../../../build-info/47dc323db6fafbe3d93a9be5111ed9f5.json"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../../build-info/7810ea4a0b1001fe4f85cee7595e8e6b.json"
"buildInfo": "../../../../../build-info/47dc323db6fafbe3d93a9be5111ed9f5.json"
}
5 changes: 5 additions & 0 deletions config/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ const networks: HardhatUserConfig['networks'] = {
url: 'https://rpc.apothem.network',
accounts: [process.env.DEPLOYER_PRIVATE_KEY!],
},
xdc: {
chainId: 50,
url: 'https://rpc.xdc.org',
accounts: [process.env.DEPLOYER_PRIVATE_KEY!],
},
dev: { url: 'http://localhost:8545' },
};
export default networks;
64 changes: 64 additions & 0 deletions deploy/012_deploy_modular_factory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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';
const IMPLEMENTATION = '0x202A5598bDba2cE62bFfA13EcccB04969719Fad9';

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

// 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, 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}`
);

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

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;
1 change: 1 addition & 0 deletions deployments/xdc/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
50
Loading

0 comments on commit d40c857

Please sign in to comment.