Skip to content

Commit

Permalink
Change DMC token name, adjust pst bridge ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
weiqiushi committed Jul 5, 2024
1 parent 79e2cf6 commit 4445e16
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contracts/dmc.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
4 changes: 2 additions & 2 deletions contracts/pst_bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 6 additions & 2 deletions scripts/deploy_dmc2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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));

0 comments on commit 4445e16

Please sign in to comment.