-
Notifications
You must be signed in to change notification settings - Fork 31
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
Remove param address _facilitator from GatewayRedeemInterface.redeem and EIP20CoGateway.redeem #517
Remove param address _facilitator from GatewayRedeemInterface.redeem and EIP20CoGateway.redeem #517
Conversation
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.
🙌 LGTM
…gh_475_remove_facilitator_redeem
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.
Nice 👍
Just a few inline comments.
* | ||
* @notice Used for test only. | ||
*/ | ||
contract MockEIP20CoGateway is EIP20CoGateway { |
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.
Rename this as TestEIP20CoGateway
, since it's not mocking the functions but uses addition functions to set data.
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.
This contract is removed.
|
||
/* Public functions */ | ||
|
||
function setOutboxStatus(bytes32 messageHash) public { |
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.
Documentation is missing.
We should also add a dev note why this function was needed.
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.
Same as above
await utilityToken.approve( | ||
eip20CoGateway.address, | ||
new BN(1000), | ||
{from: accounts[7]}, |
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.
{from: accounts[7]}
-> {form: staker}
assert.strictEqual( | ||
((await utilityToken.balanceOf(accounts[7])).cmp( | ||
new BN(stakerBalance - amount))), | ||
0, |
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.
Same as above.
|
||
it('should deactivate if activated', async function () { | ||
|
||
assert((await gateway.deactivateGateway.call({from: organisation}))); |
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.
we can
- split this to be more readable.
- use assert.strictEqual.
- add assert fail reason.
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.
These changes were introduced when i pulled the below branch to sync up :-
https://github.com/OpenSTFoundation/mosaic-contracts/pull/518/files
); | ||
}); | ||
|
||
it('should deactivated by organization only', async function () { |
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.
should fail to deactivated when the caller is not an organization address.
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.
Same as above.
…thub.com/gulshanvasnani/mosaic-contracts into gulshan/gh_475_remove_facilitator_redeem
…gh_475_remove_facilitator_redeem
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.
🐎 Almost done.
There are few tests missing.
Added inline comment for some cleanups.
|
||
}); | ||
|
||
}); |
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.
newline at the end of the file.
I think there can be more test cases.
should fail when the coGateway is not approved
should fail when the redeemer has balance less than the bounty amount
should fail when the redeemer balance is less than the redeem amount
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.
Thank you.
I have added all the above test-cases.
contracts/gateway/EIP20CoGateway.sol
Outdated
@@ -957,19 +948,19 @@ contract EIP20CoGateway is GatewayBase { | |||
require( |
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.
I couldn't test this condition.
Please recommend how to test it.
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.
Do you think that moving this condition to line 920 makes sense?
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.
I have moved it at 920 line number.
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.
Nice 🙌 🚀
This is almost done. Few comments inline.
…gh_475_remove_facilitator_redeem
…thub.com/gulshanvasnani/mosaic-contracts into gulshan/gh_475_remove_facilitator_redeem
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.
LGTM 🚀⚡️🌀 🎊
Nice work 🙌
There 2 changes required in unit test cases:
-
should fail when the redeemer 's base token balance is less than the bounty amount : This should assert this
"Payable amount should be equal to the bounty amount."
-
Please add this test :
should fail if the previous process is in revocation declared state
…ed,previous process is in declared revocation state and used TestEIP20CoGateway contract.
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.
Thank you for adding test cases. Redeem test cases really looks good to me. 🥇 💯 👍
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.
Just few comments, it will be good to go.
contracts/gateway/EIP20CoGateway.sol
Outdated
@@ -957,19 +948,19 @@ contract EIP20CoGateway is GatewayBase { | |||
require( |
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.
Do you think that moving this condition to line 920 makes sense?
|
||
it('should fail when cogateway is not approved with redeem amount', async function () { | ||
|
||
let testEIP20CoGateway2 = await TestEIP20CoGateway.new( |
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.
Why create a new object?
This can be done in 2 ways:
- Change the redeemer address.
- Increase the redeem amount.
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.
Thank you.
I have increased the amount.
…thub.com/gulshanvasnani/mosaic-contracts into gulshan/gh_475_remove_facilitator_redeem
…emove_facilitator_redeem
…emove_facilitator_redeem
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.
LGTM
Removed facilitator param from redeem method in GatewayRedeemInterface and EIP20CoGateway contracts.
Also,facilitator has been removed from redeem and stake struct.
It contains unit test-cases to test redeem method.
Burn method in utilitytoken is in sync with UtilityTokenInterface.
Fixes:- #475