Skip to content

Commit

Permalink
Change deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelKim20 committed Sep 25, 2023
1 parent 8d5057d commit bc92fc1
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 42 deletions.
24 changes: 12 additions & 12 deletions active_contracts.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
2 changes: 1 addition & 1 deletion packages/contracts-lib/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 3 additions & 3 deletions packages/contracts/contracts/Token.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
31 changes: 11 additions & 20 deletions packages/contracts/deploy/bosagora_devnet/01_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/faker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit bc92fc1

Please sign in to comment.