diff options
author | chriseth <chris@ethereum.org> | 2018-06-27 16:35:38 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-06-27 16:37:46 +0800 |
commit | 01fd5a8d51d1a950349fc7467454183cc5d0f145 (patch) | |
tree | d5eb024dd73e21b54e2c546516aa53f3b53e677d /test/compilationTests/gnosis | |
parent | b9d035264d924ca63472a6be0af287dec75c4355 (diff) | |
download | dexon-solidity-01fd5a8d51d1a950349fc7467454183cc5d0f145.tar.gz dexon-solidity-01fd5a8d51d1a950349fc7467454183cc5d0f145.tar.zst dexon-solidity-01fd5a8d51d1a950349fc7467454183cc5d0f145.zip |
Add emit keyword to compilation tests.
Diffstat (limited to 'test/compilationTests/gnosis')
22 files changed, 46 insertions, 46 deletions
diff --git a/test/compilationTests/gnosis/Events/CategoricalEvent.sol b/test/compilationTests/gnosis/Events/CategoricalEvent.sol index 6bcec271..4433bdfd 100644 --- a/test/compilationTests/gnosis/Events/CategoricalEvent.sol +++ b/test/compilationTests/gnosis/Events/CategoricalEvent.sol @@ -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 diff --git a/test/compilationTests/gnosis/Events/Event.sol b/test/compilationTests/gnosis/Events/Event.sol index 4d390d0e..a6edb778 100644 --- a/test/compilationTests/gnosis/Events/Event.sol +++ b/test/compilationTests/gnosis/Events/Event.sol @@ -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 diff --git a/test/compilationTests/gnosis/Events/EventFactory.sol b/test/compilationTests/gnosis/Events/EventFactory.sol index 4779c6e4..acef3330 100644 --- a/test/compilationTests/gnosis/Events/EventFactory.sol +++ b/test/compilationTests/gnosis/Events/EventFactory.sol @@ -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); } } diff --git a/test/compilationTests/gnosis/Events/ScalarEvent.sol b/test/compilationTests/gnosis/Events/ScalarEvent.sol index 3120090c..4f268a38 100644 --- a/test/compilationTests/gnosis/Events/ScalarEvent.sol +++ b/test/compilationTests/gnosis/Events/ScalarEvent.sol @@ -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 diff --git a/test/compilationTests/gnosis/Markets/Campaign.sol b/test/compilationTests/gnosis/Markets/Campaign.sol index d2e841b1..f99ede53 100644 --- a/test/compilationTests/gnosis/Markets/Campaign.sol +++ b/test/compilationTests/gnosis/Markets/Campaign.sol @@ -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); } } diff --git a/test/compilationTests/gnosis/Markets/CampaignFactory.sol b/test/compilationTests/gnosis/Markets/CampaignFactory.sol index 930ec2e2..d80d7d63 100644 --- a/test/compilationTests/gnosis/Markets/CampaignFactory.sol +++ b/test/compilationTests/gnosis/Markets/CampaignFactory.sol @@ -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); } } diff --git a/test/compilationTests/gnosis/Markets/StandardMarket.sol b/test/compilationTests/gnosis/Markets/StandardMarket.sol index fc384d3a..84f30386 100644 --- a/test/compilationTests/gnosis/Markets/StandardMarket.sol +++ b/test/compilationTests/gnosis/Markets/StandardMarket.sol @@ -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 diff --git a/test/compilationTests/gnosis/Markets/StandardMarketFactory.sol b/test/compilationTests/gnosis/Markets/StandardMarketFactory.sol index 101c37a2..88dcbe79 100644 --- a/test/compilationTests/gnosis/Markets/StandardMarketFactory.sol +++ b/test/compilationTests/gnosis/Markets/StandardMarketFactory.sol @@ -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); } } diff --git a/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol b/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol index 08d8e159..362c514c 100644 --- a/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol +++ b/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol @@ -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 diff --git a/test/compilationTests/gnosis/Oracles/CentralizedOracleFactory.sol b/test/compilationTests/gnosis/Oracles/CentralizedOracleFactory.sol index 62a12cf4..ca4e37d2 100644 --- a/test/compilationTests/gnosis/Oracles/CentralizedOracleFactory.sol +++ b/test/compilationTests/gnosis/Oracles/CentralizedOracleFactory.sol @@ -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); } } diff --git a/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol b/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol index a9933a8c..94fc70ca 100644 --- a/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol +++ b/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol @@ -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 diff --git a/test/compilationTests/gnosis/Oracles/DifficultyOracleFactory.sol b/test/compilationTests/gnosis/Oracles/DifficultyOracleFactory.sol index 2e97362c..fc5dcc3b 100644 --- a/test/compilationTests/gnosis/Oracles/DifficultyOracleFactory.sol +++ b/test/compilationTests/gnosis/Oracles/DifficultyOracleFactory.sol @@ -22,6 +22,6 @@ contract DifficultyOracleFactory { returns (DifficultyOracle difficultyOracle) { difficultyOracle = new DifficultyOracle(blockNumber); - DifficultyOracleCreation(msg.sender, difficultyOracle, blockNumber); + emit DifficultyOracleCreation(msg.sender, difficultyOracle, blockNumber); } } diff --git a/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol b/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol index 196d38c5..7105f247 100644 --- a/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol +++ b/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol @@ -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 diff --git a/test/compilationTests/gnosis/Oracles/FutarchyOracleFactory.sol b/test/compilationTests/gnosis/Oracles/FutarchyOracleFactory.sol index 1415486c..3c6e5c15 100644 --- a/test/compilationTests/gnosis/Oracles/FutarchyOracleFactory.sol +++ b/test/compilationTests/gnosis/Oracles/FutarchyOracleFactory.sol @@ -78,7 +78,7 @@ contract FutarchyOracleFactory { fee, deadline ); - FutarchyOracleCreation( + emit FutarchyOracleCreation( msg.sender, futarchyOracle, collateralToken, diff --git a/test/compilationTests/gnosis/Oracles/MajorityOracleFactory.sol b/test/compilationTests/gnosis/Oracles/MajorityOracleFactory.sol index 0024516a..3c02fef4 100644 --- a/test/compilationTests/gnosis/Oracles/MajorityOracleFactory.sol +++ b/test/compilationTests/gnosis/Oracles/MajorityOracleFactory.sol @@ -22,6 +22,6 @@ contract MajorityOracleFactory { returns (MajorityOracle majorityOracle) { majorityOracle = new MajorityOracle(oracles); - MajorityOracleCreation(msg.sender, majorityOracle, oracles); + emit MajorityOracleCreation(msg.sender, majorityOracle, oracles); } } diff --git a/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol b/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol index 9a7bba41..83990b9b 100644 --- a/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol +++ b/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol @@ -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 diff --git a/test/compilationTests/gnosis/Oracles/SignedMessageOracleFactory.sol b/test/compilationTests/gnosis/Oracles/SignedMessageOracleFactory.sol index 0884d8ca..ea70b2aa 100644 --- a/test/compilationTests/gnosis/Oracles/SignedMessageOracleFactory.sol +++ b/test/compilationTests/gnosis/Oracles/SignedMessageOracleFactory.sol @@ -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); } } diff --git a/test/compilationTests/gnosis/Oracles/UltimateOracle.sol b/test/compilationTests/gnosis/Oracles/UltimateOracle.sol index 0127117c..dd66c9ab 100644 --- a/test/compilationTests/gnosis/Oracles/UltimateOracle.sol +++ b/test/compilationTests/gnosis/Oracles/UltimateOracle.sol @@ -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 diff --git a/test/compilationTests/gnosis/Oracles/UltimateOracleFactory.sol b/test/compilationTests/gnosis/Oracles/UltimateOracleFactory.sol index 67f8a96e..51f5610e 100644 --- a/test/compilationTests/gnosis/Oracles/UltimateOracleFactory.sol +++ b/test/compilationTests/gnosis/Oracles/UltimateOracleFactory.sol @@ -50,7 +50,7 @@ contract UltimateOracleFactory { challengeAmount, frontRunnerPeriod ); - UltimateOracleCreation( + emit UltimateOracleCreation( msg.sender, ultimateOracle, oracle, diff --git a/test/compilationTests/gnosis/Tokens/EtherToken.sol b/test/compilationTests/gnosis/Tokens/EtherToken.sol index f6e73e5a..32e64583 100644 --- a/test/compilationTests/gnosis/Tokens/EtherToken.sol +++ b/test/compilationTests/gnosis/Tokens/EtherToken.sol @@ -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); } } diff --git a/test/compilationTests/gnosis/Tokens/OutcomeToken.sol b/test/compilationTests/gnosis/Tokens/OutcomeToken.sol index 4757c798..0bc7307d 100644 --- a/test/compilationTests/gnosis/Tokens/OutcomeToken.sol +++ b/test/compilationTests/gnosis/Tokens/OutcomeToken.sol @@ -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); } } diff --git a/test/compilationTests/gnosis/Tokens/StandardToken.sol b/test/compilationTests/gnosis/Tokens/StandardToken.sol index fc899ca6..b7d0d37a 100644 --- a/test/compilationTests/gnosis/Tokens/StandardToken.sol +++ b/test/compilationTests/gnosis/Tokens/StandardToken.sol @@ -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; } |