From b9d035264d924ca63472a6be0af287dec75c4355 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 26 Jun 2018 20:09:54 +0200 Subject: Add some more emits. --- test/contracts/AuctionRegistrar.cpp | 18 +++++++++--------- test/contracts/FixedFeeRegistrar.cpp | 12 ++++++------ test/contracts/Wallet.cpp | 14 +++++++------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/test/contracts/AuctionRegistrar.cpp b/test/contracts/AuctionRegistrar.cpp index ef84efed..a02b09ee 100644 --- a/test/contracts/AuctionRegistrar.cpp +++ b/test/contracts/AuctionRegistrar.cpp @@ -70,7 +70,7 @@ contract AuctionSystem { var auction = m_auctions[_name]; if (auction.endDate > 0 && now > auction.endDate) { - AuctionEnded(_name, auction.highestBidder); + emit AuctionEnded(_name, auction.highestBidder); onAuctionEnd(_name); delete m_auctions[_name]; return; @@ -84,7 +84,7 @@ contract AuctionSystem { auction.highestBidder = _bidder; auction.endDate = now + c_biddingTime; - NewBid(_name, _bidder, _value); + emit NewBid(_name, _bidder, _value); } } @@ -122,7 +122,7 @@ contract GlobalRegistrar is Registrar, AuctionSystem { var previousOwner = record.owner; record.renewalDate = now + c_renewalInterval; record.owner = auction.highestBidder; - Changed(_name); + emit Changed(_name); if (previousOwner != 0x0000000000000000000000000000000000000000) { if (!record.owner.send(auction.sumOfBids - auction.highestBid / 100)) throw; @@ -146,7 +146,7 @@ contract GlobalRegistrar is Registrar, AuctionSystem { if (record.owner != 0x0000000000000000000000000000000000000000) throw; m_toRecord[_name].owner = msg.sender; - Changed(_name); + emit Changed(_name); } } @@ -158,17 +158,17 @@ contract GlobalRegistrar is Registrar, AuctionSystem { function transfer(string _name, address _newOwner) onlyrecordowner(_name) { m_toRecord[_name].owner = _newOwner; - Changed(_name); + emit Changed(_name); } function disown(string _name) onlyrecordowner(_name) { if (stringsEqual(m_toName[m_toRecord[_name].primary], _name)) { - PrimaryChanged(_name, m_toRecord[_name].primary); + emit PrimaryChanged(_name, m_toRecord[_name].primary); m_toName[m_toRecord[_name].primary] = ""; } delete m_toRecord[_name]; - Changed(_name); + emit Changed(_name); } function setAddress(string _name, address _a, bool _primary) onlyrecordowner(_name) { @@ -182,11 +182,11 @@ contract GlobalRegistrar is Registrar, AuctionSystem { } function setSubRegistrar(string _name, address _registrar) onlyrecordowner(_name) { m_toRecord[_name].subRegistrar = _registrar; - Changed(_name); + emit Changed(_name); } function setContent(string _name, bytes32 _content) onlyrecordowner(_name) { m_toRecord[_name].content = _content; - Changed(_name); + emit Changed(_name); } function stringsEqual(string storage _a, string memory _b) internal returns (bool) { diff --git a/test/contracts/FixedFeeRegistrar.cpp b/test/contracts/FixedFeeRegistrar.cpp index 1fd58403..c167745c 100644 --- a/test/contracts/FixedFeeRegistrar.cpp +++ b/test/contracts/FixedFeeRegistrar.cpp @@ -78,30 +78,30 @@ contract FixedFeeRegistrar is Registrar { Record rec = m_record(_name); if (rec.owner == 0x0000000000000000000000000000000000000000 && msg.value >= c_fee) { rec.owner = msg.sender; - Changed(_name); + emit Changed(_name); } } function disown(string _name, address _refund) onlyrecordowner(_name) { delete m_recordData[uint(keccak256(_name)) / 8]; if (!_refund.send(c_fee)) throw; - Changed(_name); + emit Changed(_name); } function transfer(string _name, address _newOwner) onlyrecordowner(_name) { m_record(_name).owner = _newOwner; - Changed(_name); + emit Changed(_name); } function setAddr(string _name, address _a) onlyrecordowner(_name) { m_record(_name).addr = _a; - Changed(_name); + emit Changed(_name); } function setSubRegistrar(string _name, address _registrar) onlyrecordowner(_name) { m_record(_name).subRegistrar = _registrar; - Changed(_name); + emit Changed(_name); } function setContent(string _name, bytes32 _content) onlyrecordowner(_name) { m_record(_name).content = _content; - Changed(_name); + emit Changed(_name); } function record(string _name) constant returns (address o_addr, address o_subRegistrar, bytes32 o_content, address o_owner) { diff --git a/test/contracts/Wallet.cpp b/test/contracts/Wallet.cpp index f8ee007d..6e7b97d2 100644 --- a/test/contracts/Wallet.cpp +++ b/test/contracts/Wallet.cpp @@ -123,7 +123,7 @@ contract multiowned { if (pending.ownersDone & ownerIndexBit > 0) { pending.yetNeeded++; pending.ownersDone -= ownerIndexBit; - Revoke(msg.sender, _operation); + emit Revoke(msg.sender, _operation); } } @@ -137,7 +137,7 @@ contract multiowned { m_owners[ownerIndex] = uint(_to); m_ownerIndex[uint(_from)] = 0; m_ownerIndex[uint(_to)] = ownerIndex; - OwnerChanged(_from, _to); + emit OwnerChanged(_from, _to); } function addOwner(address _owner) onlymanyowners(keccak256(msg.data)) external { @@ -151,7 +151,7 @@ contract multiowned { m_numOwners++; m_owners[m_numOwners] = uint(_owner); m_ownerIndex[uint(_owner)] = m_numOwners; - OwnerAdded(_owner); + emit OwnerAdded(_owner); } function removeOwner(address _owner) onlymanyowners(keccak256(msg.data)) external { @@ -163,14 +163,14 @@ contract multiowned { m_ownerIndex[uint(_owner)] = 0; clearPending(); reorganizeOwners(); //make sure m_numOwner is equal to the number of owners and always points to the optimal free slot - OwnerRemoved(_owner); + emit OwnerRemoved(_owner); } function changeRequirement(uint _newRequired) onlymanyowners(keccak256(msg.data)) external { if (_newRequired > m_numOwners) return; m_required = _newRequired; clearPending(); - RequirementChanged(_newRequired); + emit RequirementChanged(_newRequired); } function isOwner(address _addr) returns (bool) { @@ -382,7 +382,7 @@ contract Wallet is multisig, multiowned, daylimit { function() payable { // just being sent some cash? if (msg.value > 0) - Deposit(msg.sender, msg.value); + emit Deposit(msg.sender, msg.value); } // Outside-visible transact entry point. Executes transacion immediately if below daily spend limit. @@ -403,7 +403,7 @@ contract Wallet is multisig, multiowned, daylimit { m_txs[_r].to = _to; m_txs[_r].value = _value; m_txs[_r].data = _data; - ConfirmationNeeded(_r, msg.sender, _value, _to, _data); + emit ConfirmationNeeded(_r, msg.sender, _value, _to, _data); } } -- cgit