mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Added default data locations to parameters for end to end tests.
This commit is contained in:
committed by
chriseth
parent
c5ff173431
commit
f48d01d066
@@ -43,20 +43,20 @@ static char const* registrarCode = R"DELIMITER(
|
||||
pragma solidity ^0.4.0;
|
||||
|
||||
contract NameRegister {
|
||||
function addr(string _name) view returns (address o_owner);
|
||||
function name(address _owner) view returns (string o_name);
|
||||
function addr(string memory _name) view returns (address o_owner);
|
||||
function name(address _owner) view returns (string memory o_name);
|
||||
}
|
||||
|
||||
contract Registrar is NameRegister {
|
||||
event Changed(string indexed name);
|
||||
event PrimaryChanged(string indexed name, address indexed addr);
|
||||
|
||||
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 owner(string memory _name) view returns (address o_owner);
|
||||
function addr(string memory _name) view returns (address o_address);
|
||||
function subRegistrar(string memory _name) view returns (address o_subRegistrar);
|
||||
function content(string memory _name) view returns (bytes32 o_content);
|
||||
|
||||
function name(address _owner) view returns (string o_name);
|
||||
function name(address _owner) view returns (string memory o_name);
|
||||
}
|
||||
|
||||
contract AuctionSystem {
|
||||
@@ -64,9 +64,9 @@ contract AuctionSystem {
|
||||
event NewBid(string indexed _name, address _bidder, uint _value);
|
||||
|
||||
/// Function that is called once an auction ends.
|
||||
function onAuctionEnd(string _name) internal;
|
||||
function onAuctionEnd(string memory _name) internal;
|
||||
|
||||
function bid(string _name, address _bidder, uint _value) internal {
|
||||
function bid(string memory _name, address _bidder, uint _value) internal {
|
||||
Auction storage auction = m_auctions[_name];
|
||||
if (auction.endDate > 0 && now > auction.endDate)
|
||||
{
|
||||
@@ -116,7 +116,7 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
|
||||
// TODO: Populate with hall-of-fame.
|
||||
}
|
||||
|
||||
function onAuctionEnd(string _name) internal {
|
||||
function onAuctionEnd(string memory _name) internal {
|
||||
Auction storage auction = m_auctions[_name];
|
||||
Record storage record = m_toRecord[_name];
|
||||
address previousOwner = record.owner;
|
||||
@@ -150,18 +150,18 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
|
||||
}
|
||||
}
|
||||
|
||||
function requiresAuction(string _name) internal returns (bool) {
|
||||
function requiresAuction(string memory _name) internal returns (bool) {
|
||||
return bytes(_name).length < c_freeBytes;
|
||||
}
|
||||
|
||||
modifier onlyrecordowner(string _name) { if (m_toRecord[_name].owner == msg.sender) _; }
|
||||
modifier onlyrecordowner(string memory _name) { if (m_toRecord[_name].owner == msg.sender) _; }
|
||||
|
||||
function transfer(string _name, address _newOwner) onlyrecordowner(_name) {
|
||||
function transfer(string memory _name, address _newOwner) onlyrecordowner(_name) {
|
||||
m_toRecord[_name].owner = _newOwner;
|
||||
emit Changed(_name);
|
||||
}
|
||||
|
||||
function disown(string _name) onlyrecordowner(_name) {
|
||||
function disown(string memory _name) onlyrecordowner(_name) {
|
||||
if (stringsEqual(m_toName[m_toRecord[_name].primary], _name))
|
||||
{
|
||||
emit PrimaryChanged(_name, m_toRecord[_name].primary);
|
||||
@@ -171,7 +171,7 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
|
||||
emit Changed(_name);
|
||||
}
|
||||
|
||||
function setAddress(string _name, address _a, bool _primary) onlyrecordowner(_name) {
|
||||
function setAddress(string memory _name, address _a, bool _primary) onlyrecordowner(_name) {
|
||||
m_toRecord[_name].primary = _a;
|
||||
if (_primary)
|
||||
{
|
||||
@@ -180,11 +180,11 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
|
||||
}
|
||||
emit Changed(_name);
|
||||
}
|
||||
function setSubRegistrar(string _name, address _registrar) onlyrecordowner(_name) {
|
||||
function setSubRegistrar(string memory _name, address _registrar) onlyrecordowner(_name) {
|
||||
m_toRecord[_name].subRegistrar = _registrar;
|
||||
emit Changed(_name);
|
||||
}
|
||||
function setContent(string _name, bytes32 _content) onlyrecordowner(_name) {
|
||||
function setContent(string memory _name, bytes32 _content) onlyrecordowner(_name) {
|
||||
m_toRecord[_name].content = _content;
|
||||
emit Changed(_name);
|
||||
}
|
||||
@@ -201,11 +201,11 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
|
||||
return true;
|
||||
}
|
||||
|
||||
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]; }
|
||||
function owner(string memory _name) view returns (address) { return m_toRecord[_name].owner; }
|
||||
function addr(string memory _name) view returns (address) { return m_toRecord[_name].primary; }
|
||||
function subRegistrar(string memory _name) view returns (address) { return m_toRecord[_name].subRegistrar; }
|
||||
function content(string memory _name) view returns (bytes32) { return m_toRecord[_name].content; }
|
||||
function name(address _addr) view returns (string memory o_name) { return m_toName[_addr]; }
|
||||
|
||||
mapping (address => string) m_toName;
|
||||
mapping (string => Record) m_toRecord;
|
||||
|
||||
@@ -58,10 +58,10 @@ pragma solidity ^0.4.0;
|
||||
contract Registrar {
|
||||
event Changed(string indexed name);
|
||||
|
||||
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 owner(string memory _name) view returns (address o_owner);
|
||||
function addr(string memory _name) view returns (address o_address);
|
||||
function subRegistrar(string memory _name) view returns (address o_subRegistrar);
|
||||
function content(string memory _name) view returns (bytes32 o_content);
|
||||
}
|
||||
|
||||
contract FixedFeeRegistrar is Registrar {
|
||||
@@ -72,52 +72,52 @@ contract FixedFeeRegistrar is Registrar {
|
||||
address owner;
|
||||
}
|
||||
|
||||
modifier onlyrecordowner(string _name) { if (m_record(_name).owner == msg.sender) _; }
|
||||
modifier onlyrecordowner(string memory _name) { if (m_record(_name).owner == msg.sender) _; }
|
||||
|
||||
function reserve(string _name) payable {
|
||||
function reserve(string memory _name) payable {
|
||||
Record storage rec = m_record(_name);
|
||||
if (rec.owner == 0x0000000000000000000000000000000000000000 && msg.value >= c_fee) {
|
||||
rec.owner = msg.sender;
|
||||
emit Changed(_name);
|
||||
}
|
||||
}
|
||||
function disown(string _name, address _refund) onlyrecordowner(_name) {
|
||||
function disown(string memory _name, address _refund) onlyrecordowner(_name) {
|
||||
delete m_recordData[uint(keccak256(bytes(_name))) / 8];
|
||||
if (!_refund.send(c_fee))
|
||||
throw;
|
||||
emit Changed(_name);
|
||||
}
|
||||
function transfer(string _name, address _newOwner) onlyrecordowner(_name) {
|
||||
function transfer(string memory _name, address _newOwner) onlyrecordowner(_name) {
|
||||
m_record(_name).owner = _newOwner;
|
||||
emit Changed(_name);
|
||||
}
|
||||
function setAddr(string _name, address _a) onlyrecordowner(_name) {
|
||||
function setAddr(string memory _name, address _a) onlyrecordowner(_name) {
|
||||
m_record(_name).addr = _a;
|
||||
emit Changed(_name);
|
||||
}
|
||||
function setSubRegistrar(string _name, address _registrar) onlyrecordowner(_name) {
|
||||
function setSubRegistrar(string memory _name, address _registrar) onlyrecordowner(_name) {
|
||||
m_record(_name).subRegistrar = _registrar;
|
||||
emit Changed(_name);
|
||||
}
|
||||
function setContent(string _name, bytes32 _content) onlyrecordowner(_name) {
|
||||
function setContent(string memory _name, bytes32 _content) onlyrecordowner(_name) {
|
||||
m_record(_name).content = _content;
|
||||
emit Changed(_name);
|
||||
}
|
||||
|
||||
function record(string _name) view returns (address o_addr, address o_subRegistrar, bytes32 o_content, address o_owner) {
|
||||
function record(string memory _name) view returns (address o_addr, address o_subRegistrar, bytes32 o_content, address o_owner) {
|
||||
Record storage rec = m_record(_name);
|
||||
o_addr = rec.addr;
|
||||
o_subRegistrar = rec.subRegistrar;
|
||||
o_content = rec.content;
|
||||
o_owner = rec.owner;
|
||||
}
|
||||
function addr(string _name) view returns (address) { return m_record(_name).addr; }
|
||||
function subRegistrar(string _name) view returns (address) { return m_record(_name).subRegistrar; }
|
||||
function content(string _name) view returns (bytes32) { return m_record(_name).content; }
|
||||
function owner(string _name) view returns (address) { return m_record(_name).owner; }
|
||||
function addr(string memory _name) view returns (address) { return m_record(_name).addr; }
|
||||
function subRegistrar(string memory _name) view returns (address) { return m_record(_name).subRegistrar; }
|
||||
function content(string memory _name) view returns (bytes32) { return m_record(_name).content; }
|
||||
function owner(string memory _name) view returns (address) { return m_record(_name).owner; }
|
||||
|
||||
Record[2**253] m_recordData;
|
||||
function m_record(string _name) view internal returns (Record storage o_record) {
|
||||
function m_record(string memory _name) view internal returns (Record storage o_record) {
|
||||
return m_recordData[uint(keccak256(bytes(_name))) / 8];
|
||||
}
|
||||
uint constant c_fee = 69 ether;
|
||||
|
||||
@@ -101,7 +101,7 @@ contract multiowned {
|
||||
|
||||
// constructor is given number of sigs required to do protected "onlymanyowners" transactions
|
||||
// as well as the selection of addresses capable of confirming them.
|
||||
constructor(address[] _owners, uint _required) {
|
||||
constructor(address[] memory _owners, uint _required) {
|
||||
m_numOwners = _owners.length + 1;
|
||||
m_owners[1] = uint(msg.sender);
|
||||
m_ownerIndex[uint(msg.sender)] = 1;
|
||||
@@ -369,7 +369,7 @@ contract Wallet is multisig, multiowned, daylimit {
|
||||
|
||||
// constructor - just pass on the owner array to the multiowned and
|
||||
// the limit to daylimit
|
||||
constructor(address[] _owners, uint _required, uint _daylimit) payable
|
||||
constructor(address[] memory _owners, uint _required, uint _daylimit) payable
|
||||
multiowned(_owners, _required) daylimit(_daylimit) {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user