mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4269 from ethereum/require-emit
[BREAKING] Remove non-0.5.0 warning for emit keyword (make it mandatory)
This commit is contained in:
commit
b67dfa154c
@ -443,7 +443,7 @@ For example,
|
||||
function Test() public { b = 0x12345678901234567890123456789012; }
|
||||
event Event(uint indexed a, bytes32 b);
|
||||
event Event2(uint indexed a, bytes32 b);
|
||||
function foo(uint a) public { Event(a, b); }
|
||||
function foo(uint a) public { emit Event(a, b); }
|
||||
bytes32 b;
|
||||
}
|
||||
|
||||
|
@ -1712,12 +1712,7 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
|
||||
m_errorReporter.typeError(_functionCall.location(), "\"suicide\" has been deprecated in favour of \"selfdestruct\"");
|
||||
}
|
||||
if (!m_insideEmitStatement && functionType->kind() == FunctionType::Kind::Event)
|
||||
{
|
||||
if (m_scope->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050))
|
||||
m_errorReporter.typeError(_functionCall.location(), "Event invocations have to be prefixed by \"emit\".");
|
||||
else
|
||||
m_errorReporter.warning(_functionCall.location(), "Invoking events without \"emit\" prefix is deprecated.");
|
||||
}
|
||||
m_errorReporter.typeError(_functionCall.location(), "Event invocations have to be prefixed by \"emit\".");
|
||||
|
||||
TypePointers parameterTypes = functionType->parameterTypes();
|
||||
|
||||
|
@ -23,6 +23,6 @@ contract Factory {
|
||||
{
|
||||
isInstantiation[instantiation] = true;
|
||||
instantiations[msg.sender].push(instantiation);
|
||||
ContractInstantiation(msg.sender, instantiation);
|
||||
emit ContractInstantiation(msg.sender, instantiation);
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ contract MultiSigWallet {
|
||||
payable
|
||||
{
|
||||
if (msg.value > 0)
|
||||
Deposit(msg.sender, msg.value);
|
||||
emit Deposit(msg.sender, msg.value);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -126,7 +126,7 @@ contract MultiSigWallet {
|
||||
{
|
||||
isOwner[owner] = true;
|
||||
owners.push(owner);
|
||||
OwnerAddition(owner);
|
||||
emit OwnerAddition(owner);
|
||||
}
|
||||
|
||||
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
|
||||
@ -145,7 +145,7 @@ contract MultiSigWallet {
|
||||
owners.length -= 1;
|
||||
if (required > owners.length)
|
||||
changeRequirement(owners.length);
|
||||
OwnerRemoval(owner);
|
||||
emit OwnerRemoval(owner);
|
||||
}
|
||||
|
||||
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
|
||||
@ -164,8 +164,8 @@ contract MultiSigWallet {
|
||||
}
|
||||
isOwner[owner] = false;
|
||||
isOwner[newOwner] = true;
|
||||
OwnerRemoval(owner);
|
||||
OwnerAddition(newOwner);
|
||||
emit OwnerRemoval(owner);
|
||||
emit OwnerAddition(newOwner);
|
||||
}
|
||||
|
||||
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
|
||||
@ -176,7 +176,7 @@ contract MultiSigWallet {
|
||||
validRequirement(owners.length, _required)
|
||||
{
|
||||
required = _required;
|
||||
RequirementChange(_required);
|
||||
emit RequirementChange(_required);
|
||||
}
|
||||
|
||||
/// @dev Allows an owner to submit and confirm a transaction.
|
||||
@ -201,7 +201,7 @@ contract MultiSigWallet {
|
||||
notConfirmed(transactionId, msg.sender)
|
||||
{
|
||||
confirmations[transactionId][msg.sender] = true;
|
||||
Confirmation(msg.sender, transactionId);
|
||||
emit Confirmation(msg.sender, transactionId);
|
||||
executeTransaction(transactionId);
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ contract MultiSigWallet {
|
||||
notExecuted(transactionId)
|
||||
{
|
||||
confirmations[transactionId][msg.sender] = false;
|
||||
Revocation(msg.sender, transactionId);
|
||||
emit Revocation(msg.sender, transactionId);
|
||||
}
|
||||
|
||||
/// @dev Allows anyone to execute a confirmed transaction.
|
||||
@ -227,9 +227,9 @@ contract MultiSigWallet {
|
||||
Transaction tx = transactions[transactionId];
|
||||
tx.executed = true;
|
||||
if (tx.destination.call.value(tx.value)(tx.data))
|
||||
Execution(transactionId);
|
||||
emit Execution(transactionId);
|
||||
else {
|
||||
ExecutionFailure(transactionId);
|
||||
emit ExecutionFailure(transactionId);
|
||||
tx.executed = false;
|
||||
}
|
||||
}
|
||||
@ -273,7 +273,7 @@ contract MultiSigWallet {
|
||||
executed: false
|
||||
});
|
||||
transactionCount += 1;
|
||||
Submission(transactionId);
|
||||
emit Submission(transactionId);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -33,7 +33,7 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet {
|
||||
onlyWallet
|
||||
{
|
||||
dailyLimit = _dailyLimit;
|
||||
DailyLimitChange(_dailyLimit);
|
||||
emit DailyLimitChange(_dailyLimit);
|
||||
}
|
||||
|
||||
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
|
||||
@ -49,9 +49,9 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet {
|
||||
if (!confirmed)
|
||||
spentToday += tx.value;
|
||||
if (tx.destination.call.value(tx.value)(tx.data))
|
||||
Execution(transactionId);
|
||||
emit Execution(transactionId);
|
||||
else {
|
||||
ExecutionFailure(transactionId);
|
||||
emit ExecutionFailure(transactionId);
|
||||
tx.executed = false;
|
||||
if (!confirmed)
|
||||
spentToday -= tx.value;
|
||||
|
@ -31,7 +31,7 @@ contract TestToken {
|
||||
}
|
||||
balances[msg.sender] -= _value;
|
||||
balances[_to] += _value;
|
||||
Transfer(msg.sender, _to, _value);
|
||||
emit Transfer(msg.sender, _to, _value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ contract TestToken {
|
||||
balances[_to] += _value;
|
||||
balances[_from] -= _value;
|
||||
allowed[_from][msg.sender] -= _value;
|
||||
Transfer(_from, _to, _value);
|
||||
emit Transfer(_from, _to, _value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ contract TestToken {
|
||||
returns (bool success)
|
||||
{
|
||||
allowed[msg.sender][_spender] = _value;
|
||||
Approval(msg.sender, _spender, _value);
|
||||
emit Approval(msg.sender, _spender, _value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ contract ico is safeMath {
|
||||
token(tokenAddr).mint(affilateAddress, extra);
|
||||
}
|
||||
checkPremium(beneficiaryAddress);
|
||||
EICO(beneficiaryAddress, _reward, affilateAddress, extra);
|
||||
emit EICO(beneficiaryAddress, _reward, affilateAddress, extra);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ contract premium is module, safeMath {
|
||||
for ( uint256 a=0 ; a<genesisAddr.length ; a++ ) {
|
||||
genesis[genesisAddr[a]] = true;
|
||||
require( db.increase(genesisAddr[a], genesisValue[a]) );
|
||||
Mint(genesisAddr[a], genesisValue[a]);
|
||||
emit Mint(genesisAddr[a], genesisValue[a]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -137,7 +137,7 @@ contract premium is module, safeMath {
|
||||
require( msg.sender != spender );
|
||||
require( db.balanceOf(msg.sender) >= amount );
|
||||
require( db.setAllowance(msg.sender, spender, amount, nonce) );
|
||||
Approval(msg.sender, spender, amount);
|
||||
emit Approval(msg.sender, spender, amount);
|
||||
}
|
||||
|
||||
function allowance(address owner, address spender) constant returns (uint256 remaining, uint256 nonce) {
|
||||
@ -178,7 +178,7 @@ contract premium is module, safeMath {
|
||||
} else {
|
||||
_transfer(msg.sender, to, amount);
|
||||
}
|
||||
Transfer(msg.sender, to, amount, _data);
|
||||
emit Transfer(msg.sender, to, amount, _data);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ contract premium is module, safeMath {
|
||||
_reamining = safeSub(_reamining, amount);
|
||||
_nonce = safeAdd(_nonce, 1);
|
||||
require( db.setAllowance(from, msg.sender, _reamining, _nonce) );
|
||||
AllowanceUsed(msg.sender, from, amount);
|
||||
emit AllowanceUsed(msg.sender, from, amount);
|
||||
}
|
||||
bytes memory _data;
|
||||
if ( isContract(to) ) {
|
||||
@ -215,7 +215,7 @@ contract premium is module, safeMath {
|
||||
} else {
|
||||
_transfer( from, to, amount);
|
||||
}
|
||||
Transfer(from, to, amount, _data);
|
||||
emit Transfer(from, to, amount, _data);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -242,7 +242,7 @@ contract premium is module, safeMath {
|
||||
} else {
|
||||
_transfer( msg.sender, to, amount);
|
||||
}
|
||||
Transfer(msg.sender, to, amount, extraData);
|
||||
emit Transfer(msg.sender, to, amount, extraData);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -301,7 +301,7 @@ contract premium is module, safeMath {
|
||||
@value Amount
|
||||
*/
|
||||
require( db.increase(owner, value) );
|
||||
Mint(owner, value);
|
||||
emit Mint(owner, value);
|
||||
}
|
||||
|
||||
function isContract(address addr) internal returns (bool success) {
|
||||
|
@ -268,7 +268,7 @@ contract provider is module, safeMath, announcementTypes {
|
||||
} else {
|
||||
delete providers[msg.sender].data[currHeight].supply[currentSchellingRound];
|
||||
}
|
||||
EProviderOpen(msg.sender, currHeight);
|
||||
emit EProviderOpen(msg.sender, currHeight);
|
||||
}
|
||||
function setProviderDetails(address addr, string website, string country, string info, uint8 rate, address admin) isReady external {
|
||||
/*
|
||||
@ -297,7 +297,7 @@ contract provider is module, safeMath, announcementTypes {
|
||||
providers[addr].data[currHeight].country = country;
|
||||
providers[addr].data[currHeight].info = info;
|
||||
providers[addr].data[currHeight].currentRate = rate;
|
||||
EProviderDetailsChanged(addr, currHeight, website, country, info, rate, admin);
|
||||
emit EProviderDetailsChanged(addr, currHeight, website, country, info, rate, admin);
|
||||
}
|
||||
function getProviderInfo(address addr, uint256 height) public constant returns (string name, string website, string country, string info, uint256 create) {
|
||||
/*
|
||||
@ -367,7 +367,7 @@ contract provider is module, safeMath, announcementTypes {
|
||||
providers[msg.sender].data[currHeight].valid = false;
|
||||
providers[msg.sender].data[currHeight].close = currentSchellingRound;
|
||||
setRightForInterest(getProviderCurrentSupply(msg.sender), 0, providers[msg.sender].data[currHeight].priv);
|
||||
EProviderClose(msg.sender, currHeight);
|
||||
emit EProviderClose(msg.sender, currHeight);
|
||||
}
|
||||
function allowUsers(address provider, address[] addr) isReady external {
|
||||
/*
|
||||
@ -437,7 +437,7 @@ contract provider is module, safeMath, announcementTypes {
|
||||
clients[msg.sender].paidUpTo = currentSchellingRound;
|
||||
clients[msg.sender].lastRate = providers[provider].data[currHeight].currentRate;
|
||||
clients[msg.sender].providerConnected = now;
|
||||
ENewClient(msg.sender, provider, currHeight, bal);
|
||||
emit ENewClient(msg.sender, provider, currHeight, bal);
|
||||
}
|
||||
function partProvider() isReady external {
|
||||
/*
|
||||
@ -467,7 +467,7 @@ contract provider is module, safeMath, announcementTypes {
|
||||
delete clients[msg.sender].paidUpTo;
|
||||
delete clients[msg.sender].lastRate;
|
||||
delete clients[msg.sender].providerConnected;
|
||||
EClientLost(msg.sender, provider, currHeight, bal);
|
||||
emit EClientLost(msg.sender, provider, currHeight, bal);
|
||||
}
|
||||
function checkReward(address addr) public constant returns (uint256 reward) {
|
||||
/*
|
||||
@ -522,7 +522,7 @@ contract provider is module, safeMath, announcementTypes {
|
||||
if ( providerReward > 0 ) {
|
||||
require( moduleHandler(moduleHandlerAddress).transfer(address(this), provider, providerReward, false) );
|
||||
}
|
||||
EReward(msg.sender, provider, clientReward, providerReward);
|
||||
emit EReward(msg.sender, provider, clientReward, providerReward);
|
||||
}
|
||||
function getClientReward(uint256 limit) internal returns (uint256 reward) {
|
||||
/*
|
||||
|
@ -148,7 +148,7 @@ contract publisher is announcementTypes, module, safeMath {
|
||||
announcements[announcementsLength]._str = _str;
|
||||
announcements[announcementsLength]._uint = _uint;
|
||||
announcements[announcementsLength]._addr = _addr;
|
||||
ENewAnnouncement(announcementsLength, Type);
|
||||
emit ENewAnnouncement(announcementsLength, Type);
|
||||
}
|
||||
|
||||
function closeAnnouncement(uint256 id) onlyOwner external {
|
||||
@ -238,7 +238,7 @@ contract publisher is announcementTypes, module, safeMath {
|
||||
opponents[msg.sender].push(id);
|
||||
}
|
||||
announcements[id].oppositionWeight += _balance;
|
||||
EOppositeAnnouncement(id, msg.sender, _balance);
|
||||
emit EOppositeAnnouncement(id, msg.sender, _balance);
|
||||
}
|
||||
|
||||
function invalidateAnnouncement(uint256 id) onlyOwner external {
|
||||
@ -250,7 +250,7 @@ contract publisher is announcementTypes, module, safeMath {
|
||||
require( announcements[id].open );
|
||||
announcements[id].end = block.number;
|
||||
announcements[id].open = false;
|
||||
EInvalidateAnnouncement(id);
|
||||
emit EInvalidateAnnouncement(id);
|
||||
}
|
||||
|
||||
modifier onlyOwner() {
|
||||
|
@ -78,7 +78,7 @@ contract token is safeMath, module, announcementTypes {
|
||||
genesis[genesisAddr[a]] = true;
|
||||
require( db.increase(genesisAddr[a], genesisValue[a]) );
|
||||
if ( ! genesisAddr[a].send(0.2 ether) ) {}
|
||||
Mint(genesisAddr[a], genesisValue[a]);
|
||||
emit Mint(genesisAddr[a], genesisValue[a]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -152,7 +152,7 @@ contract token is safeMath, module, announcementTypes {
|
||||
require( msg.sender != spender );
|
||||
require( db.balanceOf(msg.sender) >= amount );
|
||||
require( db.setAllowance(msg.sender, spender, amount, nonce) );
|
||||
Approval(msg.sender, spender, amount);
|
||||
emit Approval(msg.sender, spender, amount);
|
||||
}
|
||||
|
||||
function allowance(address owner, address spender) constant returns (uint256 remaining, uint256 nonce) {
|
||||
@ -193,7 +193,7 @@ contract token is safeMath, module, announcementTypes {
|
||||
} else {
|
||||
_transfer( msg.sender, to, amount, true);
|
||||
}
|
||||
Transfer(msg.sender, to, amount, _data);
|
||||
emit Transfer(msg.sender, to, amount, _data);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ contract token is safeMath, module, announcementTypes {
|
||||
_reamining = safeSub(_reamining, amount);
|
||||
_nonce = safeAdd(_nonce, 1);
|
||||
require( db.setAllowance(from, msg.sender, _reamining, _nonce) );
|
||||
AllowanceUsed(msg.sender, from, amount);
|
||||
emit AllowanceUsed(msg.sender, from, amount);
|
||||
}
|
||||
bytes memory _data;
|
||||
if ( isContract(to) ) {
|
||||
@ -230,7 +230,7 @@ contract token is safeMath, module, announcementTypes {
|
||||
} else {
|
||||
_transfer( from, to, amount, true);
|
||||
}
|
||||
Transfer(from, to, amount, _data);
|
||||
emit Transfer(from, to, amount, _data);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ contract token is safeMath, module, announcementTypes {
|
||||
bytes memory _data;
|
||||
require( super.isModuleHandler(msg.sender) );
|
||||
_transfer( from, to, amount, fee);
|
||||
Transfer(from, to, amount, _data);
|
||||
emit Transfer(from, to, amount, _data);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ contract token is safeMath, module, announcementTypes {
|
||||
} else {
|
||||
_transfer( msg.sender, to, amount, true);
|
||||
}
|
||||
Transfer(msg.sender, to, amount, extraData);
|
||||
emit Transfer(msg.sender, to, amount, extraData);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ contract token is safeMath, module, announcementTypes {
|
||||
require( db.increase(_schellingAddr, _forSchelling) );
|
||||
_burn(owner, _forBurn);
|
||||
bytes memory _data;
|
||||
Transfer(owner, _schellingAddr, _forSchelling, _data);
|
||||
emit Transfer(owner, _schellingAddr, _forSchelling, _data);
|
||||
require( moduleHandler(moduleHandlerAddress).broadcastTransfer(owner, _schellingAddr, _forSchelling) );
|
||||
} else {
|
||||
_burn(owner, _fee);
|
||||
@ -428,7 +428,7 @@ contract token is safeMath, module, announcementTypes {
|
||||
if ( isICO ) {
|
||||
require( ico(icoAddr).setInterestDB(owner, db.balanceOf(owner)) );
|
||||
}
|
||||
Mint(owner, value);
|
||||
emit Mint(owner, value);
|
||||
}
|
||||
|
||||
function burn(address owner, uint256 value) isReady external returns (bool success) {
|
||||
@ -454,7 +454,7 @@ contract token is safeMath, module, announcementTypes {
|
||||
*/
|
||||
require( db.decrease(owner, value) );
|
||||
require( moduleHandler(moduleHandlerAddress).broadcastTransfer(owner, address(0x00), value) );
|
||||
Burn(owner, value);
|
||||
emit Burn(owner, value);
|
||||
}
|
||||
|
||||
function isContract(address addr) internal returns (bool success) {
|
||||
|
@ -38,7 +38,7 @@ contract CategoricalEvent is Event {
|
||||
outcomeTokens[uint(outcome)].revoke(msg.sender, winnings);
|
||||
// Payout winnings
|
||||
require(collateralToken.transfer(msg.sender, winnings));
|
||||
WinningsRedemption(msg.sender, winnings);
|
||||
emit WinningsRedemption(msg.sender, winnings);
|
||||
}
|
||||
|
||||
/// @dev Calculates and returns event hash
|
||||
|
@ -44,7 +44,7 @@ contract Event {
|
||||
for (uint8 i = 0; i < outcomeCount; i++) {
|
||||
OutcomeToken outcomeToken = new OutcomeToken();
|
||||
outcomeTokens.push(outcomeToken);
|
||||
OutcomeTokenCreation(outcomeToken, i);
|
||||
emit OutcomeTokenCreation(outcomeToken, i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ contract Event {
|
||||
// Issue new outcome tokens to sender
|
||||
for (uint8 i = 0; i < outcomeTokens.length; i++)
|
||||
outcomeTokens[i].issue(msg.sender, collateralTokenCount);
|
||||
OutcomeTokenSetIssuance(msg.sender, collateralTokenCount);
|
||||
emit OutcomeTokenSetIssuance(msg.sender, collateralTokenCount);
|
||||
}
|
||||
|
||||
/// @dev Sells equal number of tokens of all outcomes, exchanging collateral tokens and sets of outcome tokens 1:1
|
||||
@ -71,7 +71,7 @@ contract Event {
|
||||
outcomeTokens[i].revoke(msg.sender, outcomeTokenCount);
|
||||
// Transfer collateral tokens to sender
|
||||
require(collateralToken.transfer(msg.sender, outcomeTokenCount));
|
||||
OutcomeTokenSetRevocation(msg.sender, outcomeTokenCount);
|
||||
emit OutcomeTokenSetRevocation(msg.sender, outcomeTokenCount);
|
||||
}
|
||||
|
||||
/// @dev Sets winning event outcome
|
||||
@ -83,7 +83,7 @@ contract Event {
|
||||
// Set winning outcome
|
||||
outcome = oracle.getOutcome();
|
||||
isOutcomeSet = true;
|
||||
OutcomeAssignment(outcome);
|
||||
emit OutcomeAssignment(outcome);
|
||||
}
|
||||
|
||||
/// @dev Returns outcome count
|
||||
|
@ -45,7 +45,7 @@ contract EventFactory {
|
||||
outcomeCount
|
||||
);
|
||||
categoricalEvents[eventHash] = eventContract;
|
||||
CategoricalEventCreation(msg.sender, eventContract, collateralToken, oracle, outcomeCount);
|
||||
emit CategoricalEventCreation(msg.sender, eventContract, collateralToken, oracle, outcomeCount);
|
||||
}
|
||||
|
||||
/// @dev Creates a new scalar event and adds it to the event mapping
|
||||
@ -74,6 +74,6 @@ contract EventFactory {
|
||||
upperBound
|
||||
);
|
||||
scalarEvents[eventHash] = eventContract;
|
||||
ScalarEventCreation(msg.sender, eventContract, collateralToken, oracle, lowerBound, upperBound);
|
||||
emit ScalarEventCreation(msg.sender, eventContract, collateralToken, oracle, lowerBound, upperBound);
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ contract ScalarEvent is Event {
|
||||
outcomeTokens[LONG].revoke(msg.sender, longOutcomeTokenCount);
|
||||
// Payout winnings to sender
|
||||
require(collateralToken.transfer(msg.sender, winnings));
|
||||
WinningsRedemption(msg.sender, winnings);
|
||||
emit WinningsRedemption(msg.sender, winnings);
|
||||
}
|
||||
|
||||
/// @dev Calculates and returns event hash
|
||||
|
@ -111,7 +111,7 @@ contract Campaign {
|
||||
contributions[msg.sender] = contributions[msg.sender].add(amount);
|
||||
if (amount == maxAmount)
|
||||
stage = Stages.AuctionSuccessful;
|
||||
CampaignFunding(msg.sender, amount);
|
||||
emit CampaignFunding(msg.sender, amount);
|
||||
}
|
||||
|
||||
/// @dev Withdraws refund amount
|
||||
@ -126,7 +126,7 @@ contract Campaign {
|
||||
contributions[msg.sender] = 0;
|
||||
// Refund collateral tokens
|
||||
require(eventContract.collateralToken().transfer(msg.sender, refundAmount));
|
||||
CampaignRefund(msg.sender, refundAmount);
|
||||
emit CampaignRefund(msg.sender, refundAmount);
|
||||
}
|
||||
|
||||
/// @dev Allows to create market after successful funding
|
||||
@ -141,7 +141,7 @@ contract Campaign {
|
||||
require(eventContract.collateralToken().approve(market, funding));
|
||||
market.fund(funding);
|
||||
stage = Stages.MarketCreated;
|
||||
MarketCreation(market);
|
||||
emit MarketCreation(market);
|
||||
return market;
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ contract Campaign {
|
||||
eventContract.redeemWinnings();
|
||||
finalBalance = eventContract.collateralToken().balanceOf(this);
|
||||
stage = Stages.MarketClosed;
|
||||
MarketClosing();
|
||||
emit MarketClosing();
|
||||
}
|
||||
|
||||
/// @dev Allows to withdraw fees from campaign contract to contributor
|
||||
@ -172,6 +172,6 @@ contract Campaign {
|
||||
contributions[msg.sender] = 0;
|
||||
// Send fee share to contributor
|
||||
require(eventContract.collateralToken().transfer(msg.sender, fees));
|
||||
FeeWithdrawal(msg.sender, fees);
|
||||
emit FeeWithdrawal(msg.sender, fees);
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,6 @@ contract CampaignFactory {
|
||||
returns (Campaign campaign)
|
||||
{
|
||||
campaign = new Campaign(eventContract, marketFactory, marketMaker, fee, funding, deadline);
|
||||
CampaignCreation(msg.sender, campaign, eventContract, marketFactory, marketMaker, fee, funding, deadline);
|
||||
emit CampaignCreation(msg.sender, campaign, eventContract, marketFactory, marketMaker, fee, funding, deadline);
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ contract StandardMarket is Market {
|
||||
eventContract.buyAllOutcomes(_funding);
|
||||
funding = _funding;
|
||||
stage = Stages.MarketFunded;
|
||||
MarketFunding(funding);
|
||||
emit MarketFunding(funding);
|
||||
}
|
||||
|
||||
/// @dev Allows market creator to close the markets by transferring all remaining outcome tokens to the creator
|
||||
@ -78,7 +78,7 @@ contract StandardMarket is Market {
|
||||
for (uint8 i = 0; i < outcomeCount; i++)
|
||||
require(eventContract.outcomeTokens(i).transfer(creator, eventContract.outcomeTokens(i).balanceOf(this)));
|
||||
stage = Stages.MarketClosed;
|
||||
MarketClosing();
|
||||
emit MarketClosing();
|
||||
}
|
||||
|
||||
/// @dev Allows market creator to withdraw fees generated by trades
|
||||
@ -91,7 +91,7 @@ contract StandardMarket is Market {
|
||||
fees = eventContract.collateralToken().balanceOf(this);
|
||||
// Transfer fees
|
||||
require(eventContract.collateralToken().transfer(creator, fees));
|
||||
FeeWithdrawal(fees);
|
||||
emit FeeWithdrawal(fees);
|
||||
}
|
||||
|
||||
/// @dev Allows to buy outcome tokens from market maker
|
||||
@ -121,7 +121,7 @@ contract StandardMarket is Market {
|
||||
// Add outcome token count to market maker net balance
|
||||
require(int(outcomeTokenCount) >= 0);
|
||||
netOutcomeTokensSold[outcomeTokenIndex] = netOutcomeTokensSold[outcomeTokenIndex].add(int(outcomeTokenCount));
|
||||
OutcomeTokenPurchase(msg.sender, outcomeTokenIndex, outcomeTokenCount, cost);
|
||||
emit OutcomeTokenPurchase(msg.sender, outcomeTokenIndex, outcomeTokenCount, cost);
|
||||
}
|
||||
|
||||
/// @dev Allows to sell outcome tokens to market maker
|
||||
@ -150,7 +150,7 @@ contract StandardMarket is Market {
|
||||
// Subtract outcome token count from market maker net balance
|
||||
require(int(outcomeTokenCount) >= 0);
|
||||
netOutcomeTokensSold[outcomeTokenIndex] = netOutcomeTokensSold[outcomeTokenIndex].sub(int(outcomeTokenCount));
|
||||
OutcomeTokenSale(msg.sender, outcomeTokenIndex, outcomeTokenCount, profit);
|
||||
emit OutcomeTokenSale(msg.sender, outcomeTokenIndex, outcomeTokenCount, profit);
|
||||
}
|
||||
|
||||
/// @dev Buys all outcomes, then sells all shares of selected outcome which were bought, keeping
|
||||
@ -178,7 +178,7 @@ contract StandardMarket is Market {
|
||||
require(eventContract.outcomeTokens(i).transfer(msg.sender, outcomeTokenCount));
|
||||
// Send change back to buyer
|
||||
require(eventContract.collateralToken().transfer(msg.sender, profit));
|
||||
OutcomeTokenShortSale(msg.sender, outcomeTokenIndex, outcomeTokenCount, cost);
|
||||
emit OutcomeTokenShortSale(msg.sender, outcomeTokenIndex, outcomeTokenCount, cost);
|
||||
}
|
||||
|
||||
/// @dev Calculates fee to be paid to market maker
|
||||
|
@ -20,6 +20,6 @@ contract StandardMarketFactory is MarketFactory {
|
||||
returns (Market market)
|
||||
{
|
||||
market = new StandardMarket(msg.sender, eventContract, marketMaker, fee);
|
||||
MarketCreation(msg.sender, market, eventContract, marketMaker, fee);
|
||||
emit MarketCreation(msg.sender, market, eventContract, marketMaker, fee);
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ contract CentralizedOracle is Oracle {
|
||||
// Result is not set yet
|
||||
require(!isSet);
|
||||
owner = newOwner;
|
||||
OwnerReplacement(newOwner);
|
||||
emit OwnerReplacement(newOwner);
|
||||
}
|
||||
|
||||
/// @dev Sets event outcome
|
||||
@ -65,7 +65,7 @@ contract CentralizedOracle is Oracle {
|
||||
require(!isSet);
|
||||
isSet = true;
|
||||
outcome = _outcome;
|
||||
OutcomeAssignment(_outcome);
|
||||
emit OutcomeAssignment(_outcome);
|
||||
}
|
||||
|
||||
/// @dev Returns if winning outcome is set
|
||||
|
@ -22,6 +22,6 @@ contract CentralizedOracleFactory {
|
||||
returns (CentralizedOracle centralizedOracle)
|
||||
{
|
||||
centralizedOracle = new CentralizedOracle(msg.sender, ipfsHash);
|
||||
CentralizedOracleCreation(msg.sender, centralizedOracle, ipfsHash);
|
||||
emit CentralizedOracleCreation(msg.sender, centralizedOracle, ipfsHash);
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ contract DifficultyOracle is Oracle {
|
||||
// Block number was reached and outcome was not set yet
|
||||
require(block.number >= blockNumber && difficulty == 0);
|
||||
difficulty = block.difficulty;
|
||||
OutcomeAssignment(difficulty);
|
||||
emit OutcomeAssignment(difficulty);
|
||||
}
|
||||
|
||||
/// @dev Returns if difficulty is set
|
||||
|
@ -22,6 +22,6 @@ contract DifficultyOracleFactory {
|
||||
returns (DifficultyOracle difficultyOracle)
|
||||
{
|
||||
difficultyOracle = new DifficultyOracle(blockNumber);
|
||||
DifficultyOracleCreation(msg.sender, difficultyOracle, blockNumber);
|
||||
emit DifficultyOracleCreation(msg.sender, difficultyOracle, blockNumber);
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ contract FutarchyOracle is Oracle {
|
||||
require(market.eventContract().collateralToken().approve(market, funding));
|
||||
market.fund(funding);
|
||||
}
|
||||
FutarchyFunding(funding);
|
||||
emit FutarchyFunding(funding);
|
||||
}
|
||||
|
||||
/// @dev Closes market for winning outcome and redeems winnings and sends all collateral tokens to creator
|
||||
@ -123,7 +123,7 @@ contract FutarchyOracle is Oracle {
|
||||
// Redeem collateral token for winning outcome tokens and transfer collateral tokens to creator
|
||||
categoricalEvent.redeemWinnings();
|
||||
require(categoricalEvent.collateralToken().transfer(creator, categoricalEvent.collateralToken().balanceOf(this)));
|
||||
FutarchyClosing();
|
||||
emit FutarchyClosing();
|
||||
}
|
||||
|
||||
/// @dev Allows to set the oracle outcome based on the market with largest long position
|
||||
@ -144,7 +144,7 @@ contract FutarchyOracle is Oracle {
|
||||
}
|
||||
winningMarketIndex = highestIndex;
|
||||
isSet = true;
|
||||
OutcomeAssignment(winningMarketIndex);
|
||||
emit OutcomeAssignment(winningMarketIndex);
|
||||
}
|
||||
|
||||
/// @dev Returns if winning outcome is set
|
||||
|
@ -78,7 +78,7 @@ contract FutarchyOracleFactory {
|
||||
fee,
|
||||
deadline
|
||||
);
|
||||
FutarchyOracleCreation(
|
||||
emit FutarchyOracleCreation(
|
||||
msg.sender,
|
||||
futarchyOracle,
|
||||
collateralToken,
|
||||
|
@ -22,6 +22,6 @@ contract MajorityOracleFactory {
|
||||
returns (MajorityOracle majorityOracle)
|
||||
{
|
||||
majorityOracle = new MajorityOracle(oracles);
|
||||
MajorityOracleCreation(msg.sender, majorityOracle, oracles);
|
||||
emit MajorityOracleCreation(msg.sender, majorityOracle, oracles);
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ contract SignedMessageOracle is Oracle {
|
||||
&& signer == ecrecover(keccak256(descriptionHash, newSigner, _nonce), v, r, s));
|
||||
nonce = _nonce;
|
||||
signer = newSigner;
|
||||
SignerReplacement(newSigner);
|
||||
emit SignerReplacement(newSigner);
|
||||
}
|
||||
|
||||
/// @dev Sets outcome based on signed message
|
||||
@ -77,7 +77,7 @@ contract SignedMessageOracle is Oracle {
|
||||
&& signer == ecrecover(keccak256(descriptionHash, _outcome), v, r, s));
|
||||
isSet = true;
|
||||
outcome = _outcome;
|
||||
OutcomeAssignment(_outcome);
|
||||
emit OutcomeAssignment(_outcome);
|
||||
}
|
||||
|
||||
/// @dev Returns if winning outcome
|
||||
|
@ -26,6 +26,6 @@ contract SignedMessageOracleFactory {
|
||||
{
|
||||
signedMessageOracle = new SignedMessageOracle(descriptionHash, v, r, s);
|
||||
address oracle = ecrecover(descriptionHash, v, r, s);
|
||||
SignedMessageOracleCreation(msg.sender, signedMessageOracle, oracle);
|
||||
emit SignedMessageOracleCreation(msg.sender, signedMessageOracle, oracle);
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ contract UltimateOracle is Oracle {
|
||||
&& forwardedOracle.isOutcomeSet());
|
||||
forwardedOutcome = forwardedOracle.getOutcome();
|
||||
forwardedOutcomeSetTimestamp = now;
|
||||
ForwardedOracleOutcomeAssignment(forwardedOutcome);
|
||||
emit ForwardedOracleOutcomeAssignment(forwardedOutcome);
|
||||
}
|
||||
|
||||
/// @dev Allows to challenge the oracle outcome
|
||||
@ -98,7 +98,7 @@ contract UltimateOracle is Oracle {
|
||||
totalAmount = challengeAmount;
|
||||
frontRunner = _outcome;
|
||||
frontRunnerSetTimestamp = now;
|
||||
OutcomeChallenge(msg.sender, _outcome);
|
||||
emit OutcomeChallenge(msg.sender, _outcome);
|
||||
}
|
||||
|
||||
/// @dev Allows to challenge the oracle outcome
|
||||
@ -122,7 +122,7 @@ contract UltimateOracle is Oracle {
|
||||
frontRunner = _outcome;
|
||||
frontRunnerSetTimestamp = now;
|
||||
}
|
||||
OutcomeVote(msg.sender, _outcome, amount);
|
||||
emit OutcomeVote(msg.sender, _outcome, amount);
|
||||
}
|
||||
|
||||
/// @dev Withdraws winnings for user
|
||||
@ -137,7 +137,7 @@ contract UltimateOracle is Oracle {
|
||||
outcomeAmounts[msg.sender][frontRunner] = 0;
|
||||
// Transfer earnings to contributor
|
||||
require(collateralToken.transfer(msg.sender, amount));
|
||||
Withdrawal(msg.sender, amount);
|
||||
emit Withdrawal(msg.sender, amount);
|
||||
}
|
||||
|
||||
/// @dev Checks if time to challenge the outcome is over
|
||||
|
@ -50,7 +50,7 @@ contract UltimateOracleFactory {
|
||||
challengeAmount,
|
||||
frontRunnerPeriod
|
||||
);
|
||||
UltimateOracleCreation(
|
||||
emit UltimateOracleCreation(
|
||||
msg.sender,
|
||||
ultimateOracle,
|
||||
oracle,
|
||||
|
@ -30,7 +30,7 @@ contract EtherToken is StandardToken {
|
||||
{
|
||||
balances[msg.sender] = balances[msg.sender].add(msg.value);
|
||||
totalTokens = totalTokens.add(msg.value);
|
||||
Deposit(msg.sender, msg.value);
|
||||
emit Deposit(msg.sender, msg.value);
|
||||
}
|
||||
|
||||
/// @dev Sells tokens in exchange for Ether, exchanging them 1:1
|
||||
@ -42,6 +42,6 @@ contract EtherToken is StandardToken {
|
||||
balances[msg.sender] = balances[msg.sender].sub(value);
|
||||
totalTokens = totalTokens.sub(value);
|
||||
msg.sender.transfer(value);
|
||||
Withdrawal(msg.sender, value);
|
||||
emit Withdrawal(msg.sender, value);
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ contract OutcomeToken is StandardToken {
|
||||
{
|
||||
balances[_for] = balances[_for].add(outcomeTokenCount);
|
||||
totalTokens = totalTokens.add(outcomeTokenCount);
|
||||
Issuance(_for, outcomeTokenCount);
|
||||
emit Issuance(_for, outcomeTokenCount);
|
||||
}
|
||||
|
||||
/// @dev Events contract revokes tokens for address. Returns success
|
||||
@ -58,6 +58,6 @@ contract OutcomeToken is StandardToken {
|
||||
{
|
||||
balances[_for] = balances[_for].sub(outcomeTokenCount);
|
||||
totalTokens = totalTokens.sub(outcomeTokenCount);
|
||||
Revocation(_for, outcomeTokenCount);
|
||||
emit Revocation(_for, outcomeTokenCount);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ contract StandardToken is Token {
|
||||
return false;
|
||||
balances[msg.sender] -= value;
|
||||
balances[to] += value;
|
||||
Transfer(msg.sender, to, value);
|
||||
emit Transfer(msg.sender, to, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ contract StandardToken is Token {
|
||||
balances[from] -= value;
|
||||
allowances[from][msg.sender] -= value;
|
||||
balances[to] += value;
|
||||
Transfer(from, to, value);
|
||||
emit Transfer(from, to, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ contract StandardToken is Token {
|
||||
returns (bool)
|
||||
{
|
||||
allowances[msg.sender][spender] = value;
|
||||
Approval(msg.sender, spender, value);
|
||||
emit Approval(msg.sender, spender, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ contract MilestoneTracker {
|
||||
) onlyRecipient campaignNotCanceled {
|
||||
proposedMilestones = _newMilestones;
|
||||
changingMilestones = true;
|
||||
NewMilestoneListProposed();
|
||||
emit NewMilestoneListProposed();
|
||||
}
|
||||
|
||||
|
||||
@ -192,7 +192,7 @@ contract MilestoneTracker {
|
||||
function unproposeMilestones() onlyRecipient campaignNotCanceled {
|
||||
delete proposedMilestones;
|
||||
changingMilestones = false;
|
||||
NewMilestoneListUnproposed();
|
||||
emit NewMilestoneListUnproposed();
|
||||
}
|
||||
|
||||
/// @notice `onlyDonor` Approves the proposed milestone list
|
||||
@ -249,7 +249,7 @@ contract MilestoneTracker {
|
||||
|
||||
delete proposedMilestones;
|
||||
changingMilestones = false;
|
||||
NewMilestoneListAccepted();
|
||||
emit NewMilestoneListAccepted();
|
||||
}
|
||||
|
||||
/// @notice `onlyRecipientOrLeadLink`Marks a milestone as DONE and
|
||||
@ -268,7 +268,7 @@ contract MilestoneTracker {
|
||||
if (now > milestone.maxCompletionDate) throw;
|
||||
milestone.status = MilestoneStatus.Completed;
|
||||
milestone.doneTime = now;
|
||||
ProposalStatusChanged(_idMilestone, milestone.status);
|
||||
emit ProposalStatusChanged(_idMilestone, milestone.status);
|
||||
}
|
||||
|
||||
/// @notice `onlyReviewer` Approves a specific milestone
|
||||
@ -297,7 +297,7 @@ contract MilestoneTracker {
|
||||
(milestone.status != MilestoneStatus.Completed)) throw;
|
||||
|
||||
milestone.status = MilestoneStatus.AcceptedAndInProgress;
|
||||
ProposalStatusChanged(_idMilestone, milestone.status);
|
||||
emit ProposalStatusChanged(_idMilestone, milestone.status);
|
||||
}
|
||||
|
||||
/// @notice `onlyRecipientOrLeadLink` Sends the milestone payment as
|
||||
@ -330,7 +330,7 @@ contract MilestoneTracker {
|
||||
throw;
|
||||
|
||||
milestone.status = MilestoneStatus.Canceled;
|
||||
ProposalStatusChanged(_idMilestone, milestone.status);
|
||||
emit ProposalStatusChanged(_idMilestone, milestone.status);
|
||||
}
|
||||
|
||||
/// @notice `onlyArbitrator` Forces a milestone to be paid out as long as it
|
||||
@ -350,7 +350,7 @@ contract MilestoneTracker {
|
||||
/// milestones.
|
||||
function arbitrateCancelCampaign() onlyArbitrator campaignNotCanceled {
|
||||
campaignCanceled = true;
|
||||
CampaignCanceled();
|
||||
emit CampaignCanceled();
|
||||
}
|
||||
|
||||
// @dev This internal function is executed when the milestone is paid out
|
||||
@ -362,6 +362,6 @@ contract MilestoneTracker {
|
||||
milestone.status = MilestoneStatus.AuthorizedForPayment;
|
||||
if (!milestone.paymentSource.call.value(0)(milestone.payData))
|
||||
throw;
|
||||
ProposalStatusChanged(_idMilestone, milestone.status);
|
||||
emit ProposalStatusChanged(_idMilestone, milestone.status);
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ contract Bounty is PullPayment, Destructible {
|
||||
function createTarget() returns(Target) {
|
||||
Target target = Target(deployContract());
|
||||
researchers[target] = msg.sender;
|
||||
TargetCreated(target);
|
||||
emit TargetCreated(target);
|
||||
return target;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
|
||||
function() payable {
|
||||
// just being sent some cash?
|
||||
if (msg.value > 0)
|
||||
Deposit(msg.sender, msg.value);
|
||||
emit Deposit(msg.sender, msg.value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -58,7 +58,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
|
||||
function execute(address _to, uint256 _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.
|
||||
if (!_to.call.value(_value)(_data)) {
|
||||
throw;
|
||||
@ -71,7 +71,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
|
||||
txs[_r].to = _to;
|
||||
txs[_r].value = _value;
|
||||
txs[_r].data = _data;
|
||||
ConfirmationNeeded(_r, msg.sender, _value, _to, _data);
|
||||
emit ConfirmationNeeded(_r, msg.sender, _value, _to, _data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
|
||||
if (!txs[_h].to.call.value(txs[_h].value)(txs[_h].data)) {
|
||||
throw;
|
||||
}
|
||||
MultiTransact(msg.sender, _h, txs[_h].value, txs[_h].to, txs[_h].data);
|
||||
emit MultiTransact(msg.sender, _h, txs[_h].value, txs[_h].to, txs[_h].data);
|
||||
delete txs[_h];
|
||||
return true;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ contract Crowdsale {
|
||||
weiRaised = updatedWeiRaised;
|
||||
|
||||
token.mint(beneficiary, tokens);
|
||||
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
|
||||
emit TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
|
||||
|
||||
forwardFunds();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ contract FinalizableCrowdsale is Crowdsale, Ownable {
|
||||
require(hasEnded());
|
||||
|
||||
finalization();
|
||||
Finalized();
|
||||
emit Finalized();
|
||||
|
||||
isFinalized = true;
|
||||
}
|
||||
|
@ -36,14 +36,14 @@ contract RefundVault is Ownable {
|
||||
function close() onlyOwner {
|
||||
require(state == State.Active);
|
||||
state = State.Closed;
|
||||
Closed();
|
||||
emit Closed();
|
||||
wallet.transfer(this.balance);
|
||||
}
|
||||
|
||||
function enableRefunds() onlyOwner {
|
||||
require(state == State.Active);
|
||||
state = State.Refunding;
|
||||
RefundsEnabled();
|
||||
emit RefundsEnabled();
|
||||
}
|
||||
|
||||
function refund(address investor) {
|
||||
@ -51,6 +51,6 @@ contract RefundVault is Ownable {
|
||||
uint256 depositedValue = deposited[investor];
|
||||
deposited[investor] = 0;
|
||||
investor.transfer(depositedValue);
|
||||
Refunded(investor, depositedValue);
|
||||
emit Refunded(investor, depositedValue);
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ contract Pausable is Ownable {
|
||||
*/
|
||||
function pause() onlyOwner whenNotPaused returns (bool) {
|
||||
paused = true;
|
||||
Pause();
|
||||
emit Pause();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ contract Pausable is Ownable {
|
||||
*/
|
||||
function unpause() onlyOwner whenPaused returns (bool) {
|
||||
paused = false;
|
||||
Unpause();
|
||||
emit Unpause();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ contract Shareable {
|
||||
if (pending.ownersDone & ownerIndexBit > 0) {
|
||||
pending.yetNeeded++;
|
||||
pending.ownersDone -= ownerIndexBit;
|
||||
Revoke(msg.sender, _operation);
|
||||
emit Revoke(msg.sender, _operation);
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ contract Shareable {
|
||||
uint256 ownerIndexBit = 2**index;
|
||||
// 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.
|
||||
|
@ -22,7 +22,7 @@ contract BasicToken is ERC20Basic {
|
||||
function transfer(address _to, uint256 _value) {
|
||||
balances[msg.sender] = balances[msg.sender].sub(_value);
|
||||
balances[_to] = balances[_to].add(_value);
|
||||
Transfer(msg.sender, _to, _value);
|
||||
emit Transfer(msg.sender, _to, _value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ contract MintableToken is StandardToken, Ownable {
|
||||
function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) {
|
||||
totalSupply = totalSupply.add(_amount);
|
||||
balances[_to] = balances[_to].add(_amount);
|
||||
Mint(_to, _amount);
|
||||
emit Mint(_to, _amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ contract MintableToken is StandardToken, Ownable {
|
||||
*/
|
||||
function finishMinting() onlyOwner returns (bool) {
|
||||
mintingFinished = true;
|
||||
MintFinished();
|
||||
emit MintFinished();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ contract StandardToken is ERC20, BasicToken {
|
||||
balances[_to] = balances[_to].add(_value);
|
||||
balances[_from] = balances[_from].sub(_value);
|
||||
allowed[_from][msg.sender] = _allowance.sub(_value);
|
||||
Transfer(_from, _to, _value);
|
||||
emit Transfer(_from, _to, _value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,7 +49,7 @@ contract StandardToken is ERC20, BasicToken {
|
||||
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw;
|
||||
|
||||
allowed[msg.sender][_spender] = _value;
|
||||
Approval(msg.sender, _spender, _value);
|
||||
emit Approval(msg.sender, _spender, _value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,7 +65,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
|
||||
|
||||
transfer(_to, _value);
|
||||
|
||||
NewTokenGrant(msg.sender, _to, _value, count - 1);
|
||||
emit NewTokenGrant(msg.sender, _to, _value, count - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -96,7 +96,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
|
||||
balances[receiver] = balances[receiver].add(nonVested);
|
||||
balances[_holder] = balances[_holder].sub(nonVested);
|
||||
|
||||
Transfer(_holder, receiver, nonVested);
|
||||
emit Transfer(_holder, receiver, nonVested);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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,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) {
|
||||
|
@ -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) {
|
||||
|
@ -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.
|
||||
@ -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.
|
||||
@ -392,7 +392,7 @@ 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;
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ contract Wallet is multisig, multiowned, daylimit {
|
||||
function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) {
|
||||
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;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(value_types)
|
||||
assembly { b := 7 }
|
||||
C c;
|
||||
assembly { c := sub(0, 5) }
|
||||
E(10, uint16(uint256(-2)), uint24(0x12121212), int24(int256(-1)), bytes3(x), b, c);
|
||||
emit E(10, uint16(uint256(-2)), uint24(0x12121212), int24(int256(-1)), bytes3(x), b, c);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(string_literal)
|
||||
contract C {
|
||||
event E(string, bytes20, string);
|
||||
function f() public {
|
||||
E("abcdef", "abcde", "abcdefabcdefgehabcabcasdfjklabcdefabcedefghabcabcasdfjklabcdefabcdefghabcabcasdfjklabcdeefabcdefghabcabcasdefjklabcdefabcdefghabcabcasdfjkl");
|
||||
emit E("abcdef", "abcde", "abcdefabcdefgehabcabcasdfjklabcdefabcedefghabcabcasdfjklabcdefabcdefghabcabcasdfjklabcdeefabcdefghabcabcasdefjklabcdefabcdefghabcabcasdfjkl");
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(conversion)
|
||||
int8 c;
|
||||
int16 d;
|
||||
assembly { a := sub(0, 1) c := 0x0101ff d := 0xff01 }
|
||||
E(10, x, a, uint8(b), c, int8(d));
|
||||
emit E(10, x, a, uint8(b), c, int8(d));
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -159,7 +159,7 @@ BOOST_AUTO_TEST_CASE(memory_array_one_dim)
|
||||
mstore(add(x, mul(add(i, 1), 0x20)), add(0xfffffffe, i))
|
||||
}
|
||||
}
|
||||
E(10, x, 11);
|
||||
emit E(10, x, 11);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -188,7 +188,7 @@ BOOST_AUTO_TEST_CASE(memory_array_two_dim)
|
||||
x[0][2] = -1;
|
||||
x[1][0] = 4;
|
||||
x[1][1] = 5;
|
||||
E(10, x, 11);
|
||||
emit E(10, x, 11);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -208,7 +208,7 @@ BOOST_AUTO_TEST_CASE(memory_byte_array)
|
||||
bytes[] memory x = new bytes[](2);
|
||||
x[0] = "abcabcdefghjklmnopqrsuvwabcdefgijklmnopqrstuwabcdefgijklmnoprstuvw";
|
||||
x[1] = "abcdefghijklmnopqrtuvwabcfghijklmnopqstuvwabcdeghijklmopqrstuvw";
|
||||
E(10, x, 11);
|
||||
emit E(10, x, 11);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -234,7 +234,7 @@ BOOST_AUTO_TEST_CASE(storage_byte_array)
|
||||
function f() public {
|
||||
short = "123456789012345678901234567890a";
|
||||
long = "ffff123456789012345678901234567890afffffffff123456789012345678901234567890a";
|
||||
E(short, long);
|
||||
emit E(short, long);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -261,7 +261,7 @@ BOOST_AUTO_TEST_CASE(storage_array)
|
||||
sstore(1, sub(0, 2))
|
||||
sstore(2, sub(0, 3))
|
||||
}
|
||||
E(addr);
|
||||
emit E(addr);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -282,7 +282,7 @@ BOOST_AUTO_TEST_CASE(storage_array_dyn)
|
||||
addr.push(0x0000000000000000000000000000000000000001);
|
||||
addr.push(0x0000000000000000000000000000000000000002);
|
||||
addr.push(0x0000000000000000000000000000000000000003);
|
||||
E(addr);
|
||||
emit E(addr);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -308,7 +308,7 @@ BOOST_AUTO_TEST_CASE(storage_array_compact)
|
||||
x.push(6);
|
||||
x.push(-7);
|
||||
x.push(8);
|
||||
E(x);
|
||||
emit E(x);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -329,7 +329,7 @@ BOOST_AUTO_TEST_CASE(external_function)
|
||||
function(uint) external returns (uint) g;
|
||||
function f(uint) public returns (uint) {
|
||||
g = this.f;
|
||||
E(this.f, g);
|
||||
emit E(this.f, g);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -351,7 +351,7 @@ BOOST_AUTO_TEST_CASE(external_function_cleanup)
|
||||
function f(uint) public returns (uint) {
|
||||
function(uint) external returns (uint)[1] memory h;
|
||||
assembly { sstore(0, sub(0, 1)) mstore(h, sub(0, 1)) }
|
||||
E(h[0], g);
|
||||
emit E(h[0], g);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -368,7 +368,7 @@ BOOST_AUTO_TEST_CASE(calldata)
|
||||
contract C {
|
||||
event E(bytes);
|
||||
function f(bytes a) external {
|
||||
E(a);
|
||||
emit E(a);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -426,7 +426,7 @@ BOOST_AUTO_TEST_CASE(structs)
|
||||
s.sub[0].x[0] = 11;
|
||||
s.sub[1].x[0] = 12;
|
||||
s.sub[2].x[1] = 13;
|
||||
e(x, s);
|
||||
emit e(x, s);
|
||||
return (x, s);
|
||||
}
|
||||
}
|
||||
|
@ -3122,7 +3122,7 @@ BOOST_AUTO_TEST_CASE(event)
|
||||
bytes32 s = 0x19dacbf83c5de6658e14cbf7bcae5c15eca2eedecf1c66fbca928e4d351bea0f;
|
||||
log3(bytes32(msg.value), s, bytes32(uint256(msg.sender)), _id);
|
||||
} else {
|
||||
Deposit(msg.sender, _id, msg.value);
|
||||
emit Deposit(msg.sender, _id, msg.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3172,7 +3172,7 @@ BOOST_AUTO_TEST_CASE(event_no_arguments)
|
||||
contract ClientReceipt {
|
||||
event Deposit();
|
||||
function deposit() {
|
||||
Deposit();
|
||||
emit Deposit();
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -3186,28 +3186,6 @@ BOOST_AUTO_TEST_CASE(event_no_arguments)
|
||||
BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("Deposit()")));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(event_access_through_base_name)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract A {
|
||||
event x();
|
||||
}
|
||||
contract B is A {
|
||||
function f() returns (uint) {
|
||||
A.x();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
callContractFunction("f()");
|
||||
BOOST_REQUIRE_EQUAL(m_logs.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress);
|
||||
BOOST_CHECK(m_logs[0].data.empty());
|
||||
BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("x()")));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(event_access_through_base_name_emit)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
@ -3238,67 +3216,15 @@ BOOST_AUTO_TEST_CASE(events_with_same_name)
|
||||
event Deposit(address _addr);
|
||||
event Deposit(address _addr, uint _amount);
|
||||
function deposit() returns (uint) {
|
||||
Deposit();
|
||||
emit Deposit();
|
||||
return 1;
|
||||
}
|
||||
function deposit(address _addr) returns (uint) {
|
||||
Deposit(_addr);
|
||||
emit Deposit(_addr);
|
||||
return 1;
|
||||
}
|
||||
function deposit(address _addr, uint _amount) returns (uint) {
|
||||
Deposit(_addr, _amount);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
)";
|
||||
u160 const c_loggedAddress = m_contractAddress;
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
ABI_CHECK(callContractFunction("deposit()"), encodeArgs(u256(1)));
|
||||
BOOST_REQUIRE_EQUAL(m_logs.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress);
|
||||
BOOST_CHECK(m_logs[0].data.empty());
|
||||
BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("Deposit()")));
|
||||
|
||||
ABI_CHECK(callContractFunction("deposit(address)", c_loggedAddress), encodeArgs(u256(1)));
|
||||
BOOST_REQUIRE_EQUAL(m_logs.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress);
|
||||
BOOST_CHECK(m_logs[0].data == encodeArgs(c_loggedAddress));
|
||||
BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("Deposit(address)")));
|
||||
|
||||
ABI_CHECK(callContractFunction("deposit(address,uint256)", c_loggedAddress, u256(100)), encodeArgs(u256(1)));
|
||||
BOOST_REQUIRE_EQUAL(m_logs.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress);
|
||||
BOOST_CHECK(m_logs[0].data == encodeArgs(c_loggedAddress, 100));
|
||||
BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("Deposit(address,uint256)")));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(events_with_same_name_inherited)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract A {
|
||||
event Deposit();
|
||||
}
|
||||
|
||||
contract B {
|
||||
event Deposit(address _addr);
|
||||
}
|
||||
|
||||
contract ClientReceipt is A, B {
|
||||
event Deposit(address _addr, uint _amount);
|
||||
function deposit() returns (uint) {
|
||||
Deposit();
|
||||
return 1;
|
||||
}
|
||||
function deposit(address _addr) returns (uint) {
|
||||
Deposit(_addr);
|
||||
return 1;
|
||||
}
|
||||
function deposit(address _addr, uint _amount) returns (uint) {
|
||||
Deposit(_addr, _amount);
|
||||
emit Deposit(_addr, _amount);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -3386,7 +3312,7 @@ BOOST_AUTO_TEST_CASE(event_anonymous)
|
||||
contract ClientReceipt {
|
||||
event Deposit() anonymous;
|
||||
function deposit() {
|
||||
Deposit();
|
||||
emit Deposit();
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -3401,7 +3327,7 @@ BOOST_AUTO_TEST_CASE(event_anonymous_with_topics)
|
||||
contract ClientReceipt {
|
||||
event Deposit(address indexed _from, bytes32 indexed _id, uint indexed _value, uint indexed _value2, bytes32 data) anonymous;
|
||||
function deposit(bytes32 _id) payable {
|
||||
Deposit(msg.sender, _id, msg.value, 2, "abc");
|
||||
emit Deposit(msg.sender, _id, msg.value, 2, "abc");
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -3425,7 +3351,7 @@ BOOST_AUTO_TEST_CASE(event_lots_of_data)
|
||||
contract ClientReceipt {
|
||||
event Deposit(address _from, bytes32 _id, uint _value, bool _flag);
|
||||
function deposit(bytes32 _id) payable {
|
||||
Deposit(msg.sender, _id, msg.value, true);
|
||||
emit Deposit(msg.sender, _id, msg.value, true);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -3446,7 +3372,7 @@ BOOST_AUTO_TEST_CASE(event_really_lots_of_data)
|
||||
contract ClientReceipt {
|
||||
event Deposit(uint fixeda, bytes dynx, uint fixedb);
|
||||
function deposit() {
|
||||
Deposit(10, msg.data, 15);
|
||||
emit Deposit(10, msg.data, 15);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -3470,7 +3396,7 @@ BOOST_AUTO_TEST_CASE(event_really_lots_of_data_from_storage)
|
||||
x[0] = "A";
|
||||
x[1] = "B";
|
||||
x[2] = "C";
|
||||
Deposit(10, x, 15);
|
||||
emit Deposit(10, x, 15);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -3495,7 +3421,7 @@ BOOST_AUTO_TEST_CASE(event_really_really_lots_of_data_from_storage)
|
||||
x[1] = "B";
|
||||
x[2] = "C";
|
||||
x[30] = "Z";
|
||||
Deposit(10, x, 15);
|
||||
emit Deposit(10, x, 15);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -3523,7 +3449,7 @@ BOOST_AUTO_TEST_CASE(event_indexed_string)
|
||||
y[1] = 5;
|
||||
y[2] = 6;
|
||||
y[3] = 7;
|
||||
E(x, y);
|
||||
emit E(x, y);
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -4246,7 +4172,7 @@ BOOST_AUTO_TEST_CASE(storing_invalid_boolean)
|
||||
assembly {
|
||||
tmp := 5
|
||||
}
|
||||
Ev(tmp);
|
||||
emit Ev(tmp);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -6034,12 +5960,12 @@ BOOST_AUTO_TEST_CASE(invalid_enum_logged)
|
||||
assembly {
|
||||
garbled := 5
|
||||
}
|
||||
Log(garbled);
|
||||
emit Log(garbled);
|
||||
return 1;
|
||||
}
|
||||
function test_log_ok() returns (uint) {
|
||||
X x = X.A;
|
||||
Log(x);
|
||||
emit Log(x);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -11932,7 +11858,7 @@ BOOST_AUTO_TEST_CASE(snark)
|
||||
input[7] = 9643208548031422463313148630985736896287522941726746581856185889848792022807;
|
||||
input[8] = 18066496933330839731877828156604;
|
||||
if (verify(input, proof) == 0) {
|
||||
Verified("Transaction successfully verified.");
|
||||
emit Verified("Transaction successfully verified.");
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -1,6 +1,5 @@
|
||||
contract c {
|
||||
event e(uint indexed a, bytes3 indexed s, bool indexed b);
|
||||
function f() public { e(2, "abc", true); }
|
||||
function f() public { emit e(2, "abc", true); }
|
||||
}
|
||||
// ----
|
||||
// Warning: (102-119): Invoking events without "emit" prefix is deprecated.
|
||||
|
@ -1,6 +1,5 @@
|
||||
contract c {
|
||||
event e(uint a, bytes3 indexed s, bool indexed b);
|
||||
function f() public { e(2, "abc", true); }
|
||||
function f() public { emit e(2, "abc", true); }
|
||||
}
|
||||
// ----
|
||||
// Warning: (94-111): Invoking events without "emit" prefix is deprecated.
|
||||
|
@ -2,7 +2,6 @@ contract base {
|
||||
event e(uint a, bytes3 indexed s, bool indexed b);
|
||||
}
|
||||
contract c is base {
|
||||
function f() public { e(2, "abc", true); }
|
||||
function f() public { emit e(2, "abc", true); }
|
||||
}
|
||||
// ----
|
||||
// Warning: (120-137): Invoking events without "emit" prefix is deprecated.
|
||||
|
@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (62-65): Invoking events without "emit" prefix is deprecated.
|
||||
// TypeError: (62-65): Event invocations have to be prefixed by "emit".
|
||||
|
@ -2,9 +2,8 @@ pragma solidity ^0.4.3;
|
||||
contract C {
|
||||
event SomeEvent();
|
||||
function a() public {
|
||||
(SomeEvent(), 7);
|
||||
(emit SomeEvent(), 7);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (95-106): Invoking events without "emit" prefix is deprecated.
|
||||
// Warning: (95-106): Tuple component cannot be empty.
|
||||
// ParserError: (95-99): Expected primary expression.
|
||||
|
@ -1,10 +0,0 @@
|
||||
pragma experimental "v0.5.0";
|
||||
contract C {
|
||||
event SomeEvent();
|
||||
function a() public {
|
||||
(SomeEvent(), 7);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (101-112): Event invocations have to be prefixed by "emit".
|
||||
// TypeError: (101-112): Tuple component cannot be empty.
|
Loading…
Reference in New Issue
Block a user