diff --git a/packages/deploy/README.md b/packages/deploy/README.md index 2d505281de..d01c86de18 100644 --- a/packages/deploy/README.md +++ b/packages/deploy/README.md @@ -1,7 +1,8 @@ # TSB contracts deploy This package is used to compile, deploy, test, upgrade and keep track of the -contracts we use in our environments. +contracts we use in our environments. Check [Contract releases](./releases.md) +for details. ## Compilation diff --git a/packages/deploy/hardhat.config.ts b/packages/deploy/hardhat.config.ts index 3cc49cd216..35c9ef5244 100644 --- a/packages/deploy/hardhat.config.ts +++ b/packages/deploy/hardhat.config.ts @@ -12,6 +12,7 @@ import { addNodeAndMnemonic, skipDeploymentsOnLiveNetworks, } from './utils/hardhatConfig'; +import './tasks/reportReleses'; // Package name : solidity source code path const importedPackages = { diff --git a/packages/deploy/package.json b/packages/deploy/package.json index 37d633b1ee..2102e9d206 100644 --- a/packages/deploy/package.json +++ b/packages/deploy/package.json @@ -28,8 +28,13 @@ "@sandbox-smart-contracts/oft-sand": "0.0.1" }, "files": [ - "deployments" + "deployments", + "README.md", + "releases.md" ], + "publishConfig": { + "access": "public" + }, "scripts": { "compile": "hardhat compile", "test": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192 node --unhandled-rejections=strict\" HARDHAT_COMPILE=true hardhat test", @@ -43,7 +48,8 @@ "verify": "yarn hardhat etherscan-verify --network", "live:deploy": "node ./utils/npmScriptHelper.js deploy", "fork:deploy": "node ./utils/npmScriptHelper.js fork:deploy", - "fork:test": "node ./utils/npmScriptHelper.js fork:test" + "fork:test": "node ./utils/npmScriptHelper.js fork:test", + "report": "yarn hardhat report" }, "devDependencies": { "@ethersproject/abi": "^5.7.0", @@ -78,6 +84,7 @@ "hardhat-contract-sizer": "^2.10.0", "hardhat-deploy": "^0.11.43", "hardhat-deploy-ethers": "^0.4.1", + "markdown-table-ts": "^1.0.3", "prettier": "^2.8.8", "prettier-plugin-solidity": "^1.1.3", "ts-node": "^10.9.2", diff --git a/packages/deploy/releases.md b/packages/deploy/releases.md new file mode 100644 index 0000000000..08d07ced8a --- /dev/null +++ b/packages/deploy/releases.md @@ -0,0 +1,81 @@ + + +# Deployed contracts + +## sepolia + +| contract | address | version | path | +| :---------------- | :----------------------------------------: | :-----: | :------------------------------------------------------------------- | +| Exchange | 0x5A9275998c5F824abAC15E318Be3011F6000570a | 1.0.1 | @sandbox-smart-contracts/marketplace/contracts/Exchange.sol | +| OFTAdapterForSand | 0x888a2180f1640b94C05A35dA7979F2e5E455Abc9 | 0.0.1 | @sandbox-smart-contracts/oft-sand/contracts/OFTAdapterForSand.sol | +| OrderValidator | 0x99E5554E44E8C01F23c86212B0Fd73048f8370E6 | 1.0.1 | @sandbox-smart-contracts/marketplace/contracts/OrderValidator.sol | +| RoyaltiesRegistry | 0xA2BAf31A638dAE4aaB54F185eFE3177b685b3557 | 1.0.1 | @sandbox-smart-contracts/marketplace/contracts/RoyaltiesRegistry.sol | + +## bscTestnet + +| contract | address | version | path | +| :------- | :----------------------------------------: | :-----: | :------------------------------------------------------ | +| OFTSand | 0xeaac002f26254576d811f84289C821ae6AC7F420 | 0.0.1 | @sandbox-smart-contracts/oft-sand/contracts/OFTSand.sol | + +## mumbai + +| contract | address | version | path | +| :------------------------- | :----------------------------------------: | :-----: | :------------------------------------------------------------------------------------------- | +| AssetCreate | 0xE7eC4195b772EB1295d42a4602c40659958f15F6 | 1.2.0 | @sandbox-smart-contracts/asset/contracts/AssetCreate.sol | +| AssetReveal | 0x6a2B6427d56495A0e49Fc4D1C3Bb3ac32C2d5E0D | 1.2.0 | @sandbox-smart-contracts/asset/contracts/AssetReveal.sol | +| Asset | 0x1B94A67Ef2cFa6Ffd7De4Cb4566135F384ae8d3D | 1.2.0 | @sandbox-smart-contracts/asset/contracts/Asset.sol | +| AuthSuperValidator | 0x9f1e999d2e7Ee0d263C9589aD46b0d8f29e8233a | 1.2.0 | @sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol | +| Catalyst | 0xeB8d626E51B67e2CAa1ec614ca172AB4eEbe601f | 1.2.0 | @sandbox-smart-contracts/asset/contracts/Catalyst.sol | +| Exchange | 0xd7b0efA0EF34C25e90D914b167A159854C59a2c9 | 1.0.1 | @sandbox-smart-contracts/marketplace/contracts/Exchange.sol | +| FaucetsERC1155 | 0xE0193d3C908DB1a1976434cdDC945a65c90fa9FE | 0.0.1 | @sandbox-smart-contracts/faucets/contracts/FaucetsERC1155.sol | +| OperatorFilterSubscription | 0x54d43934efdb0b15d007bdcb30ffae9f695caba7 | 1.0.1 | @sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFilterSubscription.sol | +| OperatorFilterSubscription | 0x1482A97e8564a829cCc5A0d81a578161Bc73431e | 1.0.1 | @sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFilterSubscription.sol | +| OperatorFilterSubscription | 0x4bd0ad9D60d686a259fBCD8C56CE6100D7031e35 | 1.0.1 | @sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFilterSubscription.sol | +| OrderValidator | 0x9a0006b87d1886e30A3EeFA780D3E5CA96351938 | 1.0.1 | @sandbox-smart-contracts/marketplace/contracts/OrderValidator.sol | +| RoyaltiesRegistry | 0xe5c08f87c949315d69707ee71babb496af70506b | 1.0.1 | @sandbox-smart-contracts/marketplace/contracts/RoyaltiesRegistry.sol | +| RoyaltyManager | 0xE7D8e2cE77eDC95e930D4E72776b77D0DeFdB52C | 1.0.2 | @sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol | +| RoyaltySplitter | 0x6ae14ED710f456995e053e0327a7467143EF0E95 | 1.0.2 | @sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol | +| SignedMultiGiveaway | 0x9412b244f1a8b30242A54EFd24c52A4697F3a3DC | 0.0.3 | @sandbox-smart-contracts/giveaway/contracts/SignedMultiGiveaway.sol | + +## amoy + +| contract | address | version | path | +| :------------------------- | :----------------------------------------: | :-----: | :------------------------------------------------------------------------------------------- | +| AssetCreate | 0xEe020cCF1Fcc6Dc434c69d789f174A48FdeF3D1C | 1.2.0 | @sandbox-smart-contracts/asset/contracts/AssetCreate.sol | +| Asset | 0xaF936B06A25dA532bAa26071b5bC2fc72547E845 | 1.2.0 | @sandbox-smart-contracts/asset/contracts/Asset.sol | +| AuthSuperValidator | 0x32112dD0006D58936b94071773765918f70fD5d1 | 1.2.0 | @sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol | +| AvatarCollection | 0x94D2a48b0f4163B0742917E3Ee255Fd8A75dEDd5 | \* | @sandbox-smart-contracts/avatar/contracts/avatar/AvatarCollection.sol | +| Catalyst | 0x61aB05Bf91aCe346a5aA56222Fe70b66520B7bAB | 1.2.0 | @sandbox-smart-contracts/asset/contracts/Catalyst.sol | +| CollectionFactory | 0xa21DC4BFaF044EFb57369ae574bc228a33368BDB | \* | @sandbox-smart-contracts/avatar/contracts/proxy/CollectionFactory.sol | +| Exchange | 0x75C3095971259aAd22aDBe8075FF395f68763d1d | 1.0.1 | @sandbox-smart-contracts/marketplace/contracts/Exchange.sol | +| FaucetsERC1155 | 0x735A0DC4BBa3a4f1Dc50DbaC1575E62225e5d10a | 0.0.1 | @sandbox-smart-contracts/faucets/contracts/FaucetsERC1155.sol | +| OperatorFilterSubscription | 0xF40Ba08C3766f8207843D6994d2C00F0276D8C0B | 1.0.1 | @sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFilterSubscription.sol | +| OperatorFilterSubscription | 0x08ba79dAF074d2B0Ead45ee0f126286459544834 | 1.0.1 | @sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFilterSubscription.sol | +| OrderValidator | 0x3AFE10Ad154165b5c687D17f0B20E655B5ae54eE | 1.0.1 | @sandbox-smart-contracts/marketplace/contracts/OrderValidator.sol | +| RoyaltiesRegistry | 0xc6105aeE23EB2C2CA36Cf3E112833D7cC5e3728A | 1.0.1 | @sandbox-smart-contracts/marketplace/contracts/RoyaltiesRegistry.sol | +| RoyaltyManager | 0x97bBe5222D5735efA9f18D01e6c8E6Fb8B92d624 | 1.0.2 | @sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol | +| RoyaltySplitter | 0xa8801b20c5744F858DE10556dCFc6650cf4D1228 | 1.0.2 | @sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol | +| SignedMultiGiveaway | 0x5A2968BC3C8129ed675C22150E02E93Dd7A4C85e | 0.0.3 | @sandbox-smart-contracts/giveaway/contracts/SignedMultiGiveaway.sol | + +## polygon + +| contract | address | version | path | +| :------------------------- | :----------------------------------------: | :-----: | :------------------------------------------------------------------------------------------- | +| AssetCreate | 0x0E0ead62734967c43BcFeC8eb7c0978e76E87dB8 | 1.2.0 | @sandbox-smart-contracts/asset/contracts/AssetCreate.sol | +| Asset | 0x07Bf0031a52efcdD5dC10dE4862E0b86f7347e07 | 1.2.0 | @sandbox-smart-contracts/asset/contracts/Asset.sol | +| AuthSuperValidator | 0xd7b21acEE83f8313936e6EB71EA31658863A300E | 1.2.0 | @sandbox-smart-contracts/asset/contracts/AuthSuperValidator.sol | +| Catalyst | 0x62a244D0f33221f24AF3DEc47D61B609D0Cd7bD3 | 1.2.0 | @sandbox-smart-contracts/asset/contracts/Catalyst.sol | +| Exchange | 0xa6c3Fe9D0F99007C4Ceeb23F5F4D74982D0b7260 | 1.0.1 | @sandbox-smart-contracts/marketplace/contracts/Exchange.sol | +| OperatorFilterSubscription | 0x2ee34F2d8B3531754a8B6F2573A6D55c2D565119 | 1.0.1 | @sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFilterSubscription.sol | +| OperatorFilterSubscription | 0xD661CaAc58842343a6aCd73e0A8De275D561a282 | 1.0.1 | @sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFilterSubscription.sol | +| OrderValidator | 0x9c299af877BCf59Bc28a4e8967De1d404d16a597 | 1.0.1 | @sandbox-smart-contracts/marketplace/contracts/OrderValidator.sol | +| RoyaltiesRegistry | 0xfaa3067b7e9a135a5c369086f76a4d29de9bcbee | 1.0.1 | @sandbox-smart-contracts/marketplace/contracts/RoyaltiesRegistry.sol | +| RoyaltyManager | 0x5D0D09DC3B11c4c6c0D94bbEaBAf1dE0B9426f04 | 1.0.2 | @sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltyManager.sol | +| RoyaltySplitter | 0xafd5f5c6e72f0f6441e4abf2ae8ff23dee21a87a | 1.0.2 | @sandbox-smart-contracts/dependency-royalty-management/contracts/RoyaltySplitter.sol | +| SignedMultiGiveaway | 0x2c0521ea8B94bdFBc981621a7bFDc3314a2C8426 | 0.0.3 | @sandbox-smart-contracts/giveaway/contracts/SignedMultiGiveaway.sol | + +## baseSepolia + +| contract | address | version | path | +| :------- | :----------------------------------------: | :-----: | :------------------------------------------------------ | +| OFTSand | 0xBdC2292b459D63516355B2C85ae0cC4C0Ef23054 | 0.0.1 | @sandbox-smart-contracts/oft-sand/contracts/OFTSand.sol | diff --git a/packages/deploy/tasks/reportReleses.ts b/packages/deploy/tasks/reportReleses.ts new file mode 100644 index 0000000000..30cb81869a --- /dev/null +++ b/packages/deploy/tasks/reportReleses.ts @@ -0,0 +1,75 @@ +import {task} from 'hardhat/config'; +import {DeploymentsManager} from 'hardhat-deploy/dist/src/DeploymentsManager'; +import {dependencies} from '../package.json'; +import {Deployment} from 'hardhat-deploy/dist/types'; +import {Align, getMarkdownTable, Row} from 'markdown-table-ts'; +import * as prettier from 'prettier'; +import * as fs from 'fs'; + +async function printDeployments( + deployments: {[k: string]: Deployment}, + deps: {[k: string]: string} +) { + const missing = []; + const found = []; + for (const k in deployments) { + const x = deployments[k]; + if (!x.metadata) { + missing.push({name: k, err: 'metadata missing'}); + continue; + } + const metadata = JSON.parse(x.metadata); + const compilationTarget = metadata.settings.compilationTarget; + const file = Object.keys(compilationTarget)[0]; + const dk = Object.keys(deps).filter((x) => file.startsWith(x)); + if (dk.length != 1) { + missing.push({name: k, err: 'dependency missing', file}); + continue; + } + found.push({ + name: k, + address: x.address, + package: dk[0], + version: deps[dk[0]], + path: Object.keys(compilationTarget)[0], + contract: Object.values(compilationTarget)[0], + }); + } + return {found, missing}; +} + +task('report', 'report deployments addresses and packages') + .addOptionalParam('fileName', 'output file', 'releases.md') + .setAction(async (args: {fileName: string}, hre) => { + const md = [ + '', + '# Deployed contracts', + ]; + for (const networkName in hre.config.networks) { + const dm = new DeploymentsManager(hre, { + ...hre.network, + name: networkName, + config: hre.config.networks[networkName], + }); + const deployments = await dm.loadDeployments(false); + const {found} = await printDeployments(deployments, dependencies); + if (found.length > 0) { + const table = getMarkdownTable({ + table: { + head: ['contract', 'address', 'version', 'path'], + body: found.map((x) => [ + x.contract, + x.address, + x.version, + x.path, + ]) as Row[], + }, + alignment: [Align.Left, Align.Center, Align.Center, Align.Left], + }); + md.push(`## ${networkName}`); + md.push(table.toString()); + } + } + const report = prettier.format(md.join('\n'), {parser: 'markdown'}); + fs.writeFileSync(args.fileName, report, 'utf-8'); + }); diff --git a/yarn.lock b/yarn.lock index f00fe2250e..11956f12ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2865,6 +2865,7 @@ __metadata: hardhat-contract-sizer: ^2.10.0 hardhat-deploy: ^0.11.43 hardhat-deploy-ethers: ^0.4.1 + markdown-table-ts: ^1.0.3 prettier: ^2.8.8 prettier-plugin-solidity: ^1.1.3 ts-node: ^10.9.2 @@ -11065,6 +11066,13 @@ __metadata: languageName: node linkType: hard +"markdown-table-ts@npm:^1.0.3": + version: 1.0.3 + resolution: "markdown-table-ts@npm:1.0.3" + checksum: af684c664f14d628cec0b554d3accc12309be02d25c7fc455bfd962e04484d2d2781c4d58dd1bfe07f5e895962b137ddbdae43e05f95ed3190f31f4035174840 + languageName: node + linkType: hard + "markdown-table@npm:^1.1.3": version: 1.1.3 resolution: "markdown-table@npm:1.1.3"