Skip to content
Open
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
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,25 @@ You could run the following command to generate gas report automatically.

<!-- begin PayGasX -->

| Chain | MaskToken | EntryPoint | DepositPaymaster | VerifyingPaymaster | WalletLogic | PresetFactory |
| ------------ | ------------------------------- | ------------------------------- | -------------------------------- | -------------------------------- | ------------------------------- | ------------------------------- |
| matic_mumbai | [`0xF8935Df6`][mt-matic_mumbai] | [`0x8A42F700`][ep-matic_mumbai] | [`0x808c7f48`][dpm-matic_mumbai] | [`0xB349AC5E`][vpm-matic_mumbai] | [`0x0912FD4D`][wl-matic_mumbai] | [`0x72C51052`][pf-matic_mumbai] |
| matic | [`0x2b9e7ccd`][mt-matic] | [`0x43B87595`][ep-matic] | [`0x5592E365`][dpm-matic] | [`0x540dcAc6`][vpm-matic] | [`0xE74351cA`][wl-matic] | [`0xd57E8156`][pf-matic] |
| Chain | MaskToken | EntryPoint | DepositPaymaster | VerifyingPaymaster | WalletLogic | PresetFactory | NativeTokenPaymaster |
| ------------ | ------------------------------- | ------------------------------- | -------------------------------- | -------------------------------- | ------------------------------- | ------------------------------- | -------------------------------- |
| matic_mumbai | [`0xF8935Df6`][mt-matic_mumbai] | [`0x8A42F700`][ep-matic_mumbai] | [`0x808c7f48`][dpm-matic_mumbai] | [`0xB349AC5E`][vpm-matic_mumbai] | [`0x1324ee1F`][wl-matic_mumbai] | [`0xd7E46dEA`][pf-matic_mumbai] | [`0x8C2306B8`][ntp-matic_mumbai] |
| matic | [`0x2b9e7ccd`][mt-matic] | [`0x43B87595`][ep-matic] | [`0x46a47fEf`][dpm-matic] | [`0x540dcAc6`][vpm-matic] | [`0xa835e7eb`][wl-matic] | [`0xce822a59`][pf-matic] | [`0x0B81e2d6`][ntp-matic] |

[mt-matic_mumbai]: https://mumbai.polygonscan.com/address/0xF8935Df67cAB7BfcA9532D1Ac2088C5c39b995b5
[mt-matic]: https://polygonscan.com/address/0x2b9e7ccdf0f4e5b24757c1e1a80e311e34cb10c7
[ep-matic_mumbai]: https://mumbai.polygonscan.com/address/0x8A42F70047a99298822dD1dbA34b454fc49913F2
[ep-matic]: https://polygonscan.com/address/0x43B87595F319B17F3386Ac244A00944B3f5A532A
[dpm-matic_mumbai]: https://mumbai.polygonscan.com/address/0x808c7f48a64404e4e97d9b62b21f13F984fF1a96
[dpm-matic]: https://polygonscan.com/address/0x5592E365EA2998721b9301eDB26F883CC08EE690
[dpm-matic]: https://polygonscan.com/address/0x46a47fEf332FBB124D8197afFED5994D89B6BF71
[vpm-matic_mumbai]: https://mumbai.polygonscan.com/address/0xB349AC5E5C037C2ecb2AE9fCDc8F122b5f384620
[vpm-matic]: https://polygonscan.com/address/0x540dcAc69cfFD35e2afDDdf610Ba8E7b2A917E6E
[wl-matic_mumbai]: https://mumbai.polygonscan.com/address/0x0912FD4D5bA43C5583B1796bb17586080cb117D3
[wl-matic]: https://polygonscan.com/address/0xE74351cA4d11659Be8Fab0054d14f6a417a25703
[pf-matic_mumbai]: https://mumbai.polygonscan.com/address/0x72C510523797653d286fD268e06226C5a1F1051b
[pf-matic]: https://polygonscan.com/address/0xd57E81560615E55f4Cd1A35d5676b25EC1b27359
[wl-matic_mumbai]: https://mumbai.polygonscan.com/address/0x1324ee1F3E982FD66579e2320c060B4e5f71579a
[wl-matic]: https://polygonscan.com/address/0xa835e7ebe39107907d7f58d459945979f86a34ad
[pf-matic_mumbai]: https://mumbai.polygonscan.com/address/0xd7E46dEAF827c0023284407e9f1bb1FA27Bf8447
[pf-matic]: https://polygonscan.com/address/0xce822a5904ef877caf11aaa02ccf4ab13f18dfb6
[ntp-matic_mumbai]: https://mumbai.polygonscan.com/address/0x8C2306B8C31c7eC78078e1C5C53dE6fee1627BF7
[ntp-matic]: https://polygonscan.com/address/0x0B81e2d66F6c52AaAEa836240f63e1b43643B5f9

<!-- end PayGasX -->

Expand Down
6 changes: 3 additions & 3 deletions contract-addresses.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Chain,MaskToken,EntryPoint,DepositPaymaster,VerifyingPaymaster,WalletLogic,PresetFactory
matic_mumbai,0xF8935Df67cAB7BfcA9532D1Ac2088C5c39b995b5,0x8A42F70047a99298822dD1dbA34b454fc49913F2,0x808c7f48a64404e4e97d9b62b21f13F984fF1a96,0xB349AC5E5C037C2ecb2AE9fCDc8F122b5f384620,0x0912FD4D5bA43C5583B1796bb17586080cb117D3,0x72C510523797653d286fD268e06226C5a1F1051b
matic,0x2b9e7ccdf0f4e5b24757c1e1a80e311e34cb10c7,0x43B87595F319B17F3386Ac244A00944B3f5A532A,0x5592E365EA2998721b9301eDB26F883CC08EE690,0x540dcAc69cfFD35e2afDDdf610Ba8E7b2A917E6E,0xE74351cA4d11659Be8Fab0054d14f6a417a25703,0xd57E81560615E55f4Cd1A35d5676b25EC1b27359
Chain,MaskToken,EntryPoint,DepositPaymaster,VerifyingPaymaster,WalletLogic,PresetFactory,NativeTokenPaymaster
matic_mumbai,0xF8935Df67cAB7BfcA9532D1Ac2088C5c39b995b5,0x8A42F70047a99298822dD1dbA34b454fc49913F2,0x808c7f48a64404e4e97d9b62b21f13F984fF1a96,0xB349AC5E5C037C2ecb2AE9fCDc8F122b5f384620,0x1324ee1F3E982FD66579e2320c060B4e5f71579a,0xd7E46dEAF827c0023284407e9f1bb1FA27Bf8447,0x8C2306B8C31c7eC78078e1C5C53dE6fee1627BF7
matic,0x2b9e7ccdf0f4e5b24757c1e1a80e311e34cb10c7,0x43B87595F319B17F3386Ac244A00944B3f5A532A,0x46a47fEf332FBB124D8197afFED5994D89B6BF71,0x540dcAc69cfFD35e2afDDdf610Ba8E7b2A917E6E,0xa835e7ebe39107907d7f58d459945979f86a34ad,0xce822a5904ef877caf11aaa02ccf4ab13f18dfb6,0x0B81e2d66F6c52AaAEa836240f63e1b43643B5f9
42 changes: 36 additions & 6 deletions deploy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async function main() {
console.log("Account balance:", (await deployer.getBalance()).toString());

// deploy fake mask token (only testnet)
let maskTokenAddress;
let maskTokenAddress = "0x2b9e7ccdf0f4e5b24757c1e1a80e311e34cb10c7";
if (!maskTokenAddress) {
const MaskTokenFactory = await ethers.getContractFactory("MaskToken");
const maskToken = await MaskTokenFactory.deploy();
Expand All @@ -21,7 +21,7 @@ async function main() {
}

// deploy entry point with create2 factory
let entryPointAddress;
let entryPointAddress = "0x43B87595F319B17F3386Ac244A00944B3f5A532A";
if (!entryPointAddress) {
const EntryPointFactory = await ethers.getContractFactory("EntryPoint");
const entryPoint = await EntryPointFactory.deploy(Create2Factory, ethers.utils.parseEther("0.01"), 60);
Expand All @@ -33,7 +33,7 @@ async function main() {
}

// deploy deposit paymaster
let depositPaymasterAddress;
let depositPaymasterAddress = "0x46a47fEf332FBB124D8197afFED5994D89B6BF71";
if (!depositPaymasterAddress) {
const DepositPaymasterFactory = await ethers.getContractFactory("DepositPaymaster");
const depositPaymaster = await DepositPaymasterFactory.deploy(entryPointAddress, maskTokenAddress);
Expand All @@ -44,16 +44,29 @@ async function main() {
depositPaymasterAddress = depositPaymaster.address;
}

let nativeTokenPaymasterAddress = "0x0B81e2d66F6c52AaAEa836240f63e1b43643B5f9";
if (!nativeTokenPaymasterAddress) {
const NativeTokenPaymasterFactory = await ethers.getContractFactory("NativeTokenPaymaster");
const nativeTokenPaymaster = await NativeTokenPaymasterFactory.deploy(entryPointAddress);

await nativeTokenPaymaster.deployed();
console.log("nativeTokenPaymaster address:", nativeTokenPaymaster.address);

nativeTokenPaymasterAddress = nativeTokenPaymaster.address;
}

//deploy presetFactory
let presetFactoryAddress;
let presetFactoryAddress = "0xce822a5904ef877caf11aaa02ccf4ab13f18dfb6";
if (!presetFactoryAddress) {
const PresetFactoryFactory = await ethers.getContractFactory("PresetFactory");
const presetFactory = await PresetFactoryFactory.deploy(
depositPaymasterAddress,
nativeTokenPaymasterAddress,
deployer.address,
maskTokenAddress,
ethers.utils.parseEther("1"),
ethers.utils.parseEther("1"),
ethers.utils.parseEther("1"),
);
await presetFactory.deployed();
console.log("presetFactory address:", presetFactory.address);
Expand All @@ -65,10 +78,16 @@ async function main() {
await ethers.getContractFactory("DepositPaymaster")
).attach(depositPaymasterAddress);
await depositPaymaster.connect(deployer).adjustAdmin(presetFactoryAddress, true);

// give admin permission to native token paymaster
const nativeTokenPaymaster = await (
await ethers.getContractFactory("NativeTokenPaymaster")
).attach(nativeTokenPaymasterAddress);
await nativeTokenPaymaster.connect(deployer).adjustAdmin(presetFactoryAddress, true);
}

// deploy verify paymaster
let verifyPaymasterAddress;
let verifyPaymasterAddress = "0x540dcAc69cfFD35e2afDDdf610Ba8E7b2A917E6E";
if (!verifyPaymasterAddress) {
const VerifyingPaymasterFactory = await ethers.getContractFactory("VerifyingPaymaster");
const verifyingPaymaster = await VerifyingPaymasterFactory.deploy(
Expand All @@ -85,7 +104,7 @@ async function main() {
}

// deploy wallet logic contract
let walletLogicAddress;
let walletLogicAddress = "0xa835e7ebe39107907d7f58d459945979f86a34ad";
if (!walletLogicAddress) {
const WalletLogicFactory = await ethers.getContractFactory("SimpleWalletUpgradeable");
const walletLogic = await WalletLogicFactory.deploy();
Expand All @@ -95,6 +114,17 @@ async function main() {

walletLogicAddress = walletLogic.address;
}

const entryPoint = await (await ethers.getContractFactory("EntryPoint")).attach(entryPointAddress);
const depositPaymaster = await (await ethers.getContractFactory("DepositPaymaster")).attach(depositPaymasterAddress);
await depositPaymaster.addStake(0, { value: ethers.utils.parseEther("1") });
await entryPoint.depositTo(depositPaymaster.address, { value: ethers.utils.parseEther("1") });

const nativeTokenPaymaster = await (
await ethers.getContractFactory("NativeTokenPaymaster")
).attach(nativeTokenPaymasterAddress);
await nativeTokenPaymaster.addStake(0, { value: ethers.utils.parseEther("1") });
await entryPoint.depositTo(nativeTokenPaymaster.address, { value: ethers.utils.parseEther("1") });
}

main()
Expand Down
9 changes: 7 additions & 2 deletions generate-readme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type DeployedAddressRow = {
VerifyingPaymaster: string;
WalletLogic: string;
PresetFactory: string;
NativeTokenPaymaster: string;
};

async function main() {
Expand All @@ -32,7 +33,7 @@ async function main() {
main();

function* makeTable(rows: DeployedAddressRow[]) {
yield "| Chain | MaskToken | EntryPoint | DepositPaymaster | VerifyingPaymaster | WalletLogic | PresetFactory |";
yield "| Chain | MaskToken | EntryPoint | DepositPaymaster | VerifyingPaymaster | WalletLogic | PresetFactory | NativeTokenPaymaster |";
yield "| - | - | - | - | - | - | - |";
for (const {
Chain,
Expand All @@ -42,14 +43,16 @@ function* makeTable(rows: DeployedAddressRow[]) {
VerifyingPaymaster,
WalletLogic,
PresetFactory,
NativeTokenPaymaster,
} of rows) {
const mtElement = formElement(MaskToken, `mt-${Chain}`);
const epElement = formElement(EntryPoint, `ep-${Chain}`);
const dpmElement = formElement(DepositPaymaster, `dpm-${Chain}`);
const vpmElement = formElement(VerifyingPaymaster, `vpm-${Chain}`);
const wtElement = formElement(WalletLogic, `wl-${Chain}`);
const pfElement = formElement(PresetFactory, `pf-${Chain}`);
yield `| ${Chain} | ${mtElement} | ${epElement} | ${dpmElement} | ${vpmElement} | ${wtElement} | ${pfElement} |`;
const ntpElement = formElement(NativeTokenPaymaster, `ntp-${Chain}`);
yield `| ${Chain} | ${mtElement} | ${epElement} | ${dpmElement} | ${vpmElement} | ${wtElement} | ${pfElement} | ${ntpElement} |`;
}
yield "";
yield* rows.map(({ Chain, MaskToken }) => formLink(MaskToken, Chain, "mt"));
Expand All @@ -58,6 +61,7 @@ function* makeTable(rows: DeployedAddressRow[]) {
yield* rows.map(({ Chain, VerifyingPaymaster }) => formLink(VerifyingPaymaster, Chain, "vpm"));
yield* rows.map(({ Chain, WalletLogic }) => formLink(WalletLogic, Chain, "wl"));
yield* rows.map(({ Chain, PresetFactory }) => formLink(PresetFactory, Chain, "pf"));
yield* rows.map(({ Chain, NativeTokenPaymaster }) => formLink(NativeTokenPaymaster, Chain, "ntp"));
}

async function loadDeployedAddressRows(): Promise<DeployedAddressRow[]> {
Expand All @@ -70,6 +74,7 @@ async function loadDeployedAddressRows(): Promise<DeployedAddressRow[]> {
"VerifyingPaymaster",
"WalletLogic",
"PresetFactory",
"NativeTokenPaymaster",
];
return parse(data, { delimiter: ",", columns, from: 2 });
}
Expand Down