-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
changes to compile at 5.0 #100
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
pragma solidity ^0.4.24; | ||
pragma solidity ^0.5.0; | ||
|
||
import "../ownership/Ownable.sol"; | ||
|
||
|
||
//was not compiling with selfdestruct(owner) added a require and changed parameter from owner to msg.sender | ||
|
||
|
||
contract Destructible is Ownable { | ||
function selfDestruct() public onlyOwner { | ||
selfdestruct(owner); | ||
require(owner == msg.sender); | ||
selfdestruct(msg.sender); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pragma solidity ^0.4.24; | ||
pragma solidity ^0.5.0; | ||
|
||
contract Ownable { | ||
address public owner; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pragma solidity ^0.4.24; | ||
pragma solidity ^0.5.0; | ||
|
||
import "./ZapCoordinatorInterface.sol"; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
pragma solidity ^0.4.24; | ||
pragma solidity ^0.5.0; | ||
|
||
import "./Ownable.sol"; | ||
|
||
contract ZapCoordinatorInterface is Ownable { | ||
function addImmutableContract(string contractName, address newAddress) external; | ||
function updateContract(string contractName, address newAddress) external; | ||
function getContractName(uint index) public view returns (string); | ||
function getContract(string contractName) public view returns (address); | ||
function addImmutableContract(string calldata contractName, address newAddress) external; | ||
function updateContract(string calldata contractName, address newAddress) external; | ||
function getContractName(uint index) public view returns (string memory); | ||
function getContract(string memory contractName) public view returns (address); | ||
function updateAllDependencies() external; | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pragma solidity ^0.4.24; | ||
pragma solidity ^0.5.0; | ||
|
||
import "../token/TokenFactoryInterface.sol"; | ||
import "../token/FactoryTokenInterface.sol"; | ||
|
@@ -18,7 +18,7 @@ contract ERCDotFactory is Ownable { | |
|
||
event DotTokenCreated(address tokenAddress); | ||
|
||
constructor(address coordinator, address factory){ | ||
constructor(address coordinator, address factory) public { | ||
coord = ZapCoordinatorInterface(coordinator); | ||
reserveToken = FactoryTokenInterface(coord.getContract("ZAP_TOKEN")); | ||
reserveToken.approve(coord.getContract("BONDAGE"), ~uint256(0)); | ||
|
@@ -30,9 +30,9 @@ contract ERCDotFactory is Ownable { | |
bytes32 providerTitle, | ||
bytes32 specifier, | ||
bytes32 symbol, | ||
int256[] curve | ||
) returns(address) { | ||
require(curves[specifier] == 0, "Curve specifier already exists"); | ||
int256[] memory curve | ||
) public returns(address) { | ||
require(curves[specifier] == address(0) , "Curve specifier already exists"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. require(curves[specifier] == 0) . could not compare and address to a uint, so casted address to zero with address(0) |
||
|
||
RegistryInterface registry = RegistryInterface(coord.getContract("REGISTRY")); | ||
if (!registry.isProviderInitiated(address(this))) { | ||
|
@@ -42,7 +42,7 @@ contract ERCDotFactory is Ownable { | |
registry.initiateProviderCurve(specifier, curve, address(this)); | ||
curves[specifier] = newToken(bytes32ToString(specifier), bytes32ToString(symbol)); | ||
|
||
DotTokenCreated(curves[specifier]); | ||
emit DotTokenCreated(curves[specifier]); | ||
return curves[specifier]; | ||
} | ||
|
||
|
@@ -62,8 +62,8 @@ contract ERCDotFactory is Ownable { | |
} | ||
|
||
function newToken( | ||
string name, | ||
string symbol | ||
string memory name, | ||
string memory symbol | ||
) | ||
public | ||
returns (address tokenAddress) | ||
|
@@ -74,7 +74,7 @@ contract ERCDotFactory is Ownable { | |
} | ||
|
||
//https://ethereum.stackexchange.com/questions/2519/how-to-convert-a-bytes32-to-string | ||
function bytes32ToString(bytes32 x) constant returns (string) { | ||
function bytes32ToString(bytes32 x) pure public returns (string memory) { | ||
bytes memory bytesString = new bytes(32); | ||
|
||
bytesString = abi.encodePacked(x); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pragma solidity ^0.4.24; | ||
pragma solidity ^0.5.0; | ||
|
||
import "../../platform/bondage/currentCost/CurrentCostInterface.sol"; | ||
import "./ERCDotFactory.sol"; | ||
|
@@ -13,7 +13,7 @@ contract EthAdapter is ERCDotFactory { | |
|
||
event MsgSender(address _sender); | ||
|
||
constructor(address coordinator, address tokenFactory, uint256 rate) | ||
constructor(address coordinator, address tokenFactory, uint256 rate) public | ||
ERCDotFactory(coordinator, tokenFactory) { | ||
adapterRate = rate; | ||
} | ||
|
@@ -23,12 +23,12 @@ contract EthAdapter is ERCDotFactory { | |
adapterRate = rate; | ||
} | ||
|
||
function ownerBond(address wallet, bytes32 specifier, uint numDots) payable onlyOwner { | ||
function ownerBond(address wallet, bytes32 specifier, uint numDots) public payable onlyOwner { | ||
emit MsgSender(msg.sender); | ||
bond(wallet, specifier, numDots); | ||
} | ||
|
||
function ownerUnbond(address wallet, bytes32 specifier, uint quantity) onlyOwner { | ||
function ownerUnbond(address wallet, bytes32 specifier, uint quantity) public onlyOwner { | ||
unbond(wallet, specifier, quantity); | ||
} | ||
|
||
|
@@ -52,8 +52,8 @@ contract EthAdapter is ERCDotFactory { | |
} | ||
|
||
//Override | ||
function unbond(address wallet, bytes32 specifier, uint quantity) internal { | ||
|
||
function unbond1(address payable wallet, bytes32 specifier, uint quantity) internal { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suspected namespacing issues so renamed function to unbond1 to prevent other bond function to be called correctly. compiler kept throwing issue to unbond |
||
bondage = BondageInterface(coord.getContract("BONDAGE")); | ||
uint issued = bondage.getDotsIssued(address(this), specifier); | ||
|
||
|
@@ -66,10 +66,10 @@ contract EthAdapter is ERCDotFactory { | |
//burn dot backed token | ||
tok.burnFrom(wallet, quantity); | ||
//send wallet eth | ||
wallet.transfer(reserveCost * adapterRate); | ||
address(wallet).transfer(reserveCost * adapterRate); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. compiler throwing issues to wallet.transfer casted wallet to address(wallet) to avoid compiler error |
||
} | ||
|
||
function getAdapterPrice(bytes32 specifier, uint quantity) view returns(uint){ | ||
function getAdapterPrice(bytes32 specifier, uint quantity) public payable returns(uint){ | ||
bondage = BondageInterface(coord.getContract("BONDAGE")); | ||
uint reserveAmount = bondage.calcZapForDots(address(this), specifier, quantity); | ||
return reserveAmount * adapterRate; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//was not compiling with selfdestruct(owner) added a require and changed parameter from owner to msg.sender