From c9cb0d1be95d61544f6db480105727083d6da5af Mon Sep 17 00:00:00 2001 From: catel <> Date: Wed, 6 Sep 2023 19:57:32 +0800 Subject: [PATCH] Create share event add decline ratio --- contracts/TrendsSharesV1.sol | 4 ++-- test/TrendsSharesV1.shares.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/TrendsSharesV1.sol b/contracts/TrendsSharesV1.sol index e4372b0..4af21f8 100644 --- a/contracts/TrendsSharesV1.sol +++ b/contracts/TrendsSharesV1.sol @@ -20,7 +20,7 @@ contract TrendsSharesV1 is Ownable { error InvalidParams(); error InvalidDeclineRatio(); - event Create(address creator, bytes32 subject, uint256 ethFee); + event Create(address creator, bytes32 subject, uint24 declineRatio, uint256 ethFee); event Trade( address trader, @@ -80,7 +80,7 @@ contract TrendsSharesV1 is Ownable { if (declineRatio * (1 ether / declineRatio) != 1 ether) revert InvalidDeclineRatio(); // Make sure declineRatio is fully divided in calculation later sharesDeclineRatio[subject] = declineRatio; - emit Create(msg.sender, subject, msg.value); + emit Create(msg.sender, subject, declineRatio, msg.value); _buyShares(msg.sender, subject, 1, 0); (bool success, ) = devFundDestination.call{value: msg.value}(""); if (!success) revert UnableSendDevFund(); diff --git a/test/TrendsSharesV1.shares.js b/test/TrendsSharesV1.shares.js index 26c783c..5b9a9ea 100644 --- a/test/TrendsSharesV1.shares.js +++ b/test/TrendsSharesV1.shares.js @@ -48,7 +48,7 @@ contract('TrendsSharesV1', function (accounts) { }); it('create shares emit event', async function () { expectEvent(createTxReceipt, 'Create', { - creator: creator1, subject: subject0, ethFee: createSharesEthFee + creator: creator1, subject: subject0, declineRatio: new BN(declineRatio), ethFee: createSharesEthFee }); expectEvent(createTxReceipt, 'Trade', { trader: creator1,