This repository has been archived by the owner on Jun 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Final submission #1
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
design translated to code, and revised in response to all warnings and errors from linting and compilation... EXCEPT for the following: contracts/CDO.sol 111:5 warning Fallback function must be simple no-complex-fallback CODE IS UNTESTED
fallback function () was too complex, per solhint
bug: needed an additional 125000 gas to deploy all of the tranche tokens needed during CDO instantiation bug: had neglected to initialize the TrancheToken contract instance held within the CDO contract also realized that there is no DebtRegistry object available in the current test environment, so changed the CDO contract to depend on a TermsContract instead.
by using a global instance of the TrancheToken contract, rather than an instance local to the CDO contract.
learned the hard way (after hours of debugging and researching) that contract methods which change the state of the blockchain cannot return values. changed CDOFactory.create() to raise an event rather than returning the contract address. also learned that msg.sender isn't persisted through nested function calls. changed CDO contract constructor to accept an owner parameter. added a test sub-section for re-use of an instantiated CDO contract.
remove unused import use named return parameter insert a few TODO reminders
also moved CDO instantiation and all tests up to the contract level (out of a describe()). also made later tests use the CDO instance created by the first test, instead of re-instantiating
changed CDO.finalize() to raise an event instead of returning values, since it's a transaction and not a view. also fixed a bug with the TrancheToken where it wasn't properly tracking ownership.
don't need to refer to them anymore, now that all of the demonstrated techniques are being utilized in other tests.
first test of repayments being made available to tranche holders. bug fixed: I had previously coded the CDO to handle repayments in ether, but it really should be done in DummyToken's. Fixed. bug fixed: function remainingExpectedSeniorPayout() was missing a return statement. removed TODO to consider division truncation as I found a way to avoid leaking repayment funds. removed TODO about considering validity of return value fron transactional function. decided it was okay since it's only called by solidity code, never from js.
changed previous repayment test to repay exactly 30% of debt, in line with example given in Instructions. also added verification of withdrawn amounts. refined precision of verification in senior withdrawl test. added test to verify that mezzanine withdrawls are denied when they're not entitled to anything.
test needs to be more precise (needs to check that withdrawn values are as expected), but this is what I have in place right now. bug fix: was using the wrong loop counter variable in mezzanine entitlement calculations!!! bug fix: was using the wrong values to decrement `unallocatedEntitlements` as the entitlement caclulation process was marching on. also realized that there never was any overflow issue, that all anomalies I was seeing were due to the aforementioned bugs, so converted those comparisons to tranche array lenghts back to their more readable original forms.
added verification of exact withdrawal amounts
Well, about half as many debts as there are accounts. one account is for OWNER, one is for PAYER, and the rest are split between DEBTORS and CREDITORS. I tried with `--accounts 200` passed to ganache-cli for `yarn chain`, and everything seemed to work fine.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.