Skip to content

Commit

Permalink
add back broadcast files and fix stack too deep in deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
fangting-alchemy committed Nov 22, 2023
1 parent d933de5 commit 89572f3
Show file tree
Hide file tree
Showing 8 changed files with 982 additions and 37 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ report/
lcov.info

# secret
.env

# deployment
broadcast/
.env
217 changes: 217 additions & 0 deletions broadcast/Deploy.s.sol/11155111/run-1700676223.json

Large diffs are not rendered by default.

444 changes: 444 additions & 0 deletions broadcast/Deploy.s.sol/11155111/run-1700676229.json

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions broadcast/Deploy.s.sol/11155111/run-1700676621.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"transactions": [
{
"hash": "0x1cb319cb522dc9657527409126a2b8d612628b853d89e35c218391e3f7cb2171",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0xFD14c78640d72f73CC88238E2f7Df3273Ee84043",
"function": null,
"arguments": null,
"transaction": {
"type": "0x02",
"from": "0x7f89ed1f3f0d52d303904101305471bca3cde710",
"to": "0xfd14c78640d72f73cc88238e2f7df3273ee84043",
"gas": "0xefd8",
"value": "0xde0b6b3a763ffff",
"data": "0xfbb1c3d400000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000de0b6b3a763ffff",
"nonce": "0x50",
"accessList": []
},
"additionalContracts": [],
"isFixedGasLimit": false
},
{
"hash": "0x286fc67e8439e61fac68ba4fd32339f99031f95cbc4715bcc784df116f7e6f2d",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0x22322E35c1850F26DD54Ed8F59a27C1c79847A15",
"function": null,
"arguments": null,
"transaction": {
"type": "0x02",
"from": "0x7f89ed1f3f0d52d303904101305471bca3cde710",
"to": "0x22322e35c1850f26dd54ed8f59a27c1c79847a15",
"gas": "0xfe14",
"value": "0xde0b6b3a763ffff",
"data": "0xfbb1c3d400000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000de0b6b3a763ffff",
"nonce": "0x51",
"accessList": []
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [],
"libraries": [],
"pending": [
"0x1cb319cb522dc9657527409126a2b8d612628b853d89e35c218391e3f7cb2171",
"0x286fc67e8439e61fac68ba4fd32339f99031f95cbc4715bcc784df116f7e6f2d"
],
"returns": {},
"timestamp": 1700676621,
"chain": 11155111,
"multi": false,
"commit": "1ff992b"
}
115 changes: 115 additions & 0 deletions broadcast/Deploy.s.sol/11155111/run-1700676627.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"transactions": [
{
"hash": "0x1cb319cb522dc9657527409126a2b8d612628b853d89e35c218391e3f7cb2171",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0xFD14c78640d72f73CC88238E2f7Df3273Ee84043",
"function": null,
"arguments": null,
"transaction": {
"type": "0x02",
"from": "0x7f89ed1f3f0d52d303904101305471bca3cde710",
"to": "0xfd14c78640d72f73cc88238e2f7df3273ee84043",
"gas": "0xefd8",
"value": "0xde0b6b3a763ffff",
"data": "0xfbb1c3d400000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000de0b6b3a763ffff",
"nonce": "0x50",
"accessList": []
},
"additionalContracts": [],
"isFixedGasLimit": false
},
{
"hash": "0x286fc67e8439e61fac68ba4fd32339f99031f95cbc4715bcc784df116f7e6f2d",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0x22322E35c1850F26DD54Ed8F59a27C1c79847A15",
"function": null,
"arguments": null,
"transaction": {
"type": "0x02",
"from": "0x7f89ed1f3f0d52d303904101305471bca3cde710",
"to": "0x22322e35c1850f26dd54ed8f59a27c1c79847a15",
"gas": "0xfe14",
"value": "0xde0b6b3a763ffff",
"data": "0xfbb1c3d400000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000de0b6b3a763ffff",
"nonce": "0x51",
"accessList": []
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [
{
"transactionHash": "0x1cb319cb522dc9657527409126a2b8d612628b853d89e35c218391e3f7cb2171",
"transactionIndex": "0xa",
"blockHash": "0xd92d201f912d4a79c1aad303379572ef0adb9cfeae102d299cf08a1331bdd2af",
"blockNumber": "0x486946",
"from": "0x7f89Ed1F3F0d52d303904101305471bca3cde710",
"to": "0xFD14c78640d72f73CC88238E2f7Df3273Ee84043",
"cumulativeGasUsed": "0x88d3a",
"gasUsed": "0xada5",
"contractAddress": null,
"logs": [
{
"address": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
"topics": [
"0xa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01",
"0x000000000000000000000000fd14c78640d72f73cc88238e2f7df3273ee84043"
],
"data": "0x0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000015180",
"blockHash": "0xd92d201f912d4a79c1aad303379572ef0adb9cfeae102d299cf08a1331bdd2af",
"blockNumber": "0x486946",
"transactionHash": "0x1cb319cb522dc9657527409126a2b8d612628b853d89e35c218391e3f7cb2171",
"transactionIndex": "0xa",
"logIndex": "0x3",
"removed": false
}
],
"status": "0x1",
"logsBloom": "0x00000000000000000000000000000000000000040000000000000000000000000000000000000000000200000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000100000000200000000000000000000000000200000000000000000000000000",
"type": "0x2",
"effectiveGasPrice": "0xb6d6ad31"
},
{
"transactionHash": "0x286fc67e8439e61fac68ba4fd32339f99031f95cbc4715bcc784df116f7e6f2d",
"transactionIndex": "0xb",
"blockHash": "0xd92d201f912d4a79c1aad303379572ef0adb9cfeae102d299cf08a1331bdd2af",
"blockNumber": "0x486946",
"from": "0x7f89Ed1F3F0d52d303904101305471bca3cde710",
"to": "0x22322E35c1850F26DD54Ed8F59a27C1c79847A15",
"cumulativeGasUsed": "0x93af5",
"gasUsed": "0xadbb",
"contractAddress": null,
"logs": [
{
"address": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
"topics": [
"0xa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01",
"0x00000000000000000000000022322e35c1850f26dd54ed8f59a27c1c79847a15"
],
"data": "0x0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000015180",
"blockHash": "0xd92d201f912d4a79c1aad303379572ef0adb9cfeae102d299cf08a1331bdd2af",
"blockNumber": "0x486946",
"transactionHash": "0x286fc67e8439e61fac68ba4fd32339f99031f95cbc4715bcc784df116f7e6f2d",
"transactionIndex": "0xb",
"logIndex": "0x4",
"removed": false
}
],
"status": "0x1",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000001000000040000000000000000000000000000100000000000000000000000020000000000200000000000000000000000000",
"type": "0x2",
"effectiveGasPrice": "0xb6d6ad31"
}
],
"libraries": [],
"pending": [],
"returns": {},
"timestamp": 1700676627,
"chain": 11155111,
"multi": false,
"commit": "1ff992b"
}
115 changes: 115 additions & 0 deletions broadcast/Deploy.s.sol/11155111/run-latest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"transactions": [
{
"hash": "0x1cb319cb522dc9657527409126a2b8d612628b853d89e35c218391e3f7cb2171",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0xFD14c78640d72f73CC88238E2f7Df3273Ee84043",
"function": null,
"arguments": null,
"transaction": {
"type": "0x02",
"from": "0x7f89ed1f3f0d52d303904101305471bca3cde710",
"to": "0xfd14c78640d72f73cc88238e2f7df3273ee84043",
"gas": "0xefd8",
"value": "0xde0b6b3a763ffff",
"data": "0xfbb1c3d400000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000de0b6b3a763ffff",
"nonce": "0x50",
"accessList": []
},
"additionalContracts": [],
"isFixedGasLimit": false
},
{
"hash": "0x286fc67e8439e61fac68ba4fd32339f99031f95cbc4715bcc784df116f7e6f2d",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0x22322E35c1850F26DD54Ed8F59a27C1c79847A15",
"function": null,
"arguments": null,
"transaction": {
"type": "0x02",
"from": "0x7f89ed1f3f0d52d303904101305471bca3cde710",
"to": "0x22322e35c1850f26dd54ed8f59a27c1c79847a15",
"gas": "0xfe14",
"value": "0xde0b6b3a763ffff",
"data": "0xfbb1c3d400000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000de0b6b3a763ffff",
"nonce": "0x51",
"accessList": []
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [
{
"transactionHash": "0x1cb319cb522dc9657527409126a2b8d612628b853d89e35c218391e3f7cb2171",
"transactionIndex": "0xa",
"blockHash": "0xd92d201f912d4a79c1aad303379572ef0adb9cfeae102d299cf08a1331bdd2af",
"blockNumber": "0x486946",
"from": "0x7f89Ed1F3F0d52d303904101305471bca3cde710",
"to": "0xFD14c78640d72f73CC88238E2f7Df3273Ee84043",
"cumulativeGasUsed": "0x88d3a",
"gasUsed": "0xada5",
"contractAddress": null,
"logs": [
{
"address": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
"topics": [
"0xa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01",
"0x000000000000000000000000fd14c78640d72f73cc88238e2f7df3273ee84043"
],
"data": "0x0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000015180",
"blockHash": "0xd92d201f912d4a79c1aad303379572ef0adb9cfeae102d299cf08a1331bdd2af",
"blockNumber": "0x486946",
"transactionHash": "0x1cb319cb522dc9657527409126a2b8d612628b853d89e35c218391e3f7cb2171",
"transactionIndex": "0xa",
"logIndex": "0x3",
"removed": false
}
],
"status": "0x1",
"logsBloom": "0x00000000000000000000000000000000000000040000000000000000000000000000000000000000000200000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000100000000200000000000000000000000000200000000000000000000000000",
"type": "0x2",
"effectiveGasPrice": "0xb6d6ad31"
},
{
"transactionHash": "0x286fc67e8439e61fac68ba4fd32339f99031f95cbc4715bcc784df116f7e6f2d",
"transactionIndex": "0xb",
"blockHash": "0xd92d201f912d4a79c1aad303379572ef0adb9cfeae102d299cf08a1331bdd2af",
"blockNumber": "0x486946",
"from": "0x7f89Ed1F3F0d52d303904101305471bca3cde710",
"to": "0x22322E35c1850F26DD54Ed8F59a27C1c79847A15",
"cumulativeGasUsed": "0x93af5",
"gasUsed": "0xadbb",
"contractAddress": null,
"logs": [
{
"address": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
"topics": [
"0xa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01",
"0x00000000000000000000000022322e35c1850f26dd54ed8f59a27c1c79847a15"
],
"data": "0x0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000015180",
"blockHash": "0xd92d201f912d4a79c1aad303379572ef0adb9cfeae102d299cf08a1331bdd2af",
"blockNumber": "0x486946",
"transactionHash": "0x286fc67e8439e61fac68ba4fd32339f99031f95cbc4715bcc784df116f7e6f2d",
"transactionIndex": "0xb",
"logIndex": "0x4",
"removed": false
}
],
"status": "0x1",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000001000000040000000000000000000000000000100000000000000000000000020000000000200000000000000000000000000",
"type": "0x2",
"effectiveGasPrice": "0xb6d6ad31"
}
],
"libraries": [],
"pending": [],
"returns": {},
"timestamp": 1700676627,
"chain": 11155111,
"multi": false,
"commit": "1ff992b"
}
File renamed without changes.
68 changes: 35 additions & 33 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,36 @@ import {SessionKeyPlugin} from "../src/plugins/session/SessionKeyPlugin.sol";
import {SessionKeyPermissionsPlugin} from "../src/plugins/session/permissions/SessionKeyPermissionsPlugin.sol";

contract Deploy is Script {
// Load entrypoint from env
address public entryPointAddr = vm.envAddress("ENTRYPOINT");
IMSCAEntryPoint public entryPoint = IMSCAEntryPoint(payable(entryPointAddr));

// Load factory owner from env
address public owner = vm.envAddress("OWNER");

// Load core contract, if not in env, deploy new contract
address public mscaImpl = vm.envOr("MSCA_IMPL", address(0));
address public ownerFactoryAddr = vm.envOr("OWNER_FACTORY", address(0));
address public ownerAndTokenReceiverFactoryAddr = vm.envOr("OWNER_TOKEN_RECEIVER_FACTORY", address(0));
MultiOwnerMSCAFactory ownerFactory;
MultiOwnerTokenReceiverMSCAFactory ownerAndTokenReceiverFactory;

// Load plugins contract, if not in env, deploy new contract
address public multiOwnerPlugin = vm.envOr("OWNER_PLUGIN", address(0));
bytes32 public multiOwnerPluginManifestHash;
address public tokenReceiverPlugin = vm.envOr("TOKEN_RECEIVER_PLUGIN", address(0));
bytes32 public tokenReceiverPluginManifestHash;
address public sessionKeyPlugin = vm.envOr("SESSION_KEY_PLUGIN", address(0));
address public sessionKeyPermissionsPlugin = vm.envOr("SESSION_KEY_PERMS_PLUGIN", address(0));

function run() public {
console.log("******** Deploying *********");
console.log("Chain: ", block.chainid);

uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

// Load entrypoint from env
address entryPointAddr = vm.envAddress("ENTRYPOINT");
console.log("EP: ", entryPointAddr);
IMSCAEntryPoint entryPoint = IMSCAEntryPoint(payable(entryPointAddr));

// Load factory owner from env
address owner = vm.envAddress("OWNER");
console.log("Factory owner: ", owner);

// Load core contract, if not in env, deploy new contract
address mscaImpl = vm.envOr("MSCA_IMPL", address(0));
address ownerFactoryAddr = vm.envOr("OWNER_FACTORY", address(0));
address ownerAndTokenReceiverFactoryAddr = vm.envOr("OWNER_TOKEN_RECEIVER_FACTORY", address(0));
MultiOwnerMSCAFactory ownerFactory;
MultiOwnerTokenReceiverMSCAFactory ownerAndTokenReceiverFactory;

// Load plugins contract, if not in env, deploy new contract
address multiOwnerPlugin = vm.envOr("OWNER_PLUGIN", address(0));
bytes32 multiOwnerPluginManifestHash;
address tokenReceiverPlugin = vm.envOr("TOKEN_RECEIVER_PLUGIN", address(0));
bytes32 tokenReceiverPluginManifestHash;
address sessionKeyPlugin = vm.envOr("SESSION_KEY_PLUGIN", address(0));
address sessionKeyPermissionsPlugin = vm.envOr("SESSION_KEY_PERMS_PLUGIN", address(0));
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

// Deploy msca impl
if (mscaImpl == address(0)) {
Expand Down Expand Up @@ -81,16 +81,18 @@ contract Deploy is Script {
tokenReceiverPluginManifestHash = keccak256(abi.encode(BasePlugin(tokenReceiverPlugin).pluginManifest()));

// Deploy MultiOwnerMSCAFactory, and add stake with EP
if (ownerFactoryAddr == address(0)) {
ownerFactory =
new MultiOwnerMSCAFactory(owner, multiOwnerPlugin, mscaImpl, multiOwnerPluginManifestHash, entryPoint);

ownerFactoryAddr = address(ownerFactory);
console.log("New MultiOwnerMSCAFactory: ", ownerFactoryAddr);
} else {
console.log("Exist MultiOwnerMSCAFactory: ", ownerFactoryAddr);
{
if (ownerFactoryAddr == address(0)) {
ownerFactory =
new MultiOwnerMSCAFactory(owner, multiOwnerPlugin, mscaImpl, multiOwnerPluginManifestHash, entryPoint);

ownerFactoryAddr = address(ownerFactory);
console.log("New MultiOwnerMSCAFactory: ", ownerFactoryAddr);
} else {
console.log("Exist MultiOwnerMSCAFactory: ", ownerFactoryAddr);
}
_addStakeForFactory(ownerFactoryAddr, entryPoint);
}
_addStakeForFactory(ownerFactoryAddr, entryPoint);

// Deploy MultiOwnerTokenReceiverMSCAFactory, and add stake with EP
if (ownerAndTokenReceiverFactoryAddr == address(0)) {
Expand Down

0 comments on commit 89572f3

Please sign in to comment.