From 2999e40f5592dc1395b988372d0be339699be714 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Fri, 20 Dec 2024 10:51:53 +0300 Subject: [PATCH 1/7] feat: new NFT task --- packages/tasks/src/index.ts | 1 + packages/tasks/src/newNFT.ts | 29 +++++++++++++++++++ .../nft/contracts/EVMUniversalNFT.hbs | 6 ++++ .../nft/contracts/ZetaChainUniversalNFT.hbs | 6 ++++ 4 files changed, 42 insertions(+) create mode 100644 packages/tasks/src/newNFT.ts create mode 100644 packages/tasks/templates/nft/contracts/EVMUniversalNFT.hbs create mode 100644 packages/tasks/templates/nft/contracts/ZetaChainUniversalNFT.hbs diff --git a/packages/tasks/src/index.ts b/packages/tasks/src/index.ts index e03682c5..1707d328 100644 --- a/packages/tasks/src/index.ts +++ b/packages/tasks/src/index.ts @@ -16,3 +16,4 @@ export { tokensTask } from "./tokens"; export { zetachainCall } from "./zetachainCall"; export { zetachainWithdraw } from "./zetachainWithdraw"; export { zetachainWithdrawAndCall } from "./zetachainWithdrawAndCall"; +export { newNFTTask } from "./newNFT"; diff --git a/packages/tasks/src/newNFT.ts b/packages/tasks/src/newNFT.ts new file mode 100644 index 00000000..be87ba84 --- /dev/null +++ b/packages/tasks/src/newNFT.ts @@ -0,0 +1,29 @@ +import * as fs from "fs"; +import { task } from "hardhat/config"; +import { HardhatRuntimeEnvironment } from "hardhat/types"; +import * as path from "path"; + +import { processTemplates } from "./processTemplates"; + +const main = async (args: any, hre: HardhatRuntimeEnvironment) => { + processTemplates("nft", args); + + const configPath = path.resolve(process.cwd(), "hardhat.config.ts"); + let hardhatConfigContents = fs.readFileSync(configPath, "utf8"); + + // Add the omnichain tasks to the hardhat.config.ts file + // ["deploy", "interact"].forEach((task) => { + // const content = `import "./tasks/${task}";\n`; + // if (!hardhatConfigContents.includes(content)) { + // hardhatConfigContents = content + hardhatConfigContents; + // } + // }); + + fs.writeFileSync(configPath, hardhatConfigContents); +}; + +export const newNFTTask = task( + "new:nft", + "Create a new Universal NFT", + main +).addPositionalParam("name", "Name of the contract"); diff --git a/packages/tasks/templates/nft/contracts/EVMUniversalNFT.hbs b/packages/tasks/templates/nft/contracts/EVMUniversalNFT.hbs new file mode 100644 index 00000000..08d9607d --- /dev/null +++ b/packages/tasks/templates/nft/contracts/EVMUniversalNFT.hbs @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +import "@zetachain/standard-contracts/contracts/nft/contracts/evm/UniversalNFT.sol"; + +contract EVMUniversalNFT is UniversalNFT {} diff --git a/packages/tasks/templates/nft/contracts/ZetaChainUniversalNFT.hbs b/packages/tasks/templates/nft/contracts/ZetaChainUniversalNFT.hbs new file mode 100644 index 00000000..b4a89b61 --- /dev/null +++ b/packages/tasks/templates/nft/contracts/ZetaChainUniversalNFT.hbs @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.26; + +import "@zetachain/standard-contracts/contracts/nft/contracts/zetachain/UniversalNFT.sol"; + +contract ZetaChainUniversalNFT is UniversalNFT {} From 706059149b33338b7ed2008a8f83f32e60332795 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Fri, 20 Dec 2024 12:10:59 +0300 Subject: [PATCH 2/7] wip --- packages/tasks/src/newNFT.ts | 7 +------ .../{EVMUniversalNFT.hbs => nft/EVMUniversalNFT.sol.hbs} | 0 .../ZetaChainUniversalNFT.sol.hbs} | 0 .../factories/contracts/SwapHelperLib__factory.ts | 2 +- 4 files changed, 2 insertions(+), 7 deletions(-) rename packages/tasks/templates/nft/contracts/{EVMUniversalNFT.hbs => nft/EVMUniversalNFT.sol.hbs} (100%) rename packages/tasks/templates/nft/contracts/{ZetaChainUniversalNFT.hbs => nft/ZetaChainUniversalNFT.sol.hbs} (100%) diff --git a/packages/tasks/src/newNFT.ts b/packages/tasks/src/newNFT.ts index be87ba84..f186c92b 100644 --- a/packages/tasks/src/newNFT.ts +++ b/packages/tasks/src/newNFT.ts @@ -7,7 +7,6 @@ import { processTemplates } from "./processTemplates"; const main = async (args: any, hre: HardhatRuntimeEnvironment) => { processTemplates("nft", args); - const configPath = path.resolve(process.cwd(), "hardhat.config.ts"); let hardhatConfigContents = fs.readFileSync(configPath, "utf8"); @@ -22,8 +21,4 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { fs.writeFileSync(configPath, hardhatConfigContents); }; -export const newNFTTask = task( - "new:nft", - "Create a new Universal NFT", - main -).addPositionalParam("name", "Name of the contract"); +export const newNFTTask = task("new:nft", "Create a new Universal NFT", main); diff --git a/packages/tasks/templates/nft/contracts/EVMUniversalNFT.hbs b/packages/tasks/templates/nft/contracts/nft/EVMUniversalNFT.sol.hbs similarity index 100% rename from packages/tasks/templates/nft/contracts/EVMUniversalNFT.hbs rename to packages/tasks/templates/nft/contracts/nft/EVMUniversalNFT.sol.hbs diff --git a/packages/tasks/templates/nft/contracts/ZetaChainUniversalNFT.hbs b/packages/tasks/templates/nft/contracts/nft/ZetaChainUniversalNFT.sol.hbs similarity index 100% rename from packages/tasks/templates/nft/contracts/ZetaChainUniversalNFT.hbs rename to packages/tasks/templates/nft/contracts/nft/ZetaChainUniversalNFT.sol.hbs diff --git a/typechain-types/factories/contracts/SwapHelperLib__factory.ts b/typechain-types/factories/contracts/SwapHelperLib__factory.ts index 297f2e3f..19079f0c 100644 --- a/typechain-types/factories/contracts/SwapHelperLib__factory.ts +++ b/typechain-types/factories/contracts/SwapHelperLib__factory.ts @@ -136,7 +136,7 @@ const _abi = [ ] as const; const _bytecode = - "0x6111d5610052600b82828239805160001a6073146045577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806354ce67ae14610045578063c63585cc14610075575b600080fd5b61005f600480360381019061005a9190610c69565b6100a5565b60405161006c9190610cdf565b60405180910390f35b61008f600480360381019061008a9190610cfa565b610489565b60405161009c9190610d5c565b60405180910390f35b6000808573ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101179190610d8c565b905060008673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610166573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018a9190610d8c565b90506060600267ffffffffffffffff8111156101a9576101a8610db9565b5b6040519080825280602002602001820160405280156101d75781602001602082028036833780820191505090505b50905086816000815181106101ef576101ee610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050858160018151811061023e5761023d610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060006102858487846104fb565b9050600367ffffffffffffffff8111156102a2576102a1610db9565b5b6040519080825280602002602001820160405280156102d05781602001602082028036833780820191505090505b50915087826000815181106102e8576102e7610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828260018151811061033757610336610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050868260028151811061038657610385610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060006103cd8588856104fb565b905080600182516103de9190610e46565b815181106103ef576103ee610de8565b5b602002602001015182600184516104069190610e46565b8151811061041757610416610de8565b5b6020026020010151116104515780600182516104339190610e46565b8151811061044457610443610de8565b5b602002602001015161047a565b81600183516104609190610e46565b8151811061047157610470610de8565b5b60200260200101515b95505050505050949350505050565b60008060006104988585610677565b915091508582826040516020016104b0929190610ec2565b604051602081830303815290604052805190602001206040516020016104d7929190610fbc565b6040516020818303038152906040528051906020012060001c925050509392505050565b6060600282511015610539576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815167ffffffffffffffff81111561055457610553610db9565b5b6040519080825280602002602001820160405280156105825781602001602082028036833780820191505090505b509050828160008151811061059a57610599610de8565b5b60200260200101818152505060005b600183516105b79190610e46565b81101561066f5760008061060c878685815181106105d8576105d7610de8565b5b6020026020010151876001876105ee9190610ffe565b815181106105ff576105fe610de8565b5b6020026020010151610791565b9150915061063584848151811061062657610625610de8565b5b60200260200101518383610894565b846001856106439190610ffe565b8151811061065457610653610de8565b5b602002602001018181525050505080806001019150506105a9565b509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036106df576040517fcb1e7cfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161061071957828461071c565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361078a576040517f78b507da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60008060006107a08585610988565b5090506000806107b1888888610aa2565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156107fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081f91906110b4565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691508273ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161461087e578082610881565b81815b8095508196505050505050935093915050565b60008084036108cf576040517f098fb56100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008314806108de5750600082145b15610915576040517fbb55fd2700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061092c6103e586610b2990919063ffffffff16565b905060006109438483610b2990919063ffffffff16565b9050600061096e836109606103e889610b2990919063ffffffff16565b610b8990919063ffffffff16565b9050808261097c9190611136565b93505050509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036109f0576040517fbd969eb000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610610a2a578284610a2d565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610a9b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60008373ffffffffffffffffffffffffffffffffffffffff1663e6a4390584846040518363ffffffff1660e01b8152600401610adf929190611176565b602060405180830381865afa158015610afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b209190610d8c565b90509392505050565b600080831480610b4d5750818383850292508281610b4a57610b49611107565b5b04145b610b83576040517f5797276a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b92915050565b6000818301905082811015610bca576040517fa259879500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b92915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c0082610bd5565b9050919050565b610c1081610bf5565b8114610c1b57600080fd5b50565b600081359050610c2d81610c07565b92915050565b6000819050919050565b610c4681610c33565b8114610c5157600080fd5b50565b600081359050610c6381610c3d565b92915050565b60008060008060808587031215610c8357610c82610bd0565b5b6000610c9187828801610c1e565b9450506020610ca287828801610c1e565b9350506040610cb387828801610c1e565b9250506060610cc487828801610c54565b91505092959194509250565b610cd981610c33565b82525050565b6000602082019050610cf46000830184610cd0565b92915050565b600080600060608486031215610d1357610d12610bd0565b5b6000610d2186828701610c1e565b9350506020610d3286828701610c1e565b9250506040610d4386828701610c1e565b9150509250925092565b610d5681610bf5565b82525050565b6000602082019050610d716000830184610d4d565b92915050565b600081519050610d8681610c07565b92915050565b600060208284031215610da257610da1610bd0565b5b6000610db084828501610d77565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610e5182610c33565b9150610e5c83610c33565b9250828203905081811115610e7457610e73610e17565b5b92915050565b60008160601b9050919050565b6000610e9282610e7a565b9050919050565b6000610ea482610e87565b9050919050565b610ebc610eb782610bf5565b610e99565b82525050565b6000610ece8285610eab565b601482019150610ede8284610eab565b6014820191508190509392505050565b600081905092915050565b7fff00000000000000000000000000000000000000000000000000000000000000600082015250565b6000610f2f600183610eee565b9150610f3a82610ef9565b600182019050919050565b6000819050919050565b6000819050919050565b610f6a610f6582610f45565b610f4f565b82525050565b7f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f600082015250565b6000610fa6602083610eee565b9150610fb182610f70565b602082019050919050565b6000610fc782610f22565b9150610fd38285610eab565b601482019150610fe38284610f59565b602082019150610ff282610f99565b91508190509392505050565b600061100982610c33565b915061101483610c33565b925082820190508082111561102c5761102b610e17565b5b92915050565b60006dffffffffffffffffffffffffffff82169050919050565b61105581611032565b811461106057600080fd5b50565b6000815190506110728161104c565b92915050565b600063ffffffff82169050919050565b61109181611078565b811461109c57600080fd5b50565b6000815190506110ae81611088565b92915050565b6000806000606084860312156110cd576110cc610bd0565b5b60006110db86828701611063565b93505060206110ec86828701611063565b92505060406110fd8682870161109f565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061114182610c33565b915061114c83610c33565b92508261115c5761115b611107565b5b828204905092915050565b61117081610bf5565b82525050565b600060408201905061118b6000830185611167565b6111986020830184611167565b939250505056fea2646970667358221220dadd3e100ef04c85d5a02036fa4da1104bb792971aa4fa9f47b428d6687d283564736f6c634300081a0033"; + "0x6111d5610052600b82828239805160001a6073146045577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806354ce67ae14610045578063c63585cc14610075575b600080fd5b61005f600480360381019061005a9190610c69565b6100a5565b60405161006c9190610cdf565b60405180910390f35b61008f600480360381019061008a9190610cfa565b610489565b60405161009c9190610d5c565b60405180910390f35b6000808573ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101179190610d8c565b905060008673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610166573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018a9190610d8c565b90506060600267ffffffffffffffff8111156101a9576101a8610db9565b5b6040519080825280602002602001820160405280156101d75781602001602082028036833780820191505090505b50905086816000815181106101ef576101ee610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050858160018151811061023e5761023d610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060006102858487846104fb565b9050600367ffffffffffffffff8111156102a2576102a1610db9565b5b6040519080825280602002602001820160405280156102d05781602001602082028036833780820191505090505b50915087826000815181106102e8576102e7610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828260018151811061033757610336610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050868260028151811061038657610385610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060006103cd8588856104fb565b905080600182516103de9190610e46565b815181106103ef576103ee610de8565b5b602002602001015182600184516104069190610e46565b8151811061041757610416610de8565b5b6020026020010151116104515780600182516104339190610e46565b8151811061044457610443610de8565b5b602002602001015161047a565b81600183516104609190610e46565b8151811061047157610470610de8565b5b60200260200101515b95505050505050949350505050565b60008060006104988585610677565b915091508582826040516020016104b0929190610ec2565b604051602081830303815290604052805190602001206040516020016104d7929190610fbc565b6040516020818303038152906040528051906020012060001c925050509392505050565b6060600282511015610539576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815167ffffffffffffffff81111561055457610553610db9565b5b6040519080825280602002602001820160405280156105825781602001602082028036833780820191505090505b509050828160008151811061059a57610599610de8565b5b60200260200101818152505060005b600183516105b79190610e46565b81101561066f5760008061060c878685815181106105d8576105d7610de8565b5b6020026020010151876001876105ee9190610ffe565b815181106105ff576105fe610de8565b5b6020026020010151610791565b9150915061063584848151811061062657610625610de8565b5b60200260200101518383610894565b846001856106439190610ffe565b8151811061065457610653610de8565b5b602002602001018181525050505080806001019150506105a9565b509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036106df576040517fcb1e7cfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161061071957828461071c565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361078a576040517f78b507da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60008060006107a08585610988565b5090506000806107b1888888610aa2565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156107fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081f91906110b4565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691508273ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161461087e578082610881565b81815b8095508196505050505050935093915050565b60008084036108cf576040517f098fb56100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008314806108de5750600082145b15610915576040517fbb55fd2700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061092c6103e586610b2990919063ffffffff16565b905060006109438483610b2990919063ffffffff16565b9050600061096e836109606103e889610b2990919063ffffffff16565b610b8990919063ffffffff16565b9050808261097c9190611136565b93505050509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036109f0576040517fbd969eb000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610610a2a578284610a2d565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610a9b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60008373ffffffffffffffffffffffffffffffffffffffff1663e6a4390584846040518363ffffffff1660e01b8152600401610adf929190611176565b602060405180830381865afa158015610afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b209190610d8c565b90509392505050565b600080831480610b4d5750818383850292508281610b4a57610b49611107565b5b04145b610b83576040517f5797276a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b92915050565b6000818301905082811015610bca576040517fa259879500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b92915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c0082610bd5565b9050919050565b610c1081610bf5565b8114610c1b57600080fd5b50565b600081359050610c2d81610c07565b92915050565b6000819050919050565b610c4681610c33565b8114610c5157600080fd5b50565b600081359050610c6381610c3d565b92915050565b60008060008060808587031215610c8357610c82610bd0565b5b6000610c9187828801610c1e565b9450506020610ca287828801610c1e565b9350506040610cb387828801610c1e565b9250506060610cc487828801610c54565b91505092959194509250565b610cd981610c33565b82525050565b6000602082019050610cf46000830184610cd0565b92915050565b600080600060608486031215610d1357610d12610bd0565b5b6000610d2186828701610c1e565b9350506020610d3286828701610c1e565b9250506040610d4386828701610c1e565b9150509250925092565b610d5681610bf5565b82525050565b6000602082019050610d716000830184610d4d565b92915050565b600081519050610d8681610c07565b92915050565b600060208284031215610da257610da1610bd0565b5b6000610db084828501610d77565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610e5182610c33565b9150610e5c83610c33565b9250828203905081811115610e7457610e73610e17565b5b92915050565b60008160601b9050919050565b6000610e9282610e7a565b9050919050565b6000610ea482610e87565b9050919050565b610ebc610eb782610bf5565b610e99565b82525050565b6000610ece8285610eab565b601482019150610ede8284610eab565b6014820191508190509392505050565b600081905092915050565b7fff00000000000000000000000000000000000000000000000000000000000000600082015250565b6000610f2f600183610eee565b9150610f3a82610ef9565b600182019050919050565b6000819050919050565b6000819050919050565b610f6a610f6582610f45565b610f4f565b82525050565b7f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f600082015250565b6000610fa6602083610eee565b9150610fb182610f70565b602082019050919050565b6000610fc782610f22565b9150610fd38285610eab565b601482019150610fe38284610f59565b602082019150610ff282610f99565b91508190509392505050565b600061100982610c33565b915061101483610c33565b925082820190508082111561102c5761102b610e17565b5b92915050565b60006dffffffffffffffffffffffffffff82169050919050565b61105581611032565b811461106057600080fd5b50565b6000815190506110728161104c565b92915050565b600063ffffffff82169050919050565b61109181611078565b811461109c57600080fd5b50565b6000815190506110ae81611088565b92915050565b6000806000606084860312156110cd576110cc610bd0565b5b60006110db86828701611063565b93505060206110ec86828701611063565b92505060406110fd8682870161109f565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061114182610c33565b915061114c83610c33565b92508261115c5761115b611107565b5b828204905092915050565b61117081610bf5565b82525050565b600060408201905061118b6000830185611167565b6111986020830184611167565b939250505056fea2646970667358221220f8a7cdfbaca1847a7b2c275e0e78c76b49768d9d7d65b0a93b0510b44467fa2864736f6c634300081a0033"; type SwapHelperLibConstructorParams = | [signer?: Signer] From 18b1deaaf9ec24988cccdd6ccd44045406612a9d Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Fri, 20 Dec 2024 15:34:17 +0300 Subject: [PATCH 3/7] wip --- packages/tasks/src/newNFT.ts | 10 +++------- packages/tasks/src/processTemplates.ts | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/tasks/src/newNFT.ts b/packages/tasks/src/newNFT.ts index f186c92b..5050da4c 100644 --- a/packages/tasks/src/newNFT.ts +++ b/packages/tasks/src/newNFT.ts @@ -10,13 +10,9 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { const configPath = path.resolve(process.cwd(), "hardhat.config.ts"); let hardhatConfigContents = fs.readFileSync(configPath, "utf8"); - // Add the omnichain tasks to the hardhat.config.ts file - // ["deploy", "interact"].forEach((task) => { - // const content = `import "./tasks/${task}";\n`; - // if (!hardhatConfigContents.includes(content)) { - // hardhatConfigContents = content + hardhatConfigContents; - // } - // }); + hardhatConfigContents = + `import "@zetachain/standard-contracts/contracts/nft/tasks"\n` + + hardhatConfigContents; fs.writeFileSync(configPath, hardhatConfigContents); }; diff --git a/packages/tasks/src/processTemplates.ts b/packages/tasks/src/processTemplates.ts index e1c2c40c..60e830ce 100644 --- a/packages/tasks/src/processTemplates.ts +++ b/packages/tasks/src/processTemplates.ts @@ -62,7 +62,7 @@ const prepareData = (args: any) => { return pair; } }); - const contractName = sanitizeSolidityFunctionName(args.name); + const contractName = sanitizeSolidityFunctionName(args.name || "Contract"); const casts = pairs.map((p: any) => { const n = capitalizeFirstChar(p[0]); const type = p[1]; From 769bae51e80dca3db4c81d17622c7bb8b739799c Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Fri, 20 Dec 2024 15:54:10 +0300 Subject: [PATCH 4/7] wip --- contracts/nft/EVMUniversalNFT.sol | 6 +++++ contracts/nft/ZetaChainUniversalNFT.sol | 6 +++++ hardhat.config.ts | 1 + packages/tasks/src/newToken.ts | 24 +++++++++++++++++++ .../contracts/nft/EVMUniversalToken.sol.hbs | 6 +++++ .../nft/ZetaChainUniversalToken.sol.hbs | 6 +++++ 6 files changed, 49 insertions(+) create mode 100644 contracts/nft/EVMUniversalNFT.sol create mode 100644 contracts/nft/ZetaChainUniversalNFT.sol create mode 100644 packages/tasks/src/newToken.ts create mode 100644 packages/tasks/templates/token/contracts/nft/EVMUniversalToken.sol.hbs create mode 100644 packages/tasks/templates/token/contracts/nft/ZetaChainUniversalToken.sol.hbs diff --git a/contracts/nft/EVMUniversalNFT.sol b/contracts/nft/EVMUniversalNFT.sol new file mode 100644 index 00000000..08d9607d --- /dev/null +++ b/contracts/nft/EVMUniversalNFT.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +import "@zetachain/standard-contracts/contracts/nft/contracts/evm/UniversalNFT.sol"; + +contract EVMUniversalNFT is UniversalNFT {} diff --git a/contracts/nft/ZetaChainUniversalNFT.sol b/contracts/nft/ZetaChainUniversalNFT.sol new file mode 100644 index 00000000..b4a89b61 --- /dev/null +++ b/contracts/nft/ZetaChainUniversalNFT.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.26; + +import "@zetachain/standard-contracts/contracts/nft/contracts/zetachain/UniversalNFT.sol"; + +contract ZetaChainUniversalNFT is UniversalNFT {} diff --git a/hardhat.config.ts b/hardhat.config.ts index 88413b73..f4ca68b1 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,3 +1,4 @@ +import "@zetachain/standard-contracts/contracts/nft/tasks" import "@nomicfoundation/hardhat-toolbox"; import "./packages/tasks/src"; diff --git a/packages/tasks/src/newToken.ts b/packages/tasks/src/newToken.ts new file mode 100644 index 00000000..9e1942e0 --- /dev/null +++ b/packages/tasks/src/newToken.ts @@ -0,0 +1,24 @@ +import * as fs from "fs"; +import { task } from "hardhat/config"; +import { HardhatRuntimeEnvironment } from "hardhat/types"; +import * as path from "path"; + +import { processTemplates } from "./processTemplates"; + +const main = async (args: any, hre: HardhatRuntimeEnvironment) => { + processTemplates("token", args); + const configPath = path.resolve(process.cwd(), "hardhat.config.ts"); + let hardhatConfigContents = fs.readFileSync(configPath, "utf8"); + + hardhatConfigContents = + `import "@zetachain/standard-contracts/contracts/token/tasks"\n` + + hardhatConfigContents; + + fs.writeFileSync(configPath, hardhatConfigContents); +}; + +export const newTokenTask = task( + "new:token", + "Create a new universal token", + main +); diff --git a/packages/tasks/templates/token/contracts/nft/EVMUniversalToken.sol.hbs b/packages/tasks/templates/token/contracts/nft/EVMUniversalToken.sol.hbs new file mode 100644 index 00000000..b73114b7 --- /dev/null +++ b/packages/tasks/templates/token/contracts/nft/EVMUniversalToken.sol.hbs @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +import "@zetachain/standard-contracts/contracts/token/contracts/evm/UniversalToken.sol"; + +contract EVMUniversalToken is UniversalToken {} diff --git a/packages/tasks/templates/token/contracts/nft/ZetaChainUniversalToken.sol.hbs b/packages/tasks/templates/token/contracts/nft/ZetaChainUniversalToken.sol.hbs new file mode 100644 index 00000000..1d7d0c96 --- /dev/null +++ b/packages/tasks/templates/token/contracts/nft/ZetaChainUniversalToken.sol.hbs @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +import "@zetachain/standard-contracts/contracts/token/contracts/zetachain/UniversalToken.sol"; + +contract ZetaChainUniversalToken is UniversalToken {} From db22797bca3b26aec12bbeff26b74e8b859321ea Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Fri, 20 Dec 2024 15:55:19 +0300 Subject: [PATCH 5/7] wip --- contracts/nft/EVMUniversalNFT.sol | 6 ------ contracts/nft/ZetaChainUniversalNFT.sol | 6 ------ hardhat.config.ts | 1 - packages/tasks/src/index.ts | 1 + .../contracts/{nft => token}/EVMUniversalToken.sol.hbs | 0 .../{nft => token}/ZetaChainUniversalToken.sol.hbs | 0 6 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 contracts/nft/EVMUniversalNFT.sol delete mode 100644 contracts/nft/ZetaChainUniversalNFT.sol rename packages/tasks/templates/token/contracts/{nft => token}/EVMUniversalToken.sol.hbs (100%) rename packages/tasks/templates/token/contracts/{nft => token}/ZetaChainUniversalToken.sol.hbs (100%) diff --git a/contracts/nft/EVMUniversalNFT.sol b/contracts/nft/EVMUniversalNFT.sol deleted file mode 100644 index 08d9607d..00000000 --- a/contracts/nft/EVMUniversalNFT.sol +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.26; - -import "@zetachain/standard-contracts/contracts/nft/contracts/evm/UniversalNFT.sol"; - -contract EVMUniversalNFT is UniversalNFT {} diff --git a/contracts/nft/ZetaChainUniversalNFT.sol b/contracts/nft/ZetaChainUniversalNFT.sol deleted file mode 100644 index b4a89b61..00000000 --- a/contracts/nft/ZetaChainUniversalNFT.sol +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.26; - -import "@zetachain/standard-contracts/contracts/nft/contracts/zetachain/UniversalNFT.sol"; - -contract ZetaChainUniversalNFT is UniversalNFT {} diff --git a/hardhat.config.ts b/hardhat.config.ts index f4ca68b1..88413b73 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,4 +1,3 @@ -import "@zetachain/standard-contracts/contracts/nft/tasks" import "@nomicfoundation/hardhat-toolbox"; import "./packages/tasks/src"; diff --git a/packages/tasks/src/index.ts b/packages/tasks/src/index.ts index 1707d328..2d7fb1f4 100644 --- a/packages/tasks/src/index.ts +++ b/packages/tasks/src/index.ts @@ -17,3 +17,4 @@ export { zetachainCall } from "./zetachainCall"; export { zetachainWithdraw } from "./zetachainWithdraw"; export { zetachainWithdrawAndCall } from "./zetachainWithdrawAndCall"; export { newNFTTask } from "./newNFT"; +export { newTokenTask } from "./newToken"; diff --git a/packages/tasks/templates/token/contracts/nft/EVMUniversalToken.sol.hbs b/packages/tasks/templates/token/contracts/token/EVMUniversalToken.sol.hbs similarity index 100% rename from packages/tasks/templates/token/contracts/nft/EVMUniversalToken.sol.hbs rename to packages/tasks/templates/token/contracts/token/EVMUniversalToken.sol.hbs diff --git a/packages/tasks/templates/token/contracts/nft/ZetaChainUniversalToken.sol.hbs b/packages/tasks/templates/token/contracts/token/ZetaChainUniversalToken.sol.hbs similarity index 100% rename from packages/tasks/templates/token/contracts/nft/ZetaChainUniversalToken.sol.hbs rename to packages/tasks/templates/token/contracts/token/ZetaChainUniversalToken.sol.hbs From 6bb3ba1f35dfc4f9396980f1c54d4afada3b55ce Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Mon, 23 Dec 2024 12:00:57 +0300 Subject: [PATCH 6/7] lint --- hardhat.config.ts | 1 + packages/tasks/src/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 88413b73..d511a16f 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,3 +1,4 @@ +import "@zetachain/standard-contracts/contracts/nft/tasks"; import "@nomicfoundation/hardhat-toolbox"; import "./packages/tasks/src"; diff --git a/packages/tasks/src/index.ts b/packages/tasks/src/index.ts index 2d7fb1f4..1188908a 100644 --- a/packages/tasks/src/index.ts +++ b/packages/tasks/src/index.ts @@ -7,6 +7,8 @@ export { evmDepositAndCall } from "./evmDepositAndCall"; export { faucetTask } from "./faucet"; export { feesTask } from "./fees"; export { messagingTask } from "./messaging"; +export { newNFTTask } from "./newNFT"; +export { newTokenTask } from "./newToken"; export { omnichainTask } from "./omnichain"; export { poolsTask } from "./pools"; export { sendBTCTask } from "./sendBTC"; @@ -16,5 +18,3 @@ export { tokensTask } from "./tokens"; export { zetachainCall } from "./zetachainCall"; export { zetachainWithdraw } from "./zetachainWithdraw"; export { zetachainWithdrawAndCall } from "./zetachainWithdrawAndCall"; -export { newNFTTask } from "./newNFT"; -export { newTokenTask } from "./newToken"; From 3d576a8a13079143c2199150f784f8968791de93 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Mon, 23 Dec 2024 12:01:14 +0300 Subject: [PATCH 7/7] lint --- hardhat.config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index d511a16f..88413b73 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,4 +1,3 @@ -import "@zetachain/standard-contracts/contracts/nft/tasks"; import "@nomicfoundation/hardhat-toolbox"; import "./packages/tasks/src";