Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Updated solidity code to the pragma 0.4.24 compiler specification. #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8,175 changes: 8,175 additions & 0 deletions build/contracts/ERC20Interface.json

Large diffs are not rendered by default.

8,237 changes: 8,237 additions & 0 deletions build/contracts/FixedSupplyToken.json

Large diffs are not rendered by default.

2,890 changes: 2,890 additions & 0 deletions build/contracts/Forwarder.json

Large diffs are not rendered by default.

1,280 changes: 1,280 additions & 0 deletions build/contracts/ForwarderTarget.json

Large diffs are not rendered by default.

13,806 changes: 13,806 additions & 0 deletions build/contracts/WalletSimple.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions contracts/FixedSupplyToken.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.11;
pragma solidity ^0.4.24;

// ----------------------------------------------------------------------------------------------
// Sample fixed supply token contract
Expand Down Expand Up @@ -59,7 +59,7 @@ contract FixedSupplyToken is ERC20Interface {
}

// Constructor
function FixedSupplyToken() public {
constructor() public {
owner = msg.sender;
balances[owner] = _totalSupply;
}
Expand All @@ -78,7 +78,7 @@ contract FixedSupplyToken is ERC20Interface {
if (balances[msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) {
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sender, _to, _amount);
emit Transfer(msg.sender, _to, _amount);
return true;
} else {
return false;
Expand All @@ -100,7 +100,7 @@ contract FixedSupplyToken is ERC20Interface {
balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(_from, _to, _amount);
emit Transfer(_from, _to, _amount);
return true;
} else {
return false;
Expand All @@ -111,11 +111,11 @@ contract FixedSupplyToken is ERC20Interface {
// If this function is called again it overwrites the current allowance with _value.
function approve(address _spender, uint256 _amount) public returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
emit Approval(msg.sender, _spender, _amount);
return true;
}

function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
}
12 changes: 6 additions & 6 deletions contracts/Forwarder.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.24;
import "./ERC20Interface.sol";
/**
* Contract that will forward any incoming Ether to the creator of the contract
Expand All @@ -11,7 +11,7 @@ contract Forwarder {
/**
* Create the contract, and sets the destination address to that of the creator
*/
function Forwarder() public {
constructor() public {
parentAddress = msg.sender;
}

Expand All @@ -32,7 +32,7 @@ contract Forwarder {
// throws on failure
parentAddress.transfer(msg.value);
// Fire off the deposited event if we can forward it
ForwarderDeposited(msg.sender, msg.value, msg.data);
emit ForwarderDeposited(msg.sender, msg.value, msg.data);
}

/**
Expand All @@ -41,8 +41,8 @@ contract Forwarder {
*/
function flushTokens(address tokenContractAddress) public onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
var forwarderAddress = address(this);
var forwarderBalance = instance.balanceOf(forwarderAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
Expand All @@ -57,6 +57,6 @@ contract Forwarder {
*/
function flush() public {
// throws on failure
parentAddress.transfer(this.balance);
parentAddress.transfer(address(this).balance);
}
}
6 changes: 3 additions & 3 deletions contracts/ForwarderTarget.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.24;


import "./Forwarder.sol";

// This is a test target for a Forwarder.
// It contains a public function with a side-effect.
contract ForwarderTarget {
uint public data;
uint256 public data;

function ForwarderTarget() public {
constructor() public {
}

function setDataWithValue(uint d, bool b) payable public returns (bool) {
Expand Down
18 changes: 9 additions & 9 deletions contracts/WalletSimple.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.24;
import "./Forwarder.sol";
import "./ERC20Interface.sol";
/**
Expand Down Expand Up @@ -56,7 +56,7 @@ contract WalletSimple {
*
* @param allowedSigners An array of signers on the wallet
*/
function WalletSimple(address[] allowedSigners) public {
constructor(address[] allowedSigners) public {
if (allowedSigners.length != 3) {
// Invalid number of signers
revert();
Expand Down Expand Up @@ -95,7 +95,7 @@ contract WalletSimple {
function() public payable {
if (msg.value > 0) {
// Fire deposited event if we are receiving funds
Deposited(msg.sender, msg.value, msg.data);
emit Deposited(msg.sender, msg.value, msg.data);
}
}

Expand Down Expand Up @@ -127,16 +127,16 @@ contract WalletSimple {
bytes signature
) public onlySigner {
// Verify the other signer
var operationHash = keccak256("ETHER", toAddress, value, data, expireTime, sequenceId);
bytes32 operationHash = keccak256(abi.encodePacked("ETHER", toAddress, value, data, expireTime, sequenceId));

var otherSigner = verifyMultiSig(toAddress, operationHash, signature, expireTime, sequenceId);
address otherSigner = verifyMultiSig(toAddress, operationHash, signature, expireTime, sequenceId);

// Success, send the transaction
if (!(toAddress.call.value(value)(data))) {
// Failed executing transaction
revert();
}
Transacted(msg.sender, otherSigner, operationHash, toAddress, value, data);
emit Transacted(msg.sender, otherSigner, operationHash, toAddress, value, data);
}

/**
Expand All @@ -159,7 +159,7 @@ contract WalletSimple {
bytes signature
) public onlySigner {
// Verify the other signer
var operationHash = keccak256("ERC20", toAddress, value, tokenContractAddress, expireTime, sequenceId);
bytes32 operationHash = keccak256(abi.encodePacked("ERC20", toAddress, value, tokenContractAddress, expireTime, sequenceId));

verifyMultiSig(toAddress, operationHash, signature, expireTime, sequenceId);

Expand Down Expand Up @@ -201,7 +201,7 @@ contract WalletSimple {
uint sequenceId
) private returns (address) {

var otherSigner = recoverAddressFromSignature(operationHash, signature);
address otherSigner = recoverAddressFromSignature(operationHash, signature);

// Verify if we are in safe mode. In safe mode, the wallet can only send to signers
if (safeMode && !isSigner(toAddress)) {
Expand Down Expand Up @@ -234,7 +234,7 @@ contract WalletSimple {
*/
function activateSafeMode() public onlySigner {
safeMode = true;
SafeModeActivated(msg.sender);
emit SafeModeActivated(msg.sender);
}

/**
Expand Down