Skip to content

Commit

Permalink
added deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
0xPilou committed Nov 27, 2023
1 parent cd571b5 commit 415e302
Show file tree
Hide file tree
Showing 2 changed files with 196 additions and 0 deletions.
117 changes: 117 additions & 0 deletions forge-cache/solidity-files-cache.json
Original file line number Diff line number Diff line change
Expand Up @@ -5201,6 +5201,123 @@
}
}
},
"script/base-goerli/deploy-kyc-upgrade.s.sol": {
"lastModificationDate": 1701091363688,
"contentHash": "559c6c819096ca166379a327a22cec6b",
"sourceName": "script/base-goerli/deploy-kyc-upgrade.s.sol",
"solcConfig": {
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"": [
"ast"
],
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
]
}
},
"evmVersion": "paris",
"libraries": {}
}
},
"imports": [
"lib/ERC721A-Upgradeable/contracts/ERC721AStorage.sol",
"lib/ERC721A-Upgradeable/contracts/ERC721AUpgradeable.sol",
"lib/ERC721A-Upgradeable/contracts/ERC721A__Initializable.sol",
"lib/ERC721A-Upgradeable/contracts/ERC721A__InitializableStorage.sol",
"lib/ERC721A-Upgradeable/contracts/IERC721AUpgradeable.sol",
"lib/forge-std/src/Base.sol",
"lib/forge-std/src/Script.sol",
"lib/forge-std/src/StdChains.sol",
"lib/forge-std/src/StdCheats.sol",
"lib/forge-std/src/StdJson.sol",
"lib/forge-std/src/StdMath.sol",
"lib/forge-std/src/StdStorage.sol",
"lib/forge-std/src/StdUtils.sol",
"lib/forge-std/src/Vm.sol",
"lib/forge-std/src/console.sol",
"lib/forge-std/src/console2.sol",
"lib/forge-std/src/interfaces/IMulticall3.sol",
"lib/openzeppelin-contracts/contracts/access/Ownable.sol",
"lib/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol",
"lib/openzeppelin-contracts/contracts/proxy/Clones.sol",
"lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol",
"lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Upgrade.sol",
"lib/openzeppelin-contracts/contracts/proxy/Proxy.sol",
"lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol",
"lib/openzeppelin-contracts/contracts/proxy/transparent/ProxyAdmin.sol",
"lib/openzeppelin-contracts/contracts/proxy/transparent/TransparentUpgradeableProxy.sol",
"lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol",
"lib/openzeppelin-contracts/contracts/token/ERC777/IERC777.sol",
"lib/openzeppelin-contracts/contracts/utils/Address.sol",
"lib/openzeppelin-contracts/contracts/utils/Context.sol",
"lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol",
"lib/openzeppelin-contracts/contracts/utils/Strings.sol",
"lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol",
"lib/openzeppelin-contracts/contracts/utils/math/Math.sol",
"lib/openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol",
"lib/openzeppelin-contracts-upgradeable/contracts/access/IAccessControlUpgradeable.sol",
"lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol",
"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol",
"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC1155/ERC1155Upgradeable.sol",
"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC1155/IERC1155ReceiverUpgradeable.sol",
"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC1155/IERC1155Upgradeable.sol",
"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol",
"lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol",
"lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol",
"lib/openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol",
"lib/openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol",
"lib/openzeppelin-contracts-upgradeable/contracts/utils/introspection/IERC165Upgradeable.sol",
"lib/openzeppelin-contracts-upgradeable/contracts/utils/math/MathUpgradeable.sol",
"lib/protocol-monorepo/packages/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol",
"lib/protocol-monorepo/packages/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol",
"lib/protocol-monorepo/packages/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol",
"lib/protocol-monorepo/packages/ethereum-contracts/contracts/interfaces/superfluid/Definitions.sol",
"lib/protocol-monorepo/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperAgreement.sol",
"lib/protocol-monorepo/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperApp.sol",
"lib/protocol-monorepo/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol",
"lib/protocol-monorepo/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol",
"lib/protocol-monorepo/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol",
"lib/protocol-monorepo/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidGovernance.sol",
"lib/protocol-monorepo/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol",
"lib/protocol-monorepo/packages/ethereum-contracts/contracts/interfaces/tokens/ERC20WithTokenInfo.sol",
"lib/protocol-monorepo/packages/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol",
"src/factory/AnotherCloneFactory.sol",
"src/libraries/ABDataTypes.sol",
"src/libraries/ABErrors.sol",
"src/libraries/ABEvents.sol",
"src/royalty/ABRoyalty.sol",
"src/royalty/IABRoyalty.sol",
"src/token/ERC1155/ERC1155AB.sol",
"src/token/ERC721/ERC721AB.sol",
"src/token/ERC721/ERC721ABLE.sol",
"src/token/ERC721/ERC721ABOE.sol",
"src/utils/ABKYCModule.sol",
"src/utils/IABDataRegistry.sol",
"src/utils/IABKYCModule.sol",
"src/utils/IABVerifier.sol"
],
"versionRequirement": "^0.8.18",
"artifacts": {
"DeployKYCUpgrade": {
"0.8.19+commit.7dd6d404.Darwin.appleclang": "deploy-kyc-upgrade.s.sol/DeployKYCUpgrade.json"
}
}
},
"script/base-goerli/deploy-platform.s.sol": {
"lastModificationDate": 1700049426046,
"contentHash": "cbacf930a7cb4bf9d8fb6c6666a246aa",
Expand Down
79 changes: 79 additions & 0 deletions script/base-goerli/deploy-kyc-upgrade.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
forge script script/base-goerli/deploy-kyc-upgrade.s.sol --rpc-url base-goerli
forge script script/base-goerli/deploy-kyc-upgrade.s.sol:DeployUpgrade --rpc-url base-goerli --broadcast --verify
*/

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import "forge-std/Script.sol";

import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";

import {ABKYCModule} from "src/utils/ABKYCModule.sol";
import {ABRoyalty} from "src/royalty/ABRoyalty.sol";
import {ERC721ABOE} from "src/token/ERC721/ERC721ABOE.sol";
import {ERC721ABLE} from "src/token/ERC721/ERC721ABLE.sol";
import {AnotherCloneFactory} from "src/factory/AnotherCloneFactory.sol";

contract DeployKYCUpgrade is Script {
string public constant KYC_MODULE_PATH = "deployment/84531/ABKYCModule/address";
string public constant PROXY_ADMIN_PATH = "deployment/84531/ProxyAdmin/address";

ABRoyalty public abRoyalty;
ERC721ABLE public erc721LimitedEditionImpl;
ProxyAdmin public proxyAdmin;
TransparentUpgradeableProxy public abKycModuleProxy;

function run(bool isDryRun) external {
// Account to deploy from
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");

address admin = vm.addr(deployerPrivateKey);

// Start broadcasting transactions
vm.startBroadcast(deployerPrivateKey);

// Check if a Proxy Admin has already been deployed
try vm.readFile(PROXY_ADMIN_PATH) returns (string memory proxyAdminAddr) {
proxyAdmin = ProxyAdmin(vm.parseAddress(proxyAdminAddr));
} catch {
proxyAdmin = new ProxyAdmin();
if (!isDryRun) {
_writeAddressToFile(address(proxyAdmin), PROXY_ADMIN_PATH);
}
}

// Deploy ABVerifier
abKycModuleProxy = new TransparentUpgradeableProxy(
address(new ABKYCModule()),
address(proxyAdmin),
abi.encodeWithSelector(ABKYCModule.initialize.selector, admin)
);
if (!isDryRun) {
_writeAddressToFile(address(abKycModuleProxy), KYC_MODULE_PATH);
}

// Deploy Implementation Contracts
abRoyalty = new ABRoyalty();
erc721LimitedEditionImpl = new ERC721ABLE();
new ERC721ABOE();

// Set new implementation contracts addresses in AnotherCloneFactory
AnotherCloneFactory(0x9BE7E2B13f70f170B63c0379663313EcdB527294).setERC721Implementation(
address(erc721LimitedEditionImpl)
);

AnotherCloneFactory(0x9BE7E2B13f70f170B63c0379663313EcdB527294).setABRoyaltyImplementation(address(abRoyalty));

// Set new implementation contracts addresses in AnotherCloneFactory
AnotherCloneFactory(0x9BE7E2B13f70f170B63c0379663313EcdB527294).setABKYCModule(address(abKycModuleProxy));

vm.stopBroadcast();
}

function _writeAddressToFile(address _addr, string memory _path) internal {
vm.writeFile(_path, vm.toString(_addr));
}
}

0 comments on commit 415e302

Please sign in to comment.