From 4445e163d33d51a76406d1e7df4812c726efbd74 Mon Sep 17 00:00:00 2001 From: weiqiushi Date: Fri, 5 Jul 2024 12:55:59 +0800 Subject: [PATCH] Change DMC token name, adjust pst bridge ratio --- contracts/dmc.sol | 2 +- contracts/pst_bridge.sol | 4 ++-- scripts/deploy_dmc2.ts | 8 ++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/contracts/dmc.sol b/contracts/dmc.sol index 40f83a0..783e652 100644 --- a/contracts/dmc.sol +++ b/contracts/dmc.sol @@ -12,7 +12,7 @@ contract DMC is ERC20Burnable, Ownable { _; } - constructor(uint256 _totalSupply, address[] memory initAddress, uint[] memory initAmount) ERC20("Datamall Chain Token", "DMC") Ownable(msg.sender) { + constructor(uint256 _totalSupply, address[] memory initAddress, uint[] memory initAmount) ERC20("Datamall Coin", "DMCX") Ownable(msg.sender) { uint256 totalInited = 0; for (uint i = 0; i < initAddress.length; i++) { _mint(initAddress[i], initAmount[i]); diff --git a/contracts/pst_bridge.sol b/contracts/pst_bridge.sol index 937c13b..24cf617 100644 --- a/contracts/pst_bridge.sol +++ b/contracts/pst_bridge.sol @@ -20,13 +20,13 @@ contract PSTBridge is Ownable { function registerPST(address[] calldata recvAddress, string[] calldata cookie, uint256[] calldata pstAmount) onlyOwner public { for (uint i = 0; i < recvAddress.length; i++) { - pst_to_gwt[keccak256(abi.encodePacked(recvAddress[i], cookie[i]))] = pstAmount[i] / 210; + pst_to_gwt[keccak256(abi.encodePacked(recvAddress[i], cookie[i]))] = pstAmount[i] * (10 ** 18); } } function claimGWT(string calldata cookie) public { bytes32 key = keccak256(abi.encodePacked(msg.sender, cookie)); - require(pst_to_gwt[key] > 0, "no dmc1 amount"); + require(pst_to_gwt[key] > 0, "no GWT amount"); uint256 gwtAmount = pst_to_gwt[key]; pst_to_gwt[key] = 0; diff --git a/scripts/deploy_dmc2.ts b/scripts/deploy_dmc2.ts index 4176f79..7d934e9 100644 --- a/scripts/deploy_dmc2.ts +++ b/scripts/deploy_dmc2.ts @@ -38,7 +38,7 @@ async function main() { console.log("Dividend address:", dividendAddress); let exchange = await (await upgrades.deployProxy(await ethers.getContractFactory("Exchange"), - [await dmc.getAddress(), await gwt.getAddress(), dividendAddress, 7 * 24 * 60 * 60], + [await dmc.getAddress(), gwtAddress, dividendAddress, 7 * 24 * 60 * 60], { initializer: "initialize", kind: "uups", @@ -47,10 +47,14 @@ async function main() { let exchangeAddr = await exchange.getAddress(); console.log("exchange address:", exchangeAddr); + let pst = await (await ethers.deployContract("PSTBridge", [gwtAddress])).waitForDeployment(); + let pstAddress = await pst.getAddress(); + console.log("PSTBridge address:", pstAddress); + console.log("enable mint"); await (await dmc.enableMinter([exchangeAddr])).wait(); - await (await gwt.enableMinter([exchangeAddr])).wait(); + await (await gwt.enableMinter([exchangeAddr, pstAddress])).wait(); } main().then(() => process.exit(0)); \ No newline at end of file