@zoralabs/comments-contracts 0.0.1 → 0.0.2-COMMENTS.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +48 -30
- package/CHANGELOG.md +8 -0
- package/README.md +10 -39
- package/abis/AddDelegateCommenterRole.json +22 -0
- package/abis/CallerAndCommenter.json +62 -0
- package/abis/CallerAndCommenterImpl.json +1218 -0
- package/abis/CallerAndCommenterMintAndCommentTest.json +771 -0
- package/abis/CallerAndCommenterSwapAndCommentTest.json +844 -0
- package/abis/CallerAndCommenterTestBase.json +577 -0
- package/abis/CommentsImpl.json +189 -59
- package/abis/CommentsImplConstants.json +106 -0
- package/abis/CommentsPermitTest.json +26 -6
- package/abis/CommentsTest.json +58 -10
- package/abis/Comments_mintAndCommentTest.json +11 -4
- package/abis/Comments_smartWallet.json +711 -0
- package/abis/DeployCallerAndCommenterImpl.json +22 -0
- package/abis/EIP712Upgradeable.json +74 -0
- package/abis/EIP712UpgradeableWithChainId.json +49 -0
- package/abis/ERC20.json +310 -0
- package/abis/ICallerAndCommenter.json +797 -0
- package/abis/IComments.json +629 -9
- package/abis/IERC20.json +39 -42
- package/abis/IERC20Metadata.json +224 -0
- package/abis/IMultiOwnable.json +21 -0
- package/abis/IProtocolRewards.json +19 -0
- package/abis/ISecondarySwap.json +45 -0
- package/abis/IZoraCreator1155.json +51 -0
- package/abis/IZoraTimedSaleStrategy.json +91 -0
- package/abis/Mock1155.json +75 -1
- package/abis/Mock1155NoCreatorRewardRecipient.json +605 -0
- package/abis/Mock1155NoOwner.json +566 -0
- package/abis/{MockMinter.json → MockDelegateCommenter.json} +12 -2
- package/abis/MockERC20z.json +315 -0
- package/abis/MockMultiOwnable.json +212 -0
- package/abis/MockSecondarySwap.json +95 -0
- package/abis/MockZoraTimedSale.json +139 -0
- package/abis/Ownable2StepUpgradeable.json +138 -0
- package/abis/UnorderedNoncesUpgradeable.json +4 -4
- package/addresses/10.json +9 -0
- package/addresses/11155111.json +9 -0
- package/addresses/11155420.json +9 -0
- package/addresses/42161.json +9 -0
- package/addresses/7777777.json +9 -0
- package/addresses/8453.json +9 -0
- package/addresses/84532.json +9 -0
- package/addresses/999999999.json +7 -2
- package/deterministicConfig/callerAndCommenter.json +8 -0
- package/deterministicConfig/comments.json +2 -2
- package/dist/index.cjs +724 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +723 -35
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/wagmiGenerated.d.ts +1102 -57
- package/dist/wagmiGenerated.d.ts.map +1 -1
- package/package/types.ts +4 -1
- package/package/wagmiGenerated.ts +728 -32
- package/package.json +11 -10
- package/script/AddDelegateCommenterRole.s.sol +24 -0
- package/script/CommentsDeployerBase.sol +101 -19
- package/script/Deploy.s.sol +2 -44
- package/script/DeployCallerAndCommenterImpl.s.sol +27 -0
- package/script/DeployImpl.s.sol +1 -0
- package/script/DeployNonDeterministic.s.sol +22 -13
- package/script/GenerateDeterministicParams.s.sol +32 -4
- package/scripts/generateCommentsTestData.ts +170 -79
- package/src/CommentsImpl.sol +267 -134
- package/src/CommentsImplConstants.sol +44 -0
- package/src/interfaces/ICallerAndCommenter.sol +215 -0
- package/src/interfaces/IComments.sol +189 -42
- package/src/interfaces/IMultiOwnable.sol +10 -0
- package/src/interfaces/ISecondarySwap.sol +40 -0
- package/src/interfaces/IZoraCreator1155.sol +6 -1
- package/src/interfaces/IZoraCreator1155TypesV1.sol +46 -0
- package/src/interfaces/IZoraTimedSaleStrategy.sol +25 -0
- package/src/proxy/CallerAndCommenter.sol +43 -0
- package/src/utils/CallerAndCommenterImpl.sol +376 -0
- package/src/utils/EIP712UpgradeableWithChainId.sol +12 -23
- package/src/version/ContractVersionBase.sol +1 -1
- package/test/CallerAndCommenterTestBase.sol +77 -0
- package/test/CallerAndCommenter_mintAndComment.t copy.sol +214 -0
- package/test/CallerAndCommenter_swapAndComment.t.sol +523 -0
- package/test/Comments.t.sol +166 -29
- package/test/CommentsTestBase.sol +12 -20
- package/test/Comments_delegateComment.t.sol +129 -0
- package/test/Comments_permit.t.sol +131 -44
- package/test/Comments_smartWallet.t.sol +152 -0
- package/test/mocks/Mock1155.sol +12 -1
- package/test/mocks/Mock1155NoCreatorRewardRecipient.sol +65 -0
- package/test/mocks/Mock1155NoOwner.sol +53 -0
- package/test/mocks/MockDelegateCommenter.sol +36 -0
- package/test/mocks/MockIZoraCreator1155.sol +16 -0
- package/test/mocks/MockSecondarySwap.sol +30 -0
- package/test/mocks/MockZoraTimedSale.sol +38 -0
- package/wagmi.config.ts +3 -1
- package/scripts/backfillComments.ts +0 -176
- package/scripts/queries.ts +0 -73
- package/scripts/queryAndSaveComments.ts +0 -48
- package/scripts/queryQuantityOfComments.ts +0 -53
- package/scripts/writeComments.ts +0 -198
- package/src/deployments/CommentsDeployment.sol +0 -14
- package/test/Comments_mintAndComment.t.sol +0 -101
- package/test/mocks/MockMinter.sol +0 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zoralabs/comments-contracts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-COMMENTS.0",
|
|
4
4
|
"author": "oveddan",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,33 +16,34 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
+
"@openzeppelin/contracts": "5.0.2",
|
|
20
|
+
"@openzeppelin/contracts-upgradeable": "5.0.2",
|
|
19
21
|
"@turnkey/api-key-stamper": "^0.3.1",
|
|
20
22
|
"@turnkey/http": "^2.5.1",
|
|
21
23
|
"@turnkey/viem": "^0.4.4",
|
|
22
24
|
"@types/node": "^20.1.2",
|
|
23
25
|
"@wagmi/cli": "^1.0.1",
|
|
24
26
|
"@zoralabs/chains": "^1.3.1",
|
|
25
|
-
"@openzeppelin/contracts": "5.0.2",
|
|
26
|
-
"@openzeppelin/contracts-upgradeable": "5.0.2",
|
|
27
27
|
"ds-test": "https://github.com/dapphub/ds-test#cd98eff28324bfac652e63a239a60632a761790b",
|
|
28
28
|
"forge-std": "https://github.com/foundry-rs/forge-std#v1.9.1",
|
|
29
|
-
"solady": "0.0.132",
|
|
30
29
|
"glob": "^10.2.2",
|
|
31
30
|
"pathe": "^1.1.2",
|
|
32
31
|
"prettier": "^3.0.3",
|
|
33
32
|
"prettier-plugin-solidity": "^1.3.1",
|
|
33
|
+
"solady": "0.0.132",
|
|
34
34
|
"tsup": "^7.2.0",
|
|
35
35
|
"tsx": "^3.13.0",
|
|
36
36
|
"typescript": "^5.2.2",
|
|
37
|
-
"viem": "^
|
|
38
|
-
"@zoralabs/
|
|
39
|
-
"@zoralabs/protocol-rewards": "^1.2.
|
|
37
|
+
"viem": "^2.21.18",
|
|
38
|
+
"@zoralabs/sparks-contracts": "^0.2.4",
|
|
39
|
+
"@zoralabs/protocol-rewards": "^1.2.5-COMMENTS.0",
|
|
40
40
|
"@zoralabs/shared-contracts": "^0.0.1",
|
|
41
|
-
"@zoralabs/
|
|
42
|
-
"@zoralabs/zora-1155-contracts": "^2.
|
|
41
|
+
"@zoralabs/tsconfig": "^0.0.1",
|
|
42
|
+
"@zoralabs/zora-1155-contracts": "^2.13.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"abitype": "^1.0.2"
|
|
45
|
+
"abitype": "^1.0.2",
|
|
46
|
+
"dotenv": "^16.4.5"
|
|
46
47
|
},
|
|
47
48
|
"scripts": {
|
|
48
49
|
"prettier:check": "prettier --check 'src/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
import "forge-std/Script.sol";
|
|
5
|
+
import {CommentsDeployerBase} from "./CommentsDeployerBase.sol";
|
|
6
|
+
import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
|
|
7
|
+
|
|
8
|
+
contract AddDelegateCommenterRole is CommentsDeployerBase {
|
|
9
|
+
function run() public view {
|
|
10
|
+
address owner = getProxyAdmin();
|
|
11
|
+
bytes32 BACKFILLER_ROLE = keccak256("DELEGATE_COMMENTER");
|
|
12
|
+
|
|
13
|
+
address callerAndCommenter = readDeterministicContractConfig("callerAndCommenter").deployedAddress;
|
|
14
|
+
|
|
15
|
+
address comments = readDeterministicContractConfig("comments").deployedAddress;
|
|
16
|
+
|
|
17
|
+
bytes memory call = abi.encodeWithSelector(AccessControlUpgradeable.grantRole.selector, BACKFILLER_ROLE, callerAndCommenter);
|
|
18
|
+
|
|
19
|
+
console.log("multisig", owner);
|
|
20
|
+
console.log("target", comments);
|
|
21
|
+
console.log("call:");
|
|
22
|
+
console.logBytes(call);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -3,41 +3,65 @@ pragma solidity ^0.8.23;
|
|
|
3
3
|
|
|
4
4
|
import "forge-std/Script.sol";
|
|
5
5
|
|
|
6
|
-
import {ProxyDeployerScript} from "@zoralabs/shared-contracts/deployment/ProxyDeployerScript.sol";
|
|
6
|
+
import {ProxyDeployerScript, DeterministicContractConfig, DeterministicDeployerAndCaller} from "@zoralabs/shared-contracts/deployment/ProxyDeployerScript.sol";
|
|
7
7
|
import {CommentsImpl} from "../src/CommentsImpl.sol";
|
|
8
|
-
import {
|
|
8
|
+
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
|
9
|
+
import {CallerAndCommenterImpl} from "../src/utils/CallerAndCommenterImpl.sol";
|
|
10
|
+
import {CallerAndCommenter} from "../src/proxy/CallerAndCommenter.sol";
|
|
9
11
|
|
|
10
12
|
// Temp script
|
|
11
13
|
contract CommentsDeployerBase is ProxyDeployerScript {
|
|
12
14
|
uint256 internal constant SPARK_VALUE = 0.000001 ether;
|
|
13
15
|
address internal constant PROTOCOL_REWARDS = 0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B;
|
|
14
16
|
address internal constant ZORA_TIMED_SALE_STRATEGY = 0x777777722D078c97c6ad07d9f36801e653E356Ae;
|
|
17
|
+
address internal constant SECONDARY_SWAP = 0x777777EDF27Ac61671e3D5718b10bf6a8802f9f1;
|
|
18
|
+
|
|
15
19
|
using stdJson for string;
|
|
16
20
|
|
|
17
21
|
struct CommentsDeployment {
|
|
18
22
|
address comments;
|
|
19
23
|
address commentsImpl;
|
|
20
24
|
string commentsVersion;
|
|
25
|
+
address callerAndCommenter;
|
|
26
|
+
address callerAndCommenterImpl;
|
|
27
|
+
string callerAndCommenterVersion;
|
|
28
|
+
uint256 commentsBlockNumber;
|
|
29
|
+
uint256 commentsImplBlockNumber;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function addressesFile() internal view returns (string memory) {
|
|
33
|
+
return string.concat("./addresses/", vm.toString(block.chainid), ".json");
|
|
21
34
|
}
|
|
22
35
|
|
|
23
36
|
function saveDeployment(CommentsDeployment memory deployment) internal {
|
|
24
37
|
string memory objectKey = "config";
|
|
25
38
|
|
|
26
39
|
vm.serializeAddress(objectKey, "COMMENTS", deployment.comments);
|
|
27
|
-
|
|
40
|
+
vm.serializeUint(objectKey, "COMMENTS_BLOCK_NUMBER", deployment.commentsBlockNumber);
|
|
41
|
+
vm.serializeAddress(objectKey, "COMMENTS_IMPL", deployment.commentsImpl);
|
|
42
|
+
vm.serializeAddress(objectKey, "CALLER_AND_COMMENTER", deployment.callerAndCommenter);
|
|
43
|
+
vm.serializeAddress(objectKey, "CALLER_AND_COMMENTER_IMPL", deployment.callerAndCommenterImpl);
|
|
44
|
+
vm.serializeString(objectKey, "CALLER_AND_COMMENTER_VERSION", deployment.callerAndCommenterVersion);
|
|
45
|
+
string memory result = vm.serializeUint(objectKey, "COMMENTS_IMPL_BLOCK_NUMBER", deployment.commentsImplBlockNumber);
|
|
28
46
|
|
|
29
|
-
vm.writeJson(result,
|
|
47
|
+
vm.writeJson(result, addressesFile());
|
|
30
48
|
}
|
|
31
49
|
|
|
32
|
-
function readDeployment() internal
|
|
33
|
-
string memory
|
|
50
|
+
function readDeployment() internal returns (CommentsDeployment memory deployment) {
|
|
51
|
+
string memory file = addressesFile();
|
|
52
|
+
if (!vm.exists(file)) {
|
|
53
|
+
return deployment;
|
|
54
|
+
}
|
|
55
|
+
string memory json = vm.readFile(file);
|
|
34
56
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
57
|
+
deployment.comments = readAddressOrDefaultToZero(json, "COMMENTS");
|
|
58
|
+
deployment.commentsImpl = readAddressOrDefaultToZero(json, "COMMENTS_IMPL");
|
|
59
|
+
deployment.commentsVersion = readStringOrDefaultToEmpty(json, "COMMENTS_VERSION");
|
|
60
|
+
deployment.commentsBlockNumber = readUintOrDefaultToZero(json, "COMMENTS_BLOCK_NUMBER");
|
|
61
|
+
deployment.commentsImplBlockNumber = readUintOrDefaultToZero(json, "COMMENTS_IMPL_BLOCK_NUMBER");
|
|
62
|
+
deployment.callerAndCommenter = readAddressOrDefaultToZero(json, "CALLER_AND_COMMENTER");
|
|
63
|
+
deployment.callerAndCommenterImpl = readAddressOrDefaultToZero(json, "CALLER_AND_COMMENTER_IMPL");
|
|
64
|
+
deployment.callerAndCommenterVersion = readStringOrDefaultToEmpty(json, "CALLER_AND_COMMENTER_VERSION");
|
|
41
65
|
}
|
|
42
66
|
|
|
43
67
|
function commentsImplCreationCode() internal pure returns (bytes memory) {
|
|
@@ -45,16 +69,74 @@ contract CommentsDeployerBase is ProxyDeployerScript {
|
|
|
45
69
|
}
|
|
46
70
|
|
|
47
71
|
function getBackfillerAccount() internal pure returns (address) {
|
|
48
|
-
|
|
49
|
-
return 0x9AfA68161f094DAEA62816b6264b3D777978a164;
|
|
72
|
+
return 0x77baCD258d2E6A5187B7344419A5e2842A49A059;
|
|
50
73
|
}
|
|
51
74
|
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
delegateCommenters[0] = ZORA_TIMED_SALE_STRATEGY;
|
|
75
|
+
function deployCommentsImpl() internal returns (CommentsImpl) {
|
|
76
|
+
return new CommentsImpl(SPARK_VALUE, PROTOCOL_REWARDS, getZoraRecipient());
|
|
55
77
|
}
|
|
56
78
|
|
|
57
|
-
function
|
|
58
|
-
|
|
79
|
+
function deployCommentsDeterministic(CommentsDeployment memory deployment, DeterministicDeployerAndCaller deployer) internal {
|
|
80
|
+
// read previously saved deterministic royalties config
|
|
81
|
+
DeterministicContractConfig memory commentsConfig = readDeterministicContractConfig("comments");
|
|
82
|
+
DeterministicContractConfig memory callerAndCommenterConfig = readDeterministicContractConfig("callerAndCommenter");
|
|
83
|
+
|
|
84
|
+
address backfiller = CommentsDeployerBase.getBackfillerAccount();
|
|
85
|
+
// get deployed implementation address. it it's not deployed, revert
|
|
86
|
+
address implAddress = address(deployCommentsImpl());
|
|
87
|
+
|
|
88
|
+
if (implAddress.code.length == 0) {
|
|
89
|
+
revert("Impl not yet deployed. Make sure to deploy it with DeployImpl.s.sol");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
address[] memory delegateCommenters = new address[](1);
|
|
93
|
+
delegateCommenters[0] = callerAndCommenterConfig.deployedAddress;
|
|
94
|
+
|
|
95
|
+
// build upgrade to and call for comments, with init call
|
|
96
|
+
bytes memory upgradeToAndCall = abi.encodeWithSelector(
|
|
97
|
+
UUPSUpgradeable.upgradeToAndCall.selector,
|
|
98
|
+
implAddress,
|
|
99
|
+
abi.encodeWithSelector(CommentsImpl.initialize.selector, getProxyAdmin(), backfiller, delegateCommenters)
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
// sign royalties deployment with turnkey account
|
|
103
|
+
bytes memory signature = signDeploymentWithTurnkey(commentsConfig, upgradeToAndCall, deployer);
|
|
104
|
+
|
|
105
|
+
deployment.comments = deployer.permitSafeCreate2AndCall(
|
|
106
|
+
signature,
|
|
107
|
+
commentsConfig.salt,
|
|
108
|
+
commentsConfig.creationCode,
|
|
109
|
+
upgradeToAndCall,
|
|
110
|
+
commentsConfig.deployedAddress
|
|
111
|
+
);
|
|
112
|
+
deployment.commentsBlockNumber = block.number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function deployCallerAndCommenterImpl(address commentsAddress) internal returns (address) {
|
|
116
|
+
return address(new CallerAndCommenterImpl(commentsAddress, ZORA_TIMED_SALE_STRATEGY, SECONDARY_SWAP, SPARK_VALUE));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function deployCallerAndCommenterDeterministic(CommentsDeployment memory deployment, DeterministicDeployerAndCaller deployer) internal {
|
|
120
|
+
address commentsAddress = readDeterministicContractConfig("comments").deployedAddress;
|
|
121
|
+
DeterministicContractConfig memory callerAndCommenterConfig = readDeterministicContractConfig("callerAndCommenter");
|
|
122
|
+
|
|
123
|
+
// deploy caller and commenter impl
|
|
124
|
+
deployment.callerAndCommenterImpl = address(deployCallerAndCommenterImpl(commentsAddress));
|
|
125
|
+
|
|
126
|
+
bytes memory upgradeToAndCall = abi.encodeWithSelector(
|
|
127
|
+
UUPSUpgradeable.upgradeToAndCall.selector,
|
|
128
|
+
deployment.callerAndCommenterImpl,
|
|
129
|
+
abi.encodeWithSelector(CallerAndCommenterImpl.initialize.selector, getProxyAdmin())
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
bytes memory signature = signDeploymentWithTurnkey(callerAndCommenterConfig, upgradeToAndCall, deployer);
|
|
133
|
+
|
|
134
|
+
deployment.callerAndCommenter = deployer.permitSafeCreate2AndCall(
|
|
135
|
+
signature,
|
|
136
|
+
callerAndCommenterConfig.salt,
|
|
137
|
+
callerAndCommenterConfig.creationCode,
|
|
138
|
+
upgradeToAndCall,
|
|
139
|
+
callerAndCommenterConfig.deployedAddress
|
|
140
|
+
);
|
|
59
141
|
}
|
|
60
142
|
}
|
package/script/Deploy.s.sol
CHANGED
|
@@ -1,62 +1,20 @@
|
|
|
1
1
|
// SPDX-License-Identifier: UNLICENSED
|
|
2
2
|
pragma solidity ^0.8.13;
|
|
3
3
|
|
|
4
|
-
import "forge-std/Script.sol";
|
|
5
|
-
|
|
6
|
-
import {ProxyDeployerScript} from "@zoralabs/shared-contracts/deployment/ProxyDeployerScript.sol";
|
|
7
|
-
import {ImmutableCreate2FactoryUtils} from "@zoralabs/shared-contracts/utils/ImmutableCreate2FactoryUtils.sol";
|
|
8
4
|
import {ProxyDeployerScript, DeterministicDeployerAndCaller, DeterministicContractConfig} from "@zoralabs/shared-contracts/deployment/ProxyDeployerScript.sol";
|
|
9
|
-
import {CommentsImpl} from "../src/CommentsImpl.sol";
|
|
10
|
-
import {CommentsDeployment} from "../src/deployments/CommentsDeployment.sol";
|
|
11
|
-
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
|
12
5
|
import {CommentsDeployerBase} from "./CommentsDeployerBase.sol";
|
|
13
6
|
|
|
14
|
-
// Temp script
|
|
15
7
|
contract DeployScript is CommentsDeployerBase {
|
|
16
8
|
function run() public {
|
|
17
9
|
CommentsDeployment memory deployment = readDeployment();
|
|
18
10
|
|
|
19
|
-
address owner = getProxyAdmin();
|
|
20
|
-
|
|
21
|
-
// todo: figure out backfiller. right now this is made from cast wallet new
|
|
22
|
-
address backfiller = 0x9AfA68161f094DAEA62816b6264b3D777978a164;
|
|
23
|
-
address zoraRecipient = getZoraRecipient();
|
|
24
|
-
|
|
25
|
-
// get deployed implementation address. it it's not deployed, revert
|
|
26
|
-
address implAddress = deployment.commentsImpl;
|
|
27
|
-
|
|
28
|
-
if (implAddress.code.length == 0) {
|
|
29
|
-
revert("Impl not yet deployed. Make sure to deploy it with DeployImpl.s.sol");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
11
|
vm.startBroadcast();
|
|
33
12
|
|
|
34
13
|
// get deployer contract
|
|
35
14
|
DeterministicDeployerAndCaller deployer = createOrGetDeployerAndCaller();
|
|
36
15
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
address[] memory delegateCommenters = defaultDelegateCommenters();
|
|
41
|
-
|
|
42
|
-
// build upgrade to and call for comments, with init call
|
|
43
|
-
bytes memory upgradeToAndCall = abi.encodeWithSelector(
|
|
44
|
-
UUPSUpgradeable.upgradeToAndCall.selector,
|
|
45
|
-
implAddress,
|
|
46
|
-
abi.encodeWithSelector(CommentsImpl.initialize.selector, zoraRecipient, owner, backfiller, delegateCommenters)
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
// sign royalties deployment with turnkey account
|
|
50
|
-
bytes memory commentsSignature = signDeploymentWithTurnkey(commentsConfig, upgradeToAndCall, deployer);
|
|
51
|
-
|
|
52
|
-
// deterministically deploy royalties contract using the signature
|
|
53
|
-
deployment.comments = deployer.permitSafeCreate2AndCall(
|
|
54
|
-
commentsSignature,
|
|
55
|
-
commentsConfig.salt,
|
|
56
|
-
commentsConfig.creationCode,
|
|
57
|
-
upgradeToAndCall,
|
|
58
|
-
commentsConfig.deployedAddress
|
|
59
|
-
);
|
|
16
|
+
deployCommentsDeterministic(deployment, deployer);
|
|
17
|
+
deployCallerAndCommenterDeterministic(deployment, deployer);
|
|
60
18
|
|
|
61
19
|
vm.stopBroadcast();
|
|
62
20
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// SPDX-License-Identifier: UNLICENSED
|
|
2
|
+
pragma solidity ^0.8.13;
|
|
3
|
+
|
|
4
|
+
import "forge-std/console2.sol";
|
|
5
|
+
|
|
6
|
+
import {CommentsDeployerBase} from "./CommentsDeployerBase.sol";
|
|
7
|
+
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
|
8
|
+
|
|
9
|
+
contract DeployCallerAndCommenterImpl is CommentsDeployerBase {
|
|
10
|
+
function run() public {
|
|
11
|
+
CommentsDeployment memory config = readDeployment();
|
|
12
|
+
|
|
13
|
+
vm.startBroadcast();
|
|
14
|
+
|
|
15
|
+
config.callerAndCommenterImpl = deployCallerAndCommenterImpl(config.comments);
|
|
16
|
+
|
|
17
|
+
vm.stopBroadcast();
|
|
18
|
+
|
|
19
|
+
console2.log("CallerAndCommenterImpl deployed, to upgrade:");
|
|
20
|
+
console2.log("target:", config.callerAndCommenter);
|
|
21
|
+
console2.log("calldata:");
|
|
22
|
+
console2.logBytes(abi.encodeWithSelector(UUPSUpgradeable.upgradeToAndCall.selector, config.callerAndCommenterImpl, ""));
|
|
23
|
+
console2.log("multisig:", getProxyAdmin());
|
|
24
|
+
|
|
25
|
+
saveDeployment(config);
|
|
26
|
+
}
|
|
27
|
+
}
|
package/script/DeployImpl.s.sol
CHANGED
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
pragma solidity ^0.8.13;
|
|
3
3
|
|
|
4
4
|
import "forge-std/Script.sol";
|
|
5
|
-
|
|
6
|
-
import {ProxyDeployerScript} from "@zoralabs/shared-contracts/deployment/ProxyDeployerScript.sol";
|
|
7
|
-
import {ImmutableCreate2FactoryUtils} from "@zoralabs/shared-contracts/utils/ImmutableCreate2FactoryUtils.sol";
|
|
8
|
-
import {ProxyDeployerScript, DeterministicDeployerAndCaller, DeterministicContractConfig} from "@zoralabs/shared-contracts/deployment/ProxyDeployerScript.sol";
|
|
9
5
|
import {Comments} from "../src/proxy/Comments.sol";
|
|
10
6
|
import {CommentsImpl} from "../src/CommentsImpl.sol";
|
|
11
|
-
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
|
12
7
|
import {CommentsDeployerBase} from "./CommentsDeployerBase.sol";
|
|
8
|
+
import {CallerAndCommenterImpl} from "../src/utils/CallerAndCommenterImpl.sol";
|
|
9
|
+
import {CallerAndCommenter} from "../src/proxy/CallerAndCommenter.sol";
|
|
13
10
|
|
|
14
11
|
contract DeployNonDeterministic is CommentsDeployerBase {
|
|
15
12
|
function run() public {
|
|
@@ -17,27 +14,39 @@ contract DeployNonDeterministic is CommentsDeployerBase {
|
|
|
17
14
|
|
|
18
15
|
address owner = getProxyAdmin();
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
address backfiller = 0x9AfA68161f094DAEA62816b6264b3D777978a164;
|
|
22
|
-
address zoraRecipient = getZoraRecipient();
|
|
17
|
+
address backfiller = CommentsDeployerBase.getBackfillerAccount();
|
|
23
18
|
|
|
24
19
|
vm.startBroadcast();
|
|
25
|
-
// deploy comments backfiller
|
|
26
20
|
|
|
27
|
-
address implAddress =
|
|
21
|
+
address implAddress = deployment.commentsImpl;
|
|
22
|
+
|
|
23
|
+
if (implAddress.code.length == 0) {
|
|
24
|
+
revert("impl not deployed");
|
|
25
|
+
}
|
|
28
26
|
|
|
29
27
|
Comments comments = new Comments(implAddress);
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
CallerAndCommenterImpl callerAndCommenterImpl = new CallerAndCommenterImpl(address(comments), ZORA_TIMED_SALE_STRATEGY, SECONDARY_SWAP, SPARK_VALUE);
|
|
30
|
+
|
|
31
|
+
CallerAndCommenter callerAndCommenter = new CallerAndCommenter(address(callerAndCommenterImpl));
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
CallerAndCommenterImpl(payable(address(callerAndCommenter))).initialize(owner);
|
|
34
|
+
|
|
35
|
+
address[] memory delegateCommenters = new address[](1);
|
|
36
|
+
delegateCommenters[0] = address(callerAndCommenter);
|
|
37
|
+
|
|
38
|
+
CommentsImpl(payable(address(comments))).initialize(owner, backfiller, delegateCommenters);
|
|
34
39
|
|
|
35
40
|
vm.stopBroadcast();
|
|
36
41
|
|
|
37
42
|
deployment.comments = address(comments);
|
|
38
|
-
deployment.
|
|
43
|
+
deployment.commentsBlockNumber = block.number;
|
|
44
|
+
deployment.callerAndCommenter = address(callerAndCommenter);
|
|
45
|
+
deployment.callerAndCommenterImpl = address(callerAndCommenterImpl);
|
|
39
46
|
|
|
40
47
|
// save the deployment json
|
|
41
48
|
saveDeployment(deployment);
|
|
49
|
+
|
|
50
|
+
console.log("Comments deployed at", address(comments));
|
|
42
51
|
}
|
|
43
52
|
}
|
|
@@ -3,11 +3,10 @@ pragma solidity ^0.8.20;
|
|
|
3
3
|
|
|
4
4
|
import "forge-std/Script.sol";
|
|
5
5
|
|
|
6
|
-
import {LibString} from "solady/utils/LibString.sol";
|
|
7
6
|
import {ImmutableCreate2FactoryUtils} from "@zoralabs/shared-contracts/utils/ImmutableCreate2FactoryUtils.sol";
|
|
8
7
|
import {ProxyDeployerScript, DeterministicDeployerAndCaller, DeterministicContractConfig} from "@zoralabs/shared-contracts/deployment/ProxyDeployerScript.sol";
|
|
9
|
-
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
|
|
10
8
|
import {Comments} from "../src/proxy/Comments.sol";
|
|
9
|
+
import {CallerAndCommenter} from "../src/proxy/CallerAndCommenter.sol";
|
|
11
10
|
|
|
12
11
|
/// @dev This script saves the current bytecode, and initialization parameters for the Sparks proxy,
|
|
13
12
|
/// which then need to be populated with a salt and expected address, which can be achieved by
|
|
@@ -37,6 +36,32 @@ contract GenerateDeterministicParams is ProxyDeployerScript {
|
|
|
37
36
|
config.deploymentCaller = caller;
|
|
38
37
|
}
|
|
39
38
|
|
|
39
|
+
function mineForCallerAndCommenterAddress(
|
|
40
|
+
DeterministicDeployerAndCaller deployer,
|
|
41
|
+
address caller
|
|
42
|
+
) private returns (DeterministicContractConfig memory config) {
|
|
43
|
+
// get proxy creation code
|
|
44
|
+
// get the expected init code for the proxy from the uupsProxyDeployer
|
|
45
|
+
bytes memory initCode = deployer.proxyCreationCode(type(CallerAndCommenter).creationCode);
|
|
46
|
+
bytes32 initCodeHash = keccak256(initCode);
|
|
47
|
+
|
|
48
|
+
// uupsProxyDeployer is deployer
|
|
49
|
+
(bytes32 salt, address expectedAddress) = mineSalt(address(deployer), initCodeHash, "7777777", caller);
|
|
50
|
+
|
|
51
|
+
// test deployment
|
|
52
|
+
// Create2.deploy(0, salt, initCode);
|
|
53
|
+
|
|
54
|
+
console2.log("salt");
|
|
55
|
+
console2.log(vm.toString(salt));
|
|
56
|
+
|
|
57
|
+
config.salt = salt;
|
|
58
|
+
config.deployedAddress = expectedAddress;
|
|
59
|
+
config.creationCode = initCode;
|
|
60
|
+
config.constructorArgs = deployer.proxyConstructorArgs();
|
|
61
|
+
config.contractName = "CallerAndCommenter";
|
|
62
|
+
config.deploymentCaller = caller;
|
|
63
|
+
}
|
|
64
|
+
|
|
40
65
|
function run() public {
|
|
41
66
|
address caller = vm.envAddress("DEPLOYER");
|
|
42
67
|
|
|
@@ -48,8 +73,11 @@ contract GenerateDeterministicParams is ProxyDeployerScript {
|
|
|
48
73
|
|
|
49
74
|
vm.stopBroadcast();
|
|
50
75
|
|
|
51
|
-
DeterministicContractConfig memory commentsConfig = mineForCommentsAddress(deployer, caller);
|
|
76
|
+
// DeterministicContractConfig memory commentsConfig = mineForCommentsAddress(deployer, caller);
|
|
77
|
+
|
|
78
|
+
DeterministicContractConfig memory callerAndCommenterConfig = mineForCallerAndCommenterAddress(deployer, caller);
|
|
52
79
|
|
|
53
|
-
saveDeterministicContractConfig(commentsConfig, "comments");
|
|
80
|
+
// saveDeterministicContractConfig(commentsConfig, "comments");
|
|
81
|
+
saveDeterministicContractConfig(callerAndCommenterConfig, "callerAndCommenter");
|
|
54
82
|
}
|
|
55
83
|
}
|