From 3dc1d8f475cd47d023a0226bfcf145f00db3adf9 Mon Sep 17 00:00:00 2001 From: Michael Kim Date: Mon, 25 Sep 2023 12:13:02 +0900 Subject: [PATCH] Change deploy scripts --- active_contracts.json | 24 +++++++------- packages/contracts-lib/package.json | 2 +- packages/contracts/contracts/Token.sol | 6 ++-- .../bosagora_devnet/00_linkCollection.ts | 2 +- .../deploy/bosagora_devnet/01_token.ts | 31 +++++++------------ .../bosagora_devnet/02_validatorCollection.ts | 4 +-- packages/contracts/package.json | 2 +- packages/faker/package.json | 2 +- packages/relay/package.json | 2 +- 9 files changed, 33 insertions(+), 42 deletions(-) diff --git a/active_contracts.json b/active_contracts.json index b3cc691b..4924eaa6 100644 --- a/active_contracts.json +++ b/active_contracts.json @@ -1,23 +1,23 @@ { "bosagora_mainnet": { "Token": "0xFDa3d1ff3C570c2f76c2157Ef7A8640A75794eD9", - "ValidatorCollection": "0x43Bc973075748Afc704D9b59B156f9b9E24b73fb", - "TokenPrice": "0x2473770AdCAB3253504f8d9B46dA22417037a2ce", - "ShopCollection": "0x3705f330B593b28B3663a3C4BC2c7C5565988d18", - "Ledger": "0x52bB9258733086243Ad1a4A818945F94BCAd05B9" + "ValidatorCollection": "0x4Ca91738C7cD24895467c6d550D96BE8dC4b33AA", + "TokenPrice": "0xF396e42687C4ba2d1E2A65792B7165Ee8010Fdfe", + "ShopCollection": "0x979a62090BDCff36F2e140F6915fbAdA7510cb6a", + "Ledger": "0x12c316e0358d914A211A3d477db912A503cFCc21" }, "bosagora_testnet": { "Token": "0xFDa3d1ff3C570c2f76c2157Ef7A8640A75794eD9", - "ValidatorCollection": "0x43Bc973075748Afc704D9b59B156f9b9E24b73fb", - "TokenPrice": "0x2473770AdCAB3253504f8d9B46dA22417037a2ce", - "ShopCollection": "0x3705f330B593b28B3663a3C4BC2c7C5565988d18", - "Ledger": "0x52bB9258733086243Ad1a4A818945F94BCAd05B9" + "ValidatorCollection": "0x4Ca91738C7cD24895467c6d550D96BE8dC4b33AA", + "TokenPrice": "0xF396e42687C4ba2d1E2A65792B7165Ee8010Fdfe", + "ShopCollection": "0x979a62090BDCff36F2e140F6915fbAdA7510cb6a", + "Ledger": "0x12c316e0358d914A211A3d477db912A503cFCc21" }, "bosagora_devnet": { "Token": "0xFDa3d1ff3C570c2f76c2157Ef7A8640A75794eD9", - "ValidatorCollection": "0x43Bc973075748Afc704D9b59B156f9b9E24b73fb", - "TokenPrice": "0x2473770AdCAB3253504f8d9B46dA22417037a2ce", - "ShopCollection": "0x3705f330B593b28B3663a3C4BC2c7C5565988d18", - "Ledger": "0x52bB9258733086243Ad1a4A818945F94BCAd05B9" + "ValidatorCollection": "0x4Ca91738C7cD24895467c6d550D96BE8dC4b33AA", + "TokenPrice": "0xF396e42687C4ba2d1E2A65792B7165Ee8010Fdfe", + "ShopCollection": "0x979a62090BDCff36F2e140F6915fbAdA7510cb6a", + "Ledger": "0x12c316e0358d914A211A3d477db912A503cFCc21" } } diff --git a/packages/contracts-lib/package.json b/packages/contracts-lib/package.json index 517e27d6..1a4027c2 100644 --- a/packages/contracts-lib/package.json +++ b/packages/contracts-lib/package.json @@ -1,6 +1,6 @@ { "name": "dms-osx-lib", - "version": "1.0.13", + "version": "1.0.14", "description": "", "main": "dist/bundle-cjs.js", "module": "dist/bundle-esm.js", diff --git a/packages/contracts/contracts/Token.sol b/packages/contracts/contracts/Token.sol index e2c740f6..26c38e0a 100644 --- a/packages/contracts/contracts/Token.sol +++ b/packages/contracts/contracts/Token.sol @@ -5,10 +5,10 @@ pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract Token is ERC20 { - uint256 public constant INITIAL_SUPPLY = 100000000000000000000000000; + uint256 public constant INITIAL_SUPPLY = 10000000000000000000000000000; - constructor(string memory tokenName, string memory tokenSymbol) ERC20(tokenName, tokenSymbol) { - _mint(msg.sender, INITIAL_SUPPLY); + constructor(address owner, string memory tokenName, string memory tokenSymbol) ERC20(tokenName, tokenSymbol) { + _mint(owner, INITIAL_SUPPLY); } function decimals() public view virtual override returns (uint8) { diff --git a/packages/contracts/deploy/bosagora_devnet/00_linkCollection.ts b/packages/contracts/deploy/bosagora_devnet/00_linkCollection.ts index 807255b0..e662918f 100644 --- a/packages/contracts/deploy/bosagora_devnet/00_linkCollection.ts +++ b/packages/contracts/deploy/bosagora_devnet/00_linkCollection.ts @@ -17,7 +17,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const { network } = hre; const { deployments, getNamedAccounts, ethers } = hre; const { deploy } = deployments; - const { deployer, foundation, linkValidator1, linkValidator2, linkValidator3 } = await getNamedAccounts(); + const { deployer, owner, foundation, linkValidator1, linkValidator2, linkValidator3 } = await getNamedAccounts(); const validators = [linkValidator1, linkValidator2, linkValidator3]; const officialLinkCollectionAddress = LINK_COLLECTION_ADDRESSES[network.name]; diff --git a/packages/contracts/deploy/bosagora_devnet/01_token.ts b/packages/contracts/deploy/bosagora_devnet/01_token.ts index 4c56e4d5..74bfe494 100644 --- a/packages/contracts/deploy/bosagora_devnet/01_token.ts +++ b/packages/contracts/deploy/bosagora_devnet/01_token.ts @@ -14,38 +14,29 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const { deployments, getNamedAccounts, ethers } = hre; const { deploy } = deployments; - const { deployer, foundation } = await getNamedAccounts(); + const { deployer, owner, foundation } = await getNamedAccounts(); const deployResult = await deploy("Token", { from: deployer, - args: ["Sample", "SAM"], + args: [owner, "Sample", "SAM"], log: true, }); if (deployResult.newlyDeployed) { - const assetAmount = Amount.make(10_000_000, 18); const contractAddress = await getContractAddress("Token", hre); const contract = (await ethers.getContractAt("Token", contractAddress)) as Token; - const tx = await contract.connect(await ethers.getSigner(deployer)).transfer(foundation, assetAmount.value); - console.log(`Transfer token to foundation (tx: ${tx.hash})...`); - await tx.wait(); + + const assetAmount = Amount.make(10_000_000, 18); + const tx1 = await contract.connect(await ethers.getSigner(owner)).transfer(foundation, assetAmount.value); + console.log(`Transfer token to foundation (tx: ${tx1.hash})...`); + await tx1.wait(); const users = JSON.parse(fs.readFileSync("./deploy/data/users.json")); + const addresses = users.map((m: { address: string }) => m.address); const userAmount = Amount.make(100_000, 18); - for (const user of users) { - const tx2 = await contract - .connect(await ethers.getSigner(deployer)) - .transfer(user.address, userAmount.value); - console.log(`Transfer token to user ${user.address} (tx: ${tx2.hash})...`); - await tx2.wait(); - } - // - // const users = JSON.parse(fs.readFileSync("./deploy/data/users.json")); - // const addresses = users.map((m: { address: string }) => m.address); - // const userAmount = Amount.make(100_000, 18); - // const tx2 = await contract.connect(await ethers.getSigner(deployer)).multiTransfer(addresses, userAmount.value); - // console.log(`Transfer token to users (tx: ${tx2.hash})...`); - // await tx2.wait(); + const tx2 = await contract.connect(await ethers.getSigner(owner)).multiTransfer(addresses, userAmount.value); + console.log(`Transfer token to users (tx: ${tx2.hash})...`); + await tx2.wait(); } }; diff --git a/packages/contracts/deploy/bosagora_devnet/02_validatorCollection.ts b/packages/contracts/deploy/bosagora_devnet/02_validatorCollection.ts index 5c33c1c7..fb02f9ac 100644 --- a/packages/contracts/deploy/bosagora_devnet/02_validatorCollection.ts +++ b/packages/contracts/deploy/bosagora_devnet/02_validatorCollection.ts @@ -13,7 +13,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const { deployments, getNamedAccounts, ethers } = hre; const { deploy } = deployments; - const { deployer, validator1, validator2, validator3, validator4, validator5 } = await getNamedAccounts(); + const { deployer, owner, validator1, validator2, validator3, validator4, validator5 } = await getNamedAccounts(); const validators = [validator1, validator2, validator3, validator4, validator5]; const tokenAddress = await getContractAddress("Token", hre); @@ -35,7 +35,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const depositAmount = Amount.make(50_000, 18); for (const elem of validators) { - await tokenContract.connect(await ethers.getSigner(deployer)).transfer(elem, amount.value); + await tokenContract.connect(await ethers.getSigner(owner)).transfer(elem, amount.value); } for (const elem of validators) { diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 08b426bc..69e27973 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,6 +1,6 @@ { "name": "dms-osx-artifacts", - "version": "1.0.13", + "version": "1.0.14", "description": "Smart contracts that decentralized point systems", "files": [ "**/*.sol" diff --git a/packages/faker/package.json b/packages/faker/package.json index 87cfd3fc..5328332a 100644 --- a/packages/faker/package.json +++ b/packages/faker/package.json @@ -46,7 +46,7 @@ "assert": "^2.0.0", "axios": "^0.26.0", "chai": "^4.3.7", - "dms-osx-artifacts": "^1.0.13", + "dms-osx-artifacts": "^1.0.14", "dotenv": "^10.0.0", "ethereum-waffle": "^4.0.10", "ethers": "^5.7.0", diff --git a/packages/relay/package.json b/packages/relay/package.json index 37d191bb..28786f7d 100644 --- a/packages/relay/package.json +++ b/packages/relay/package.json @@ -56,7 +56,7 @@ "chai": "^4.3.7", "chai-http": "^4.3.7", "cors": "^2.8.5", - "dms-osx-artifacts": "^1.0.13", + "dms-osx-artifacts": "^1.0.14", "dotenv": "^10.0.0", "ethereum-waffle": "^4.0.10", "ethers": "^5.7.0",