Skip to content
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

[WIP] Credit #198

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open

[WIP] Credit #198

wants to merge 7 commits into from

Conversation

pgev
Copy link
Collaborator

@pgev pgev commented Apr 18, 2019

No description provided.

This was referenced Apr 18, 2019
@abhayks1 abhayks1 self-assigned this Apr 22, 2019
@abhayks1
Copy link
Contributor

abhayks1 commented Apr 22, 2019

Started reviewing this. It's in "Review/QA" column.

Copy link
Contributor

@abhayks1 abhayks1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 👍
It took quite bit of time to understand the overall flow. I feel the overall documentation(documentation, sequence diagram) should be improved 📝 I assume It will already be in your todo list as in the title it says WIP.

@@ -33,7 +35,7 @@ import "../organization/Organized.sol";
* During a execution, rule can call TokenRules.executeTransfers()
* function only once.
*/
contract TokenRules is Organized {
contract TokenRules is Organized, TransfersAgent {
Copy link
Contributor

@abhayks1 abhayks1 Apr 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since TokenRules contract is updated with TransfersAgent inheritance, is it needed to redeploy new TokenRules contract for an economy?

// limitations under the License.


interface TransfersAgent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"title" for the interface is missing.

const budgetHolderSessionKeyExpirationDelta = 300;

await TokenHolderUtils.authorizeSessionKey(
budgetHolder, budgetHolderOwnerAddress,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

budgetHolderOwnerAddress should go to new line. Please check once if there are other instances like this.

const tokenHolderSessionKeyExpirationDelta = 200;

await TokenHolderUtils.authorizeSessionKey(
tokenHolder, tokenHolderOwnerAddress,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tokenHolderOwnerAddress should go to new line.


struct CreditInfo {
uint256 amount;
bool inProgress;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call inProgress to isAllocated/allocated ? I believe amount is the allocated amount to user.
Any specific reason to keep inProgress naming?

@@ -0,0 +1,69 @@
// Copyright 2018 OpenST Ltd.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the copyright with
Copyright 2019 OpenST Ltd.

Generic Comment applicable to other test files also.

);
});
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreditRule.executeRule unit test cases are missing. Adding this comment here as I wasn't sure where to comment.

assert.isOk(
actualTransfersAmountLength.eqn(2),
);

assert.isOk(
transferredAmount1.eq(expectedTransferAmount1),
);
Copy link
Contributor

@abhayks1 abhayks1 Apr 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also introduce integration tests in openst-contracts like we have in mosaic-contracts.
CreditRule with CustomRule is a good starting point 🚗 . It could be a separate ticket 💭


/* Storage */

CreditRule public creditRule;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we introduce CreditRuleInterface contract for rules contract to integrate ❓


TransfersAgent public transfersAgent;

mapping(address => CreditInfo) public credits;
Copy link
Contributor

@abhayks1 abhayks1 Apr 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to handle use case where credits for a user are only valid for a particular duration or blockheight? 💭
I might not be aware of scope of the project ⏲

@abhayks1 abhayks1 removed their assignment Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants