aboutsummaryrefslogtreecommitdiffstats
path: root/test/contracts/AuctionRegistrar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/contracts/AuctionRegistrar.cpp')
-rw-r--r--test/contracts/AuctionRegistrar.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/test/contracts/AuctionRegistrar.cpp b/test/contracts/AuctionRegistrar.cpp
index f5abb83d..3d759aa0 100644
--- a/test/contracts/AuctionRegistrar.cpp
+++ b/test/contracts/AuctionRegistrar.cpp
@@ -43,20 +43,20 @@ static char const* registrarCode = R"DELIMITER(
pragma solidity ^0.4.0;
contract NameRegister {
- function addr(string _name) constant returns (address o_owner);
- function name(address _owner) constant returns (string o_name);
+ function addr(string _name) view returns (address o_owner);
+ function name(address _owner) view returns (string o_name);
}
contract Registrar is NameRegister {
event Changed(string indexed name);
event PrimaryChanged(string indexed name, address indexed addr);
- function owner(string _name) constant returns (address o_owner);
- function addr(string _name) constant returns (address o_address);
- function subRegistrar(string _name) constant returns (address o_subRegistrar);
- function content(string _name) constant returns (bytes32 o_content);
+ function owner(string _name) view returns (address o_owner);
+ function addr(string _name) view returns (address o_address);
+ function subRegistrar(string _name) view returns (address o_subRegistrar);
+ function content(string _name) view returns (bytes32 o_content);
- function name(address _owner) constant returns (string o_name);
+ function name(address _owner) view returns (string o_name);
}
contract AuctionSystem {
@@ -67,7 +67,7 @@ contract AuctionSystem {
function onAuctionEnd(string _name) internal;
function bid(string _name, address _bidder, uint _value) internal {
- var auction = m_auctions[_name];
+ Auction storage auction = m_auctions[_name];
if (auction.endDate > 0 && now > auction.endDate)
{
emit AuctionEnded(_name, auction.highestBidder);
@@ -117,9 +117,9 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
}
function onAuctionEnd(string _name) internal {
- var auction = m_auctions[_name];
- var record = m_toRecord[_name];
- var previousOwner = record.owner;
+ Auction storage auction = m_auctions[_name];
+ Record storage record = m_toRecord[_name];
+ address previousOwner = record.owner;
record.renewalDate = now + c_renewalInterval;
record.owner = auction.highestBidder;
emit Changed(_name);
@@ -201,11 +201,11 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
return true;
}
- function owner(string _name) constant returns (address) { return m_toRecord[_name].owner; }
- function addr(string _name) constant returns (address) { return m_toRecord[_name].primary; }
- function subRegistrar(string _name) constant returns (address) { return m_toRecord[_name].subRegistrar; }
- function content(string _name) constant returns (bytes32) { return m_toRecord[_name].content; }
- function name(address _addr) constant returns (string o_name) { return m_toName[_addr]; }
+ function owner(string _name) view returns (address) { return m_toRecord[_name].owner; }
+ function addr(string _name) view returns (address) { return m_toRecord[_name].primary; }
+ function subRegistrar(string _name) view returns (address) { return m_toRecord[_name].subRegistrar; }
+ function content(string _name) view returns (bytes32) { return m_toRecord[_name].content; }
+ function name(address _addr) view returns (string o_name) { return m_toName[_addr]; }
mapping (address => string) m_toName;
mapping (string => Record) m_toRecord;
@@ -223,6 +223,7 @@ protected:
s_compiledRegistrar.reset(new bytes(compileContract(registrarCode, "GlobalRegistrar")));
sendMessage(*s_compiledRegistrar, true);
+ BOOST_REQUIRE(m_transactionSuccessful);
BOOST_REQUIRE(!m_output.empty());
}