From 8d7e7bc63e6e2628fbad6f3a0262450c08b58d80 Mon Sep 17 00:00:00 2001 From: "nicoacosta.eth" Date: Tue, 5 Nov 2024 01:43:59 -0300 Subject: [PATCH] feat: create names deploy script --- script/deploy/DeployNames.s.sol | 34 +++++++++++++++++++++++++++++++++ src/names/Names.sol | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 script/deploy/DeployNames.s.sol diff --git a/script/deploy/DeployNames.s.sol b/script/deploy/DeployNames.s.sol new file mode 100644 index 0000000..ec64a70 --- /dev/null +++ b/script/deploy/DeployNames.s.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import { Script, console } from "forge-std/Script.sol"; + +import { Names } from "../../src/names/Names.sol"; + +contract DeployNames is Script { + function setUp() external {} + + function run() external { + uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY"); + uint256 superAdminPrivateKey = vm.envUint("SUPER_ADMIN_PRIVATE_KEY"); + + address deployer = vm.addr(deployerPrivateKey); + address superAdmin = vm.addr(superAdminPrivateKey); + + console.log("Deployer address:", deployer); + console.log("Super Admin address:", superAdmin); + + vm.startBroadcast(deployerPrivateKey); + + Names names = new Names(superAdmin); + console.log("Names contract address:", address(names)); + + vm.stopBroadcast(); + + vm.startBroadcast(superAdminPrivateKey); + + names.mintName("admin"); + + vm.stopBroadcast(); + } +} diff --git a/src/names/Names.sol b/src/names/Names.sol index d388c79..3d21349 100644 --- a/src/names/Names.sol +++ b/src/names/Names.sol @@ -48,7 +48,7 @@ contract Names is ERC721Enumerable, INames, Ownable { /// @notice Initializes the Names contract with basic metadata /// @dev Sets initial URIs and configures base contract parameters - constructor() Ownable(msg.sender) ERC721("Plasa Names", "NAME") ERC721Enumerable() { + constructor(address _owner) Ownable(_owner) ERC721("Plasa Names", "NAME") ERC721Enumerable() { contractURI = "some-contract-uri"; _tokenURI = "some-token-uri"; }