Skip to content

Commit

Permalink
Zk era triage (#105)
Browse files Browse the repository at this point in the history
* working on zk deploy

* add zk specific file

* experimental but working program factory

* chore: add new factory contract

* update script

* update script

* fix

* fix sscript

* update

* fix

* remove era

* mainnet deploys

---------

Co-authored-by: 0xKurt <[email protected]>
Co-authored-by: Aditya Anand M C <[email protected]>
  • Loading branch information
3 people authored Dec 11, 2023
1 parent 005b7cf commit 1e60af9
Show file tree
Hide file tree
Showing 23 changed files with 13,863 additions and 520 deletions.
22 changes: 7 additions & 15 deletions .upgradable/zkSync-era.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"manifestVersion": "3.2",
"admin": {
"address": "0x8eDFBfcf436b098C7B25a7D11a0F60e1A811f70c",
"txHash": "0x1e8355ff9eb85d9153b0e49212e06f5e41ba60f8d85c7d86f540e3256bb7fbd7"
"address": "0xA32A2e8c77b3ad879a837B4766ceE247FBf6E8df",
"txHash": "0xf225962c1a46413a859e998ab7cf39e4341c687e68873a931b90ca93d1739b0b"
},
"proxies": [
{
"address": "0xe1b01395986bd93Cc9Fa62290987793c150a1AB2",
"txHash": "0xc341422ed8f683e51968fc9086293b7611bdc3ad944eedc167bc16110754ee6b",
"address": "0x68a14AF71BFa0FE09fC937033f6Ea5153c0e75e4",
"txHash": "0x18721cdf4951898fe6c09f887df1aad2dbebba64b37db4bfce86a357fdf130a9",
"kind": "transparent"
}
],
"impls": {
"aae8603567b3768ea2e8f5334c65ad0ba5e1fbeee71f3d4bcd0469994e306fac": {
"address": "0xF4f71847Dbc541841D1Bf4B07AF7B47584a3dca8",
"txHash": "0x0b912b539f4fa4266b4b5a36f2accdc2eab11d5a41a82d28dec0dd4e42ba321e",
"b33f2f469bdc249af48debe29884079de44f3404c42fc09a338852a54364caf8": {
"address": "0x993abb247BAA8b450BD88Ab212F3F3f9D05BdAE8",
"txHash": "0x917f8a956607495331595d468cff6e344fda07b70da3a3aa6fe42a75275eced1",
"layout": {
"solcVersion": "0.8.17",
"storage": [
Expand Down Expand Up @@ -58,14 +58,6 @@
"type": "t_array(t_uint256)49_storage",
"contract": "OwnableUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94"
},
{
"label": "programContract",
"offset": 0,
"slot": "101",
"type": "t_address",
"contract": "ProgramFactory",
"src": "contracts/program/ProgramFactory.sol:12"
}
],
"types": {
Expand Down
164 changes: 11 additions & 153 deletions .upgradable/zkSync-testnet.json
Original file line number Diff line number Diff line change
@@ -1,80 +1,30 @@
{
"manifestVersion": "3.2",
"admin": {
"address": "0x08Bfe6ec7831d4bbd48873fCDc89Ef3d2d8c2C4E",
"txHash": "0xc8fd90d2056a2a0eda2d5a42b8d9e267de1f0d199b77cb54899511a8eb1ece1e"
"address": "0x03f2d2fFd7D6192Bf3248aF454c233303D6791a4",
"txHash": "0xbaa8b461558d2e3fa7c6dd9ab6cbc65a7643590953a9ca63d787710cd848884f"
},
"proxies": [
{
"address": "0xa1F116d1Cb73b6f8dDFD6DDD6E06386553B3af7b",
"txHash": "0xc572446d3cd6f1572a0b5c9dceb9daa20a3e063ee28bdeda0ade70140d92ddde",
"address": "0xA1d9DFbBD7CF30dE70E22e23245fc5849d661DfB",
"txHash": "0x5883b72662b2410f79e8c364040226f2a320a2e2190486ebf12ecfe3df4d45fe",
"kind": "transparent"
},
{
"address": "0xE3710C11A5E06E987657A8ce665961362C079De3",
"txHash": "0xb6739e415c7fd98cfc5c3f6b41e893e54f23f84534e7651892b9863dcabac53f",
"address": "0xeC48DFcC3e5A9594229B5e2900b5b1De29f15F8D",
"txHash": "0xe8e374458c8afc4a768f9bd552970446c1811cbf88ff77a8793abeecee5e9748",
"kind": "transparent"
},
{
"address": "0x5A7ea8C03C40e02A97B1901101e415Fdfc1aE64d",
"txHash": "0x0fd3091cc55805c3ebcc53b8473c4fcf5ec819a33c32519c32f2eb8b46075d92",
"kind": "transparent"
},
{
"address": "0xA86824AB3038daCfeB61e03f45CA1a02b77f1081",
"txHash": "0x15af4956d88aadd4b55122e106b57a027678a02a1c5c1ad8004232d3ddc50103",
"kind": "transparent"
},
{
"address": "0x590638033E8DeE4028244326c1ecA251c8022346",
"txHash": "0xbeb232d9192ed76cd374e6456340e18127c8974864f6a19794ea8fbdc025241d",
"kind": "transparent"
},
{
"address": "0x7f5D2e3aC29265a7E09A642b7e22421dc0Cd4075",
"txHash": "0x3bebfdfd92233167573dc15a414d5e501cf184bb3e93983ea9854435dcf39a52",
"kind": "transparent"
},
{
"address": "0x1a7f5eB2632A0DACA98a1CC5091887C1f4F5Fc0c",
"txHash": "0xf4d04a7d773c3b4c49867616e2984a71d479c5ff89a6a8412e48d95bee1ba124",
"kind": "transparent"
},
{
"address": "0x9c0f0600BF83d08EFfb1B8ff90c71B57c68c3B15",
"txHash": "0xfe8e573712e5dc4dcf191fdf94987fdede1c92a66e0a731fb4450e25c7524f9d",
"kind": "transparent"
},
{
"address": "0x8A777C2f88BCEF9ECC2F4B1f70E0262718D130e5",
"txHash": "0x0bf3a3bac8c59d735d9170bfec4945d392b6664b2982aa82bcf9f10611be3c1d",
"kind": "transparent"
},
{
"address": "0x993abb247BAA8b450BD88Ab212F3F3f9D05BdAE8",
"txHash": "0x3eac4aac5a303bdb8c015a86b0cbaacccb838148d44e6a97eca53b174b424b01",
"kind": "transparent"
},
{
"address": "0x1c58945a9A61a3390c56a24d42fEab7106E48d03",
"txHash": "0x339de88c0a2f73cdbf38d88978a92c8a02d987579ff43c0d86f43e412f0e51b7",
"kind": "transparent"
},
{
"address": "0x24076909f4ecDCAe328392E6ae077090101c48Cd",
"txHash": "0xc664f6b27aa229fb3c728a45bf60304c7be8dea501e90a211eb7f324595d26e0",
"kind": "transparent"
},
{
"address": "0x733847d96870f2Fa4789C4C8b6e78345F53919e2",
"txHash": "0xd9efd848d7c6846621647ed21373c6787f1a337a29c18c6e2f741ab9a2a77b17",
"address": "0x6D341814Be4E2316142D9190E390b494F1dECFAf",
"txHash": "0x2441ec92e3f78064ebb95a71231f9a2159a847515b503075a453d051036d1d63",
"kind": "transparent"
}
],
"impls": {
"aae8603567b3768ea2e8f5334c65ad0ba5e1fbeee71f3d4bcd0469994e306fac": {
"address": "0xe1b01395986bd93Cc9Fa62290987793c150a1AB2",
"txHash": "0x6dc73c9b6376fd03bbed6936807c015cd5c92162bf241c316ce495575f7a190f",
"b33f2f469bdc249af48debe29884079de44f3404c42fc09a338852a54364caf8": {
"address": "0x6A75d630f88647AB36869aba70947a9fE832706C",
"txHash": "0xf73afb16e8a6874a43638001d2ad58e70abd37312dba741a3071c3f39a246de4",
"layout": {
"solcVersion": "0.8.17",
"storage": [
Expand Down Expand Up @@ -118,98 +68,6 @@
"type": "t_array(t_uint256)49_storage",
"contract": "OwnableUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94"
},
{
"label": "programContract",
"offset": 0,
"slot": "101",
"type": "t_address",
"contract": "ProgramFactory",
"src": "contracts/program/ProgramFactory.sol:12"
}
],
"types": {
"t_address": {
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]",
"numberOfBytes": "1568"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]",
"numberOfBytes": "1600"
},
"t_bool": {
"label": "bool",
"numberOfBytes": "1"
},
"t_uint256": {
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint8": {
"label": "uint8",
"numberOfBytes": "1"
}
}
}
},
"3b918698381d5ee133f52f5b18e939c12b5fb00a8ad271c2406bffbb4f7deac5": {
"address": "0xF631C72e0C5837b794911DDaf167861d1A3eDBf5",
"txHash": "0x536fe1114745a4eaf02b3b8414aa130d3968202b4b179b30c040f57fb6a3f7f5",
"layout": {
"solcVersion": "0.8.17",
"storage": [
{
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62",
"retypedFrom": "bool"
},
{
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67"
},
{
"label": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage",
"contract": "ContextUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36"
},
{
"label": "_owner",
"offset": 0,
"slot": "51",
"type": "t_address",
"contract": "OwnableUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22"
},
{
"label": "__gap",
"offset": 0,
"slot": "52",
"type": "t_array(t_uint256)49_storage",
"contract": "OwnableUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:87"
},
{
"label": "programContract",
"offset": 0,
"slot": "101",
"type": "t_address",
"contract": "ProgramFactory",
"src": "contracts/program/ProgramFactory.sol:12"
}
],
"types": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;

import "./DirectPayoutStrategyImplementation.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

import "../../utils/MetaPtr.sol";

contract DirectPayoutStrategyFactoryZk is OwnableUpgradeable {

// --- Event ---

/// @notice Emitted when a new payout contract is created
event PayoutContractCreated(
address indexed payoutContractAddress,
address indexed payoutImplementation
);

/// @notice constructor function which ensure deployer is set as owner
function initialize() external initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}

// --- Core methods ---

/**
* @notice Clones DirectPayoutStrategyImplementation and deploys a contract
* and emits an event
*/
function create() external returns (address) {

address impl = address(new DirectPayoutStrategyImplementation());
DirectPayoutStrategyImplementation(payable(impl)).initialize();
emit PayoutContractCreated(impl, address(0));

return impl;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;

import "./MerklePayoutStrategyImplementation.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "../../utils/MetaPtr.sol";

contract MerklePayoutStrategyFactoryZk is OwnableUpgradeable {

// --- Event ---

/// @notice Emitted when a new payout contract is created
event PayoutContractCreated(
address indexed payoutContractAddress,
address indexed payoutImplementation
);

/// @notice constructor function which ensure deployer is set as owner
function initialize() external initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}

// --- Core methods ---

/**
* @notice Clones MerklePayoutStrategyImplementation and deploys a contract
* and emits an event
*/
function create(
) external returns (address) {

address impl = address(new MerklePayoutStrategyImplementation());
MerklePayoutStrategyImplementation(payable(impl)).initialize();
emit PayoutContractCreated(impl, address(0));

return impl;
}

}
37 changes: 37 additions & 0 deletions contracts/program/ProgramFactoryZK.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./ProgramImplementation.sol";

contract ProgramFactoryZk is OwnableUpgradeable {

// --- Event ---

/// @notice Emitted when a new Program is created
event ProgramCreated(address indexed programContractAddress, address indexed programImplementation);

/// @notice constructor function which ensure deployer is set as owner
function initialize() external initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}

// --- Core methods ---

/**
* @notice Clones ProgramImplmentation and deployed a program and emits an event
*
* @param encodedParameters Encoded parameters for creating a program
*/
function create(
bytes calldata encodedParameters
) external returns (address) {

address impl = address(new ProgramImplementation());
emit ProgramCreated(impl, address(0));
ProgramImplementation(impl).initialize(encodedParameters);

return impl;
}
}
Loading

0 comments on commit 1e60af9

Please sign in to comment.