aboutsummaryrefslogtreecommitdiffstats
path: root/test/contracts
diff options
context:
space:
mode:
Diffstat (limited to 'test/contracts')
-rw-r--r--test/contracts/AuctionRegistrar.cpp26
-rw-r--r--test/contracts/FixedFeeRegistrar.cpp18
-rw-r--r--test/contracts/Wallet.cpp28
3 files changed, 36 insertions, 36 deletions
diff --git a/test/contracts/AuctionRegistrar.cpp b/test/contracts/AuctionRegistrar.cpp
index 33b392d4..f5abb83d 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,8 +122,8 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
var previousOwner = record.owner;
record.renewalDate = now + c_renewalInterval;
record.owner = auction.highestBidder;
- Changed(_name);
- if (previousOwner != 0) {
+ emit Changed(_name);
+ if (previousOwner != 0x0000000000000000000000000000000000000000) {
if (!record.owner.send(auction.sumOfBids - auction.highestBid / 100))
throw;
} else {
@@ -143,10 +143,10 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
bid(_name, msg.sender, msg.value);
} else {
Record record = m_toRecord[_name];
- if (record.owner != 0)
+ if (record.owner != 0x0000000000000000000000000000000000000000)
throw;
m_toRecord[_name].owner = msg.sender;
- Changed(_name);
+ emit Changed(_name);
}
}
@@ -158,35 +158,35 @@ 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) {
m_toRecord[_name].primary = _a;
if (_primary)
{
- PrimaryChanged(_name, _a);
+ emit PrimaryChanged(_name, _a);
m_toName[_a] = _name;
}
- Changed(_name);
+ emit Changed(_name);
}
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 a3a27c37..142f4144 100644
--- a/test/contracts/FixedFeeRegistrar.cpp
+++ b/test/contracts/FixedFeeRegistrar.cpp
@@ -76,32 +76,32 @@ contract FixedFeeRegistrar is Registrar {
function reserve(string _name) payable {
Record rec = m_record(_name);
- if (rec.owner == 0 && msg.value >= c_fee) {
+ 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];
+ delete m_recordData[uint(keccak256(bytes(_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) {
@@ -118,7 +118,7 @@ contract FixedFeeRegistrar is Registrar {
Record[2**253] m_recordData;
function m_record(string _name) constant internal returns (Record storage o_record) {
- return m_recordData[uint(keccak256(_name)) / 8];
+ return m_recordData[uint(keccak256(bytes(_name))) / 8];
}
uint constant c_fee = 69 ether;
}
diff --git a/test/contracts/Wallet.cpp b/test/contracts/Wallet.cpp
index 1031e8f1..0a596b6d 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) {
@@ -215,7 +215,7 @@ contract multiowned {
uint ownerIndexBit = 2**ownerIndex;
// make sure we (the message sender) haven't confirmed this operation previously.
if (pending.ownersDone & ownerIndexBit == 0) {
- Confirmation(msg.sender, _operation);
+ emit Confirmation(msg.sender, _operation);
// ok - check if count is enough to go ahead.
if (pending.yetNeeded <= 1) {
// enough confirmations: reset and run interior.
@@ -379,10 +379,10 @@ contract Wallet is multisig, multiowned, daylimit {
}
// gets called when no other function matches
- function() payable {
+ function() external 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.
@@ -392,27 +392,27 @@ contract Wallet is multisig, multiowned, daylimit {
function execute(address _to, uint _value, bytes _data) external onlyowner returns (bytes32 _r) {
// first, take the opportunity to check that we're under the daily limit.
if (underLimit(_value)) {
- SingleTransact(msg.sender, _value, _to, _data);
+ emit SingleTransact(msg.sender, _value, _to, _data);
// yes - just execute the call.
_to.call.value(_value)(_data);
return 0;
}
// determine our operation hash.
- _r = keccak256(msg.data, block.number);
- if (!confirm(_r) && m_txs[_r].to == 0) {
+ _r = keccak256(abi.encodePacked(msg.data, block.number));
+ if (!confirm(_r) && m_txs[_r].to == 0x0000000000000000000000000000000000000000) {
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);
}
}
// confirm a transaction through just the hash. we use the previous transactions map, m_txs, in order
// to determine the body of the transaction from the hash provided.
function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) {
- if (m_txs[_h].to != 0) {
+ if (m_txs[_h].to != 0x0000000000000000000000000000000000000000) {
m_txs[_h].to.call.value(m_txs[_h].value)(m_txs[_h].data);
- MultiTransact(msg.sender, _h, m_txs[_h].value, m_txs[_h].to, m_txs[_h].data);
+ emit MultiTransact(msg.sender, _h, m_txs[_h].value, m_txs[_h].to, m_txs[_h].data);
delete m_txs[_h];
return true;
}