|
3 | 3 |
|
4 | 4 | Implements a simplified version of tokenized Product/ETH Products. |
5 | 5 | */ |
6 | | -pragma solidity >=0.4.24; |
| 6 | +pragma solidity ^0.5.0; |
7 | 7 |
|
8 | 8 | import "openzeppelin-solidity/contracts/math/SafeMath.sol"; |
9 | 9 | import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; |
@@ -71,7 +71,7 @@ contract TokenizedDerivative is ERC20 { |
71 | 71 | } |
72 | 72 |
|
73 | 73 | struct ContractParty { |
74 | | - address accountAddress; |
| 74 | + address payable accountAddress; |
75 | 75 | int256 balance; |
76 | 76 | bool hasConfirmedPrice; |
77 | 77 | uint marginRequirement; // Percentage of nav*10^18 |
@@ -118,7 +118,7 @@ contract TokenizedDerivative is ERC20 { |
118 | 118 | uint deposit; |
119 | 119 | } |
120 | 120 |
|
121 | | - Dispute public dispute; |
| 121 | + Dispute public disputeInfo; |
122 | 122 |
|
123 | 123 | // The information in the following struct is only valid if in the midst of a Default or Termination. |
124 | 124 | struct Termination { |
@@ -148,13 +148,13 @@ contract TokenizedDerivative is ERC20 { |
148 | 148 | } |
149 | 149 |
|
150 | 150 | constructor( |
151 | | - address _providerAddress, |
152 | | - address _investorAddress, |
| 151 | + address payable _providerAddress, |
| 152 | + address payable _investorAddress, |
153 | 153 | address _oracleAddress, |
154 | 154 | uint _defaultPenalty, // Percentage of nav*10^18 |
155 | 155 | uint _terminationFee, // Percentage of nav*10^18 |
156 | 156 | uint _providerRequiredMargin, // Percentage of nav*10^18 |
157 | | - string _product, |
| 157 | + string memory _product, |
158 | 158 | uint _fixedYearlyFee, // Percentage of nav * 10^18 |
159 | 159 | uint _disputeDeposit, // Percentage of nav * 10^18 |
160 | 160 | address _returnCalculator, |
@@ -249,8 +249,8 @@ contract TokenizedDerivative is ERC20 { |
249 | 249 |
|
250 | 250 | uint initialSupply = totalSupply(); |
251 | 251 |
|
252 | | - require(this.transferFrom(msg.sender, this, numTokens)); |
253 | | - _burn(this, numTokens); |
| 252 | + require(this.transferFrom(msg.sender, address(this), numTokens)); |
| 253 | + _burn(address(this), numTokens); |
254 | 254 |
|
255 | 255 |
|
256 | 256 | int256 investorBalance = investor.balance; |
@@ -312,9 +312,9 @@ contract TokenizedDerivative is ERC20 { |
312 | 312 |
|
313 | 313 | state = State.Disputed; |
314 | 314 | endTime = lastRemarginTime; |
315 | | - dispute.disputedNav = nav; |
316 | | - dispute.disputer = msg.sender; |
317 | | - dispute.deposit = requiredDeposit; |
| 315 | + disputeInfo.disputedNav = nav; |
| 316 | + disputeInfo.disputer = msg.sender; |
| 317 | + disputeInfo.deposit = requiredDeposit; |
318 | 318 |
|
319 | 319 | msg.sender.transfer(refund); |
320 | 320 | } |
@@ -343,9 +343,9 @@ contract TokenizedDerivative is ERC20 { |
343 | 343 | require(startingState == State.Disputed || startingState == State.Expired || startingState == State.Defaulted); |
344 | 344 | _settleVerifiedPrice(); |
345 | 345 | if (startingState == State.Disputed) { |
346 | | - (ContractParty storage disputer, ContractParty storage notDisputer) = _whoAmI(dispute.disputer); |
347 | | - int256 depositValue = int256(dispute.deposit); |
348 | | - if (nav == dispute.disputedNav) { |
| 346 | + (ContractParty storage disputer, ContractParty storage notDisputer) = _whoAmI(disputeInfo.disputer); |
| 347 | + int256 depositValue = int256(disputeInfo.deposit); |
| 348 | + if (nav == disputeInfo.disputedNav) { |
349 | 349 | disputer.balance += depositValue; |
350 | 350 | } else { |
351 | 351 | notDisputer.balance += depositValue; |
@@ -539,7 +539,7 @@ contract TokenizedDerivative is ERC20 { |
539 | 539 | if (state != State.Live) { |
540 | 540 | didReduce = additionalAuthorizedNav != 0; |
541 | 541 | additionalAuthorizedNav = 0; |
542 | | - return; |
| 542 | + return didReduce; |
543 | 543 | } |
544 | 544 |
|
545 | 545 | int256 totalAuthorizedNav = currentNav + int256(additionalAuthorizedNav); |
@@ -630,12 +630,12 @@ contract TokenizedDerivativeCreator is ContractCreator { |
630 | 630 | ContractCreator(registryAddress, _oracleAddress) {} // solhint-disable-line no-empty-blocks |
631 | 631 |
|
632 | 632 | function createTokenizedDerivative( |
633 | | - address provider, |
634 | | - address investor, |
| 633 | + address payable provider, |
| 634 | + address payable investor, |
635 | 635 | uint defaultPenalty, |
636 | 636 | uint terminationFee, |
637 | 637 | uint providerRequiredMargin, |
638 | | - string product, |
| 638 | + string calldata product, |
639 | 639 | uint fixedYearlyFee, |
640 | 640 | uint disputeDeposit, |
641 | 641 | address returnCalculator, |
|
0 commit comments