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

Signed Transfer Manager #533

Closed
wants to merge 10 commits into from
Closed

Signed Transfer Manager #533

wants to merge 10 commits into from

Conversation

maxsam4
Copy link
Contributor

@maxsam4 maxsam4 commented Jan 24, 2019

This PR includes STM and proper test case with signed data.
The module uses datastore to store its data.

@maxsam4 maxsam4 changed the base branch from dev-3.0.0 to datastore January 25, 2019 08:40
@maxsam4 maxsam4 mentioned this pull request Jan 25, 2019
1 task
@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.079% when pulling 772d2f2 on signed-tm into cda7408 on datastore.

return Result.NA;

bytes32 hash = keccak256(abi.encodePacked(targetAddress, nonce, expiry, _from, _to, _amount));
bytes32 prependedHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
Copy link
Contributor

Choose a reason for hiding this comment

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

Encoder Library could be used

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll refactor a bit to use this (and in other places if needed)

if (!_checkSigner(signer)) {
return Result.NA;
} else if(_isTransfer) {
_invalidateSignature(signature);
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of SignatureInvalidated event, we could emit SignatureUsed or something +ve event as transaction get succeed. For invalidateSignature() function this event makes sense but for a successful transfer, it will create confusion.

*/
function getTags() public view returns(bytes32[] memory) {
bytes32[] memory availableTags = new bytes32[](2);
availableTags[0] = "General";
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be "Signed"

function deploy(bytes calldata /* _data */) external returns(address) {
address polyToken = _takeFee();
SignedTransferManager signedTransferManager = new SignedTransferManager(msg.sender, polyToken);
emit GenerateModuleFromFactory(address(signedTransferManager), getName(), address(this), msg.sender, now);
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it follow the proxy approach of deployment ?

Copy link
Contributor

Choose a reason for hiding this comment

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

For "Experimental" modules we haven't been using the Proxy deployment approach.

function updateSigners(address[] calldata _signers, bool[] calldata _signersStats) external withPerm(ADMIN) {
require(_signers.length == _signersStats.length, "Array length mismatch");
IDataStore dataStore = IDataStore(ISecurityToken(securityToken).dataStore());
for(uint256 i=0; i<_signers.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting to store Signer addresses in the data store. I guess this makes sense, esp. if "signers" are going to be used in other places and would make upgrading the module easier (via a remove and re-add).

@adamdossa adamdossa closed this Jan 31, 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.

4 participants